• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM BGM not looping seamlessly

Before you ask if my format is .MP3 or .wav they are not ... all my BGMs are converted into .oggs before hand to prevent this sort of problemm there are no gaps either at the end or the start of the track... i have my BGM set as compressed because thats what the tutorial site says to do for BGMs. for some reason the Track isnt looping and theres a little bit of a pause before playing it again. I am currently using the Legacy Sound Engine because the New one isnt as good as the old one and wont work on HTML5. I've tried this on windows and same problem... Why isnt it looping when its already a .ogg?


what i did notice is that when the game is compiling this is what happens...
Converting TestSong to MP3 with bitrate 192, mono @ 44100Hz

this is not making any sense what-so-ever
 
Last edited:
use the new engine and see if it works, if yes than the legacy thingy is the problem here
@jazzzar thats what i ended up doing however...now the problem arises, when i try to stop i get an error like this in the compile form

OpenAL error: 40963 (Audio_Tick End)

This is my code for the Song stopping
Code:
if dead=true //If player is dead
{
if swd=0 //Wait untill i can deduct the volume 
{
if audio_is_playing(global.handle)
{
if global.soundvol>0
{
global.soundvol-=.08
audio_sound_gain(global.handle,global.soundvol, 0);
swd=5
}
else{audio_stop_sound(global.handle);global.hass=false}
}

}


}
 
M

Mocgames998

Guest
First, the legacy sound engine does not support OGG files.
MP3s will ALWAYS have gaps at the end, even after conversion.
Also, I'd recommend using the new sound engine.
However, since audio_play_music() no longer exists, I'd recommend something like this:
(The following code is from one of my games)

First, create a script that you use to play music with. For instance, playmus, and have the song you want to play as argument 0.
e.g. playmus(song1);
You will also need to set a few global variables at the start of the game:
Code:
//You'll Probably want a silent sound file for initialization...
global.prevsong=snd_nothing;
global.song=snd_nothing;
Also, you're going to need an object to actually handle music playing, such as obj_musicplayer.
But other than this script, you won't really need to call for obj_musicplayer ever again.
The playmus script can just be something like this:
Code:
global.currentsong=argument0;
obj_musicplayer.alarm[0]=1; //This will actually handle playing the music.
For alarm[0] in obj_musicplayer, put this code in:
Code:
//The global.oldsong variable prevents more than one song from playing at the same time.
//Also, note the indentation:
if(audio_is_playing(global.oldsong))
    audio_stop_sound(global.oldsong);

//You want a high priority, aka the 99 in the line below, so other sounds don't force it to stop playing:
audio_play_sound(global.currentsong,99,1);

//The music volume is divided by 100, because the actual volume is between 0 and 1:
audio_sound_gain(global.currentsong,global.musicvol/100,0);

//This sets the current song playing as the previous song, so the next song played
   //with playmus() cancels out this one.
global.oldsong=global.currentsong;

Phew.
Now, if you want to stop the current song from playing, just use:
audio_stop_sound(global.currentsong);

Well, there you go, the best way to play OGG music in Studio.
Also, for music, I recommend "Compressed - Streamed".
It's also possible to have endlessly looping songs between two points, but that's for another time.
 
Last edited by a moderator:
Top