Commit b70f0d72 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

winmm: Add playing status to MIDI stream structure and use it.

parent 169d657d
...@@ -919,6 +919,7 @@ typedef struct WINE_MIDIStream { ...@@ -919,6 +919,7 @@ typedef struct WINE_MIDIStream {
DWORD dwPulses; DWORD dwPulses;
DWORD dwStartTicks; DWORD dwStartTicks;
WORD wFlags; WORD wFlags;
WORD status;
HANDLE hEvent; HANDLE hEvent;
LPMIDIHDR lpMidiHdr; LPMIDIHDR lpMidiHdr;
} WINE_MIDIStream; } WINE_MIDIStream;
...@@ -928,6 +929,10 @@ typedef struct WINE_MIDIStream { ...@@ -928,6 +929,10 @@ typedef struct WINE_MIDIStream {
#define WINE_MSM_PAUSE (WM_USER+2) #define WINE_MSM_PAUSE (WM_USER+2)
#define WINE_MSM_RESUME (WM_USER+3) #define WINE_MSM_RESUME (WM_USER+3)
#define MSM_STATUS_STOPPED WINE_MSM_STOP
#define MSM_STATUS_PAUSED WINE_MSM_PAUSE
#define MSM_STATUS_PLAYING WINE_MSM_RESUME
/************************************************************************** /**************************************************************************
* MMSYSTEM_GetMidiStream [internal] * MMSYSTEM_GetMidiStream [internal]
*/ */
...@@ -976,7 +981,6 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI ...@@ -976,7 +981,6 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
LPMIDIHDR lpMidiHdr; LPMIDIHDR lpMidiHdr;
LPMIDIHDR* lpmh; LPMIDIHDR* lpmh;
LPBYTE lpData; LPBYTE lpData;
BOOL paused = FALSE;
for (;;) { for (;;) {
switch (msg->message) { switch (msg->message) {
...@@ -984,6 +988,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI ...@@ -984,6 +988,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
return FALSE; return FALSE;
case WINE_MSM_STOP: case WINE_MSM_STOP:
TRACE("STOP\n"); TRACE("STOP\n");
lpMidiStrm->status = MSM_STATUS_STOPPED;
/* this is not quite what MS doc says... */ /* this is not quite what MS doc says... */
midiOutReset(lpMidiStrm->hDevice); midiOutReset(lpMidiStrm->hDevice);
/* empty list of already submitted buffers */ /* empty list of already submitted buffers */
...@@ -1003,10 +1008,11 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI ...@@ -1003,10 +1008,11 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
case WINE_MSM_RESUME: case WINE_MSM_RESUME:
/* FIXME: send out cc64 0 (turn off sustain pedal) on every channel */ /* FIXME: send out cc64 0 (turn off sustain pedal) on every channel */
lpMidiStrm->dwStartTicks = GetTickCount() - lpMidiStrm->dwPositionMS; lpMidiStrm->dwStartTicks = GetTickCount() - lpMidiStrm->dwPositionMS;
lpMidiStrm->status = MSM_STATUS_PLAYING;
return TRUE; return TRUE;
case WINE_MSM_PAUSE: case WINE_MSM_PAUSE:
/* FIXME: send out cc64 0 (turn off sustain pedal) on every channel */ /* FIXME: send out cc64 0 (turn off sustain pedal) on every channel */
paused = TRUE; lpMidiStrm->status = MSM_STATUS_PAUSED;
break; break;
/* FIXME(EPP): "I don't understand the content of the first MIDIHDR sent /* FIXME(EPP): "I don't understand the content of the first MIDIHDR sent
* by native mcimidi, it doesn't look like a correct one". * by native mcimidi, it doesn't look like a correct one".
...@@ -1087,7 +1093,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI ...@@ -1087,7 +1093,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
FIXME("Unknown message %d\n", msg->message); FIXME("Unknown message %d\n", msg->message);
break; break;
} }
if (!paused) if (lpMidiStrm->status != MSM_STATUS_PAUSED)
return TRUE; return TRUE;
GetMessageA(msg, 0, 0, 0); GetMessageA(msg, 0, 0, 0);
} }
...@@ -1292,6 +1298,7 @@ MMRESULT WINAPI midiStreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, ...@@ -1292,6 +1298,7 @@ MMRESULT WINAPI midiStreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
lpMidiStrm->dwTempo = 500000; /* micro seconds per quarter note, i.e. 120 BPM */ lpMidiStrm->dwTempo = 500000; /* micro seconds per quarter note, i.e. 120 BPM */
lpMidiStrm->dwTimeDiv = 24; /* ticks per quarter note */ lpMidiStrm->dwTimeDiv = 24; /* ticks per quarter note */
lpMidiStrm->dwPositionMS = 0; lpMidiStrm->dwPositionMS = 0;
lpMidiStrm->status = MSM_STATUS_PAUSED;
mosm.dwStreamID = (DWORD)lpMidiStrm; mosm.dwStreamID = (DWORD)lpMidiStrm;
/* FIXME: the correct value is not allocated yet for MAPPER */ /* FIXME: the correct value is not allocated yet for MAPPER */
...@@ -1332,8 +1339,6 @@ MMRESULT WINAPI midiStreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, ...@@ -1332,8 +1339,6 @@ MMRESULT WINAPI midiStreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
/* wait for thread to have started, and for its queue to be created */ /* wait for thread to have started, and for its queue to be created */
WaitForSingleObject(lpMidiStrm->hEvent, INFINITE); WaitForSingleObject(lpMidiStrm->hEvent, INFINITE);
PostThreadMessageA(lpMidiStrm->dwThreadID, WINE_MSM_PAUSE, 0, 0);
TRACE("=> (%u/%d) hMidi=%p ret=%d lpMidiStrm=%p\n", TRACE("=> (%u/%d) hMidi=%p ret=%d lpMidiStrm=%p\n",
*lpuDeviceID, lpwm->mld.uDeviceID, *lphMidiStrm, ret, lpMidiStrm); *lpuDeviceID, lpwm->mld.uDeviceID, *lphMidiStrm, ret, lpMidiStrm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment