winecoreaudio: Fixed a bunch of compiler warnings.
This commit is contained in:
parent
788e30f139
commit
11fe657466
|
@ -96,8 +96,8 @@ typedef struct tagCoreAudio_Device {
|
||||||
unsigned open_count;
|
unsigned open_count;
|
||||||
char* interface_name;
|
char* interface_name;
|
||||||
|
|
||||||
WAVEOUTCAPSA out_caps;
|
WAVEOUTCAPSW out_caps;
|
||||||
WAVEINCAPSA in_caps;
|
WAVEINCAPSW in_caps;
|
||||||
DWORD in_caps_support;
|
DWORD in_caps_support;
|
||||||
int sample_rate;
|
int sample_rate;
|
||||||
int stereo;
|
int stereo;
|
||||||
|
@ -170,17 +170,13 @@ typedef struct {
|
||||||
} WINE_WAVEIN;
|
} WINE_WAVEIN;
|
||||||
|
|
||||||
static WINE_WAVEOUT WOutDev [MAX_WAVEOUTDRV];
|
static WINE_WAVEOUT WOutDev [MAX_WAVEOUTDRV];
|
||||||
static WINE_WAVEIN WInDev [MAX_WAVEINDRV ];
|
|
||||||
|
|
||||||
static DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv);
|
|
||||||
static DWORD wodDsDesc(UINT wDevID, PDSDRIVERDESC desc);
|
|
||||||
|
|
||||||
static LPWAVEHDR wodHelper_PlayPtrNext(WINE_WAVEOUT* wwo);
|
static LPWAVEHDR wodHelper_PlayPtrNext(WINE_WAVEOUT* wwo);
|
||||||
static DWORD wodHelper_NotifyCompletions(WINE_WAVEOUT* wwo, BOOL force);
|
static DWORD wodHelper_NotifyCompletions(WINE_WAVEOUT* wwo, BOOL force);
|
||||||
|
|
||||||
extern int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au);
|
extern int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au);
|
||||||
extern int AudioUnit_CloseAudioUnit(AudioUnit au);
|
extern int AudioUnit_CloseAudioUnit(AudioUnit au);
|
||||||
extern int AudioUnit_InitializeWithStreamDescription(AudioUnit au, AudioStreamBasicDescription streamFormat);
|
extern int AudioUnit_InitializeWithStreamDescription(AudioUnit au, AudioStreamBasicDescription *streamFormat);
|
||||||
|
|
||||||
extern OSStatus AudioOutputUnitStart(AudioUnit au);
|
extern OSStatus AudioOutputUnitStart(AudioUnit au);
|
||||||
extern OSStatus AudioOutputUnitStop(AudioUnit au);
|
extern OSStatus AudioOutputUnitStop(AudioUnit au);
|
||||||
|
@ -277,7 +273,7 @@ static CFDataRef wodMessageHandler(CFMessagePortRef local, SInt32 msgid, CFDataR
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD messageThread(LPVOID p)
|
static DWORD WINAPI messageThread(LPVOID p)
|
||||||
{
|
{
|
||||||
CFMessagePortRef local;
|
CFMessagePortRef local;
|
||||||
CFRunLoopSourceRef source;
|
CFRunLoopSourceRef source;
|
||||||
|
@ -312,7 +308,7 @@ static DWORD wodSendDriverCallbackMessage(WINE_WAVEOUT* wwo, WORD wMsg, DWORD dw
|
||||||
buffer[2] = (UInt32) dwParam1;
|
buffer[2] = (UInt32) dwParam1;
|
||||||
buffer[3] = (UInt32) dwParam2;
|
buffer[3] = (UInt32) dwParam2;
|
||||||
|
|
||||||
data = CFDataCreate(kCFAllocatorDefault, buffer, sizeof(UInt32) * 4);
|
data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)buffer, sizeof(UInt32) * 4);
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
CFAllocatorDeallocate(NULL, buffer);
|
CFAllocatorDeallocate(NULL, buffer);
|
||||||
|
@ -410,8 +406,8 @@ BOOL CoreAudio_GetDevCaps (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Device Stream Description mSampleRate : %f\n mFormatID : %c%c%c%c\n"
|
TRACE("Device Stream Description mSampleRate : %f\n mFormatID : %c%c%c%c\n"
|
||||||
"mFormatFlags : %lX\n mBytesPerPacket : %u\n mFramesPerPacket : %u\n"
|
"mFormatFlags : %lX\n mBytesPerPacket : %lu\n mFramesPerPacket : %lu\n"
|
||||||
"mBytesPerFrame : %u\n mChannelsPerFrame : %u\n mBitsPerChannel : %u\n",
|
"mBytesPerFrame : %lu\n mChannelsPerFrame : %lu\n mBitsPerChannel : %lu\n",
|
||||||
CoreAudio_DefaultDevice.streamDescription.mSampleRate,
|
CoreAudio_DefaultDevice.streamDescription.mSampleRate,
|
||||||
(char) (CoreAudio_DefaultDevice.streamDescription.mFormatID >> 24),
|
(char) (CoreAudio_DefaultDevice.streamDescription.mFormatID >> 24),
|
||||||
(char) (CoreAudio_DefaultDevice.streamDescription.mFormatID >> 16),
|
(char) (CoreAudio_DefaultDevice.streamDescription.mFormatID >> 16),
|
||||||
|
@ -457,7 +453,7 @@ LONG CoreAudio_WaveInit(void)
|
||||||
/* number of sound cards */
|
/* number of sound cards */
|
||||||
AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propertySize, NULL);
|
AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propertySize, NULL);
|
||||||
propertySize /= sizeof(AudioDeviceID);
|
propertySize /= sizeof(AudioDeviceID);
|
||||||
TRACE("sound cards : %u\n", propertySize);
|
TRACE("sound cards : %lu\n", propertySize);
|
||||||
|
|
||||||
/* Get the output device */
|
/* Get the output device */
|
||||||
propertySize = sizeof(CoreAudio_DefaultDevice.outputDeviceID);
|
propertySize = sizeof(CoreAudio_DefaultDevice.outputDeviceID);
|
||||||
|
@ -528,11 +524,11 @@ LONG CoreAudio_WaveInit(void)
|
||||||
|
|
||||||
void CoreAudio_WaveRelease(void)
|
void CoreAudio_WaveRelease(void)
|
||||||
{
|
{
|
||||||
TRACE("()\n");
|
|
||||||
|
|
||||||
/* Stop CFRunLoop in messageThread */
|
/* Stop CFRunLoop in messageThread */
|
||||||
CFMessagePortRef messagePort;
|
CFMessagePortRef messagePort;
|
||||||
|
|
||||||
|
TRACE("()\n");
|
||||||
|
|
||||||
messagePort = CFMessagePortCreateRemote(kCFAllocatorDefault, CFSTR("WaveMessagePort"));
|
messagePort = CFMessagePortCreateRemote(kCFAllocatorDefault, CFSTR("WaveMessagePort"));
|
||||||
CFMessagePortSendRequest(messagePort, kStopLoopMessage, NULL, 0.0, 0.0, NULL, NULL);
|
CFMessagePortSendRequest(messagePort, kStopLoopMessage, NULL, 0.0, 0.0, NULL, NULL);
|
||||||
CFRelease(messagePort);
|
CFRelease(messagePort);
|
||||||
|
@ -604,8 +600,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
||||||
WINE_WAVEOUT* wwo;
|
WINE_WAVEOUT* wwo;
|
||||||
DWORD retval;
|
DWORD retval;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
int audio_fragment;
|
AudioStreamBasicDescription streamFormat;
|
||||||
|
|
||||||
TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
|
TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
|
||||||
if (lpDesc == NULL)
|
if (lpDesc == NULL)
|
||||||
{
|
{
|
||||||
|
@ -656,14 +652,12 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
||||||
|
|
||||||
pthread_mutex_init(&wwo->lock, NULL); /* initialize the mutex */
|
pthread_mutex_init(&wwo->lock, NULL); /* initialize the mutex */
|
||||||
pthread_mutex_lock(&wwo->lock);
|
pthread_mutex_lock(&wwo->lock);
|
||||||
|
|
||||||
AudioStreamBasicDescription streamFormat;
|
|
||||||
|
|
||||||
streamFormat.mFormatID = kAudioFormatLinearPCM;
|
streamFormat.mFormatID = kAudioFormatLinearPCM;
|
||||||
|
|
||||||
/* FIXME check for 32bits float -> kLinearPCMFormatFlagIsFloat */
|
/* FIXME check for 32bits float -> kLinearPCMFormatFlagIsFloat */
|
||||||
streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger
|
streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger
|
||||||
# ifdef __powerpc__
|
# ifdef WORDS_BIGENDIAN
|
||||||
| kLinearPCMFormatFlagIsBigEndian /* FIXME Wave format is little endian */
|
| kLinearPCMFormatFlagIsBigEndian /* FIXME Wave format is little endian */
|
||||||
# endif
|
# endif
|
||||||
| kLinearPCMFormatFlagIsPacked;
|
| kLinearPCMFormatFlagIsPacked;
|
||||||
|
@ -674,8 +668,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
||||||
streamFormat.mBitsPerChannel = lpDesc->lpFormat->wBitsPerSample;
|
streamFormat.mBitsPerChannel = lpDesc->lpFormat->wBitsPerSample;
|
||||||
streamFormat.mBytesPerFrame = streamFormat.mBitsPerChannel * streamFormat.mChannelsPerFrame / 8;
|
streamFormat.mBytesPerFrame = streamFormat.mBitsPerChannel * streamFormat.mChannelsPerFrame / 8;
|
||||||
streamFormat.mBytesPerPacket = streamFormat.mBytesPerFrame * streamFormat.mFramesPerPacket;
|
streamFormat.mBytesPerPacket = streamFormat.mBytesPerFrame * streamFormat.mFramesPerPacket;
|
||||||
|
|
||||||
ret = AudioUnit_InitializeWithStreamDescription(wwo->audioUnit, streamFormat);
|
ret = AudioUnit_InitializeWithStreamDescription(wwo->audioUnit, &streamFormat);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(&wwo->lock);
|
pthread_mutex_unlock(&wwo->lock);
|
||||||
|
@ -1124,8 +1118,7 @@ static DWORD wodGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize)
|
||||||
{
|
{
|
||||||
DWORD val;
|
DWORD val;
|
||||||
WINE_WAVEOUT* wwo;
|
WINE_WAVEOUT* wwo;
|
||||||
DWORD elapsedMS;
|
|
||||||
|
|
||||||
TRACE("(%u, %p, %lu);\n", wDevID, lpTime, uSize);
|
TRACE("(%u, %p, %lu);\n", wDevID, lpTime, uSize);
|
||||||
|
|
||||||
if (wDevID >= MAX_WAVEOUTDRV)
|
if (wDevID >= MAX_WAVEOUTDRV)
|
||||||
|
@ -1146,31 +1139,6 @@ static DWORD wodGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize)
|
||||||
return bytes_to_mmtime(lpTime, val, &wwo->format);
|
return bytes_to_mmtime(lpTime, val, &wwo->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* wodBreakLoop [internal]
|
|
||||||
*/
|
|
||||||
static DWORD wodBreakLoop(WORD wDevID)
|
|
||||||
{
|
|
||||||
FIXME("(%u);\n", wDevID);
|
|
||||||
|
|
||||||
if (wDevID >= MAX_WAVEOUTDRV)
|
|
||||||
{
|
|
||||||
WARN("bad device ID !\n");
|
|
||||||
return MMSYSERR_BADDEVICEID;
|
|
||||||
}
|
|
||||||
pthread_mutex_lock(&WOutDev[wDevID].lock);
|
|
||||||
|
|
||||||
if (WOutDev[wDevID].state == WINE_WS_PLAYING && WOutDev[wDevID].lpLoopPtr != NULL)
|
|
||||||
{
|
|
||||||
/* ensure exit at end of current loop */
|
|
||||||
WOutDev[wDevID].dwLoops = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&WOutDev[wDevID].lock);
|
|
||||||
|
|
||||||
return MMSYSERR_NOERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* wodGetVolume [internal]
|
* wodGetVolume [internal]
|
||||||
*/
|
*/
|
||||||
|
@ -1185,7 +1153,7 @@ static DWORD wodGetVolume(WORD wDevID, LPDWORD lpdwVol)
|
||||||
return MMSYSERR_BADDEVICEID;
|
return MMSYSERR_BADDEVICEID;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("(%u, %08lX);\n", wDevID, lpdwVol);
|
TRACE("(%u, %p);\n", wDevID, lpdwVol);
|
||||||
|
|
||||||
pthread_mutex_lock(&WOutDev[wDevID].lock);
|
pthread_mutex_lock(&WOutDev[wDevID].lock);
|
||||||
|
|
||||||
|
@ -1341,23 +1309,6 @@ struct IDsDriverBufferImpl
|
||||||
DWORD buflen;
|
DWORD buflen;
|
||||||
};
|
};
|
||||||
|
|
||||||
static DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv)
|
|
||||||
{
|
|
||||||
/* we can't perform memory mapping as we don't have a file stream
|
|
||||||
interface with jack like we do with oss */
|
|
||||||
MESSAGE("This sound card's driver does not support direct access\n");
|
|
||||||
MESSAGE("The (slower) DirectSound HEL mode will be used instead.\n");
|
|
||||||
return MMSYSERR_NOTSUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DWORD wodDsDesc(UINT wDevID, PDSDRIVERDESC desc)
|
|
||||||
{
|
|
||||||
memset(desc, 0, sizeof(*desc));
|
|
||||||
strcpy(desc->szDesc, "Wine CoreAudio DirectSound Driver");
|
|
||||||
strcpy(desc->szDrvname, "winecoreaudio.drv");
|
|
||||||
return MMSYSERR_NOERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CoreAudio IO threaded callback,
|
CoreAudio IO threaded callback,
|
||||||
|
|
|
@ -26,24 +26,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wave);
|
||||||
#ifdef HAVE_AUDIOUNIT_AUDIOUNIT_H
|
#ifdef HAVE_AUDIOUNIT_AUDIOUNIT_H
|
||||||
#include <AudioUnit/AudioUnit.h>
|
#include <AudioUnit/AudioUnit.h>
|
||||||
|
|
||||||
static char streamStr[512] = {0};
|
|
||||||
static char *streamDescription(AudioStreamBasicDescription stream)
|
|
||||||
{
|
|
||||||
sprintf(streamStr, "\n mSampleRate : %f\n mFormatID : %c%c%c%c\n mFormatFlags : %lX\n mBytesPerPacket : %u\n mFramesPerPacket : %u\n mBytesPerFrame : %u\n mChannelsPerFrame : %u\n mBitsPerChannel : %u\n",
|
|
||||||
stream.mSampleRate,
|
|
||||||
(char) (stream.mFormatID >> 24),
|
|
||||||
(char) (stream.mFormatID >> 16),
|
|
||||||
(char) (stream.mFormatID >> 8),
|
|
||||||
(char) stream.mFormatID,
|
|
||||||
stream.mFormatFlags,
|
|
||||||
stream.mBytesPerPacket,
|
|
||||||
stream.mFramesPerPacket,
|
|
||||||
stream.mBytesPerFrame,
|
|
||||||
stream.mChannelsPerFrame,
|
|
||||||
stream.mBitsPerChannel);
|
|
||||||
return streamStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern OSStatus CoreAudio_woAudioUnitIOProc(void *inRefCon,
|
extern OSStatus CoreAudio_woAudioUnitIOProc(void *inRefCon,
|
||||||
AudioUnitRenderActionFlags *ioActionFlags,
|
AudioUnitRenderActionFlags *ioActionFlags,
|
||||||
const AudioTimeStamp *inTimeStamp,
|
const AudioTimeStamp *inTimeStamp,
|
||||||
|
@ -54,6 +36,7 @@ extern OSStatus CoreAudio_woAudioUnitIOProc(void *inRefCon,
|
||||||
int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au)
|
int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au)
|
||||||
{
|
{
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
Component comp;
|
||||||
ComponentDescription desc;
|
ComponentDescription desc;
|
||||||
AURenderCallbackStruct callbackStruct;
|
AURenderCallbackStruct callbackStruct;
|
||||||
|
|
||||||
|
@ -62,8 +45,8 @@ int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au)
|
||||||
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
|
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
|
||||||
desc.componentFlags = 0;
|
desc.componentFlags = 0;
|
||||||
desc.componentFlagsMask = 0;
|
desc.componentFlagsMask = 0;
|
||||||
|
|
||||||
Component comp = FindNextComponent(NULL, &desc);
|
comp = FindNextComponent(NULL, &desc);
|
||||||
if (comp == NULL)
|
if (comp == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -89,13 +72,13 @@ int AudioUnit_CloseAudioUnit(AudioUnit au)
|
||||||
return (err == noErr);
|
return (err == noErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioUnit_InitializeWithStreamDescription(AudioUnit au, AudioStreamBasicDescription stream)
|
int AudioUnit_InitializeWithStreamDescription(AudioUnit au, AudioStreamBasicDescription *stream)
|
||||||
{
|
{
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
|
|
||||||
err = AudioUnitSetProperty(au, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
|
err = AudioUnitSetProperty(au, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
|
||||||
0, &stream, sizeof(AudioStreamBasicDescription));
|
0, stream, sizeof(*stream));
|
||||||
|
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
{
|
{
|
||||||
ERR("AudioUnitSetProperty return an error %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
|
ERR("AudioUnitSetProperty return an error %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
|
||||||
|
|
Loading…
Reference in New Issue