Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarMainMixer.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
commit4b0bc220e4da1173f742a4973939b139bef562db (patch)
tree0ff66d5957575fa814fc10b8cd93e3dd378f45dc /source/frontend/StarMainMixer.cpp
parent607be749451aa40e3619e7ceab0927d1fcec8233 (diff)
Support for changing the game's timescale
Context-specific (like per-world) timescales can also be added later
Diffstat (limited to 'source/frontend/StarMainMixer.cpp')
-rw-r--r--source/frontend/StarMainMixer.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/frontend/StarMainMixer.cpp b/source/frontend/StarMainMixer.cpp
index d4a2e73..219daa2 100644
--- a/source/frontend/StarMainMixer.cpp
+++ b/source/frontend/StarMainMixer.cpp
@@ -23,7 +23,7 @@ void MainMixer::setWorldPainter(WorldPainterPtr worldPainter) {
m_worldPainter = move(worldPainter);
}
-void MainMixer::update(bool muteSfx, bool muteMusic) {
+void MainMixer::update(float dt, bool muteSfx, bool muteMusic) {
auto assets = Root::singleton().assets();
auto updateGroupVolume = [&](MixerGroup group, bool muted, String const& settingName) {
@@ -111,9 +111,9 @@ void MainMixer::update(bool muteSfx, bool muteMusic) {
};
if (Voice* voice = Voice::singletonPtr())
- voice->update(attenuationFunction);
+ voice->update(dt, attenuationFunction);
- m_mixer->update(attenuationFunction);
+ m_mixer->update(dt, attenuationFunction);
} else {
if (m_mixer->hasEffect("lowpass"))
@@ -122,9 +122,9 @@ void MainMixer::update(bool muteSfx, bool muteMusic) {
m_mixer->removeEffect("echo", 0);
if (Voice* voice = Voice::singletonPtr())
- voice->update();
+ voice->update(dt);
- m_mixer->update();
+ m_mixer->update(dt);
}
}
@@ -132,6 +132,10 @@ MixerPtr MainMixer::mixer() const {
return m_mixer;
}
+void MainMixer::setSpeed(float speed) {
+ m_mixer->setSpeed(max(speed, 0.0f));
+}
+
void MainMixer::setVolume(float volume, float rampTime) {
m_mixer->setVolume(volume, rampTime);
}