Legacy GM [solved]ogg file not playing

P

petra

Guest
I've been trying to use this piece of code in a "room start" event to play external .ogg files

snd =audio_create_stream("music/start.ogg");
audio_play_sound(snd,1,true)

my music file is here
Documents\GameMaker\Projects\<project name>.gmx\music


The room starts, and the music doesn't play. I've tried switching to a create event, and even to a game start event, but nothing.
I should also mention this is background music, and the code is in an object I place in the room
is there a different code I should be using, or am I not putting the file in the correct location?
 

Jabbers

Member
As you suspected, you are putting it in the wrong location.

You can put a sound file in GameMaker in the IDE and set it to stream from disk in the sound editor, if you want to save memory. If you want to load an .ogg externally, then the best thing to do is to add it as an included file. Right click on "Included Files" at the bottom of the GameMaker resource tree, add the .ogg, then use audio_create_stream("start.ogg"); and hopefully it will work.
 
P

petra

Guest
As you suspected, you are putting it in the wrong location.

You can put a sound file in GameMaker in the IDE and set it to stream from disk in the sound editor, if you want to save memory. If you want to load an .ogg externally, then the best thing to do is to add it as an included file. Right click on "Included Files" at the bottom of the GameMaker resource tree, add the .ogg, then use audio_create_stream("start.ogg"); and hopefully it will work.

thank you SO much!! I tried the "included files" and everything works perfectly now! I greatly appreciate the help
 
Top