@@ -20,7 +20,7 @@ MusicManager::MusicManager(ServiceProvider* service_provider, u8 channel_size)
2020 m_channel_size{ channel_size },
2121 m_chunk_map{ std::unordered_map<std::string, Mix_Chunk*>{} },
2222 m_service_provider{ service_provider },
23- volume { m_service_provider->command_line_arguments ().silent ? std::nullopt : std::optional{ 1 .0F } } {
23+ m_volume { m_service_provider->command_line_arguments ().silent ? std::nullopt : std::optional{ 1 .0F } } {
2424 if (s_instance != nullptr ) {
2525 spdlog::error (" it's not allowed to create more than one MusicManager instance" );
2626 return ;
@@ -57,7 +57,7 @@ MusicManager::MusicManager(ServiceProvider* service_provider, u8 channel_size)
5757
5858 s_instance = this ;
5959
60- set_volume (volume , true );
60+ set_volume (m_volume , true );
6161}
6262
6363MusicManager::~MusicManager () noexcept {
@@ -95,7 +95,7 @@ std::optional<std::string> MusicManager::load_and_play_music(const std::filesyst
9595 }
9696
9797 // if we are mute, set the current music to this
98- if (not volume .has_value ()) {
98+ if (not m_volume .has_value ()) {
9999 assert (m_queued_music == nullptr && " No queued music is possible, when muted!" );
100100 if (m_music != nullptr ) {
101101 Mix_FreeMusic (m_music);
@@ -258,7 +258,7 @@ void MusicManager::set_volume(
258258 const bool notify_listeners
259259) {
260260
261- if (volume == new_volume and not force_update) {
261+ if (m_volume == new_volume and not force_update) {
262262 return ;
263263 }
264264
@@ -268,15 +268,15 @@ void MusicManager::set_volume(
268268 Mix_HaltMusic ();
269269 }
270270
271- volume = std::nullopt ;
271+ m_volume = std::nullopt ;
272272 }
273273
274274
275275 const int new_volume_mapped =
276276 not new_volume.has_value () ? 0 : static_cast <int >(MIX_MAX_VOLUME * new_volume.value ());
277277 Mix_VolumeMusic (new_volume_mapped);
278278
279- if (not volume .has_value ()) {
279+ if (not m_volume .has_value ()) {
280280
281281 if (m_music != nullptr ) {
282282 const int result = Mix_PlayMusic (m_music, -1 );
@@ -289,10 +289,10 @@ void MusicManager::set_volume(
289289 }
290290
291291
292- volume = new_volume;
292+ m_volume = new_volume;
293293 if (notify_listeners) {
294- for (const auto & [_, listener] : volume_listeners ) {
295- listener (volume );
294+ for (const auto & [_, listener] : m_volume_listeners ) {
295+ listener (m_volume );
296296 }
297297 }
298298}
0 commit comments