parent
ec4b71eca2
commit
6d152d5aee
|
@ -181,6 +181,16 @@ bool ALSound::CacheMusic(const std::string &filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ALSound::IsCached(Sound sound)
|
||||
{
|
||||
return m_sounds.find(sound) != m_sounds.end();
|
||||
}
|
||||
|
||||
bool ALSound::IsCachedMusic(const std::string &filename)
|
||||
{
|
||||
return m_music.find("music/"+filename) != m_music.end();
|
||||
}
|
||||
|
||||
int ALSound::GetPriority(Sound sound)
|
||||
{
|
||||
if ( sound == SOUND_FLYh ||
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
bool Create() override;
|
||||
bool Cache(Sound, const std::string &) override;
|
||||
bool CacheMusic(const std::string &) override;
|
||||
bool IsCached(Sound) override;
|
||||
bool IsCachedMusic(const std::string &) override;
|
||||
|
||||
bool GetEnable() override;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ bool Buffer::LoadFromFile(std::string filename, Sound sound)
|
|||
|
||||
if (!file->IsOpen())
|
||||
{
|
||||
GetLogger()->Warn("Could not load file. Reason: %s\n", file->GetLastError().c_str());
|
||||
GetLogger()->Warn("Could not load file %s. Reason: %s\n", filename.c_str(), file->GetLastError().c_str());
|
||||
m_loaded = false;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,16 @@ bool CSoundInterface::CacheMusic(const std::string &bFile)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CSoundInterface::IsCached(Sound bSound)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSoundInterface::IsCachedMusic(const std::string& bFile)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSoundInterface::GetEnable()
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -180,6 +180,18 @@ public:
|
|||
* \return return true on success
|
||||
*/
|
||||
virtual bool CacheMusic(const std::string &bFile);
|
||||
|
||||
/** Function to check if sound effect file was cached.
|
||||
* \param bSound - id of a sound effect file
|
||||
* \return return true if the file was cached
|
||||
*/
|
||||
virtual bool IsCached(Sound bSound);
|
||||
|
||||
/** Function called to check if music file was cached.
|
||||
* \param bFile - file to check
|
||||
* \return return true if the file was cached
|
||||
*/
|
||||
virtual bool IsCachedMusic(const std::string &bFile);
|
||||
|
||||
/** Return if plugin is enabled
|
||||
* \return return true if plugin is enabled
|
||||
|
|
|
@ -707,7 +707,7 @@ void CMainDialog::ChangePhase(Phase phase)
|
|||
m_phase != PHASE_SETUPcs &&
|
||||
m_phase != PHASE_SETUPss )
|
||||
{
|
||||
if (!m_sound->IsPlayingMusic())
|
||||
if (!m_sound->IsPlayingMusic() && m_sound->IsCachedMusic("Intro1.ogg"))
|
||||
{
|
||||
m_sound->PlayMusic("Intro1.ogg", false);
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ void CMainDialog::ChangePhase(Phase phase)
|
|||
}
|
||||
|
||||
if ( m_phase == PHASE_TRAINER ) strcpy(m_sceneName, "exercises");
|
||||
if ( m_phase == PHASE_DEFI ) strcpy(m_sceneName, "challenges" );
|
||||
if ( m_phase == PHASE_DEFI ) strcpy(m_sceneName, "challenges");
|
||||
if ( m_phase == PHASE_MISSION ) strcpy(m_sceneName, "missions");
|
||||
if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "freemissions");
|
||||
if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "custom");
|
||||
|
@ -1760,7 +1760,7 @@ bool CMainDialog::EventProcess(const Event &event)
|
|||
m_phase != PHASE_SETUPcs &&
|
||||
m_phase != PHASE_SETUPss )
|
||||
{
|
||||
if (!m_sound->IsPlayingMusic())
|
||||
if (!m_sound->IsPlayingMusic() && m_sound->IsCachedMusic("Intro2.ogg"))
|
||||
{
|
||||
m_sound->PlayMusic("Intro2.ogg", true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue