mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 04:00:56 +00:00
winealsa: Move MODM_RESET to the unixlib.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d76fccfe7f
commit
bf39545315
|
@ -48,6 +48,17 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(midi);
|
||||
|
||||
struct midi_dest
|
||||
{
|
||||
BOOL bEnabled;
|
||||
MIDIOPENDESC midiDesc;
|
||||
WORD wFlags;
|
||||
MIDIOUTCAPSW caps;
|
||||
snd_seq_t *seq;
|
||||
snd_seq_addr_t addr;
|
||||
int port_out;
|
||||
};
|
||||
|
||||
static pthread_mutex_t seq_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static unsigned int num_dests, num_srcs;
|
||||
|
@ -353,9 +364,7 @@ NTSTATUS midi_init(void *args)
|
|||
free( pinfo );
|
||||
|
||||
*params->err = NOERROR;
|
||||
params->num_dests = num_dests;
|
||||
params->num_srcs = num_srcs;
|
||||
params->dests = dests;
|
||||
params->srcs = srcs;
|
||||
|
||||
TRACE("End\n");
|
||||
|
@ -800,6 +809,31 @@ 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)
|
||||
{
|
||||
unsigned chn;
|
||||
|
||||
TRACE("(%04X);\n", dev_id);
|
||||
|
||||
if (dev_id >= num_dests) return MMSYSERR_BADDEVICEID;
|
||||
if (!dests[dev_id].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_CMD_CONTROL | chn);
|
||||
/* remove sustain on all channels */
|
||||
midi_out_data(dev_id, (MIDI_CTL_SUSTAIN << 8) | MIDI_CMD_CONTROL | 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;
|
||||
|
@ -844,6 +878,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;
|
||||
|
|
|
@ -48,10 +48,7 @@
|
|||
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 total number of MIDI out devices found */
|
||||
static int MIDM_NumDevs = 0;
|
||||
|
||||
|
@ -605,35 +602,6 @@ static DWORD midStop(WORD wDevID)
|
|||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* modReset [internal]
|
||||
*/
|
||||
static DWORD modReset(WORD wDevID)
|
||||
{
|
||||
DWORD WINAPI ALSA_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
|
||||
DWORD_PTR dwParam1, DWORD_PTR dwParam2);
|
||||
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 */
|
||||
ALSA_modMessage(wDevID, MODM_DATA, 0, 0x7800 | MIDI_CMD_CONTROL | chn, 0);
|
||||
/* remove sustain on all channels */
|
||||
ALSA_modMessage(wDevID, MODM_DATA, 0, (MIDI_CTL_SUSTAIN << 8) | MIDI_CMD_CONTROL | chn, 0);
|
||||
}
|
||||
/* FIXME: the LongData buffers must also be returned to the app */
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
/*======================================================================*
|
||||
* MIDI entry points *
|
||||
*======================================================================*/
|
||||
|
@ -653,9 +621,7 @@ static BOOL ALSA_MidiInit(void)
|
|||
|
||||
if (!err)
|
||||
{
|
||||
MODM_NumDevs = params.num_dests;
|
||||
MIDM_NumDevs = params.num_srcs;
|
||||
MidiOutDev = params.dests;
|
||||
MidiInDev = params.srcs;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -721,8 +687,6 @@ DWORD WINAPI ALSA_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
|
|||
case DRVM_INIT:
|
||||
ALSA_MidiInit();
|
||||
return 0;
|
||||
case MODM_RESET:
|
||||
return modReset(wDevID);
|
||||
}
|
||||
|
||||
params.dev_id = wDevID;
|
||||
|
|
|
@ -223,22 +223,11 @@ typedef struct midi_src
|
|||
int port_in;
|
||||
} WINE_MIDIIN;
|
||||
|
||||
typedef struct midi_dest
|
||||
{
|
||||
BOOL bEnabled;
|
||||
MIDIOPENDESC midiDesc;
|
||||
WORD wFlags;
|
||||
MIDIOUTCAPSW caps;
|
||||
snd_seq_t *seq;
|
||||
snd_seq_addr_t addr;
|
||||
int port_out;
|
||||
} WINE_MIDIOUT;
|
||||
|
||||
struct midi_init_params
|
||||
{
|
||||
UINT *err;
|
||||
unsigned int num_dests, num_srcs;
|
||||
void *dests, *srcs;
|
||||
unsigned int num_srcs;
|
||||
void *srcs;
|
||||
};
|
||||
|
||||
struct notify_context
|
||||
|
|
Loading…
Reference in a new issue