[xiph-cvs] cvs commit: ao/src/plugins/mmsound .cvsignore mmsound.c mmsound.dsp

Chris Wolf cwolf at xiph.org
Fri Sep 7 17:04:28 PDT 2001



cwolf       01/09/07 17:04:28

  Modified:    src/plugins/mmsound mmsound.c mmsound.dsp
  Added:       src/plugins/mmsound .cvsignore
  Log:
  Make semaphore handle a per-instance variable instead of global.

Revision  Changes    Path
1.2       +14 -20    ao/src/plugins/mmsound/mmsound.c

Index: mmsound.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/mmsound/mmsound.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mmsound.c	2001/09/07 20:41:39	1.1
+++ mmsound.c	2001/09/08 00:04:28	1.2
@@ -29,22 +29,13 @@
 #include <ao/ao.h>
 #include <ao/plugin.h>
 
-HANDLE notdone;
-
-static	void CALLBACK waveOutProc(HWAVEOUT hwo,UINT uMsg,DWORD dwInstance,DWORD dwParam1,DWORD dwParam2)
-{
-	if (uMsg == WOM_DONE)
-	{
-		ReleaseSemaphore(notdone, 1, NULL);
-	}
-}
-
 typedef struct ao_mmsound_internal {
         HWAVEOUT m_hWaveOut;
         WAVEHDR	m_waveHeader[2];
         uint_32 buf_size;
         void *buffer[2];
         int currentb;
+  HANDLE notdone;
 } ao_mmsound_internal;
 
 static char *ao_mmsound_options[] = {"buf_size"};
@@ -62,19 +53,26 @@
         1
 };
 
+static	void CALLBACK waveOutProc(HWAVEOUT hwo,UINT uMsg,DWORD dwInstance,DWORD dwParam1,DWORD dwParam2)
+{
+  ao_mmsound_internal *internal = (ao_mmsound_internal *)dwInstance;
+
+	if (uMsg == WOM_DONE)
+	{
+		ReleaseSemaphore(internal->notdone, 1, NULL);
+	}
+}
 
 int ao_plugin_test()
 {
         return 1; /* This plugin works in default mode */
 }
 
-
 ao_info *ao_plugin_driver_info(void)
 {
         return &ao_mmsound_info;
 }
 
-
 int ao_plugin_device_init(ao_device *device)
 {
         ao_mmsound_internal *internal;
@@ -91,7 +89,6 @@
         return 1; /* Memory alloc successful */
 }
 
-
 int ao_plugin_set_option(ao_device *device, const char *key, const char *value)
 {
         ao_mmsound_internal *internal = (ao_mmsound_internal *) device->internal;
@@ -101,7 +98,6 @@
         return 1;
 }
 
-
 /*
  * open the audio device for writing to
  */
@@ -124,7 +120,7 @@
                                                         WAVE_MAPPER,
                                                         &wfx,
                                                         (DWORD)waveOutProc,
-							0,
+							(DWORD)device->internal,
                                                         (DWORD)CALLBACK_FUNCTION);
 
         if (errCode != MMSYSERR_NOERROR) return 0;
@@ -140,8 +136,7 @@
         internal->buffer[1] = malloc(internal->buf_size);
         internal->currentb = 0;
 
-	notdone = CreateSemaphore(NULL, 0, 1, NULL);
-	ReleaseSemaphore(notdone, 1, NULL);
+	internal->notdone = CreateSemaphore(NULL, 0, 1, NULL);
 
         device->driver_byte_format = AO_FMT_NATIVE;
         
@@ -171,7 +166,7 @@
 
         // Send internal->buffer[n] to the WaveOut device buffer.
         waveOutWrite(internal->m_hWaveOut,&internal->m_waveHeader[internal->currentb],sizeof(WAVEHDR));
-	WaitForSingleObject(notdone, INFINITE);
+	WaitForSingleObject(internal->notdone, INFINITE);
 
         internal->currentb++;
         if(internal->currentb >= 2) internal->currentb = 0;
@@ -183,7 +178,7 @@
 {
         ao_mmsound_internal *internal = (ao_mmsound_internal *) device->internal;
 
-	CloseHandle(notdone);
+	CloseHandle(internal->notdone);
         free(internal->buffer[0]);
         free(internal->buffer[1]);
         
@@ -192,7 +187,6 @@
 
         return 1;
 }
-
 
 void ao_plugin_device_clear(ao_device *device)
 {

1.2       +3 -3      ao/src/plugins/mmsound/mmsound.dsp

Index: mmsound.dsp
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/mmsound/mmsound.dsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mmsound.dsp	2001/09/07 20:41:39	1.1
+++ mmsound.dsp	2001/09/08 00:04:28	1.2
@@ -54,7 +54,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /dll /machine:I386 /out:"../../../win32/lib/mmsound.dll"
 
 !ELSEIF  "$(CFG)" == "mmsound - Win32 Debug"
 
@@ -70,7 +70,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMSOUND_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\win32\include" /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMSOUND_EXPORTS" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\win32\include" /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMSOUND_EXPORTS" /FR /FD /GZ /c
 # SUBTRACT CPP /YX
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@@ -81,7 +81,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /dll /debug /machine:I386 /out:"../../../win32/lib/mmsound_d.dll" /pdbtype:sept
 
 !ENDIF 
 

1.1                  ao/src/plugins/mmsound/.cvsignore

Index: .cvsignore
===================================================================
Debug
Release
*.ncb
*.opt
*.plg
*.dsw

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list