From ac35d4214e380afc3a09d03b64c2ae714f4fbe9b Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sun, 1 Dec 2013 09:36:15 +0100 Subject: [PATCH] Audio: Make cheap OpenAL pitch shifting a config option --- README.md | 2 ++ src/audio.cpp | 7 +++++-- src/config.cpp | 4 ++++ src/config.h | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52aa41a..f1e7654 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,8 @@ mkxp reads configuration data from the file "mkxp.conf" contained in the current | defScreenH | int | 480 | Height the game window starts in | | fixedFramerate | int | 0 | FPS will be fixed to this amount. Ignored if 0. | | solidFonts | bool | false | Don't use alpha blending for fonts | +| fastSoundPitch | bool | true | Use cheap OpenAL pitch shifting for sounds (SE) | +| fastMusicPitch | bool | false | Use cheap OpenAL pitch shifting for music (BGM/BGS/ME) | | gameFolder | string | "." | mkxp will look for all game related files here | | allowSymlinks | bool | false | Allow symlinks to be followed in the game folder. | | customScript | string | "" | Execute a raw ruby script file instead of an RPG Maker game. | diff --git a/src/audio.cpp b/src/audio.cpp index 9e26275..35f5a6a 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -26,6 +26,7 @@ #include "intrulist.h" #include "filesystem.h" #include "exception.h" +#include "config.h" #include "al-util.h" #include @@ -300,7 +301,8 @@ struct SoundEmitter AL::Source::setVolume(src, _volume); #ifndef RUBBERBAND - AL::Source::setPitch(src, clamp(pitch, 50, 150) / 100.f); + if (shState->config().fastSoundPitch) + AL::Source::setPitch(src, clamp(pitch, 50, 150) / 100.f); #endif AL::Source::play(src); @@ -761,7 +763,8 @@ private: needsRewind = false; #ifndef RUBBERBAND - AL::Source::setPitch(alSrc, pitch); + if (shState->config().fastMusicPitch) + AL::Source::setPitch(alSrc, pitch); #endif } diff --git a/src/config.cpp b/src/config.cpp index 3525b0e..0852293 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -39,6 +39,8 @@ Config::Config() defScreenH(480), fixedFramerate(0), solidFonts(false), + fastSoundPitch(true), + fastMusicPitch(false), gameFolder("."), allowSymlinks(false) {} @@ -59,6 +61,8 @@ void Config::read() READ_VAL(defScreenH, Int); READ_VAL(fixedFramerate, Int); READ_VAL(solidFonts, Bool); + READ_VAL(fastSoundPitch, Bool); + READ_VAL(fastMusicPitch, Bool); READ_VAL(gameFolder, ByteArray); READ_VAL(allowSymlinks, Bool); READ_VAL(customScript, ByteArray); diff --git a/src/config.h b/src/config.h index 869b59e..bbe9b9f 100644 --- a/src/config.h +++ b/src/config.h @@ -44,6 +44,9 @@ struct Config bool solidFonts; + bool fastSoundPitch; + bool fastMusicPitch; + QByteArray gameFolder; bool allowSymlinks;