From cff4da8db8a152535a0e20110618ea8815e67e51 Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Thu, 28 Dec 2006 11:06:51 -0600 Subject: [PATCH] winecoreaudio: Add mechanism for cross-thread call of widHelper_NotifyCompletions. wodSendNotifyInputCompletionsMessage sends the kWaveInNotifyCompletionsMessage to the message thread, which calls widHelper_NotifyCompletions. --- dlls/winmm/winecoreaudio/audio.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c index 607b7115fd3..10a01fcc519 100644 --- a/dlls/winmm/winecoreaudio/audio.c +++ b/dlls/winmm/winecoreaudio/audio.c @@ -284,7 +284,7 @@ static const char * getMessage(UINT msg) #define kStopLoopMessage 0 #define kWaveOutNotifyCompletionsMessage 1 -#define kWaveInCallbackMessage 2 +#define kWaveInNotifyCompletionsMessage 2 /* Mach Message Handling */ static CFDataRef wodMessageHandler(CFMessagePortRef port_ReceiveInMessageThread, SInt32 msgid, CFDataRef data, void *info) @@ -297,7 +297,10 @@ static CFDataRef wodMessageHandler(CFMessagePortRef port_ReceiveInMessageThread, buffer = (UInt32 *) CFDataGetBytePtr(data); wodHelper_NotifyCompletions(&WOutDev[buffer[0]], FALSE); break; - case kWaveInCallbackMessage: + case kWaveInNotifyCompletionsMessage: + buffer = (UInt32 *) CFDataGetBytePtr(data); + widHelper_NotifyCompletions(&WInDev[buffer[0]]); + break; default: CFRunLoopStop(CFRunLoopGetCurrent()); break; @@ -342,6 +345,25 @@ static void wodSendNotifyCompletionsMessage(WINE_WAVEOUT* wwo) CFRelease(data); } +/************************************************************************** +* wodSendNotifyInputCompletionsMessage [internal] +* Call from AudioUnit IO thread can't use Wine debug channels. +*/ +static void wodSendNotifyInputCompletionsMessage(WINE_WAVEIN* wwi) +{ + CFDataRef data; + UInt32 buffer; + + buffer = (UInt32) wwi->wiID; + + data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)&buffer, sizeof(buffer)); + if (!data) + return; + + CFMessagePortSendRequest(Port_SendToMessageThread, kWaveInNotifyCompletionsMessage, data, 0.0, 0.0, NULL, NULL); + CFRelease(data); +} + static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, PCMWAVEFORMAT* format) {