From 03ac816e83dded357d9f72be969b1cee64e97dfe Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Feb 2017 14:04:30 +0100 Subject: [PATCH] - added a gme_stereodepth CVAR. --- src/sound/i_music.cpp | 4 ++++ src/sound/i_music.h | 1 + src/sound/music_gme.cpp | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/sound/i_music.cpp b/src/sound/i_music.cpp index 1cbca0863..a896aeee7 100644 --- a/src/sound/i_music.cpp +++ b/src/sound/i_music.cpp @@ -279,6 +279,10 @@ void MusInfo::TimidityVolumeChanged() { } +void MusInfo::GMEDepthChanged(float val) +{ +} + void MusInfo::FluidSettingInt(const char *, int) { } diff --git a/src/sound/i_music.h b/src/sound/i_music.h index aaa00b020..069d2f142 100644 --- a/src/sound/i_music.h +++ b/src/sound/i_music.h @@ -84,6 +84,7 @@ public: virtual void FluidSettingNum(const char *setting, double value); // " virtual void FluidSettingStr(const char *setting, const char *value); // " virtual void WildMidiSetOption(int opt, int set); + virtual void GMEDepthChanged(float val); void Start(bool loop, float rel_vol = -1.f, int subsong = 0); diff --git a/src/sound/music_gme.cpp b/src/sound/music_gme.cpp index 6038f2349..d00728ec6 100644 --- a/src/sound/music_gme.cpp +++ b/src/sound/music_gme.cpp @@ -43,6 +43,7 @@ #include #include "v_text.h" #include "files.h" +#include "templates.h" // MACROS ------------------------------------------------------------------ @@ -67,6 +68,7 @@ protected: bool StartTrack(int track, bool getcritsec=true); bool GetTrackInfo(); int CalcSongLength(); + void GMEDepthChanged(float val); static bool Read(SoundStream *stream, void *buff, int len, void *userdata); }; @@ -84,6 +86,12 @@ protected: // Currently not used. CVAR (Float, spc_amp, 1.875f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Float, gme_stereodepth, 0.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +{ + if (currSong != nullptr) + currSong->GMEDepthChanged(self); +} + // PRIVATE DATA DEFINITIONS ------------------------------------------------ // CODE -------------------------------------------------------------------- @@ -146,6 +154,7 @@ MusInfo *GME_OpenSong(FileReader &reader, const char *fmt) reader.Seek(fpos, SEEK_SET); return NULL; } + gme_set_stereo_depth(emu, clamp(*gme_stereodepth, 0.f, 1.f)); return new GMESong(emu, sample_rate); } @@ -189,6 +198,19 @@ GMESong::~GMESong() } +//========================================================================== +// +// GMESong :: GMEDepthChanged +// +//========================================================================== + +void GMESong::GMEDepthChanged(float val) +{ + if (Emu != nullptr) + gme_set_stereo_depth(Emu, clamp(val, 0.f, 1.f)); +} + + //========================================================================== // // GMESong :: Play