mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 19:20:46 +00:00
Fix MIDI playback on Windows, broken in r5817.
The main fix here is GET_NEXT_EVENT. git-svn-id: https://svn.eduke32.com/eduke32@5855 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
07cbae15c9
commit
750ceb932c
2 changed files with 8 additions and 7 deletions
|
@ -70,9 +70,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#define MIDI_MONO_MODE_ON 0x7E
|
#define MIDI_MONO_MODE_ON 0x7E
|
||||||
#define MIDI_SYSTEM_RESET 0xFF
|
#define MIDI_SYSTEM_RESET 0xFF
|
||||||
|
|
||||||
#define GET_NEXT_EVENT( track, data ) \
|
#define GET_NEXT_EVENT( track, data ) do { \
|
||||||
( data ) = *( track )->pos; \
|
( data ) = *( track )->pos; \
|
||||||
( track )->pos += 1
|
( track )->pos += 1; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define GET_MIDI_CHANNEL( event ) ( ( event ) & 0xf )
|
#define GET_MIDI_CHANNEL( event ) ( ( event ) & 0xf )
|
||||||
#define GET_MIDI_COMMAND( event ) ( ( event ) >> 4 )
|
#define GET_MIDI_COMMAND( event ) ( ( event ) >> 4 )
|
||||||
|
|
|
@ -218,11 +218,11 @@ static void _MIDI_MetaEvent(track *Track)
|
||||||
_MIDI_BeatsPerMeasure = (int32_t)*Track->pos;
|
_MIDI_BeatsPerMeasure = (int32_t)*Track->pos;
|
||||||
int32_t denominator = (int32_t) * (Track->pos + 1);
|
int32_t denominator = (int32_t) * (Track->pos + 1);
|
||||||
|
|
||||||
do
|
while (denominator > 0)
|
||||||
{
|
{
|
||||||
_MIDI_TimeBase += _MIDI_TimeBase;
|
_MIDI_TimeBase += _MIDI_TimeBase;
|
||||||
denominator--;
|
denominator--;
|
||||||
} while (denominator > 0);
|
}
|
||||||
|
|
||||||
_MIDI_TicksPerBeat = tabledivide32_noinline(_MIDI_Division * 4, _MIDI_TimeBase);
|
_MIDI_TicksPerBeat = tabledivide32_noinline(_MIDI_Division * 4, _MIDI_TimeBase);
|
||||||
break;
|
break;
|
||||||
|
@ -397,6 +397,8 @@ static void _MIDI_ServiceRoutine(void)
|
||||||
track *Track = _MIDI_TrackPtr;
|
track *Track = _MIDI_TrackPtr;
|
||||||
int32_t tracknum = 0;
|
int32_t tracknum = 0;
|
||||||
int32_t TimeSet = FALSE;
|
int32_t TimeSet = FALSE;
|
||||||
|
int32_t c1 = 0;
|
||||||
|
int32_t c2 = 0;
|
||||||
|
|
||||||
while (tracknum < _MIDI_NumTracks)
|
while (tracknum < _MIDI_NumTracks)
|
||||||
{
|
{
|
||||||
|
@ -429,8 +431,6 @@ static void _MIDI_ServiceRoutine(void)
|
||||||
|
|
||||||
int const channel = GET_MIDI_CHANNEL(event);
|
int const channel = GET_MIDI_CHANNEL(event);
|
||||||
int const command = GET_MIDI_COMMAND(event);
|
int const command = GET_MIDI_COMMAND(event);
|
||||||
int32_t c1 = 0;
|
|
||||||
int32_t c2 = 0;
|
|
||||||
|
|
||||||
if (_MIDI_CommandLengths[ command ] > 0)
|
if (_MIDI_CommandLengths[ command ] > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue