- Moved the identical code between the MUS and MIDI streamers into a new base

class so they all the low-level details of MIDI streaming are kept in
  one place.
- Converted the SMF MIDI playback to use the same MIDI streams as MUS
  playback.
- Moved MUS playback back into its own thread so that it can continue
  uninterrupted if the main thread is too busy to service it in a timely
  manner.
- Fixed: The MEVT_* values are not defined shifted into their spot for a
  MIDIEVENT, so I need to do it myself.
- Fixed: Pausing a MUS and the changing snd_midivolume caused the paused
  notes to become audible.


SVN r784 (trunk)
This commit is contained in:
Randy Heit 2008-03-05 03:10:31 +00:00
commit 68a8ea2189
11 changed files with 1673 additions and 1238 deletions

View file

@ -62,7 +62,6 @@
#include "templates.h"
#include "gameconfigfile.h"
#include "v_font.h"
#include "i_musicinterns.h"
#include "stats.h"
@ -86,7 +85,6 @@ UINT TimerPeriod;
UINT TimerEventID;
UINT MillisecondsPerTic;
HANDLE NewTicArrived;
HANDLE MusicEvent;
uint32 LanguageIDs[4];
void CalculateCPUSpeed ();
@ -175,15 +173,7 @@ int I_WaitForTicEvent (int prevtic)
{
while (prevtic >= tics)
{
HANDLE handles[2] = { NewTicArrived, MusicEvent };
switch(WaitForMultipleObjects(1 + (MusicEvent != NULL), handles, FALSE, 1000/TICRATE))
{
case WAIT_OBJECT_0 + 1:
if (currSong != NULL)
{
currSong->ServiceEvent();
}
}
WaitForSingleObject(NewTicArrived, 1000/TICRATE);
}
return tics;
@ -445,11 +435,6 @@ void I_Init (void)
I_WaitForTic = I_WaitForTicPolled;
}
if ((MusicEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL)
{
Printf ("Creation of music event failed.");
}
atterm (I_ShutdownSound);
I_InitSound ();
}
@ -515,8 +500,6 @@ void I_Quit (void)
timeKillEvent (TimerEventID);
if (NewTicArrived)
CloseHandle (NewTicArrived);
if (MusicEvent)
CloseHandle (MusicEvent);
timeEndPeriod (TimerPeriod);