[13/18] winecoreaudio: Add mechanism for cross-thread call of
widHelper_NotifyCompletions.
Ken Thomases
ken at codeweavers.com
Thu Dec 28 11:06:51 CST 2006
wodSendNotifyInputCompletionsMessage sends the kWaveInNotifyCompletionsMessage
to the message thread, which calls widHelper_NotifyCompletions. This will be
necessary for the input callback to arrange for buffers which it has filled
to be returned to the application. The input callback can't do it itself
because it's 1) not a Wine thread, and 2) a realtime thread.
---
dlls/winmm/winecoreaudio/audio.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c
index ab9163f..266ed4b 100644
--- a/dlls/winmm/winecoreaudio/audio.c
+++ b/dlls/winmm/winecoreaudio/audio.c
@@ -284,7 +284,7 @@ #undef MSG_TO_STR
#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(CFMes
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 wodSendNotifyCompletionsMess
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)
{
More information about the wine-patches
mailing list