How to play a ogg

BlitzMax Forums/BlitzMax Beginners Area/How to play a ogg

Hi, anybody can tell me a code example of how to play an ogg in bmax using the bmax functions?

I have been trying but it returns me a memory error :(

mySound:TSound = LoadSound("mysound.ogg")
PlaySound mySound


Graphics 800,600

Local music:TSound = LoadSound ("charlotte1.ogg",True)
Local canal1:TChannel = AllocChannel()

Repeat

Cls

PlaySound (musica_level1, canal1)

Flip

Until KeyHit(KEY_ESCAPE)

This returnsme an "Unhandled Memory Exception Error"

Why?

What is 'musica_level1'? Try setting debug mode as well.

i dont know why but it seems to work now O_oU

What? That code you posted, you never changed it at all and it now WORKS? That's absolutely amazing.

i dont know why but it seems to work now

You didnt by any chance make "musica_level1" and "music" the same label did you?

nah that wasnt the problem i change the name of the variables to paste it here and i forget changing the second one

What? So you're saying everything was correct but you still got an "Unhandled Memory Exception Error". Then, without changing anything it suddenly began to work? Why that's just crazy!

Not Crazy, just very very very wierd.

Mind you, Ive had something give an error, then without changeing anything recompiled, and it worked.

Graphics 800,600

Local music:TSound = LoadSound ("o:\frohe ostern.ogg",True)
Global canal1:TChannel = AllocChannel()

Cls

PlaySound (music, canal1)

Flip
Repeat
Until KeyHit(KEY_ESCAPE)

Using SuperStrict should help uncover bugs too, me thinks.

:-)

It's really important to use Stop Channel or the ogg will stay in memory = big fat memory leak.