1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.
This commit is contained in:
parent
c3b032a45a
commit
0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions
113
port/external/openal/OALCaptureDevice.h
vendored
Normal file
113
port/external/openal/OALCaptureDevice.h
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
// Declarations of pflib/external/openal/OALCaptureDevice.h (Apple OpenAL, Playground SDK 4.0): OALCaptureDevice,
|
||||
// an ALC capture device. Layout from the DWARF of parity-out/sdk/dbgobj/oalImp.o (size 180): +0x00 mSelfToken,
|
||||
// +0x04 mCurrentError, +0x08 mCaptureOn, +0x0c mStoreSampleTime, +0x14 mFetchSampleTime, +0x1c mInputUnit,
|
||||
// +0x20 mNativeFormat, +0x48 mRequestedFormat, +0x70 mOutputFormat, +0x98 mRingBuffer, +0x9c mBufferData,
|
||||
// +0xa0 mAudioConverter, +0xa4 mSampleRateRatio, +0xac mRequestedRingFrames, +0xb0 mAudioInputPtrs.
|
||||
//
|
||||
// Of oalCaptureDevice.cpp only SetError has code in the game (ported in oalCaptureDevice.cpp); the rest of the
|
||||
// class has no game code and is only declared (not part of this port slice). OALCaptureDeviceMap (also declared
|
||||
// in Apple's OALCaptureDevice.h) is oalImp code and ported at the bottom of this header: its out-of-line code
|
||||
// is in the SDK's oalImp.o (sdk @); the game inlines the Get call of SetDeviceError.
|
||||
|
||||
#ifndef OALCAPTUREDEVICE_H_INCLUDED
|
||||
#define OALCAPTUREDEVICE_H_INCLUDED
|
||||
|
||||
#include "oal_sysdecls.h"
|
||||
|
||||
#include "CAStreamBasicDescription.h"
|
||||
|
||||
#include <map>
|
||||
#include <stdint.h>
|
||||
|
||||
class CABufferList;
|
||||
class OALRingBuffer;
|
||||
|
||||
class OALCaptureDevice
|
||||
{
|
||||
public:
|
||||
OALCaptureDevice(const char* inDeviceName, uintptr_t inSelfToken, UInt32 inSampleRate, UInt32 inFormat,
|
||||
UInt32 inBufferSize);
|
||||
~OALCaptureDevice();
|
||||
|
||||
void StartCapture();
|
||||
void StopCapture();
|
||||
OSStatus GetFrames(UInt32 inFrameCount, UInt8* inBuffer);
|
||||
UInt32 AvailableFrames();
|
||||
void SetError(ALenum errorCode);
|
||||
ALenum GetError();
|
||||
|
||||
private:
|
||||
void InitializeAU(const char* inDeviceName);
|
||||
static OSStatus InputProc(void* inRefCon, AudioUnitRenderActionFlags* inActionFlags,
|
||||
const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames,
|
||||
AudioBufferList* ioData);
|
||||
static OSStatus ACComplexInputDataProc(AudioConverterRef inAudioConverter, UInt32* ioNumberDataPackets,
|
||||
AudioBufferList* ioData,
|
||||
AudioStreamPacketDescription** outDataPacketDescription,
|
||||
void* inUserData);
|
||||
|
||||
uintptr_t mSelfToken;
|
||||
ALenum mCurrentError;
|
||||
bool mCaptureOn;
|
||||
SInt64 mStoreSampleTime;
|
||||
SInt64 mFetchSampleTime;
|
||||
AudioUnit mInputUnit;
|
||||
CAStreamBasicDescription mNativeFormat;
|
||||
CAStreamBasicDescription mRequestedFormat;
|
||||
CAStreamBasicDescription mOutputFormat;
|
||||
OALRingBuffer* mRingBuffer;
|
||||
UInt8* mBufferData;
|
||||
AudioConverterRef mAudioConverter;
|
||||
Float64 mSampleRateRatio;
|
||||
UInt32 mRequestedRingFrames;
|
||||
CABufferList* mAudioInputPtrs;
|
||||
};
|
||||
|
||||
// The capture-device map of oalImp.cpp (gOALCaptureDeviceMap). Get is the only member the game uses (inlined
|
||||
// in SetDeviceError); every member's out-of-line code is in the SDK's oalImp.o (sdk @ below). Size() has no
|
||||
// out-of-line code in either build (nothing calls it); the destructor is emitted out of line in the SDK build.
|
||||
class OALCaptureDeviceMap : std::multimap<uintptr_t, OALCaptureDevice*, std::less<uintptr_t> >
|
||||
{
|
||||
public:
|
||||
// sdk @0x5ce9c (oalImp.o)
|
||||
OALCaptureDeviceMap() {}
|
||||
|
||||
// sdk @0x5cca4 (oalImp.o)
|
||||
~OALCaptureDeviceMap() {}
|
||||
|
||||
// sdk @0x5e358 (oalImp.o)
|
||||
void Add(const uintptr_t inDeviceToken, OALCaptureDevice** inDevice)
|
||||
{
|
||||
iterator it = upper_bound(inDeviceToken);
|
||||
insert(it, value_type(inDeviceToken, *inDevice));
|
||||
}
|
||||
|
||||
// sdk @0x5c188 (oalImp.o)
|
||||
OALCaptureDevice* Get(uintptr_t inDeviceToken)
|
||||
{
|
||||
iterator it = find(inDeviceToken);
|
||||
if (it != end())
|
||||
{
|
||||
return ((*it).second);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
// sdk @0x5cb8c (oalImp.o)
|
||||
void Remove(const uintptr_t inDeviceToken)
|
||||
{
|
||||
iterator it = find(inDeviceToken);
|
||||
if (it != end())
|
||||
{
|
||||
erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
// no out-of-line code in either build (nothing calls it)
|
||||
UInt32 Size() const { return (UInt32)size(); }
|
||||
|
||||
// sdk @0x5af3c (oalImp.o)
|
||||
bool Empty() const { return empty(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue