File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,12 +13,13 @@ ASSERTNAME
1313
1414#define AssertDoMix (x ) AssertDo(x >= 0 , Mix_GetError());
1515
16- typedef int SDLChannelId;
17-
1816// Maximum number of SDL channels that will be allocated
1917const SDLChannelId kSDLChannelIdMac = 32 ;
2018const SDLChannelId kSDLChannelIdInvalid = -1 ;
2119
20+ // Channel ID reserved for MIDI playback
21+ const SDLChannelId kSDLChannelIdMidi = 0 ;
22+
2223// Number of milliseconds after playing a new sound that pause will be ignored.
2324// This is a hack to work around a difference in behaviour in AudioMan.
2425// When AudioMan plays a sound it will mix and write a chunk of the sound to the
@@ -425,6 +426,9 @@ PSNQUE SDLSoundDevice::_PsnqueNew(void)
425426 bool rgfAllocated[kSDLChannelIdMac ];
426427 ClearPb (rgfAllocated, SIZEOF (rgfAllocated));
427428
429+ // Reserve channel for MIDI playback
430+ rgfAllocated[kSDLChannelIdMidi ] = fTrue ;
431+
428432 for (int32_t iqueue = 0 ; iqueue < _pglsnqd->IvMac (); iqueue++)
429433 {
430434 SNQD snqd;
@@ -438,6 +442,7 @@ PSNQUE SDLSoundDevice::_PsnqueNew(void)
438442
439443 if (ichannel >= 0 && ichannel < CvFromRgv (rgfAllocated))
440444 {
445+ Assert (!rgfAllocated[ichannel], " Mixer channel used by multiple sound queues" );
441446 rgfAllocated[ichannel] = fTrue ;
442447 }
443448 else
Original file line number Diff line number Diff line change 1313// Custom SDL message used for notifications
1414#define SDL_USEREVENT_SOUND_FINISHED (SDL_USEREVENT + 1 )
1515
16+ typedef int SDLChannelId;
17+
18+ // Channel ID reserved for MIDI playback
19+ extern const SDLChannelId kSDLChannelIdMidi ;
20+
1621typedef class SDLSoundDevice *PSDLSoundDevice;
1722
1823#define SDLSoundDevice_PAR SNDMQ
You can’t perform that action at this time.
0 commit comments