winecoreaudio: Move midi_out_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
5df38b4708
commit
b74a8ab202
|
@ -92,6 +92,19 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(midi);
|
WINE_DEFAULT_DEBUG_CHANNEL(midi);
|
||||||
|
|
||||||
|
struct midi_dest
|
||||||
|
{
|
||||||
|
/* graph and synth are only used for MIDI Synth */
|
||||||
|
AUGraph graph;
|
||||||
|
AudioUnit synth;
|
||||||
|
|
||||||
|
MIDIEndpointRef dest;
|
||||||
|
|
||||||
|
MIDIOUTCAPSW caps;
|
||||||
|
MIDIOPENDESC midiDesc;
|
||||||
|
WORD wFlags;
|
||||||
|
};
|
||||||
|
|
||||||
static MIDIClientRef midi_client;
|
static MIDIClientRef midi_client;
|
||||||
static MIDIPortRef midi_out_port, midi_in_port;
|
static MIDIPortRef midi_out_port, midi_in_port;
|
||||||
static UINT num_dests, num_srcs;
|
static UINT num_dests, num_srcs;
|
||||||
|
@ -234,11 +247,8 @@ NTSTATUS midi_init(void *args)
|
||||||
dests[i].caps.wNotes = 0;
|
dests[i].caps.wNotes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
params->num_dests = num_dests;
|
|
||||||
params->num_srcs = num_srcs;
|
params->num_srcs = num_srcs;
|
||||||
params->dests = dests;
|
|
||||||
params->srcs = srcs;
|
params->srcs = srcs;
|
||||||
params->midi_out_port = (void *)midi_out_port;
|
|
||||||
params->midi_in_port = (void *)midi_in_port;
|
params->midi_in_port = (void *)midi_in_port;
|
||||||
|
|
||||||
*params->err = DRV_SUCCESS;
|
*params->err = DRV_SUCCESS;
|
||||||
|
@ -674,6 +684,33 @@ static DWORD midi_out_set_volume(WORD dev_id, DWORD volume)
|
||||||
return MMSYSERR_NOTSUPPORTED;
|
return MMSYSERR_NOTSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD midi_out_reset(WORD dev_id)
|
||||||
|
{
|
||||||
|
unsigned chn;
|
||||||
|
|
||||||
|
TRACE("%d\n", dev_id);
|
||||||
|
|
||||||
|
if (dev_id >= num_dests)
|
||||||
|
{
|
||||||
|
WARN("bad device ID : %d\n", dev_id);
|
||||||
|
return MMSYSERR_BADDEVICEID;
|
||||||
|
}
|
||||||
|
if (dests[dev_id].caps.wTechnology == MOD_SYNTH)
|
||||||
|
{
|
||||||
|
for (chn = 0; chn < 16; chn++)
|
||||||
|
{
|
||||||
|
/* turn off every note */
|
||||||
|
MusicDeviceMIDIEvent(dests[dev_id].synth, 0xB0 | chn, 0x7B, 0, 0);
|
||||||
|
/* remove sustain on channel */
|
||||||
|
MusicDeviceMIDIEvent(dests[dev_id].synth, 0xB0 | chn, 0x40, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else FIXME("MOD_MIDIPORT\n");
|
||||||
|
|
||||||
|
/* FIXME: the LongData buffers must also be returned to the app */
|
||||||
|
return MMSYSERR_NOERROR;
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS midi_out_message(void *args)
|
NTSTATUS midi_out_message(void *args)
|
||||||
{
|
{
|
||||||
struct midi_out_message_params *params = args;
|
struct midi_out_message_params *params = args;
|
||||||
|
@ -718,6 +755,9 @@ NTSTATUS midi_out_message(void *args)
|
||||||
case MODM_SETVOLUME:
|
case MODM_SETVOLUME:
|
||||||
*params->err = midi_out_set_volume(params->dev_id, params->param_1);
|
*params->err = midi_out_set_volume(params->dev_id, params->param_1);
|
||||||
break;
|
break;
|
||||||
|
case MODM_RESET:
|
||||||
|
*params->err = midi_out_reset(params->dev_id);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
TRACE("Unsupported message\n");
|
TRACE("Unsupported message\n");
|
||||||
*params->err = MMSYSERR_NOTSUPPORTED;
|
*params->err = MMSYSERR_NOTSUPPORTED;
|
||||||
|
|
|
@ -64,19 +64,6 @@ extern OSStatus MusicDeviceSysEx(AudioUnit au, const UInt8 *inData, UInt32 inLen
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* midi.c */
|
/* midi.c */
|
||||||
typedef struct midi_dest
|
|
||||||
{
|
|
||||||
/* graph and synth are only used for MIDI Synth */
|
|
||||||
AUGraph graph;
|
|
||||||
AudioUnit synth;
|
|
||||||
|
|
||||||
MIDIEndpointRef dest;
|
|
||||||
|
|
||||||
MIDIOUTCAPSW caps;
|
|
||||||
MIDIOPENDESC midiDesc;
|
|
||||||
WORD wFlags;
|
|
||||||
} MIDIDestination;
|
|
||||||
|
|
||||||
typedef struct midi_src
|
typedef struct midi_src
|
||||||
{
|
{
|
||||||
MIDIEndpointRef source;
|
MIDIEndpointRef source;
|
||||||
|
|
|
@ -50,7 +50,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(midi);
|
||||||
#define WINE_DEFINITIONS
|
#define WINE_DEFINITIONS
|
||||||
#include "coremidi.h"
|
#include "coremidi.h"
|
||||||
|
|
||||||
static DWORD MIDIOut_NumDevs = 0;
|
|
||||||
static DWORD MIDIIn_NumDevs = 0;
|
static DWORD MIDIIn_NumDevs = 0;
|
||||||
|
|
||||||
static CRITICAL_SECTION midiInLock; /* Critical section for MIDI In */
|
static CRITICAL_SECTION midiInLock; /* Critical section for MIDI In */
|
||||||
|
@ -59,9 +58,7 @@ static CFStringRef MIDIInThreadPortName;
|
||||||
static DWORD WINAPI MIDIIn_MessageThread(LPVOID p);
|
static DWORD WINAPI MIDIIn_MessageThread(LPVOID p);
|
||||||
|
|
||||||
static MIDIPortRef MIDIInPort = NULL;
|
static MIDIPortRef MIDIInPort = NULL;
|
||||||
static MIDIPortRef MIDIOutPort = NULL;
|
|
||||||
|
|
||||||
MIDIDestination *destinations;
|
|
||||||
MIDISource *sources;
|
MIDISource *sources;
|
||||||
|
|
||||||
static void notify_client(struct notify_context *notify)
|
static void notify_client(struct notify_context *notify)
|
||||||
|
@ -86,11 +83,8 @@ static LONG CoreAudio_MIDIInit(void)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIDIOut_NumDevs = params.num_dests;
|
|
||||||
MIDIIn_NumDevs = params.num_srcs;
|
MIDIIn_NumDevs = params.num_srcs;
|
||||||
destinations = params.dests;
|
|
||||||
sources = params.srcs;
|
sources = params.srcs;
|
||||||
MIDIOutPort = params.midi_out_port;
|
|
||||||
MIDIInPort = params.midi_in_port;
|
MIDIInPort = params.midi_in_port;
|
||||||
|
|
||||||
if (MIDIIn_NumDevs > 0)
|
if (MIDIIn_NumDevs > 0)
|
||||||
|
@ -110,7 +104,6 @@ static LONG CoreAudio_MIDIRelease(void)
|
||||||
|
|
||||||
UNIX_CALL(midi_release, NULL);
|
UNIX_CALL(midi_release, NULL);
|
||||||
sources = NULL;
|
sources = NULL;
|
||||||
destinations = NULL;
|
|
||||||
|
|
||||||
if (MIDIIn_NumDevs > 0)
|
if (MIDIIn_NumDevs > 0)
|
||||||
{
|
{
|
||||||
|
@ -155,31 +148,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_
|
||||||
DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2);
|
DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD MIDIOut_Reset(WORD wDevID)
|
|
||||||
{
|
|
||||||
unsigned chn;
|
|
||||||
|
|
||||||
TRACE("%d\n", wDevID);
|
|
||||||
|
|
||||||
if (wDevID >= MIDIOut_NumDevs) {
|
|
||||||
WARN("bad device ID : %d\n", wDevID);
|
|
||||||
return MMSYSERR_BADDEVICEID;
|
|
||||||
}
|
|
||||||
if (destinations[wDevID].caps.wTechnology == MOD_SYNTH)
|
|
||||||
{
|
|
||||||
for (chn = 0; chn < 16; chn++) {
|
|
||||||
/* turn off every note */
|
|
||||||
MusicDeviceMIDIEvent(destinations[wDevID].synth, 0xB0 | chn, 0x7B, 0, 0);
|
|
||||||
/* remove sustain on channel */
|
|
||||||
MusicDeviceMIDIEvent(destinations[wDevID].synth, 0xB0 | chn, 0x40, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else FIXME("MOD_MIDIPORT\n");
|
|
||||||
|
|
||||||
/* FIXME: the LongData buffers must also be returned to the app */
|
|
||||||
return MMSYSERR_NOERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DWORD MIDIIn_Open(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
|
static DWORD MIDIIn_Open(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
TRACE("wDevID=%d lpDesc=%p dwFlags=%08x\n", wDevID, lpDesc, dwFlags);
|
TRACE("wDevID=%d lpDesc=%p dwFlags=%08x\n", wDevID, lpDesc, dwFlags);
|
||||||
|
@ -532,11 +500,6 @@ DWORD WINAPI CoreAudio_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR
|
||||||
|
|
||||||
TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2);
|
TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2);
|
||||||
|
|
||||||
switch (wMsg) {
|
|
||||||
case MODM_RESET:
|
|
||||||
return MIDIOut_Reset(wDevID);
|
|
||||||
}
|
|
||||||
|
|
||||||
params.dev_id = wDevID;
|
params.dev_id = wDevID;
|
||||||
params.msg = wMsg;
|
params.msg = wMsg;
|
||||||
params.user = dwUser;
|
params.user = dwUser;
|
||||||
|
|
|
@ -186,9 +186,9 @@ struct set_volumes_params
|
||||||
struct midi_init_params
|
struct midi_init_params
|
||||||
{
|
{
|
||||||
DWORD *err;
|
DWORD *err;
|
||||||
UINT num_dests, num_srcs;
|
UINT num_srcs;
|
||||||
void *dests, *srcs;
|
void *srcs;
|
||||||
void *midi_out_port, *midi_in_port;
|
void *midi_in_port;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct notify_context
|
struct notify_context
|
||||||
|
|
Loading…
Reference in New Issue