mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-01 07:21:34 +00:00
Change get/set music position to UINT32 parameter, milliseconds
# Conflicts: # src/d_netcmd.c # src/lua_baselib.c # 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
a4f7b17389
commit
8981ef2cdc
10 changed files with 54 additions and 56 deletions
|
@ -143,13 +143,13 @@ boolean I_SetSongSpeed(float speed)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(float position)
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
(void)position;
|
||||
return false;
|
||||
}
|
||||
|
||||
float I_GetSongPosition(void)
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
return 0.0f;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -4041,6 +4041,15 @@ static void Command_Tunes_f(void)
|
|||
if (speed > 0.0f)
|
||||
S_SpeedMusic(speed);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
if (argc > 4)
|
||||
{
|
||||
UINT32 position = (UINT32)atoi(COM_Argv(4));
|
||||
S_PositionMusic(position);
|
||||
}
|
||||
>>>>>>> f453fb65... Change get/set music position to UINT32 parameter, milliseconds
|
||||
}
|
||||
|
||||
static void Command_RestartAudio_f(void)
|
||||
|
|
|
@ -550,13 +550,13 @@ boolean I_SetSongSpeed(float speed)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(float position)
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
(void)position;
|
||||
return false;
|
||||
}
|
||||
|
||||
float I_GetSongPosition(void)
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
return 0.0f;
|
||||
return 0.;
|
||||
}
|
||||
|
|
|
@ -146,13 +146,13 @@ boolean I_SetSongTrack(int track)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(float position)
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
(void)position;
|
||||
return false;
|
||||
}
|
||||
|
||||
float I_GetSongPosition(void)
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
return 0.0f;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -206,9 +206,9 @@ void I_ShutdownDigMusic(void);
|
|||
|
||||
boolean I_SetSongSpeed(float speed);
|
||||
|
||||
boolean I_SetSongPosition(float position);
|
||||
boolean I_SetSongPosition(UINT32 position);
|
||||
|
||||
float I_GetSongPosition(void);
|
||||
UINT32 I_GetSongPosition(void);
|
||||
|
||||
boolean I_SetSongTrack(INT32 track);
|
||||
|
||||
|
|
|
@ -1404,12 +1404,12 @@ boolean S_SpeedMusic(float speed)
|
|||
return I_SetSongSpeed(speed);
|
||||
}
|
||||
|
||||
boolean S_PositionMusic(float position)
|
||||
boolean S_PositionMusic(UINT32 position)
|
||||
{
|
||||
return I_SetSongPosition(position);
|
||||
}
|
||||
|
||||
float S_GetPositionMusic(void)
|
||||
UINT32 S_GetPositionMusic(void)
|
||||
{
|
||||
return I_GetSongPosition();
|
||||
}
|
||||
|
|
|
@ -136,10 +136,10 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping);
|
|||
boolean S_SpeedMusic(float speed);
|
||||
|
||||
// Set Position of Music
|
||||
boolean S_PositionMusic(float position);
|
||||
boolean S_PositionMusic(UINT32 position);
|
||||
|
||||
// Get Position of Music
|
||||
float S_GetPositionMusic(void);
|
||||
UINT32 S_GetPositionMusic(void);
|
||||
|
||||
// Stops the music.
|
||||
void S_StopMusic(void);
|
||||
|
|
|
@ -736,21 +736,17 @@ boolean I_SetSongSpeed(float speed)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(float position)
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
if (position > 0.0f)
|
||||
{
|
||||
Mix_RewindMusic(); // needed for MP3
|
||||
Mix_SetMusicPosition(position);
|
||||
return true;
|
||||
}
|
||||
(void)position;
|
||||
return false;
|
||||
int r;
|
||||
Mix_RewindMusic(); // needed for MP3
|
||||
r = Mix_SetMusicPosition(position*1000);
|
||||
return r == 0;
|
||||
}
|
||||
|
||||
float I_GetSongPosition(void)
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
return 0.0f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongTrack(int track)
|
||||
|
|
|
@ -1973,15 +1973,15 @@ boolean I_SetSongSpeed(float speed)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(float position)
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
(void)position;
|
||||
return false;
|
||||
}
|
||||
|
||||
float I_GetSongPosition(void)
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
return 0.0f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongTrack(int track)
|
||||
|
|
|
@ -756,38 +756,31 @@ boolean I_SetSongSpeed(float speed)
|
|||
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)
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
FMOD_RESULT e;
|
||||
UINT32 fmposition = 0.0;
|
||||
e = FMOD_Channel_SetPosition(music_channel, 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;
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
FMOD_RESULT e;
|
||||
unsigned int fmposition = 0;
|
||||
e = FMOD_Channel_GetPosition(music_channel, &fmposition, FMOD_TIMEUNIT_MS);
|
||||
if (e == FMOD_OK)
|
||||
return fmposition / 1000.0f;
|
||||
return (UINT32)fmposition;
|
||||
else
|
||||
return 0.0f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongTrack(INT32 track)
|
||||
|
|
Loading…
Reference in a new issue