mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Initial attempt for get/set song position
* Declared I_SetSongPosition, I_GetSongPosition * Implemented S_PositionMusic and S_GetPositionMusic * Exposed in console TUNES and lua * Implemented set position in SDL, SDL12, WIN32 * Implemented get position in WIN32 # Conflicts: # src/nds/i_sound.c # src/sdl12/mixer_sound.c # src/sdl12/sdl_sound.c # src/win32ce/win_snd.c
This commit is contained in:
parent
effd0ebe97
commit
f8f71422ca
9 changed files with 115 additions and 0 deletions
|
|
@ -142,3 +142,14 @@ boolean I_SetSongSpeed(float speed)
|
||||||
(void)speed;
|
(void)speed;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_SetSongPosition(float position)
|
||||||
|
{
|
||||||
|
(void)position;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float I_GetSongPosition(void)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -549,3 +549,14 @@ boolean I_SetSongSpeed(float speed)
|
||||||
(void)speed;
|
(void)speed;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_SetSongPosition(float position)
|
||||||
|
{
|
||||||
|
(void)position;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float I_GetSongPosition(void)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,3 +145,14 @@ boolean I_SetSongTrack(int track)
|
||||||
(void)track;
|
(void)track;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_SetSongPosition(float position)
|
||||||
|
{
|
||||||
|
(void)position;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float I_GetSongPosition(void)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,10 @@ void I_ShutdownDigMusic(void);
|
||||||
|
|
||||||
boolean I_SetSongSpeed(float speed);
|
boolean I_SetSongSpeed(float speed);
|
||||||
|
|
||||||
|
boolean I_SetSongPosition(float position);
|
||||||
|
|
||||||
|
float I_GetSongPosition(void);
|
||||||
|
|
||||||
boolean I_SetSongTrack(INT32 track);
|
boolean I_SetSongTrack(INT32 track);
|
||||||
|
|
||||||
/** \brief The I_StartDigSong function
|
/** \brief The I_StartDigSong function
|
||||||
|
|
|
||||||
|
|
@ -1404,6 +1404,16 @@ boolean S_SpeedMusic(float speed)
|
||||||
return I_SetSongSpeed(speed);
|
return I_SetSongSpeed(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean S_PositionMusic(float position)
|
||||||
|
{
|
||||||
|
return I_SetSongPosition(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
float S_GetPositionMusic(void)
|
||||||
|
{
|
||||||
|
return I_GetSongPosition();
|
||||||
|
}
|
||||||
|
|
||||||
void S_StopMusic(void)
|
void S_StopMusic(void)
|
||||||
{
|
{
|
||||||
if (!music_playing)
|
if (!music_playing)
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,12 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping);
|
||||||
// Set Speed of Music
|
// Set Speed of Music
|
||||||
boolean S_SpeedMusic(float speed);
|
boolean S_SpeedMusic(float speed);
|
||||||
|
|
||||||
|
// Set Position of Music
|
||||||
|
boolean S_PositionMusic(float position);
|
||||||
|
|
||||||
|
// Get Position of Music
|
||||||
|
float S_GetPositionMusic(void);
|
||||||
|
|
||||||
// Stops the music.
|
// Stops the music.
|
||||||
void S_StopMusic(void);
|
void S_StopMusic(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -736,6 +736,23 @@ boolean I_SetSongSpeed(float speed)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_SetSongPosition(float position)
|
||||||
|
{
|
||||||
|
if (position > 0.0f)
|
||||||
|
{
|
||||||
|
Mix_RewindMusic(); // needed for MP3
|
||||||
|
Mix_SetMusicPosition(position);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
(void)position;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float I_GetSongPosition(void)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
boolean I_SetSongTrack(int track)
|
boolean I_SetSongTrack(int track)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBGME
|
#ifdef HAVE_LIBGME
|
||||||
|
|
|
||||||
|
|
@ -1973,6 +1973,17 @@ boolean I_SetSongSpeed(float speed)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_SetSongPosition(float position)
|
||||||
|
{
|
||||||
|
(void)position;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float I_GetSongPosition(void)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
boolean I_SetSongTrack(int track)
|
boolean I_SetSongTrack(int track)
|
||||||
{
|
{
|
||||||
(void)track;
|
(void)track;
|
||||||
|
|
|
||||||
|
|
@ -756,6 +756,40 @@ boolean I_SetSongSpeed(float speed)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_SetSongPosition(float position)
|
||||||
|
{
|
||||||
|
if(position > 0.0f)
|
||||||
|
{
|
||||||
|
FMOD_RESULT e;
|
||||||
|
position *= 1000.0f;
|
||||||
|
e = FMOD_Channel_SetPosition(music_channel, (UINT32)position, FMOD_TIMEUNIT_MS);
|
||||||
|
if (e == FMOD_OK)
|
||||||
|
return true;
|
||||||
|
else if (e == FMOD_ERR_UNSUPPORTED // Only music modules, numbnuts!
|
||||||
|
|| e == FMOD_ERR_INVALID_POSITION) // Out-of-bounds!
|
||||||
|
return false;
|
||||||
|
else // Congrats, you horribly broke it somehow
|
||||||
|
{
|
||||||
|
FMR_MUSIC(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
(void)position;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float I_GetSongPosition(void)
|
||||||
|
{
|
||||||
|
FMOD_RESULT e;
|
||||||
|
UINT32 fmposition = 0.0;
|
||||||
|
e = FMOD_Channel_GetPosition(music_channel, &fmposition, FMOD_TIMEUNIT_MS);
|
||||||
|
if (e == FMOD_OK)
|
||||||
|
return fmposition / 1000.0f;
|
||||||
|
else
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
boolean I_SetSongTrack(INT32 track)
|
boolean I_SetSongTrack(INT32 track)
|
||||||
{
|
{
|
||||||
if (track != current_track) // If the track's already playing, then why bother?
|
if (track != current_track) // If the track's already playing, then why bother?
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue