Fix missing initialization of some sound buffer

This commit is contained in:
Benau 2021-05-15 00:03:06 +08:00
parent 8e885d15ac
commit be7b46f7d9
4 changed files with 6 additions and 3 deletions

View File

@ -66,7 +66,7 @@ public:
virtual SFXStatus getStatus() OVERRIDE { return SFX_STOPPED; }
virtual void onSoundEnabledBack() OVERRIDE {}
virtual void setRolloff(float rolloff) OVERRIDE {}
virtual const SFXBuffer* getBuffer() const OVERRIDE { return NULL; }
virtual SFXBuffer* getBuffer() const OVERRIDE { return NULL; }
}; // DummySFX

View File

@ -82,7 +82,7 @@ public:
virtual void reallySetMasterVolumeNow(float gain) = 0;
virtual void onSoundEnabledBack() = 0;
virtual void setRolloff(float rolloff) = 0;
virtual const SFXBuffer* getBuffer() const = 0;
virtual SFXBuffer* getBuffer() const = 0;
virtual SFXStatus getStatus() = 0;
}; // SFXBase

View File

@ -941,6 +941,9 @@ void SFXManager::reallyResumeAllNow()
for (std::vector<SFXBase*>::iterator i =m_all_sfx.getData().begin();
i!=m_all_sfx.getData().end(); i++)
{
// Some buffer not added to m_all_sfx_types need to be loaded here
// For example sound for entering challenge house in overworld
(*i)->getBuffer()->load();
(*i)->reallyResumeNow();
} // for i in m_all_sfx
m_all_sfx.unlock();

View File

@ -114,7 +114,7 @@ public:
// ------------------------------------------------------------------------
/** Returns the buffer associated with this sfx. */
virtual const SFXBuffer* getBuffer() const OVERRIDE
virtual SFXBuffer* getBuffer() const OVERRIDE
{ return m_sound_buffer; }
}; // SFXOpenAL