winecoreaudio: Do additional setup in AudioUnit_CreateInputUnit.
It now returns in an output parameter the frame count that the AU will use. Also, initialize the Audio Unit.
This commit is contained in:
parent
5c489283c9
commit
4b904bbf13
|
@ -211,7 +211,8 @@ extern int AudioUnit_SetVolume(AudioUnit au, float left, float right);
|
|||
extern int AudioUnit_GetVolume(AudioUnit au, float *left, float *right);
|
||||
|
||||
extern int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au,
|
||||
WORD nChannels, DWORD nSamplesPerSec, WORD wBitsPerSample);
|
||||
WORD nChannels, DWORD nSamplesPerSec, WORD wBitsPerSample,
|
||||
UInt32* outFrameCount);
|
||||
|
||||
OSStatus CoreAudio_woAudioUnitIOProc(void *inRefCon,
|
||||
AudioUnitRenderActionFlags *ioActionFlags,
|
||||
|
@ -1522,7 +1523,8 @@ static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSW lpCaps, DWORD dwSize)
|
|||
*/
|
||||
static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
||||
{
|
||||
WINE_WAVEIN* wwi;
|
||||
WINE_WAVEIN* wwi;
|
||||
UInt32 frameCount;
|
||||
|
||||
TRACE("(%u, %p, %08X);\n", wDevID, lpDesc, dwFlags);
|
||||
if (lpDesc == NULL)
|
||||
|
@ -1592,7 +1594,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||
|
||||
if (!AudioUnit_CreateInputUnit(wwi, &wwi->audioUnit,
|
||||
wwi->format.wf.nChannels, wwi->format.wf.nSamplesPerSec,
|
||||
wwi->format.wBitsPerSample))
|
||||
wwi->format.wBitsPerSample, &frameCount))
|
||||
{
|
||||
ERR("AudioUnit_CreateInputUnit failed\n");
|
||||
OSSpinLockUnlock(&wwi->lock);
|
||||
|
|
|
@ -131,7 +131,8 @@ int AudioUnit_GetVolume(AudioUnit au, float *left, float *right)
|
|||
|
||||
|
||||
int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au,
|
||||
WORD nChannels, DWORD nSamplesPerSec, WORD wBitsPerSample)
|
||||
WORD nChannels, DWORD nSamplesPerSec, WORD wBitsPerSample,
|
||||
UInt32* outFrameCount)
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
ComponentDescription description;
|
||||
|
@ -143,6 +144,12 @@ int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au,
|
|||
AudioStreamBasicDescription desiredFormat;
|
||||
|
||||
|
||||
if (!outFrameCount)
|
||||
{
|
||||
ERR("Invalid parameter\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Open the AudioOutputUnit */
|
||||
description.componentType = kAudioUnitType_Output;
|
||||
description.componentSubType = kAudioUnitSubType_HALOutput;
|
||||
|
@ -244,6 +251,25 @@ int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au,
|
|||
goto error;
|
||||
}
|
||||
|
||||
/* Get the number of frames in the IO buffer(s) */
|
||||
param = sizeof(*outFrameCount);
|
||||
err = AudioUnitGetProperty(au, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, outFrameCount, ¶m);
|
||||
if (err != noErr)
|
||||
{
|
||||
ERR("Failed to get audio sample size: %08lx\n", err);
|
||||
goto error;
|
||||
}
|
||||
|
||||
TRACE("Frame count: %lu\n", *outFrameCount);
|
||||
|
||||
/* Initialize the AU */
|
||||
err = AudioUnitInitialize(au);
|
||||
if (err != noErr)
|
||||
{
|
||||
ERR("Failed to initialize AU: %08lx\n", err);
|
||||
goto error;
|
||||
}
|
||||
|
||||
*out_au = au;
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue