how to start music from middle of a song? (SOLVED)

Started by mchammer, Thu 08/03/2007 14:44:18

Previous topic - Next topic

mchammer

I dont know if its possible, but can you start music from a certain spot of a song?

I mean that when i stop playing a song, can i save to a global int a value, witch would tell how many seconds i have played the song and then continue playing the song from the same spot later?  ???
My 40 bullets - An action/war game.

Gilbert

Look for the following functions from the manual:
GetMIDIPosition()
GetMODPattern()
GetMP3PosMillis()
SeekMIDIPosition()
SeekMODPattern()
SeekMP3PosMillis()

mchammer

Thx, this is exactly what i was looking for, but i have problems when im trying to save the position of song to global.

For example this works just right:

SeekMP3PosMillis(30000);
--------------------------------------------------------------
But if i do it like this, it doesnt work:

SetGlobalInt(eGMixtapePosition, GetMP3PosMillis());
StopMusic();

PlayMusic(2);
SeekMP3PosMillis(eGMixtapePosition);

When i try this, it plays the song from the beginning.
Tracks are mp3 files converted to music.vox file.

My 40 bullets - An action/war game.

Khris

I was stumped for a few seconds, but then it hit me :):
Code: ags
PlayMusic(2);
SeekMP3PosMillis(GetGlobalInt(eGMixtapePosition));

mchammer

#4
Quote from: KhrisMUC on Thu 08/03/2007 16:25:07
I was stumped for a few seconds, but then it hit me :):
Code: ags
PlayMusic(2);
SeekMP3PosMillis(GetGlobalInt(eGMixtapePosition));


:o :o

How embarrassing, but i havent used ags for a long time...

thxs anyway, now everything works.  :)

My 40 bullets - An action/war game.

SMF spam blocked by CleanTalk