Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/wineoss.drv/midi.c | 63 -------------------------------------- dlls/wineoss.drv/oss.c | 1 - dlls/wineoss.drv/ossmidi.c | 41 +++++++++++++++++++------ dlls/wineoss.drv/unixlib.h | 7 ----- 4 files changed, 31 insertions(+), 81 deletions(-)
diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index 84a4fac4b74..dda5dabf522 100644 --- a/dlls/wineoss.drv/midi.c +++ b/dlls/wineoss.drv/midi.c @@ -34,19 +34,7 @@ * timers (like select on fd) */
-#include "config.h" - -#include <stdlib.h> -#include <string.h> #include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/ioctl.h> -#include <poll.h> -#include <sys/soundcard.h>
#include "windef.h" #include "winbase.h" @@ -67,44 +55,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(midi); * Low level MIDI implementation * *======================================================================*/
-static int MIDI_loadcount; -/************************************************************************** - * OSS_MidiInit [internal] - * - * Initializes the MIDI devices information variables - */ -static LRESULT OSS_MidiInit(void) -{ - struct midi_init_params params; - UINT err; - - TRACE("(%i)\n", MIDI_loadcount); - if (MIDI_loadcount++) - return 1; - - TRACE("Initializing the MIDI variables.\n"); - - params.err = &err; - OSS_CALL(midi_init, ¶ms); - - return err; -} - -/************************************************************************** - * OSS_MidiExit [internal] - * - * Release the MIDI devices information variables - */ -static LRESULT OSS_MidiExit(void) -{ - TRACE("(%i)\n", MIDI_loadcount); - - if (--MIDI_loadcount) - return 1; - - return 0; -} - static void notify_client(struct notify_context *notify) { TRACE("dev_id = %d msg = %d param1 = %04lX param2 = %04lX\n", @@ -130,12 +80,6 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
TRACE("(%04X, %04X, %08lX, %08lX, %08lX);\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); - switch (wMsg) { - case DRVM_INIT: - return OSS_MidiInit(); - case DRVM_EXIT: - return OSS_MidiExit(); - }
params.dev_id = wDevID; params.msg = wMsg; @@ -167,13 +111,6 @@ DWORD WINAPI OSS_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, TRACE("(%04X, %04X, %08lX, %08lX, %08lX);\n", wDevID, wMsg, dwUser, dwParam1, dwParam2);
- switch (wMsg) { - case DRVM_INIT: - return OSS_MidiInit(); - case DRVM_EXIT: - return OSS_MidiExit(); - } - params.dev_id = wDevID; params.msg = wMsg; params.user = dwUser; diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index b0a411ecd9b..a5aea9ee724 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1405,7 +1405,6 @@ unixlib_entry_t __wine_unix_call_funcs[] = set_volumes, set_event_handle, is_started, - midi_init, midi_release, midi_out_message, midi_in_message, diff --git a/dlls/wineoss.drv/ossmidi.c b/dlls/wineoss.drv/ossmidi.c index 072a9815c35..6677609a5a6 100644 --- a/dlls/wineoss.drv/ossmidi.c +++ b/dlls/wineoss.drv/ossmidi.c @@ -83,6 +83,7 @@ static pthread_mutex_t in_buffer_mutex = PTHREAD_MUTEX_INITIALIZER; static unsigned int num_dests, num_srcs, num_synths, seq_refs; static struct midi_dest dests[MAX_MIDIOUTDRV]; static struct midi_src srcs[MAX_MIDIINDRV]; +static int load_count;
static unsigned int num_midi_in_started; static int rec_cancel_pipe[2]; @@ -301,22 +302,23 @@ static int seq_close(int fd) return 0; }
-NTSTATUS midi_init(void *args) +static UINT midi_init(void) { - struct midi_init_params *params = args; int i, status, synth_devs = 255, midi_devs = 255, fd, len; struct synth_info sinfo; struct midi_info minfo; struct midi_dest *dest; struct midi_src *src;
+ TRACE("(%i)\n", load_count); + + if (load_count++) + return 1; + /* try to open device */ fd = seq_open(); if (fd == -1) - { - *params->err = -1; - return STATUS_SUCCESS; - } + return -1;
/* find how many Synth devices are there in the system */ status = ioctl(fd, SNDCTL_SEQ_NRSYNTHS, &synth_devs); @@ -324,8 +326,7 @@ NTSTATUS midi_init(void *args) { ERR("ioctl for nr synth failed.\n"); seq_close(fd); - *params->err = -1; - return STATUS_SUCCESS; + return -1; }
if (synth_devs > MAX_MIDIOUTDRV) @@ -506,9 +507,17 @@ wrapup: /* close file and exit */ seq_close(fd);
- *params->err = 0; + return 0; +}
- return STATUS_SUCCESS; +static UINT midi_exit(void) +{ + TRACE("(%i)\n", load_count); + + if (--load_count) + return 1; + + return 0; }
NTSTATUS midi_release(void *args) @@ -1634,6 +1643,12 @@ NTSTATUS midi_out_message(void *args)
switch (params->msg) { + case DRVM_INIT: + *params->err = midi_init(); + break; + case DRVM_EXIT: + *params->err = midi_exit(); + break; case DRVM_ENABLE: case DRVM_DISABLE: /* FIXME: Pretend this is supported */ @@ -1688,6 +1703,12 @@ NTSTATUS midi_in_message(void *args)
switch (params->msg) { + case DRVM_INIT: + *params->err = midi_init(); + break; + case DRVM_EXIT: + *params->err = midi_exit(); + break; case DRVM_ENABLE: case DRVM_DISABLE: /* FIXME: Pretend this is supported */ diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index d3dda7c76f2..6a7dc9288d9 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -209,11 +209,6 @@ struct is_started_params HRESULT result; };
-struct midi_init_params -{ - UINT *err; -}; - struct notify_context { BOOL send_notify; @@ -280,14 +275,12 @@ enum oss_funcs oss_set_volumes, oss_set_event_handle, oss_is_started, - oss_midi_init, oss_midi_release, oss_midi_out_message, oss_midi_in_message, oss_midi_notify_wait, };
-NTSTATUS midi_init(void *args) DECLSPEC_HIDDEN; NTSTATUS midi_release(void *args) DECLSPEC_HIDDEN; NTSTATUS midi_out_message(void *args) DECLSPEC_HIDDEN; NTSTATUS midi_in_message(void *args) DECLSPEC_HIDDEN;