ios stuff
This commit is contained in:
parent
6a1b50a29f
commit
a8e01ed69d
@ -306,6 +306,7 @@
|
|||||||
4C8CE91215B0A0FB00078175 /* src */ = {
|
4C8CE91215B0A0FB00078175 /* src */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
4C8CE94015B0A57F00078175 /* Console */,
|
||||||
4CF8747416B65183009B1214 /* GUIManager */,
|
4CF8747416B65183009B1214 /* GUIManager */,
|
||||||
4CF8747316B65173009B1214 /* HalibutAnimation */,
|
4CF8747316B65173009B1214 /* HalibutAnimation */,
|
||||||
4CF8747116B6514F009B1214 /* PhysicsManager */,
|
4CF8747116B6514F009B1214 /* PhysicsManager */,
|
||||||
@ -387,7 +388,6 @@
|
|||||||
4C8CE96B15B0B31F00078175 /* PngHelper.h */,
|
4C8CE96B15B0B31F00078175 /* PngHelper.h */,
|
||||||
4C8CE94B15B0AA8000078175 /* Utils.h */,
|
4C8CE94B15B0AA8000078175 /* Utils.h */,
|
||||||
4C8CE94D15B0AA9600078175 /* SerializeInterface */,
|
4C8CE94D15B0AA9600078175 /* SerializeInterface */,
|
||||||
4C8CE94015B0A57F00078175 /* Console */,
|
|
||||||
4C8CE94215B0A57F00078175 /* ErrorTypes */,
|
4C8CE94215B0A57F00078175 /* ErrorTypes */,
|
||||||
4C8CE94415B0A57F00078175 /* FileUtils */,
|
4C8CE94415B0A57F00078175 /* FileUtils */,
|
||||||
4C8CE91415B0A11A00078175 /* DataTypes */,
|
4C8CE91415B0A11A00078175 /* DataTypes */,
|
||||||
|
@ -30,6 +30,11 @@ public:
|
|||||||
virtual void PlayMusicLooped(const std::string& musicName);
|
virtual void PlayMusicLooped(const std::string& musicName);
|
||||||
virtual void StopMusic(const std::string& musicName);
|
virtual void StopMusic(const std::string& musicName);
|
||||||
|
|
||||||
|
virtual void StopAllMusic();
|
||||||
|
|
||||||
|
virtual void TryStopAndPlayMusicLooped(const std::string& musicName);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +104,8 @@ void TSoundManagerIos::PlayMusic(const std::string& musicName)
|
|||||||
AudioSourceMap[musicName].looped = false;
|
AudioSourceMap[musicName].looped = false;
|
||||||
|
|
||||||
[AudioSourceMap[musicName] playAtListenerPosition];
|
[AudioSourceMap[musicName] playAtListenerPosition];
|
||||||
|
|
||||||
|
//AudioSourceMap[musicName].isPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSoundManagerIos::PlayMusicLooped(const std::string& musicName)
|
void TSoundManagerIos::PlayMusicLooped(const std::string& musicName)
|
||||||
@ -116,6 +118,8 @@ void TSoundManagerIos::PlayMusicLooped(const std::string& musicName)
|
|||||||
AudioSourceMap[musicName].looped = true;
|
AudioSourceMap[musicName].looped = true;
|
||||||
|
|
||||||
[AudioSourceMap[musicName] playAtListenerPosition];
|
[AudioSourceMap[musicName] playAtListenerPosition];
|
||||||
|
|
||||||
|
//AudioSourceMap[musicName].isPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSoundManagerIos::StopMusic(const std::string& musicName)
|
void TSoundManagerIos::StopMusic(const std::string& musicName)
|
||||||
@ -126,7 +130,52 @@ void TSoundManagerIos::StopMusic(const std::string& musicName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[AudioSourceMap[musicName] stop];
|
[AudioSourceMap[musicName] stop];
|
||||||
|
//AudioSourceMap[musicName].isPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TSoundManagerIos::StopAllMusic()
|
||||||
|
{
|
||||||
|
for (auto i = AudioSourceMap.begin(); i != AudioSourceMap.end(); ++i)
|
||||||
|
{
|
||||||
|
PASoundSource* s = i->second;
|
||||||
|
if (s.isPlaying)
|
||||||
|
{
|
||||||
|
[s stop];
|
||||||
|
//s.isPlaying = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TSoundManagerIos::TryStopAndPlayMusicLooped(const std::string& musicName)
|
||||||
|
{
|
||||||
|
if (AudioSourceMap.count(musicName) == 0)
|
||||||
|
{
|
||||||
|
throw ErrorToLog("Sound or music not exists: "+musicName);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto i = AudioSourceMap.begin(); i != AudioSourceMap.end(); ++i)
|
||||||
|
{
|
||||||
|
if (i->first != musicName)
|
||||||
|
{
|
||||||
|
PASoundSource* s = i->second;
|
||||||
|
if (s.isPlaying)
|
||||||
|
{
|
||||||
|
[s stop];
|
||||||
|
//s.isPlaying = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PASoundSource* s = AudioSourceMap[musicName];
|
||||||
|
|
||||||
|
if (!s.isPlaying)
|
||||||
|
{
|
||||||
|
AudioSourceMap[musicName].looped = true;
|
||||||
|
|
||||||
|
//AudioSourceMap[musicName].isPlaying = true;
|
||||||
|
|
||||||
|
[AudioSourceMap[musicName] playAtListenerPosition];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace SE
|
} //namespace SE
|
Loading…
Reference in New Issue
Block a user