Fangames > Programming Questions
SG Audio Help please?
(1/1)
HAEGOE:
I'm using SG Audio for my new game. I wanted to use the sga_SetPlayOffset function for making the intro of the boss them play only once and rest of the music loops, and then something went wrong.
I found out after looping the ogg file, the music kept starting from the intro.
So I used GetPlayOffset to see the problem and the result was a value that's under 0.5 or so and has lots of digits that kept looping as the music being played.
like this
(click to show/hide)
could you tell me how to fix it and do what I intended to do?
nikaple:
I don't know how to use SG Audio, but I've done the same effect using SSound. I'll put the code here for reference. First you need to create an object for looping the music :
In the Create Event:
--- Code: ---loop_start = 50.157; // the position when the loop starts in seconds
loop_end = 78.570; // the position when the loop ends in seconds
song_length = 87.098; // the length of the song in seconds
song_byte = SS_GetSoundLength(curMusic); // the length of the song in bytes
--- End code ---
In the Step Event:
--- Code: ---if SS_GetSoundPosition(curMusic)/song_byte > loop_end/song_length{
SS_SetSoundPosition(curMusic,loop_start/song_length*song_byte);
}
--- End code ---
Maybe change the functions in SSound to some similar functions in SG Audio will work. Test it out xD
Navigation
[0] Message Index
Go to full version