Only use sound and music in main process
This commit is contained in:
parent
885aec8020
commit
f37a5ee5d3
@ -38,6 +38,7 @@
|
||||
#include "audio/sfx_openal.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "utils/stk_process.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
MusicManager* music_manager= NULL;
|
||||
@ -180,6 +181,9 @@ void MusicManager::startMusic()
|
||||
*/
|
||||
void MusicManager::startMusic(MusicInformation* mi, bool start_right_now)
|
||||
{
|
||||
if (STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
// If this music is already playing, ignore this call.
|
||||
if (m_current_music != NULL &&
|
||||
m_current_music == mi &&
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "io/file_manager.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "utils/stk_process.hpp"
|
||||
#include "utils/profiler.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/vs.hpp"
|
||||
@ -185,7 +186,7 @@ SFXManager::~SFXManager()
|
||||
void SFXManager::queue(SFXCommands command, SFXBase *sfx)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
if (!UserConfigParams::m_enable_sound)
|
||||
if (!UserConfigParams::m_enable_sound || STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
SFXCommand *sfx_command = new SFXCommand(command, sfx);
|
||||
@ -204,7 +205,7 @@ void SFXManager::queue(SFXCommands command, SFXBase *sfx)
|
||||
void SFXManager::queue(SFXCommands command, SFXBase *sfx, float f)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
if (!UserConfigParams::m_enable_sound)
|
||||
if (!UserConfigParams::m_enable_sound || STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
SFXCommand *sfx_command = new SFXCommand(command, sfx, f);
|
||||
@ -223,7 +224,7 @@ void SFXManager::queue(SFXCommands command, SFXBase *sfx, float f)
|
||||
void SFXManager::queue(SFXCommands command, SFXBase *sfx, const Vec3 &p)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
if (!UserConfigParams::m_enable_sound)
|
||||
if (!UserConfigParams::m_enable_sound || STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
SFXCommand *sfx_command = new SFXCommand(command, sfx, p);
|
||||
@ -236,7 +237,7 @@ void SFXManager::queue(SFXCommands command, SFXBase *sfx, const Vec3 &p)
|
||||
void SFXManager::queue(SFXCommands command, SFXBase *sfx, const Vec3 &p, SFXBuffer* buffer)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
if (!UserConfigParams::m_enable_sound)
|
||||
if (!UserConfigParams::m_enable_sound || STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
SFXCommand *sfx_command = new SFXCommand(command, sfx, p);
|
||||
@ -258,7 +259,7 @@ void SFXManager::queue(SFXCommands command, SFXBase *sfx, float f,
|
||||
const Vec3 &p)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
if (!UserConfigParams::m_enable_sound)
|
||||
if (!UserConfigParams::m_enable_sound || STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
SFXCommand *sfx_command = new SFXCommand(command, sfx, f, p);
|
||||
@ -273,7 +274,7 @@ void SFXManager::queue(SFXCommands command, SFXBase *sfx, float f,
|
||||
void SFXManager::queue(SFXCommands command, MusicInformation *mi)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
if (!UserConfigParams::m_enable_sound)
|
||||
if (!UserConfigParams::m_enable_sound || STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
SFXCommand *sfx_command = new SFXCommand(command, mi);
|
||||
@ -289,7 +290,7 @@ void SFXManager::queue(SFXCommands command, MusicInformation *mi)
|
||||
void SFXManager::queue(SFXCommands command, MusicInformation *mi, float f)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
if (!UserConfigParams::m_enable_sound)
|
||||
if (!UserConfigParams::m_enable_sound || STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
SFXCommand *sfx_command = new SFXCommand(command, mi, f);
|
||||
@ -305,7 +306,7 @@ void SFXManager::queue(SFXCommands command, MusicInformation *mi, float f)
|
||||
void SFXManager::queueCommand(SFXCommand *command)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
if (!UserConfigParams::m_enable_sound)
|
||||
if (!UserConfigParams::m_enable_sound || STKProcess::getType() != PT_MAIN)
|
||||
return;
|
||||
|
||||
m_sfx_commands.lock();
|
||||
@ -541,6 +542,8 @@ void SFXManager::toggleSound(const bool on)
|
||||
*/
|
||||
bool SFXManager::sfxAllowed()
|
||||
{
|
||||
if (STKProcess::getType() != PT_MAIN)
|
||||
return false;
|
||||
if(!UserConfigParams::m_sfx || !m_initialized)
|
||||
return false;
|
||||
else
|
||||
@ -705,7 +708,7 @@ SFXBase* SFXManager::createSoundSource(SFXBuffer* buffer,
|
||||
SFXBase* sfx = NULL;
|
||||
|
||||
#ifdef ENABLE_SOUND
|
||||
if (UserConfigParams::m_enable_sound)
|
||||
if (UserConfigParams::m_enable_sound && STKProcess::getType() == PT_MAIN)
|
||||
{
|
||||
//assert( alIsBuffer(buffer->getBufferID()) ); crashes on server
|
||||
sfx = new SFXOpenAL(buffer, positional, buffer->getGain(), owns_buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user