Skip to content

Commit

Permalink
Change playMusic return type from bool to void
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmoro93 committed Apr 3, 2024
1 parent 95e6537 commit 0e59eb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/OpenLoco/src/Audio/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ namespace OpenLoco::Audio

// Load info on the song to play.
const auto& mi = kMusicInfo[_currentSong];
cfg.musicPlaying = playMusic(mi.pathId, cfg.volume, false);
playMusic(mi.pathId, cfg.volume, false);

WindowManager::invalidate(WindowType::options);
}
Expand All @@ -1141,17 +1141,17 @@ namespace OpenLoco::Audio

// 0x0048AC66
// previously called void playTitleScreenMusic()
bool playMusic(PathId sample, int32_t volume, bool loop)
void playMusic(PathId sample, int32_t volume, bool loop)
{
auto* channel = getChannel(ChannelId::music);
if (!_audioInitialised || _audioIsPaused || !_audioIsEnabled || channel == nullptr)
{
return false;
return;
}

if (currentTrackPathId == sample)
{
return true;
return;
}

currentTrackPathId = sample;
Expand All @@ -1161,10 +1161,8 @@ namespace OpenLoco::Audio
if (channel->load(*musicSample))
{
channel->setVolume(volume);
return channel->play(loop);
channel->play(loop);
}

return false;
}

// 0x0048AAD2
Expand Down
2 changes: 1 addition & 1 deletion src/OpenLoco/src/Audio/Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace OpenLoco::Audio
void resetMusic();
void playBackgroundMusic();
void stopMusic();
bool playMusic(Environment::PathId sample, int32_t volume, bool loop);
void playMusic(Environment::PathId sample, int32_t volume, bool loop);

void resetSoundObjects();

Expand Down

0 comments on commit 0e59eb3

Please sign in to comment.