summaryrefslogtreecommitdiff
path: root/src/koopatlas/mapmusic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/koopatlas/mapmusic.cpp')
-rw-r--r--src/koopatlas/mapmusic.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/koopatlas/mapmusic.cpp b/src/koopatlas/mapmusic.cpp
index d73d3da..f061059 100644
--- a/src/koopatlas/mapmusic.cpp
+++ b/src/koopatlas/mapmusic.cpp
@@ -38,7 +38,8 @@ void dKPMusic::play(int id) {
} else {
OSReport("Will switch; Fading out current track 2 over %d frames\n", FADE_OUT_LEN);
- s_handle.SetTrackVolume(1<<1, FADE_OUT_LEN, 0.0f);
+ if (s_handle.Exists())
+ s_handle.SetTrackVolume(1<<1, FADE_OUT_LEN, 0.0f);
s_nextSong = id;
s_countdownToSwitch = FADE_OUT_LEN;
}
@@ -121,6 +122,9 @@ void dKPMusic::execute() {
u8 *sourceData = ((u8*)(s_adpcmInfoLoader.buffer)) + (0x30*sourceBlockID);
nw4r::db::Exception_Printf_("Using ADPCM data for channel %d from block %d, data at %p\n", i, sourceBlockID, sourceData);
+ if (!voice)
+ continue;
+
Voice_SetADPCMLoop(voice, i, sourceData+0x28);
// loop through all axVoices
@@ -145,7 +149,8 @@ void dKPMusic::execute() {
s_countdownToFadeIn--;
if (s_countdownToFadeIn == 0) {
OSReport("Going to fade in the second track now!\n");
- s_handle.SetTrackVolume(1<<1, FADE_IN_LEN, 1.0f);
+ if (s_handle.Exists())
+ s_handle.SetTrackVolume(1<<1, FADE_IN_LEN, 1.0f);
}
}
}