- Changed MUS playback to use MIDI streams, like it did during the early days
of ZDoom, except now the entire song isn't prebuffered in large chunks, so I can insert MIDI events into the playback with fairly low latency. This should offer more precise timing than the combination of low-level MIDI and WaitForSingleObject timeouts. SVN r783 (trunk)
This commit is contained in:
parent
ef99d9c057
commit
69cebb7e57
6 changed files with 342 additions and 172 deletions
|
|
@ -95,6 +95,7 @@
|
|||
#include "gameconfigfile.h"
|
||||
#include "win32iface.h"
|
||||
#include "templates.h"
|
||||
#include "i_musicinterns.h"
|
||||
|
||||
#define DINPUT_BUFFERSIZE 32
|
||||
|
||||
|
|
@ -109,6 +110,7 @@ BOOL DI_InitJoy (void);
|
|||
|
||||
extern HINSTANCE g_hInst;
|
||||
extern DWORD SessionID;
|
||||
extern HANDLE MusicEvent;
|
||||
|
||||
extern void ShowEAXEditor ();
|
||||
extern bool SpawnEAXWindow;
|
||||
|
|
@ -1929,22 +1931,34 @@ void I_GetEvent ()
|
|||
|
||||
// Briefly enter an alertable state so that if a secondary thread
|
||||
// crashed, we will execute the APC it sent now.
|
||||
SleepEx (0, TRUE);
|
||||
|
||||
// for (;;) {
|
||||
while (PeekMessage (&mess, NULL, 0, 0, PM_REMOVE))
|
||||
if (MusicEvent != NULL)
|
||||
{
|
||||
DWORD res;
|
||||
do
|
||||
{
|
||||
if (mess.message == WM_QUIT)
|
||||
exit (mess.wParam);
|
||||
if (EAXEditWindow == 0 || !IsDialogMessage (EAXEditWindow, &mess))
|
||||
{
|
||||
TranslateMessage (&mess);
|
||||
DispatchMessage (&mess);
|
||||
}
|
||||
res = WaitForSingleObjectEx(MusicEvent, 0, TRUE);
|
||||
}
|
||||
// if (havefocus || netgame || gamestate != GS_LEVEL)
|
||||
// break;
|
||||
// }
|
||||
while (res == WAIT_IO_COMPLETION);
|
||||
if (res == WAIT_OBJECT_0 && currSong != NULL)
|
||||
{
|
||||
currSong->ServiceEvent();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SleepEx (0, TRUE);
|
||||
}
|
||||
|
||||
while (PeekMessage (&mess, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (mess.message == WM_QUIT)
|
||||
exit (mess.wParam);
|
||||
if (EAXEditWindow == 0 || !IsDialogMessage (EAXEditWindow, &mess))
|
||||
{
|
||||
TranslateMessage (&mess);
|
||||
DispatchMessage (&mess);
|
||||
}
|
||||
}
|
||||
|
||||
KeyRead ();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue