mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'vape-mode' into 'master'
Slow down level music in Encore - "vape mode" See merge request KartKrew/Kart!1359
This commit is contained in:
commit
713cb57486
5 changed files with 22 additions and 7 deletions
|
|
@ -84,5 +84,11 @@ size_t Resampler<C>::generate(tcb::span<Sample<C>> buffer)
|
|||
return written;
|
||||
}
|
||||
|
||||
template <size_t C>
|
||||
void Resampler<C>::ratio(float new_ratio)
|
||||
{
|
||||
ratio_ = std::max(new_ratio, 0.f);
|
||||
}
|
||||
|
||||
template class srb2::audio::Resampler<1>;
|
||||
template class srb2::audio::Resampler<2>;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ public:
|
|||
|
||||
virtual std::size_t generate(tcb::span<Sample<C>> buffer);
|
||||
|
||||
void ratio(float new_ratio);
|
||||
|
||||
Resampler& operator=(const Resampler<C>& r) = delete;
|
||||
Resampler& operator=(Resampler<C>&& r);
|
||||
|
||||
|
|
|
|||
|
|
@ -873,8 +873,6 @@ skippingposition:
|
|||
if (jingle == NULL)
|
||||
return;
|
||||
|
||||
S_SpeedMusic(1.0f);
|
||||
|
||||
S_ChangeMusicInternal(jingle, false);
|
||||
}
|
||||
|
||||
|
|
@ -894,8 +892,6 @@ void P_RestoreMusic(player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
S_SpeedMusic(1.0f);
|
||||
|
||||
// Event - HERE COMES A NEW CHALLENGER
|
||||
if (mapreset)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2801,6 +2801,9 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
|||
I_SetSongPosition(position);
|
||||
|
||||
I_SetSongTrack(mflags & MUSIC_TRACKMASK);
|
||||
|
||||
// Slow level music down a bit in Encore. (Values are vibe-based. WE GET IT YOU VAPE)
|
||||
S_SpeedMusic((encoremode && gamestate == GS_LEVEL) ? 0.86471f : 1.f);
|
||||
}
|
||||
else if (fadeinms) // let fades happen with same music
|
||||
{
|
||||
|
|
@ -2833,7 +2836,6 @@ void S_StopMusic(void)
|
|||
if (I_SongPaused())
|
||||
I_ResumeSong();
|
||||
|
||||
S_SpeedMusic(1.0f);
|
||||
I_StopSong();
|
||||
S_UnloadMusic(); // for now, stopping also means you unload the song
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "../audio/gain.hpp"
|
||||
#include "../audio/mixer.hpp"
|
||||
#include "../audio/music_player.hpp"
|
||||
#include "../audio/resample.hpp"
|
||||
#include "../audio/sound_chunk.hpp"
|
||||
#include "../audio/sound_effect_player.hpp"
|
||||
#include "../cxxutil.hpp"
|
||||
|
|
@ -42,6 +43,7 @@ using std::vector;
|
|||
using srb2::audio::Gain;
|
||||
using srb2::audio::Mixer;
|
||||
using srb2::audio::MusicPlayer;
|
||||
using srb2::audio::Resampler;
|
||||
using srb2::audio::Sample;
|
||||
using srb2::audio::SoundChunk;
|
||||
using srb2::audio::SoundEffectPlayer;
|
||||
|
|
@ -56,6 +58,7 @@ static unique_ptr<Mixer<2>> master;
|
|||
static shared_ptr<Mixer<2>> mixer_sound_effects;
|
||||
static shared_ptr<Mixer<2>> mixer_music;
|
||||
static shared_ptr<MusicPlayer> music_player;
|
||||
static shared_ptr<Resampler<2>> resample_music_player;
|
||||
static shared_ptr<Gain<2>> gain_sound_effects;
|
||||
static shared_ptr<Gain<2>> gain_music_player;
|
||||
static shared_ptr<Gain<2>> gain_music_channel;
|
||||
|
|
@ -187,11 +190,12 @@ void initialize_sound()
|
|||
mixer_sound_effects = make_shared<Mixer<2>>();
|
||||
mixer_music = make_shared<Mixer<2>>();
|
||||
music_player = make_shared<MusicPlayer>();
|
||||
resample_music_player = make_shared<Resampler<2>>(music_player, 1.f);
|
||||
gain_sound_effects = make_shared<Gain<2>>();
|
||||
gain_music_player = make_shared<Gain<2>>();
|
||||
gain_music_channel = make_shared<Gain<2>>();
|
||||
gain_sound_effects->bind(mixer_sound_effects);
|
||||
gain_music_player->bind(music_player);
|
||||
gain_music_player->bind(resample_music_player);
|
||||
gain_music_channel->bind(mixer_music);
|
||||
master->add_source(gain_sound_effects);
|
||||
master->add_source(gain_music_channel);
|
||||
|
|
@ -443,7 +447,12 @@ boolean I_SongPaused(void)
|
|||
|
||||
boolean I_SetSongSpeed(float speed)
|
||||
{
|
||||
(void) speed;
|
||||
if (resample_music_player)
|
||||
{
|
||||
resample_music_player->ratio(speed);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue