Revert "fix: optimization: Various PVS-Studio warnings"
This commit is contained in:
@@ -40,8 +40,7 @@ namespace AL {
|
||||
/// @param field enum value
|
||||
/// @param def default value will be returned in case of error
|
||||
/// @return field value or default
|
||||
inline glm::vec3 getSource3f(uint source, ALenum field, const glm::vec3& def= {}
|
||||
) {
|
||||
inline glm::vec3 getSource3f(uint source, ALenum field, glm::vec3 def={}) {
|
||||
glm::vec3 value = def;
|
||||
if (source == 0)
|
||||
return def;
|
||||
|
||||
+9
-9
@@ -210,10 +210,10 @@ std::unique_ptr<Stream> audio::open_stream(std::shared_ptr<PCMStream> stream, bo
|
||||
|
||||
|
||||
void audio::set_listener(
|
||||
const glm::vec3& position,
|
||||
const glm::vec3& velocity,
|
||||
const glm::vec3& lookAt,
|
||||
const glm::vec3& up
|
||||
glm::vec3 position,
|
||||
glm::vec3 velocity,
|
||||
glm::vec3 lookAt,
|
||||
glm::vec3 up
|
||||
) {
|
||||
backend->setListener(position, velocity, lookAt, up);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ speakerid_t audio::play(
|
||||
if (!sound->variants.empty()) {
|
||||
size_t index = rand() % (sound->variants.size() + 1);
|
||||
if (index < sound->variants.size()) {
|
||||
sound = sound->variants[index].get();
|
||||
sound = sound->variants.at(index).get();
|
||||
}
|
||||
}
|
||||
auto speaker_ptr = sound->newInstance(priority, channel);
|
||||
@@ -266,7 +266,7 @@ speakerid_t audio::play(
|
||||
}
|
||||
auto speaker = speaker_ptr.get();
|
||||
speakerid_t id = nextId++;
|
||||
speakers.try_emplace(id, std::move(speaker_ptr));
|
||||
speakers.emplace(id, std::move(speaker_ptr));
|
||||
speaker->setPosition(position);
|
||||
speaker->setVolume(volume);
|
||||
speaker->setPitch(pitch);
|
||||
@@ -295,8 +295,8 @@ speakerid_t audio::play(
|
||||
}
|
||||
auto speaker = speaker_ptr.get();
|
||||
speakerid_t id = nextId++;
|
||||
streams.try_emplace(id, stream);
|
||||
speakers.try_emplace(id, std::move(speaker_ptr));
|
||||
streams.emplace(id, stream);
|
||||
speakers.emplace(id, std::move(speaker_ptr));
|
||||
stream->bindSpeaker(id);
|
||||
|
||||
speaker->setPosition(position);
|
||||
@@ -310,7 +310,7 @@ speakerid_t audio::play(
|
||||
|
||||
speakerid_t audio::play_stream(
|
||||
const fs::path& file,
|
||||
const glm::vec3& position,
|
||||
glm::vec3 position,
|
||||
bool relative,
|
||||
float volume,
|
||||
float pitch,
|
||||
|
||||
+5
-5
@@ -399,10 +399,10 @@ namespace audio {
|
||||
/// @param lookAt point the listener look at
|
||||
/// @param up camera up vector
|
||||
void set_listener(
|
||||
const glm::vec3& position,
|
||||
const glm::vec3& velocity,
|
||||
const glm::vec3& lookAt,
|
||||
const glm::vec3& up
|
||||
glm::vec3 position,
|
||||
glm::vec3 velocity,
|
||||
glm::vec3 lookAt,
|
||||
glm::vec3 up
|
||||
);
|
||||
|
||||
/// @brief Play 3D sound in the world
|
||||
@@ -457,7 +457,7 @@ namespace audio {
|
||||
/// @return speaker id or 0
|
||||
speakerid_t play_stream(
|
||||
const fs::path& file,
|
||||
const glm::vec3& position,
|
||||
glm::vec3 position,
|
||||
bool relative,
|
||||
float volume,
|
||||
float pitch,
|
||||
|
||||
Reference in New Issue
Block a user