Author Topic: SG Audio Help please?  (Read 1585 times)

HAEGOE

  • Spike Dodger
  • Posts: 101
  • Why the *beep* they're not in puyo tetris?????????
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 36.0.1985.143 Chrome 36.0.1985.143
    • View Profile
  • Playstyle: Keyboard
SG Audio Help please?
« on: August 16, 2014, 06:26:54 AM »
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?
a.k.a. tasteisgone
pronounciaton of HAEGOE is HAEGWE, not HAEGO.

I MAEK MBOILE GEAMS!
https://play.google.com/store/apps/details?id=com.Haegoe.MostPop


nikaple

  • Trial Wannabe
  • Posts: 7
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 36.0.1985.143 Chrome 36.0.1985.143
    • View Profile
Re: SG Audio Help please?
« Reply #1 on: August 19, 2014, 02:28:53 PM »
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: [Select]
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

In the Step Event:
Code: [Select]
if SS_GetSoundPosition(curMusic)/song_byte > loop_end/song_length{
    SS_SetSoundPosition(curMusic,loop_start/song_length*song_byte);
}

Maybe change the functions in SSound to some similar functions in SG Audio will work. Test it out xD