audio::playStream + speaker relative property

This commit is contained in:
MihailRis
2024-03-01 14:47:12 +03:00
parent 2fab1593c8
commit 603546f642
5 changed files with 65 additions and 2 deletions
+16
View File
@@ -208,6 +208,7 @@ void remove_lower_priority_speaker(int priority) {
speakerid_t audio::play(
Sound* sound,
glm::vec3 position,
bool relative,
float volume,
float pitch,
bool loop,
@@ -227,6 +228,7 @@ speakerid_t audio::play(
speaker->setVolume(volume);
speaker->setPitch(pitch);
speaker->setLoop(loop);
speaker->setRelative(relative);
speaker->play();
return id;
}
@@ -234,6 +236,7 @@ speakerid_t audio::play(
speakerid_t audio::play(
std::shared_ptr<Stream> stream,
glm::vec3 position,
bool relative,
float volume,
float pitch,
bool loop
@@ -255,10 +258,23 @@ speakerid_t audio::play(
speaker->setVolume(volume);
speaker->setPitch(pitch);
speaker->setLoop(false);
speaker->setRelative(relative);
speaker->play();
return id;
}
speakerid_t audio::playStream(
const fs::path& file,
glm::vec3 position,
bool relative,
float volume,
float pitch,
bool loop
) {
std::shared_ptr<Stream> stream (openStream(file, false));
return play(stream, position, relative, volume, pitch, loop);
}
Speaker* audio::get(speakerid_t id) {
auto found = speakers.find(id);
if (found == speakers.end()) {