1.1 --- a/CHANGES Wed Dec 19 17:11:40 2001 +0000
1.2 +++ b/CHANGES Thu Dec 20 00:01:30 2001 +0000
1.3 @@ -1,7 +1,7 @@
1.4
1.5 1.2.2:
1.6 Guillaume Cottenceau - Wed Dec 19 08:59:05 PST 2001
1.7 - * Added an API for seeking in music files (implemented for MOD files)
1.8 + * Added an API for seeking in music files (implemented for MOD and Ogg music)
1.9 Mix_FadeInMusicPos(), Mix_SetMusicPosition()
1.10 * Exposed the mikmod synchro value for music synchronization
1.11 Mix_SetSynchroValue(), Mix_GetSynchroValue()
2.1 --- a/SDL_mixer.h Wed Dec 19 17:11:40 2001 +0000
2.2 +++ b/SDL_mixer.h Thu Dec 20 00:01:30 2001 +0000
2.3 @@ -460,7 +460,7 @@
2.4
2.5 /* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */
2.6 extern DECLSPEC int Mix_FadeInMusic(Mix_Music *music, int loops, int ms);
2.7 -extern DECLSPEC int Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, int position);
2.8 +extern DECLSPEC int Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position);
2.9 #define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1)
2.10 extern DECLSPEC int Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks);
2.11
2.12 @@ -509,9 +509,11 @@
2.13
2.14 /* Set the current position in the music stream.
2.15 This returns 0 if successful, or -1 if it failed or isn't implemented.
2.16 - This function is only implemented for MOD music formats at the moment.
2.17 + This function is only implemented for MOD music formats (set pattern
2.18 + order number) and for OGG music (set position in seconds), at the
2.19 + moment.
2.20 */
2.21 -extern DECLSPEC int Mix_SetMusicPosition(int position);
2.22 +extern DECLSPEC int Mix_SetMusicPosition(double position);
2.23
2.24 /* Check the status of a specific channel.
2.25 If the specified channel is -1, check all channels.
3.1 --- a/music.c Wed Dec 19 17:11:40 2001 +0000
3.2 +++ b/music.c Thu Dec 20 00:01:30 2001 +0000
3.3 @@ -679,7 +679,7 @@
3.4 return(0);
3.5 }
3.6
3.7 -int Mix_SetMusicPosition(int position)
3.8 +int Mix_SetMusicPosition(double position)
3.9 {
3.10 if ( music_playing && !music_stopped ) {
3.11 switch ( music_playing->type ) {
3.12 @@ -689,16 +689,22 @@
3.13 return(0);
3.14 break;
3.15 #endif
3.16 +#ifdef OGG_MUSIC
3.17 + case MUS_OGG:
3.18 + OGG_jump_to_time(music_playing->data.ogg, position);
3.19 + return(0);
3.20 + break;
3.21 +#endif
3.22 default:
3.23 /* TODO: Implement this for other music backends */
3.24 - return(-1);
3.25 break;
3.26 }
3.27 }
3.28 + return(-1);
3.29 }
3.30
3.31 /* Fade in a music over "ms" milliseconds */
3.32 -int Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, int position)
3.33 +int Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position)
3.34 {
3.35 if ( music && music_volume > 0 ) { /* No need to fade if we can't hear it */
3.36 music->fade_volume = music_volume;
4.1 --- a/music_cmd.c Wed Dec 19 17:11:40 2001 +0000
4.2 +++ b/music_cmd.c Thu Dec 20 00:01:30 2001 +0000
4.3 @@ -33,6 +33,7 @@
4.4 #include <unistd.h>
4.5 #include <string.h>
4.6 #include <signal.h>
4.7 +#include <ctype.h>
4.8
4.9 #include "SDL_mixer.h"
4.10 #include "music_cmd.h"
5.1 --- a/music_ogg.c Wed Dec 19 17:11:40 2001 +0000
5.2 +++ b/music_ogg.c Thu Dec 20 00:01:30 2001 +0000
5.3 @@ -183,4 +183,10 @@
5.4 }
5.5 }
5.6
5.7 +/* Jump (seek) to a given position (time is in seconds) */
5.8 +void OGG_jump_to_time(OGG_music *music, double time)
5.9 +{
5.10 + ov_time_seek( &music->vf, time );
5.11 +}
5.12 +
5.13 #endif /* OGG_MUSIC */
6.1 --- a/music_ogg.h Wed Dec 19 17:11:40 2001 +0000
6.2 +++ b/music_ogg.h Thu Dec 20 00:01:30 2001 +0000
6.3 @@ -64,4 +64,7 @@
6.4 /* Close the given OGG stream */
6.5 extern void OGG_delete(OGG_music *music);
6.6
6.7 +/* Jump (seek) to a given position (time is in seconds) */
6.8 +extern void OGG_jump_to_time(OGG_music *music, double time);
6.9 +
6.10 #endif /* OGG_MUSIC */
7.1 --- a/playmus.c Wed Dec 19 17:11:40 2001 +0000
7.2 +++ b/playmus.c Thu Dec 20 00:01:30 2001 +0000
7.3 @@ -177,7 +177,7 @@
7.4 /* Play and then exit */
7.5 printf("Playing %s\n", argv[i]);
7.6 Mix_FadeInMusic(music,looping,2000);
7.7 - while ( !next_track && Mix_PlayingMusic() || Mix_PausedMusic() ) {
7.8 + while ( !next_track && (Mix_PlayingMusic() || Mix_PausedMusic()) ) {
7.9 if(interactive)
7.10 Menu();
7.11 else