Sound not being played...

BlitzMax Forums/BlitzMax Beginners Area/Sound not being played...

Ryan Burnside(Posted 2009) [#1]
I can't figure out why this won't play the sound> I have ensured that the file name is correct and that the sound is in the proper folder. This was going to be used in a little program that runs during start up of my computer.

SuperStrict

Incbin "greeting.wav"
Global sound:TSound = LoadSound("Incbin::greeting.wav", False)
PlaySound(sound)



Ked(Posted 2009) [#2]
If you're using Framework, you may need to add:
Import BRL.WAVLoader
Also, you may need to import your audio driver and make sure you set it.


Ryan Burnside(Posted 2009) [#3]
The code I posted is the ENTIRE code. I thought that bmax would include everything needed if Framework was not specified?


Bremer(Posted 2009) [#4]
SuperStrict

Incbin "greeting.wav"
Global sound:TSound = LoadSound("Incbin::greeting.wav", False)
PlaySound(sound)
Waitkey


That works for me. Without the waitkey the program ends before it has time to load the .wav file, so it does not play it.


GfK(Posted 2009) [#5]
Without the waitkey the program ends before it has time to load the .wav file, so it does not play it.
That's not strictly true. Blitzmax doesn't delegate loading to threads by itself, so program execution will halt until loading has completed - you just won't hear anything because the program ends virtually as soon as the WAV has loaded.

If you need to know when the sound has finished playing so you can end the program, then you need to assign it to a channel rather than just using PlaySound - that way you can use channel.playing() to monitor it.


Ked(Posted 2009) [#6]
The code I posted is the ENTIRE code. I thought that bmax would include everything needed if Framework was not specified?

Well, you didn't specify it was the ENTIRE code.


Ryan Burnside(Posted 2009) [#7]
Thanks guys, I wrongly assumed that the sound had to be finished before the program would close.