Warn only once about positional stereo sounds (#13895)

This commit is contained in:
DS 2023-10-18 20:16:45 +02:00 committed by GitHub
parent 6fdc7e0dad
commit 6026003508
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -164,10 +164,13 @@ std::shared_ptr<PlayingSound> OpenALSoundManager::createPlayingSound(
return nullptr; return nullptr;
} }
if (lsnd->m_decode_info.is_stereo && pos_vel_opt.has_value()) { if (lsnd->m_decode_info.is_stereo && pos_vel_opt.has_value()
&& m_warned_positional_stereo_sounds.find(sound_name)
== m_warned_positional_stereo_sounds.end()) {
warningstream << "OpenALSoundManager::createPlayingSound: " warningstream << "OpenALSoundManager::createPlayingSound: "
<< "Creating positional stereo sound \"" << sound_name << "\"." << "Creating positional stereo sound \"" << sound_name << "\"."
<< std::endl; << std::endl;
m_warned_positional_stereo_sounds.insert(sound_name);
} }
ALuint source_id; ALuint source_id;

View file

@ -77,6 +77,9 @@ class OpenALSoundManager final : public Thread
// if true, all sounds will be directly paused after creation // if true, all sounds will be directly paused after creation
bool m_is_paused = false; bool m_is_paused = false;
// used for printing warnings only once
std::unordered_set<std::string> m_warned_positional_stereo_sounds;
public: public:
// used for communication with ProxySoundManager // used for communication with ProxySoundManager
MutexedQueue<SoundManagerMsgToMgr> m_queue_to_mgr; MutexedQueue<SoundManagerMsgToMgr> m_queue_to_mgr;