Hi everyone,
I implemented 3 functions for the SDL_mixer library, in the file music.c
Mix_GetMusicPosition() - Returns the current position in seconds.
Mix_FFMusic(seconds) - Fast Forward in seconds from the current
position. Only for MP3 and OGG
Mix_RewMusic(seconds) - Rewind in seconds from the current position.
Only for MP3 and OGG.
apply the patch with : “patch music.c patch.diff”.
Sorry about my English.
Let me know what you think
Best Regards--------------------------
Emmanuel N. Millan
-------------- next part --------------
27a28
#include <time.h>
79a81,82
time_t start, end, duration;
728a732
732a737,738
start = time(0);
//fprintf(stderr,“Inicio %f\n”, start);
768a775,823void Mix_FFMusic(long int seconds) {
switch (Mix_GetMusicType(NULL)){
case MUS_MP3:
start -=seconds;
Mix_SetMusicPosition(seconds);break; case MUS_OGG: Mix_SetMusicPosition(Mix_GetMusicPosition() + seconds); start -=seconds; break; }
}
void Mix_RewMusic(long int seconds){
switch (Mix_GetMusicType(NULL)) {
case MUS_MP3:
Mix_SetMusicPosition(0);
Mix_SetMusicPosition(Mix_GetMusicPosition() - seconds);
start += seconds;
break;case MUS_OGG: Mix_SetMusicPosition(Mix_GetMusicPosition() - seconds); start += seconds; break;
}
}
long int Mix_GetMusicPosition()
{
end = time(0);duration = difftime(end, start);
return(duration);}
772c827,828
<
959a1016