Ken Thomases : winecoreaudio: Add mechanism for cross-thread call of widHelper_NotifyCompletions.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 29 06:47:22 CST 2006


Module: wine
Branch: master
Commit: cff4da8db8a152535a0e20110618ea8815e67e51
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cff4da8db8a152535a0e20110618ea8815e67e51

Author: Ken Thomases <ken at codeweavers.com>
Date:   Thu Dec 28 11:06:51 2006 -0600

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 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c
index 607b711..10a01fc 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(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-cvs mailing list