Unqueue raw samples when the menu is entered during cinematic playback

When the client is paused (either explicit or by entering the menu or
console) the cinematic is paused, too. Therefor no more sound samples
are generated and added to the playback queue, the existing samples are
played over and over again. Until now these samples weren't hearable,
because OpenAL marked them as processed and AL_StreamUpdate() removed
them from OpenALs playback queues. This changed in the previous commit,
now the stay in OpenALs queue and are hearable.

Fix this by calling AL_UnqueueRawSamples() when the menu or console is
entered during cinematic playback.
This commit is contained in:
Yamagi Burmeister 2017-04-22 09:50:52 +02:00
parent 12fba237c2
commit eb2a11f0b2
2 changed files with 12 additions and 1 deletions

View file

@ -25,6 +25,7 @@
*/
#include "header/client.h"
#include "sound/header/local.h"
#include <time.h>
console_t con;
@ -96,6 +97,11 @@ Con_ToggleConsole_f(void)
Key_ClearTyping();
Con_ClearNotify();
if (cl.cinematic_file)
{
AL_UnqueueRawSamples();
}
if (cls.key_dest == key_console)
{
M_ForceMenuOff();

View file

@ -31,7 +31,7 @@
#include <ctype.h>
#include "../header/client.h"
#include "../header/keyboard.h"
#include "../sound/header/local.h"
#include "header/qmenu.h"
static int m_main_cursor;
@ -151,6 +151,11 @@ M_PushMenu(void (*draw)(void), const char *(*key)(int))
Cvar_Set("paused", "1");
}
if (cl.cinematic_file)
{
AL_UnqueueRawSamples();
}
/* if this menu is already open (and on top),
close it => toggling behaviour */
if ((m_drawfunc == draw) && (m_keyfunc == key))