From 14b2851e72f610ae81dd296598867e6fb0babd2a Mon Sep 17 00:00:00 2001 From: Michael Papageorgiou Date: Sat, 25 Feb 2012 19:09:45 +0200 Subject: [PATCH] Fix for cell change OpenAL music streaming issue --- sound/outputs/openal_out.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/outputs/openal_out.cpp b/sound/outputs/openal_out.cpp index bce08d02f..f1cf39838 100644 --- a/sound/outputs/openal_out.cpp +++ b/sound/outputs/openal_out.cpp @@ -30,8 +30,11 @@ static char tmp_buffer[BSIZE]; // Number of buffers used (per sound) for streaming sounds. Each // buffer is of size BSIZE. Increasing this will make streaming sounds // more fault tolerant against temporary lapses in call to update(), -// but will also increase memory usage. 4 should be ok. -const int STREAM_BUF_NUM = 4; +// but will also increase memory usage. +// This was changed from 4 to 150 for an estimated 30 seconds tolerance. +// At some point we should replace it with a more multithreading-ish +// solution. +const int STREAM_BUF_NUM = 150; static void fail(const std::string &msg) { throw std::runtime_error("OpenAL exception: " + msg); } @@ -101,7 +104,7 @@ class Mangle::Sound::OpenAL_Sound : public Sound ALuint inst; // Buffers. Only the first is used for non-streaming sounds. - ALuint bufferID[4]; + ALuint bufferID[STREAM_BUF_NUM]; // Number of buffers used int bufNum;