Log In  

I have a weird thing going on that I'm 100% sure is because of something I'm doing wrong, but I can't quite figure it out. Hoping one of you will have some insight!

When I run my cart, I have a title screen music track that plays using music(X), then fades out using music(-1,500) when the user presses X/Z to start the game. There's an intro cut scene where a different track plays using music(Y) then fades out when that cut scene ends, also using music(-1,500). The user plays, there's no music during the game but there are a variety of SFX that play from time to time. When the user wins or loses, there's another cut scene that plays music(Y) - however, for whatever reason, it only plays one of the 2 SFX in the pattern this time around. When that cut scene is done, the user gets the score screen, which plays either music(X) or music(Z) depending on whether the user wins or loses, but again only one SFX in the pattern plays. The user can then press X or Z to go back to the title screen, and music(X) only plays one of the 3 SFX in that pattern.

I suspect that somewhere, something's not getting cleared from a channel and that's preventing the rest of the SFX from playing, but I am not sure how to figure out what I'm doing wrong or how to fix it. Is there any guidance anyone can offer from this vague description? This is for my Toy Box Jam game, so if I can't figure it out before the deadline, I may end up posting it with "broken" music and maybe somebody can help me figure it out from my specific messy code so I can fix it post-release :).

For TL;DR - the flow that leads to this condition is basically:

music(X) --title screen, plays all 3 SFX, player presses X/Z
music(-1,500) --fades
music(Y) --plays both SFX, fade starts when scene ends
music(-1,500) --fades

gameplay with various SFX but no music playing until lose condition

music(Y) --plays only leftmost SFX in pattern, fade starts when scene ends
music(-1,500) --fades
music(Z) --plays only leftmost SFX in pattern, player presses X/Z
music(X) --title screen, plays only middle SFX in pattern
P#85940 2020-12-30 19:36

2

In terms of guidance, stat(16) through stat(19) show you what is currently playing on each of the four sound channels. See this reference for more details on that.

My best guesses are that either:

  • the fadeout is too long so it can't play new music sfx, because those sound channels are still in use when the new track starts playing, or
  • a looping sound effect is blocking your music channels.

Using a channel mask should solve both of these problems, by forcing the new music to reserve the channels specified for itself, regardless of what is already playing on them. I'm not sure how that works with fadeout timers though, as I've never used them myself.

P#85947 2020-12-31 01:14
2

@shy You just saved my game's music, thank you! Bullet number two, the looping sound effect, was the culprit. Particularly vexing because it's looping over a set of silent notes, so it seemed like the channel was dropping sound when it was actually continuously playing silence! I can't believe I never noticed the loop fields in the UI weren't set to 0.

P#85951 2020-12-31 01:43

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 04:17:32 | 0.017s | Q:10