Huw Davies : wineoss: Move MODM_RESET to the unixlib.
Alexandre Julliard
julliard at winehq.org
Mon Apr 25 16:30:34 CDT 2022
Module: wine
Branch: master
Commit: 6784845f3f8866e7642bf248b953a01951d32b64
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6784845f3f8866e7642bf248b953a01951d32b64
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Apr 22 07:08:41 2022 +0100
wineoss: Move MODM_RESET to the unixlib.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wineoss.drv/midi.c | 47 ----------------------------------------------
dlls/wineoss.drv/ossmidi.c | 43 +++++++++++++++++++++++++++++++++++++++---
dlls/wineoss.drv/unixlib.h | 14 --------------
3 files changed, 40 insertions(+), 64 deletions(-)
diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c
index 8c3a2405b0f..470e8e4403d 100644
--- a/dlls/wineoss.drv/midi.c
+++ b/dlls/wineoss.drv/midi.c
@@ -64,13 +64,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(midi);
static WINE_MIDIIN *MidiInDev;
-static WINE_MIDIOUT *MidiOutDev;
-
-/* this is the total number of MIDI out devices found (synth and port) */
-static int MODM_NumDevs = 0;
-/* this is the number of FM synthesizers (index from 0 to NUMFMSYNTHDEVS - 1) */
-static int MODM_NumFMSynthDevs = 0;
-/* the Midi ports have index from NUMFMSYNTHDEVS to NumDevs - 1 */
/* this is the total number of MIDI out devices found */
static int MIDM_NumDevs = 0;
@@ -119,9 +112,6 @@ static LRESULT OSS_MidiInit(void)
if (!err)
{
MidiInDev = params.srcs;
- MidiOutDev = params.dests;
- MODM_NumDevs = params.num_dests;
- MODM_NumFMSynthDevs = params.num_synths;
MIDM_NumDevs = params.num_srcs;
}
return err;
@@ -140,10 +130,6 @@ static LRESULT OSS_MidiExit(void)
return 1;
MidiInDev = NULL;
- MidiOutDev = NULL;
-
- MODM_NumDevs = 0;
- MODM_NumFMSynthDevs = 0;
MIDM_NumDevs = 0;
return 0;
@@ -646,37 +632,6 @@ static DWORD midStop(WORD wDevID)
return MMSYSERR_NOERROR;
}
-/*-----------------------------------------------------------------------*/
-
-DWORD WINAPI OSS_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
- DWORD_PTR dwParam1, DWORD_PTR dwParam2);
-
-/**************************************************************************
- * modReset [internal]
- */
-static DWORD modReset(WORD wDevID)
-{
- unsigned chn;
-
- TRACE("(%04X);\n", wDevID);
-
- if (wDevID >= MODM_NumDevs) return MMSYSERR_BADDEVICEID;
- if (!MidiOutDev[wDevID].bEnabled) return MIDIERR_NODEVICE;
-
- /* stop all notes */
- /* FIXME: check if 0x78B0 is channel dependent or not. I coded it so that
- * it's channel dependent...
- */
- for (chn = 0; chn < 16; chn++) {
- /* turn off every note */
- OSS_modMessage(wDevID, MODM_DATA, 0, 0x7800 | MIDI_CTL_CHANGE | chn, 0);
- /* remove sustain on all channels */
- OSS_modMessage(wDevID, MODM_DATA, 0, (CTL_SUSTAIN << 8) | MIDI_CTL_CHANGE | chn, 0);
- }
- /* FIXME: the LongData buffers must also be returned to the app */
- return MMSYSERR_NOERROR;
-}
-
/*======================================================================*
* MIDI entry points *
*======================================================================*/
@@ -742,8 +697,6 @@ DWORD WINAPI OSS_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
return OSS_MidiInit();
case DRVM_EXIT:
return OSS_MidiExit();
- case MODM_RESET:
- return modReset(wDevID);
}
params.dev_id = wDevID;
diff --git a/dlls/wineoss.drv/ossmidi.c b/dlls/wineoss.drv/ossmidi.c
index 4b419c2716c..ba3017a5ad7 100644
--- a/dlls/wineoss.drv/ossmidi.c
+++ b/dlls/wineoss.drv/ossmidi.c
@@ -48,6 +48,17 @@
#include "unixlib.h"
+struct midi_dest
+{
+ BOOL bEnabled;
+ MIDIOPENDESC midiDesc;
+ WORD wFlags;
+ MIDIHDR *lpQueueHdr;
+ void *lpExtra; /* according to port type (MIDI, FM...), extra data when needed */
+ MIDIOUTCAPSW caps;
+ int fd;
+};
+
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];
@@ -381,10 +392,7 @@ wrapup:
*params->err = 0;
params->num_srcs = num_srcs;
- params->num_dests = num_dests;
- params->num_synths = num_synths;
params->srcs = srcs;
- params->dests = dests;
return STATUS_SUCCESS;
}
@@ -1065,6 +1073,32 @@ static UINT midi_out_get_volume(WORD dev_id, UINT *volume)
return (dests[dev_id].caps.dwSupport & MIDICAPS_VOLUME) ? 0 : MMSYSERR_NOTSUPPORTED;
}
+static UINT midi_out_reset(WORD dev_id)
+{
+ struct midi_dest *dest;
+ unsigned chn;
+
+ TRACE("(%04X);\n", dev_id);
+
+ if (dev_id >= num_dests) return MMSYSERR_BADDEVICEID;
+ dest = dests + dev_id;
+ if (!dest->bEnabled) return MIDIERR_NODEVICE;
+
+ /* stop all notes */
+ /* FIXME: check if 0x78B0 is channel dependent or not. I coded it so that
+ * it's channel dependent...
+ */
+ for (chn = 0; chn < 16; chn++)
+ {
+ /* turn off every note */
+ midi_out_data(dev_id, 0x7800 | MIDI_CTL_CHANGE | chn);
+ /* remove sustain on all channels */
+ midi_out_data(dev_id, (CTL_SUSTAIN << 8) | MIDI_CTL_CHANGE | chn);
+ }
+ /* FIXME: the LongData buffers must also be returned to the app */
+ return MMSYSERR_NOERROR;
+}
+
NTSTATUS midi_out_message(void *args)
{
struct midi_out_message_params *params = args;
@@ -1108,6 +1142,9 @@ NTSTATUS midi_out_message(void *args)
case MODM_SETVOLUME:
*params->err = 0;
break;
+ case MODM_RESET:
+ *params->err = midi_out_reset(params->dev_id);
+ break;
default:
TRACE("Unsupported message\n");
*params->err = MMSYSERR_NOTSUPPORTED;
diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h
index d56e11b8d23..183f5017d04 100644
--- a/dlls/wineoss.drv/unixlib.h
+++ b/dlls/wineoss.drv/unixlib.h
@@ -225,24 +225,10 @@ typedef struct midi_src
int fd;
} WINE_MIDIIN;
-typedef struct midi_dest
-{
- BOOL bEnabled;
- MIDIOPENDESC midiDesc;
- WORD wFlags;
- MIDIHDR *lpQueueHdr;
- void *lpExtra; /* according to port type (MIDI, FM...), extra data when needed */
- MIDIOUTCAPSW caps;
- int fd;
-} WINE_MIDIOUT;
-
struct midi_init_params
{
UINT *err;
- unsigned int num_dests;
unsigned int num_srcs;
- unsigned int num_synths;
- struct midi_dest *dests;
struct midi_src *srcs;
};
More information about the wine-cvs
mailing list