|
|
|
@ -38,17 +38,26 @@ namespace sound { |
|
|
|
|
|
|
|
|
|
void play(const std::string name) { |
|
|
|
|
dbc::check(initialized, "You need to call sound::init() first"); |
|
|
|
|
dbc::check(SMGR.sounds.contains(name), fmt::format("sound {} is not loaded in map", name)); |
|
|
|
|
// get the sound from the sound map
|
|
|
|
|
auto pair = SMGR.sounds.at(name); |
|
|
|
|
// play it
|
|
|
|
|
pair.sound->play(); |
|
|
|
|
if(SMGR.sounds.contains(name)) { |
|
|
|
|
// get the sound from the sound map
|
|
|
|
|
auto pair = SMGR.sounds.at(name); |
|
|
|
|
// play it
|
|
|
|
|
pair.sound->play(); |
|
|
|
|
} else { |
|
|
|
|
dbc::log(fmt::format("Attempted to play {} sound but not available.", |
|
|
|
|
name)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void play_at(const std::string name, float x, float y, float z) { |
|
|
|
|
dbc::check(initialized, "You need to call sound::init() first"); |
|
|
|
|
auto pair = SMGR.sounds.at(name); |
|
|
|
|
pair.sound->setPosition({x, y, z}); |
|
|
|
|
pair.sound->play(); |
|
|
|
|
if(SMGR.sounds.contains(name)) { |
|
|
|
|
auto pair = SMGR.sounds.at(name); |
|
|
|
|
pair.sound->setPosition({x, y, z}); |
|
|
|
|
pair.sound->play(); |
|
|
|
|
} else { |
|
|
|
|
dbc::log(fmt::format("Attempted to play_at {} sound but not available.", |
|
|
|
|
name)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|