Browse Source

drop handle parameter of OpenDevice

pionere 3 years ago
parent
commit
a70bb259c7

+ 2 - 2
src/audio/SDL_audio.c

@@ -289,7 +289,7 @@ SDL_AudioFreeDeviceHandle_Default(void *handle)
 
 
 
 
 static int
 static int
-SDL_AudioOpenDevice_Default(_THIS, void *handle, const char *devname)
+SDL_AudioOpenDevice_Default(_THIS, const char *devname)
 {
 {
     return SDL_Unsupported();
     return SDL_Unsupported();
 }
 }
@@ -1383,7 +1383,7 @@ open_audio_device(const char *devname, int iscapture,
         }
         }
     }
     }
 
 
-    if (current_audio.impl.OpenDevice(device, handle, devname) < 0) {
+    if (current_audio.impl.OpenDevice(device, devname) < 0) {
         close_audio_device(device);
         close_audio_device(device);
         return 0;
         return 0;
     }
     }

+ 1 - 1
src/audio/SDL_sysaudio.h

@@ -65,7 +65,7 @@ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device);
 typedef struct SDL_AudioDriverImpl
 typedef struct SDL_AudioDriverImpl
 {
 {
     void (*DetectDevices) (void);
     void (*DetectDevices) (void);
-    int (*OpenDevice) (_THIS, void *handle, const char *devname);
+    int (*OpenDevice) (_THIS, const char *devname);
     void (*ThreadInit) (_THIS); /* Called by audio thread at start */
     void (*ThreadInit) (_THIS); /* Called by audio thread at start */
     void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */
     void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */
     void (*WaitDevice) (_THIS);
     void (*WaitDevice) (_THIS);

+ 1 - 1
src/audio/aaudio/SDL_aaudio.c

@@ -71,7 +71,7 @@ void aaudio_errorCallback( AAudioStream *stream, void *userData, aaudio_result_t
 #define LIB_AAUDIO_SO "libaaudio.so"
 #define LIB_AAUDIO_SO "libaaudio.so"
 
 
 static int
 static int
-aaudio_OpenDevice(_THIS, void *handle, const char *devname)
+aaudio_OpenDevice(_THIS, const char *devname)
 {
 {
     struct SDL_PrivateAudioData *private;
     struct SDL_PrivateAudioData *private;
     SDL_bool iscapture = this->iscapture;
     SDL_bool iscapture = this->iscapture;

+ 2 - 2
src/audio/alsa/SDL_alsa_audio.c

@@ -543,7 +543,7 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params)
 }
 }
 
 
 static int
 static int
-ALSA_OpenDevice(_THIS, void *handle, const char *devname)
+ALSA_OpenDevice(_THIS, const char *devname)
 {
 {
     int status = 0;
     int status = 0;
     SDL_bool iscapture = this->iscapture;
     SDL_bool iscapture = this->iscapture;
@@ -570,7 +570,7 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname)
     /* Open the audio device */
     /* Open the audio device */
     /* Name of device should depend on # channels in spec */
     /* Name of device should depend on # channels in spec */
     status = ALSA_snd_pcm_open(&pcm_handle,
     status = ALSA_snd_pcm_open(&pcm_handle,
-                get_audio_device(handle, this->spec.channels),
+                get_audio_device(this->handle, this->spec.channels),
                 iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
                 iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
                 SND_PCM_NONBLOCK);
                 SND_PCM_NONBLOCK);
 
 

+ 1 - 1
src/audio/android/SDL_androidaudio.c

@@ -36,7 +36,7 @@ static SDL_AudioDevice* audioDevice = NULL;
 static SDL_AudioDevice* captureDevice = NULL;
 static SDL_AudioDevice* captureDevice = NULL;
 
 
 static int
 static int
-ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+ANDROIDAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;
     SDL_bool iscapture = this->iscapture;
     SDL_bool iscapture = this->iscapture;

+ 1 - 1
src/audio/arts/SDL_artsaudio.c

@@ -216,7 +216,7 @@ ARTS_Suspend(void)
 }
 }
 
 
 static int
 static int
-ARTS_OpenDevice(_THIS, void *handle, const char *devname)
+ARTS_OpenDevice(_THIS, const char *devname)
 {
 {
     int rc = 0;
     int rc = 0;
     int bits, frag_spec = 0;
     int bits, frag_spec = 0;

+ 6 - 4
src/audio/coreaudio/SDL_coreaudio.m

@@ -741,8 +741,10 @@ COREAUDIO_CloseDevice(_THIS)
 
 
 #if MACOSX_COREAUDIO
 #if MACOSX_COREAUDIO
 static int
 static int
-prepare_device(_THIS, void *handle, int iscapture)
+prepare_device(_THIS)
 {
 {
+    void *handle = this->handle;
+    SDL_bool iscapture = this->iscapture;
     AudioDeviceID devid = (AudioDeviceID) ((size_t) handle);
     AudioDeviceID devid = (AudioDeviceID) ((size_t) handle);
     OSStatus result = noErr;
     OSStatus result = noErr;
     UInt32 size = 0;
     UInt32 size = 0;
@@ -983,7 +985,7 @@ audioqueue_thread(void *arg)
                and quits (flagging the audioqueue for shutdown), or toggles to some other system
                and quits (flagging the audioqueue for shutdown), or toggles to some other system
                output device (in which case we'll try again). */
                output device (in which case we'll try again). */
             const AudioDeviceID prev_devid = this->hidden->deviceID;
             const AudioDeviceID prev_devid = this->hidden->deviceID;
-            if (prepare_device(this, this->handle, this->iscapture) && (prev_devid != this->hidden->deviceID)) {
+            if (prepare_device(this) && (prev_devid != this->hidden->deviceID)) {
                 AudioQueueStop(this->hidden->audioQueue, 1);
                 AudioQueueStop(this->hidden->audioQueue, 1);
                 if (assign_device_to_audioqueue(this)) {
                 if (assign_device_to_audioqueue(this)) {
                     int i;
                     int i;
@@ -1015,7 +1017,7 @@ audioqueue_thread(void *arg)
 }
 }
 
 
 static int
 static int
-COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+COREAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     AudioStreamBasicDescription *strdesc;
     AudioStreamBasicDescription *strdesc;
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;
@@ -1112,7 +1114,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
     strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket;
     strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket;
 
 
 #if MACOSX_COREAUDIO
 #if MACOSX_COREAUDIO
-    if (!prepare_device(this, handle, iscapture)) {
+    if (!prepare_device(this)) {
         return -1;
         return -1;
     }
     }
 #endif
 #endif

+ 2 - 2
src/audio/directsound/SDL_directsound.c

@@ -473,14 +473,14 @@ CreateCaptureBuffer(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt)
 }
 }
 
 
 static int
 static int
-DSOUND_OpenDevice(_THIS, void *handle, const char *devname)
+DSOUND_OpenDevice(_THIS, const char *devname)
 {
 {
     const DWORD numchunks = 8;
     const DWORD numchunks = 8;
     HRESULT result;
     HRESULT result;
     SDL_bool tried_format = SDL_FALSE;
     SDL_bool tried_format = SDL_FALSE;
     SDL_bool iscapture = this->iscapture;
     SDL_bool iscapture = this->iscapture;
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;
-    LPGUID guid = (LPGUID) handle;
+    LPGUID guid = (LPGUID) this->handle;
     DWORD bufsize;
     DWORD bufsize;
 
 
     /* Initialize all variables that we clean on shutdown */
     /* Initialize all variables that we clean on shutdown */

+ 2 - 1
src/audio/disk/SDL_diskaudio.c

@@ -126,8 +126,9 @@ get_filename(const SDL_bool iscapture, const char *devname)
 }
 }
 
 
 static int
 static int
-DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+DISKAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
+    void *handle = _this->handle;
     /* handle != NULL means "user specified the placeholder name on the fake detected device list" */
     /* handle != NULL means "user specified the placeholder name on the fake detected device list" */
     SDL_bool iscapture = _this->iscapture;
     SDL_bool iscapture = _this->iscapture;
     const char *fname = get_filename(iscapture, handle ? NULL : devname);
     const char *fname = get_filename(iscapture, handle ? NULL : devname);

+ 1 - 1
src/audio/dsp/SDL_dspaudio.c

@@ -68,7 +68,7 @@ DSP_CloseDevice(_THIS)
 
 
 
 
 static int
 static int
-DSP_OpenDevice(_THIS, void *handle, const char *devname)
+DSP_OpenDevice(_THIS, const char *devname)
 {
 {
     SDL_bool iscapture = this->iscapture;
     SDL_bool iscapture = this->iscapture;
     const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
     const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);

+ 1 - 1
src/audio/dummy/SDL_dummyaudio.c

@@ -28,7 +28,7 @@
 #include "SDL_dummyaudio.h"
 #include "SDL_dummyaudio.h"
 
 
 static int
 static int
-DUMMYAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+DUMMYAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     _this->hidden = (void *) 0x1;  /* just something non-NULL */
     _this->hidden = (void *) 0x1;  /* just something non-NULL */
     return 0;                   /* always succeeds. */
     return 0;                   /* always succeeds. */

+ 1 - 1
src/audio/emscripten/SDL_emscriptenaudio.c

@@ -192,7 +192,7 @@ EMSCRIPTENAUDIO_CloseDevice(_THIS)
 }
 }
 
 
 static int
 static int
-EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;
     SDL_bool iscapture = this->iscapture;
     SDL_bool iscapture = this->iscapture;

+ 1 - 1
src/audio/esd/SDL_esdaudio.c

@@ -208,7 +208,7 @@ get_progname(void)
 
 
 
 
 static int
 static int
-ESD_OpenDevice(_THIS, void *handle, const char *devname)
+ESD_OpenDevice(_THIS, const char *devname)
 {
 {
     esd_format_t format = (ESD_STREAM | ESD_PLAY);
     esd_format_t format = (ESD_STREAM | ESD_PLAY);
     SDL_AudioFormat test_format = 0;
     SDL_AudioFormat test_format = 0;

+ 1 - 1
src/audio/fusionsound/SDL_fsaudio.c

@@ -174,7 +174,7 @@ SDL_FS_CloseDevice(_THIS)
 
 
 
 
 static int
 static int
-SDL_FS_OpenDevice(_THIS, void *handle, const char *devname)
+SDL_FS_OpenDevice(_THIS, const char *devname)
 {
 {
     int bytes;
     int bytes;
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;

+ 1 - 1
src/audio/haiku/SDL_haikuaudio.cc

@@ -120,7 +120,7 @@ UnmaskSignals(sigset_t * omask)
 
 
 
 
 static int
 static int
-HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+HAIKUAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     media_raw_audio_format format;
     media_raw_audio_format format;
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;

+ 1 - 1
src/audio/jack/SDL_jackaudio.c

@@ -280,7 +280,7 @@ JACK_CloseDevice(_THIS)
 }
 }
 
 
 static int
 static int
-JACK_OpenDevice(_THIS, void *handle, const char *devname)
+JACK_OpenDevice(_THIS, const char *devname)
 {
 {
     /* Note that JACK uses "output" for capture devices (they output audio
     /* Note that JACK uses "output" for capture devices (they output audio
         data to us) and "input" for playback (we input audio data to them).
         data to us) and "input" for playback (we input audio data to them).

+ 1 - 1
src/audio/nacl/SDL_naclaudio.c

@@ -99,7 +99,7 @@ static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) {
 }
 }
 
 
 static int
 static int
-NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname) {
+NACLAUDIO_OpenDevice(_THIS, const char *devname) {
     PP_Instance instance = PSGetInstanceId();
     PP_Instance instance = PSGetInstanceId();
     const PPB_Audio *ppb_audio = PSInterfaceAudio();
     const PPB_Audio *ppb_audio = PSInterfaceAudio();
     const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig();
     const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig();

+ 1 - 1
src/audio/nas/SDL_nasaudio.c

@@ -311,7 +311,7 @@ find_device(_THIS)
 }
 }
 
 
 static int
 static int
-NAS_OpenDevice(_THIS, void *handle, const char *devname)
+NAS_OpenDevice(_THIS, const char *devname)
 {
 {
     AuElement elms[3];
     AuElement elms[3];
     int buffer_size;
     int buffer_size;

+ 1 - 1
src/audio/netbsd/SDL_netbsdaudio.c

@@ -202,7 +202,7 @@ NETBSDAUDIO_CloseDevice(_THIS)
 }
 }
 
 
 static int
 static int
-NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+NETBSDAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     SDL_bool iscapture = this->iscapture;
     SDL_bool iscapture = this->iscapture;
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;

+ 1 - 1
src/audio/openslES/SDL_openslES.c

@@ -582,7 +582,7 @@ failed:
 }
 }
 
 
 static int
 static int
-openslES_OpenDevice(_THIS, void *handle, const char *devname)
+openslES_OpenDevice(_THIS, const char *devname)
 {
 {
     this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *this->hidden));
     this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *this->hidden));
     if (this->hidden == NULL) {
     if (this->hidden == NULL) {

+ 2 - 2
src/audio/os2/SDL_os2audio.c

@@ -248,7 +248,7 @@ static void OS2_CloseDevice(_THIS)
     SDL_free(pAData);
     SDL_free(pAData);
 }
 }
 
 
-static int OS2_OpenDevice(_THIS, void *handle, const char *devname)
+static int OS2_OpenDevice(_THIS, const char *devname)
 {
 {
     SDL_PrivateAudioData *pAData;
     SDL_PrivateAudioData *pAData;
     SDL_AudioFormat       test_format;
     SDL_AudioFormat       test_format;
@@ -284,7 +284,7 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname)
     }
     }
 
 
     /* Open audio device */
     /* Open audio device */
-    stMCIAmpOpen.usDeviceID = (handle != NULL) ? ((ULONG)handle - 1) : 0;
+    stMCIAmpOpen.usDeviceID = (_this->handle != NULL) ? ((ULONG)_this->handle - 1) : 0;
     stMCIAmpOpen.pszDeviceType = (PSZ)MCI_DEVTYPE_AUDIO_AMPMIX;
     stMCIAmpOpen.pszDeviceType = (PSZ)MCI_DEVTYPE_AUDIO_AMPMIX;
     ulRC = mciSendCommand(0, MCI_OPEN,
     ulRC = mciSendCommand(0, MCI_OPEN,
                           (_getEnvULong("SDL_AUDIO_SHARE", 1, 0) != 0)?
                           (_getEnvULong("SDL_AUDIO_SHARE", 1, 0) != 0)?

+ 1 - 1
src/audio/paudio/SDL_paudio.c

@@ -223,7 +223,7 @@ PAUDIO_CloseDevice(_THIS)
 }
 }
 
 
 static int
 static int
-PAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+PAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     const char *workaround = SDL_getenv("SDL_DSP_NOSELECT");
     const char *workaround = SDL_getenv("SDL_DSP_NOSELECT");
     char audiodev[1024];
     char audiodev[1024];

+ 2 - 2
src/audio/pipewire/SDL_pipewire.c

@@ -1027,7 +1027,7 @@ static const struct pw_stream_events stream_input_events  = { PW_VERSION_STREAM_
                                                              .process       = input_callback };
                                                              .process       = input_callback };
 
 
 static int
 static int
-PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname)
+PIPEWIRE_OpenDevice(_THIS, const char *devname)
 {
 {
     /*
     /*
      * NOTE: The PW_STREAM_FLAG_RT_PROCESS flag can be set to call the stream
      * NOTE: The PW_STREAM_FLAG_RT_PROCESS flag can be set to call the stream
@@ -1108,7 +1108,7 @@ PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname)
         }
         }
     }
     }
 
 
-    SDL_snprintf(thread_name, sizeof(thread_name), "SDLAudio%c%ld", (iscapture) ? 'C' : 'P', (long)handle);
+    SDL_snprintf(thread_name, sizeof(thread_name), "SDLAudio%c%ld", (iscapture) ? 'C' : 'P', (long)this->handle);
     priv->loop = PIPEWIRE_pw_thread_loop_new(thread_name, NULL);
     priv->loop = PIPEWIRE_pw_thread_loop_new(thread_name, NULL);
     if (priv->loop == NULL) {
     if (priv->loop == NULL) {
         return SDL_SetError("Pipewire: Failed to create stream loop (%i)", errno);
         return SDL_SetError("Pipewire: Failed to create stream loop (%i)", errno);

+ 1 - 1
src/audio/psp/SDL_pspaudio.c

@@ -42,7 +42,7 @@
 #define PSPAUDIO_DRIVER_NAME    "psp"
 #define PSPAUDIO_DRIVER_NAME    "psp"
 
 
 static int
 static int
-PSPAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+PSPAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     int format, mixlen, i;
     int format, mixlen, i;
 
 

+ 2 - 2
src/audio/pulseaudio/SDL_pulseaudio.c

@@ -544,7 +544,7 @@ FindDeviceName(struct SDL_PrivateAudioData *h, const SDL_bool iscapture, void *h
 }
 }
 
 
 static int
 static int
-PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+PULSEAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     struct SDL_PrivateAudioData *h = NULL;
     struct SDL_PrivateAudioData *h = NULL;
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;
@@ -644,7 +644,7 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
         return SDL_SetError("Could not connect to PulseAudio server");
         return SDL_SetError("Could not connect to PulseAudio server");
     }
     }
 
 
-    if (!FindDeviceName(h, iscapture, handle)) {
+    if (!FindDeviceName(h, iscapture, this->handle)) {
         return SDL_SetError("Requested PulseAudio sink/source missing?");
         return SDL_SetError("Requested PulseAudio sink/source missing?");
     }
     }
 
 

+ 2 - 2
src/audio/qsa/SDL_qsa_audio.c

@@ -257,9 +257,9 @@ QSA_CloseDevice(_THIS)
 }
 }
 
 
 static int
 static int
-QSA_OpenDevice(_THIS, void *handle, const char *devname)
+QSA_OpenDevice(_THIS, const char *devname)
 {
 {
-    const QSA_Device *device = (const QSA_Device *) handle;
+    const QSA_Device *device = (const QSA_Device *) this->handle;
     SDL_Bool iscapture = this->iscapture;
     SDL_Bool iscapture = this->iscapture;
     int status = 0;
     int status = 0;
     int format = 0;
     int format = 0;

+ 1 - 1
src/audio/sndio/SDL_sndioaudio.c

@@ -237,7 +237,7 @@ SNDIO_CloseDevice(_THIS)
 }
 }
 
 
 static int
 static int
-SNDIO_OpenDevice(_THIS, void *handle, const char *devname)
+SNDIO_OpenDevice(_THIS, const char *devname)
 {
 {
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;
     struct sio_par par;
     struct sio_par par;

+ 1 - 1
src/audio/sun/SDL_sunaudio.c

@@ -188,7 +188,7 @@ SUNAUDIO_CloseDevice(_THIS)
 }
 }
 
 
 static int
 static int
-SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname)
+SUNAUDIO_OpenDevice(_THIS, const char *devname)
 {
 {
 #ifdef AUDIO_SETINFO
 #ifdef AUDIO_SETINFO
     int enc;
     int enc;

+ 1 - 1
src/audio/vita/SDL_vitaaudio.c

@@ -45,7 +45,7 @@
 #define VITAAUD_DRIVER_NAME     "vita"
 #define VITAAUD_DRIVER_NAME     "vita"
 
 
 static int
 static int
-VITAAUD_OpenDevice(_THIS, void *handle, const char *devname)
+VITAAUD_OpenDevice(_THIS, const char *devname)
 {
 {
     int format, mixlen, i, port = SCE_AUDIO_OUT_PORT_TYPE_MAIN;
     int format, mixlen, i, port = SCE_AUDIO_OUT_PORT_TYPE_MAIN;
     int vols[2] = {SCE_AUDIO_MAX_VOLUME, SCE_AUDIO_MAX_VOLUME};
     int vols[2] = {SCE_AUDIO_MAX_VOLUME, SCE_AUDIO_MAX_VOLUME};

+ 2 - 2
src/audio/wasapi/SDL_wasapi.c

@@ -636,9 +636,9 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
 
 
 
 
 static int
 static int
-WASAPI_OpenDevice(_THIS, void *handle, const char *devname)
+WASAPI_OpenDevice(_THIS, const char *devname)
 {
 {
-    LPCWSTR devid = (LPCWSTR) handle;
+    LPCWSTR devid = (LPCWSTR) this->handle;
 
 
     /* Initialize all variables that we clean on shutdown */
     /* Initialize all variables that we clean on shutdown */
     this->hidden = (struct SDL_PrivateAudioData *)
     this->hidden = (struct SDL_PrivateAudioData *)

+ 2 - 1
src/audio/winmm/SDL_winmm.c

@@ -283,10 +283,11 @@ PrepWaveFormat(_THIS, UINT devId, WAVEFORMATEX *pfmt, const int iscapture)
 }
 }
 
 
 static int
 static int
-WINMM_OpenDevice(_THIS, void *handle, const char *devname)
+WINMM_OpenDevice(_THIS, const char *devname)
 {
 {
     SDL_AudioFormat test_format;
     SDL_AudioFormat test_format;
     SDL_bool iscapture = this->iscapture;
     SDL_bool iscapture = this->iscapture;
+    void *handle = this->handle;
     MMRESULT result;
     MMRESULT result;
     WAVEFORMATEX waveformat;
     WAVEFORMATEX waveformat;
     UINT devId = WAVE_MAPPER;  /* WAVE_MAPPER == choose system's default */
     UINT devId = WAVE_MAPPER;  /* WAVE_MAPPER == choose system's default */