Make S_FadeMusicFromLevel accept mandatory source_volume
* Make S_FadeMusic a legitimate function to grab current internal volume
This commit is contained in:
parent
3d8c4585d4
commit
b844a908a1
|
@ -251,9 +251,9 @@ void I_SetInternalMusicVolume(UINT8 volume);
|
||||||
|
|
||||||
void I_StopFadingMusic(void);
|
void I_StopFadingMusic(void);
|
||||||
|
|
||||||
boolean I_FadeMusicFromLevel(UINT8 target_volume, INT16 source_volume, UINT32 ms);
|
boolean I_FadeMusicFromLevel(UINT8 target_volume, UINT16 source_volume, UINT32 ms);
|
||||||
|
|
||||||
#define I_FadeMusic(a, b) I_FadeMusicFromLevel(a, -1, b)
|
boolean I_FadeMusic(UINT8 target_volume, UINT32 ms);
|
||||||
|
|
||||||
/** \brief The I_StartDigSong function
|
/** \brief The I_StartDigSong function
|
||||||
|
|
||||||
|
|
|
@ -1488,7 +1488,10 @@ void S_StopFadingMusic(void)
|
||||||
|
|
||||||
boolean S_FadeMusicFromLevel(UINT8 target_volume, INT16 source_volume, UINT32 ms)
|
boolean S_FadeMusicFromLevel(UINT8 target_volume, INT16 source_volume, UINT32 ms)
|
||||||
{
|
{
|
||||||
return I_FadeMusicFromLevel(target_volume, source_volume, ms);
|
if (source_volume < 0)
|
||||||
|
return I_FadeMusic(target_volume, ms);
|
||||||
|
else
|
||||||
|
return I_FadeMusicFromLevel(target_volume, source_volume, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SetDigMusicVolume(INT32 volume)
|
void S_SetDigMusicVolume(INT32 volume)
|
||||||
|
|
|
@ -1189,13 +1189,13 @@ void I_StopFadingMusic(void)
|
||||||
fading_target = fading_steps = fading_volume_step = fading_id = 0;
|
fading_target = fading_steps = fading_volume_step = fading_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean I_FadeMusicFromLevel(UINT8 target_volume, INT16 source_volume, UINT32 ms)
|
boolean I_FadeMusicFromLevel(UINT8 target_volume, UINT8 source_volume, UINT32 ms)
|
||||||
{
|
{
|
||||||
UINT32 target_steps, ms_per_step;
|
UINT32 target_steps, ms_per_step;
|
||||||
INT16 target_volume_step, volume_delta;
|
INT16 target_volume_step, volume_delta;
|
||||||
|
|
||||||
source_volume = min(source_volume, 100);
|
source_volume = min(source_volume, 100);
|
||||||
volume_delta = (INT16)(target_volume - (source_volume < 0 ? internal_volume : source_volume));
|
volume_delta = (INT16)(target_volume - source_volume));
|
||||||
|
|
||||||
I_StopFadingMusic();
|
I_StopFadingMusic();
|
||||||
|
|
||||||
|
@ -1230,17 +1230,19 @@ boolean I_FadeMusicFromLevel(UINT8 target_volume, INT16 source_volume, UINT32 ms
|
||||||
fading_steps = target_steps;
|
fading_steps = target_steps;
|
||||||
fading_volume_step = target_volume_step;
|
fading_volume_step = target_volume_step;
|
||||||
|
|
||||||
if (source_volume >= 0 && internal_volume != source_volume)
|
if (internal_volume != source_volume)
|
||||||
I_SetInternalMusicVolume(source_volume);
|
I_SetInternalMusicVolume(source_volume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CONS_Printf("Target %d> Source %d> MS %d> Steps %d> MSPer %d> VolPer %d> Fading %d\n",
|
|
||||||
target_volume, internal_volume, ms, target_steps, ms_per_step, target_volume_step, is_fading);
|
|
||||||
|
|
||||||
return is_fading;
|
return is_fading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_FadeMusic(UINT8 target_volume, UINT32 ms)
|
||||||
|
{
|
||||||
|
return I_FadeMusicFromLevel(target_volume, internal_volume, ms);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// MIDI Music
|
// MIDI Music
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue