- Joined
- Dec 13, 2018
- Messages
- 384
I have this bit of code:
But for some reason the sound just will not play. I've tried making goSound global in case going out of scope has some effect, using a different channel, pausing and resuming the channel, setting the volume as 1.0 in code, but still no joy. I've tried both ogg and wav formats and the result is the same - no sound.
The files play properly in Cerberus' previewer and external players. I've added a debuglog message to check that this code is being called - it is. Once the state is changed to GAME_OVER it returns immediately to the main loop which continues to call the gameover.cxs update and rendering fuctions. There is no sound related code in any of those functions/loops.
The bizarre thing is, if I change the above code to play the file as music it works perfectly! (I don't want it to repeat which is why i'm trying to play it as a sound).
If anyone can make a suggestion in the next hour or two before I need to package up the game for the LD44 Compo I'd appreciate the help
Cerberus:
Function Init:Void()
goSound = LoadSound("sounds/gameover.ogg")
' play game over 'music' once
SetChannelVolume(3, sfxVolume)
PlaySound(goSound, 3, 0)
state = GAME_OVER
End
But for some reason the sound just will not play. I've tried making goSound global in case going out of scope has some effect, using a different channel, pausing and resuming the channel, setting the volume as 1.0 in code, but still no joy. I've tried both ogg and wav formats and the result is the same - no sound.
The files play properly in Cerberus' previewer and external players. I've added a debuglog message to check that this code is being called - it is. Once the state is changed to GAME_OVER it returns immediately to the main loop which continues to call the gameover.cxs update and rendering fuctions. There is no sound related code in any of those functions/loops.
The bizarre thing is, if I change the above code to play the file as music it works perfectly! (I don't want it to repeat which is why i'm trying to play it as a sound).
If anyone can make a suggestion in the next hour or two before I need to package up the game for the LD44 Compo I'd appreciate the help