mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- uncoupled OpenAL music updates from UpdateSounds.
UpdateSounds will not be called during screen wipes and the entire setup of this function suggests that this is not advisable at all. The OpenAL stream updates were done deep inside this function implicitly. This caused music to stop while a wipe was in progress. So in order to allow uninterrupted music playback during screen wipes the music updates need to be handled separately from sound updates and be called both in the main loop and the wipe loop. I think that the OpenAL music updating should be offloaded to a separate thread but at least it's working now without causing interruptions during wipes.
This commit is contained in:
parent
54c2a14145
commit
dccd35ef29
6 changed files with 42 additions and 20 deletions
|
@ -905,6 +905,7 @@ void D_Display ()
|
|||
} while (diff < 1);
|
||||
wipestart = nowtime;
|
||||
done = screen->WipeDo (1);
|
||||
S_UpdateMusic(); // OpenAL needs this to keep the music running, thanks to a complete lack of a sane streaming implementation using callbacks. :(
|
||||
C_DrawConsole (hw2d); // console and
|
||||
M_Drawer (); // menu are drawn even on top of wipes
|
||||
screen->Update (); // page flip or blit buffer
|
||||
|
@ -1003,6 +1004,7 @@ void D_DoomLoop ()
|
|||
// Update display, next frame, with current state.
|
||||
I_StartTic ();
|
||||
D_Display ();
|
||||
S_UpdateMusic(); // OpenAL needs this to keep the music running, thanks to a complete lack of a sane streaming implementation using callbacks. :(
|
||||
}
|
||||
catch (CRecoverableError &error)
|
||||
{
|
||||
|
|
|
@ -1914,29 +1914,32 @@ void S_UpdateSounds (AActor *listenactor)
|
|||
S_ActivatePlayList(false);
|
||||
}
|
||||
|
||||
// should never happen
|
||||
S_SetListener(listener, listenactor);
|
||||
|
||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||
if (listenactor != NULL)
|
||||
{
|
||||
if ((chan->ChanFlags & (CHAN_EVICTED | CHAN_IS3D)) == CHAN_IS3D)
|
||||
// should never happen
|
||||
S_SetListener(listener, listenactor);
|
||||
|
||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||
{
|
||||
CalcPosVel(chan, &pos, &vel);
|
||||
GSnd->UpdateSoundParams3D(&listener, chan, !!(chan->ChanFlags & CHAN_AREA), pos, vel);
|
||||
if ((chan->ChanFlags & (CHAN_EVICTED | CHAN_IS3D)) == CHAN_IS3D)
|
||||
{
|
||||
CalcPosVel(chan, &pos, &vel);
|
||||
GSnd->UpdateSoundParams3D(&listener, chan, !!(chan->ChanFlags & CHAN_AREA), pos, vel);
|
||||
}
|
||||
chan->ChanFlags &= ~CHAN_JUSTSTARTED;
|
||||
}
|
||||
chan->ChanFlags &= ~CHAN_JUSTSTARTED;
|
||||
}
|
||||
|
||||
SN_UpdateActiveSequences();
|
||||
SN_UpdateActiveSequences();
|
||||
|
||||
|
||||
GSnd->UpdateListener(&listener);
|
||||
GSnd->UpdateSounds();
|
||||
GSnd->UpdateListener(&listener);
|
||||
GSnd->UpdateSounds();
|
||||
|
||||
if (level.time >= RestartEvictionsAt)
|
||||
{
|
||||
RestartEvictionsAt = 0;
|
||||
S_RestoreEvictedChannels();
|
||||
if (level.time >= RestartEvictionsAt)
|
||||
{
|
||||
RestartEvictionsAt = 0;
|
||||
S_RestoreEvictedChannels();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2605,6 +2608,17 @@ void S_StopMusic (bool force)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_UpdateMusic()
|
||||
{
|
||||
GSnd->UpdateMusic();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CCMD playsound
|
||||
|
|
|
@ -329,6 +329,7 @@ int S_GetMusic (char **name);
|
|||
|
||||
// Stops the music for sure.
|
||||
void S_StopMusic (bool force);
|
||||
void S_UpdateMusic();
|
||||
|
||||
// Stop and resume music, during game PAUSE.
|
||||
void S_PauseSound (bool notmusic, bool notsfx);
|
||||
|
|
|
@ -149,6 +149,7 @@ public:
|
|||
|
||||
virtual void UpdateListener (SoundListener *) = 0;
|
||||
virtual void UpdateSounds () = 0;
|
||||
virtual void UpdateMusic() {}
|
||||
|
||||
virtual bool IsValid () = 0;
|
||||
virtual void PrintStatus () = 0;
|
||||
|
|
|
@ -1624,10 +1624,6 @@ void OpenALSoundRenderer::UpdateSounds()
|
|||
{
|
||||
alProcessUpdatesSOFT();
|
||||
|
||||
// For some reason this isn't being called?
|
||||
for(uint32 i = 0;i < Streams.Size();++i)
|
||||
Streams[i]->IsEnded();
|
||||
|
||||
if(ALC.EXT_disconnect)
|
||||
{
|
||||
ALCint connected = ALC_TRUE;
|
||||
|
@ -1644,6 +1640,13 @@ void OpenALSoundRenderer::UpdateSounds()
|
|||
PurgeStoppedSources();
|
||||
}
|
||||
|
||||
void OpenALSoundRenderer::UpdateMusic()
|
||||
{
|
||||
// For some reason this isn't being called?
|
||||
for(uint32 i = 0;i < Streams.Size();++i)
|
||||
Streams[i]->IsEnded();
|
||||
}
|
||||
|
||||
bool OpenALSoundRenderer::IsValid()
|
||||
{
|
||||
return Device != NULL;
|
||||
|
|
|
@ -111,6 +111,7 @@ public:
|
|||
|
||||
virtual void UpdateListener(SoundListener *);
|
||||
virtual void UpdateSounds();
|
||||
virtual void UpdateMusic();
|
||||
|
||||
virtual void MarkStartTime(FISoundChannel*);
|
||||
virtual float GetAudibility(FISoundChannel*);
|
||||
|
|
Loading…
Reference in a new issue