MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / playMusic

Method playMusic

src/Resource/ResourcePack.cpp:187–209  ·  view source on GitHub ↗

* Plays the specified track if it's not already playing. * @param name Name of the music. * @param random Pick a random track? */

Source from the content-addressed store, hash-verified

185 * @param random Pick a random track?
186 */
187void ResourcePack::playMusic(const std::string &name, bool random)
188{
189 if (!Options::mute && _playingMusic != name)
190 {
191 int loop = -1;
192 _playingMusic = name;
193
194 // hacks
195 if (name == "GMGEO1")
196 _playingMusic = "GMGEO";
197 else if (!Options::musicAlwaysLoop && (name == "GMSTORY" || name == "GMWIN" || name == "GMLOSE"))
198 loop = 0;
199
200 if (random)
201 {
202 getRandomMusic(name)->play(loop);
203 }
204 else
205 {
206 getMusic(name)->play(loop);
207 }
208 }
209}
210
211/**
212 * Returns a specific sound from the resource set.

Callers 11

BriefingStateMethod · 0.80
DebriefingStateMethod · 0.80
BattlescapeStateMethod · 0.80
SoldierMemorialStateMethod · 0.80
btnOkClickMethod · 0.80
MainMenuStateMethod · 0.80
btnOkClickMethod · 0.80
initMethod · 0.80
time5SecondsMethod · 0.80
DefeatStateMethod · 0.80
VictoryStateMethod · 0.80

Calls 1

playMethod · 0.45

Tested by

no test coverage detected