Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Thu, Apr 21, 2022 at 07:52:17AM +0100, Huw Davies wrote:
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/wineoss.drv/midi.c | 128 ------------------------------------- dlls/wineoss.drv/ossmidi.c | 83 ++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 128 deletions(-)
diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index 1751af2349e..aa672e211b9 100644 --- a/dlls/wineoss.drv/midi.c +++ b/dlls/wineoss.drv/midi.c @@ -173,16 +173,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, wDevID, wMsg, dwParam1, dwParam2);
switch (wMsg) {
- case MOM_DONE:
- case MOM_POSITIONCB:
- if (wDevID > MODM_NumDevs) return;
- dwCallBack = MidiOutDev[wDevID].midiDesc.dwCallback;
- uFlags = MidiOutDev[wDevID].wFlags;
- hDev = MidiOutDev[wDevID].midiDesc.hMidi;
- dwInstance = MidiOutDev[wDevID].midiDesc.dwInstance;
- break;
- case MIM_OPEN: case MIM_CLOSE: case MIM_DATA:
@@ -233,40 +223,6 @@ static int midiCloseSeq(int fd) return 0; }
-/* FIXME: this is a bad idea, it's even not static... */ -SEQ_DEFINEBUF(1024);
-/* FIXME: this is not reentrant, not static - because of global variable
- _seqbuf and al.
- */
-/**************************************************************************
seqbuf_dump [internal]
- Used by SEQ_DUMPBUF to flush the buffer.
- */
-void seqbuf_dump(void) -{
- int fd;
- /* The device is already open, but there's no way to pass the
fd to this function. Rather than rely on a global variable
we pretend to open the seq again. */
- fd = midiOpenSeq();
- if (_seqbufptr) {
- if (write(fd, _seqbuf, _seqbufptr) == -1) {
WARN("Can't write data to sequencer %d, errno %d (%s)!\n",
fd, errno, strerror(errno));
- }
- /* FIXME:
* in any case buffer is lost so that if many errors occur the buffer
* will not overrun
*/
- _seqbufptr = 0;
- }
- midiCloseSeq(fd);
-}
/**************************************************************************
midReceiveChar [internal]
*/ @@ -707,88 +663,6 @@ static DWORD modGetDevCaps(WORD wDevID, LPMIDIOUTCAPSW lpCaps, DWORD dwSize) return MMSYSERR_NOERROR; }
-/**************************************************************************
modLongData [internal]
- */
-static DWORD modLongData(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) -{
- int count;
- LPBYTE lpData;
- TRACE("(%04X, %p, %08X);\n", wDevID, lpMidiHdr, dwSize);
- /* Note: MS doc does not say much about the dwBytesRecorded member of the MIDIHDR structure
* but it seems to be used only for midi input.
* Taking a look at the WAVEHDR structure (which is quite similar) confirms this assumption.
*/
- if (wDevID >= MODM_NumDevs) return MMSYSERR_BADDEVICEID;
- if (!MidiOutDev[wDevID].bEnabled) return MIDIERR_NODEVICE;
- if (MidiOutDev[wDevID].fd == -1) {
- WARN("can't play !\n");
- return MIDIERR_NODEVICE;
- }
- lpData = (LPBYTE) lpMidiHdr->lpData;
- if (lpData == NULL)
- return MIDIERR_UNPREPARED;
- if (!(lpMidiHdr->dwFlags & MHDR_PREPARED))
- return MIDIERR_UNPREPARED;
- if (lpMidiHdr->dwFlags & MHDR_INQUEUE)
- return MIDIERR_STILLPLAYING;
- lpMidiHdr->dwFlags &= ~MHDR_DONE;
- lpMidiHdr->dwFlags |= MHDR_INQUEUE;
- /* FIXME: MS doc is not 100% clear. Will lpData only contain system exclusive
* data, or can it also contain raw MIDI data, to be split up and sent to
* modShortData() ?
* If the latter is true, then the following WARNing will fire up
*/
- if (lpData[0] != 0xF0 || lpData[lpMidiHdr->dwBufferLength - 1] != 0xF7) {
- WARN("The allegedly system exclusive buffer is not correct\n\tPlease report with MIDI file\n");
- }
- TRACE("dwBufferLength=%u !\n", lpMidiHdr->dwBufferLength);
- TRACE(" %02X %02X %02X ... %02X %02X %02X\n",
lpData[0], lpData[1], lpData[2], lpData[lpMidiHdr->dwBufferLength-3],
lpData[lpMidiHdr->dwBufferLength-2], lpData[lpMidiHdr->dwBufferLength-1]);
- switch (MidiOutDev[wDevID].caps.wTechnology) {
- case MOD_FMSYNTH:
- /* FIXME: I don't think there is much to do here */
- break;
- case MOD_MIDIPORT:
- if (lpData[0] != 0xF0) {
/* Send end of System Exclusive */
SEQ_MIDIOUT(wDevID - MODM_NumFMSynthDevs, 0xF0);
WARN("Adding missing 0xF0 marker at the beginning of "
"system exclusive byte stream\n");
- }
- for (count = 0; count < lpMidiHdr->dwBufferLength; count++) {
SEQ_MIDIOUT(wDevID - MODM_NumFMSynthDevs, lpData[count]);
- }
- if (lpData[count - 1] != 0xF7) {
/* Send end of System Exclusive */
SEQ_MIDIOUT(wDevID - MODM_NumFMSynthDevs, 0xF7);
WARN("Adding missing 0xF7 marker at the end of "
"system exclusive byte stream\n");
- }
- SEQ_DUMPBUF();
- break;
- default:
- WARN("Technology not supported (yet) %d !\n",
MidiOutDev[wDevID].caps.wTechnology);
- return MMSYSERR_NOTENABLED;
- }
- lpMidiHdr->dwFlags &= ~MHDR_INQUEUE;
- lpMidiHdr->dwFlags |= MHDR_DONE;
- MIDI_NotifyClient(wDevID, MOM_DONE, (DWORD_PTR)lpMidiHdr, 0L);
- return MMSYSERR_NOERROR;
-}
/**************************************************************************
modPrepare [internal]
*/ @@ -929,8 +803,6 @@ DWORD WINAPI OSS_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, return OSS_MidiInit(); case DRVM_EXIT: return OSS_MidiExit();
- case MODM_LONGDATA:
- return modLongData(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MODM_PREPARE: return modPrepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MODM_UNPREPARE:
diff --git a/dlls/wineoss.drv/ossmidi.c b/dlls/wineoss.drv/ossmidi.c index ee83da8bfcd..7ab78bcbfdd 100644 --- a/dlls/wineoss.drv/ossmidi.c +++ b/dlls/wineoss.drv/ossmidi.c @@ -934,6 +934,86 @@ static UINT midi_out_data(WORD dev_id, UINT data) return MMSYSERR_NOTENABLED; }
+static UINT midi_out_long_data(WORD dev_id, MIDIHDR *hdr, UINT hdr_size, struct notify_context *notify) +{
- struct midi_dest *dest;
- BYTE *data;
- unsigned int count;
- TRACE("(%04X, %p, %08X);\n", dev_id, hdr, hdr_size);
- /* Note: MS doc does not say much about the dwBytesRecorded member of the MIDIHDR structure
* but it seems to be used only for midi input.
* Taking a look at the WAVEHDR structure (which is quite similar) confirms this assumption.
*/
- if (dev_id >= num_dests) return MMSYSERR_BADDEVICEID;
- dest = dests + dev_id;
- if (!dest->bEnabled) return MIDIERR_NODEVICE;
- if (dest->fd == -1)
- {
WARN("can't play !\n");
return MIDIERR_NODEVICE;
- }
- data = (BYTE *)hdr->lpData;
- if (data == NULL)
return MIDIERR_UNPREPARED;
- if (!(hdr->dwFlags & MHDR_PREPARED))
return MIDIERR_UNPREPARED;
- if (hdr->dwFlags & MHDR_INQUEUE)
return MIDIERR_STILLPLAYING;
- hdr->dwFlags &= ~MHDR_DONE;
- hdr->dwFlags |= MHDR_INQUEUE;
- /* FIXME: MS doc is not 100% clear. Will lpData only contain system exclusive
* data, or can it also contain raw MIDI data, to be split up and sent to
* modShortData() ?
* If the latter is true, then the following WARNing will fire up
*/
- if (data[0] != 0xF0 || data[hdr->dwBufferLength - 1] != 0xF7)
WARN("The allegedly system exclusive buffer is not correct\n\tPlease report with MIDI file\n");
- TRACE("dwBufferLength=%u !\n", hdr->dwBufferLength);
- TRACE(" %02X %02X %02X ... %02X %02X %02X\n",
data[0], data[1], data[2], data[hdr->dwBufferLength - 3],
data[hdr->dwBufferLength - 2], data[hdr->dwBufferLength - 1]);
- switch (dest->caps.wTechnology)
- {
- case MOD_FMSYNTH:
/* FIXME: I don't think there is much to do here */
break;
- case MOD_MIDIPORT:
if (data[0] != 0xF0)
{
/* Send end of System Exclusive */
SEQ_MIDIOUT(dev_id - num_synths, 0xF0);
WARN("Adding missing 0xF0 marker at the beginning of system exclusive byte stream\n");
}
for (count = 0; count < hdr->dwBufferLength; count++)
SEQ_MIDIOUT(dev_id - num_synths, data[count]);
if (data[count - 1] != 0xF7)
{
/* Send end of System Exclusive */
SEQ_MIDIOUT(dev_id - num_synths, 0xF7);
WARN("Adding missing 0xF7 marker at the end of system exclusive byte stream\n");
}
SEQ_DUMPBUF();
break;
- default:
WARN("Technology not supported (yet) %d !\n", dest->caps.wTechnology);
return MMSYSERR_NOTENABLED;
- }
- hdr->dwFlags &= ~MHDR_INQUEUE;
- hdr->dwFlags |= MHDR_DONE;
- set_out_notify(notify, dest, dev_id, MOM_DONE, (UINT_PTR)hdr, 0);
- return MMSYSERR_NOERROR;
+}
NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -956,6 +1036,9 @@ NTSTATUS midi_out_message(void *args) case MODM_DATA: *params->err = midi_out_data(params->dev_id, params->param_1); break;
- case MODM_LONGDATA:
*params->err = midi_out_long_data(params->dev_id, (MIDIHDR *)params->param_1, params->param_2, params->notify);
default: TRACE("Unsupported message\n"); *params->err = MMSYSERR_NOTSUPPORTED;break;
-- 2.25.1