osb/source/frontend/StarMainMixer.hpp
Kae 4b0bc220e4 Support for changing the game's timescale
Context-specific (like per-world) timescales can also be added later
2023-07-21 00:58:49 +10:00

39 lines
860 B
C++

#ifndef STAR_MAIN_MIXER_HPP
#define STAR_MAIN_MIXER_HPP
#include "StarMixer.hpp"
#include "StarGameTypes.hpp"
namespace Star {
STAR_CLASS(UniverseClient);
STAR_CLASS(WorldPainter);
STAR_CLASS(MainMixer);
class MainMixer {
public:
MainMixer(unsigned sampleRate, unsigned channels);
void setUniverseClient(UniverseClientPtr universeClient);
void setWorldPainter(WorldPainterPtr worldPainter);
void update(float dt, bool muteSfx = false, bool muteMusic = false);
MixerPtr mixer() const;
void setSpeed(float speed);
void setVolume(float volume, float rampTime = 0.0f);
void read(int16_t* sampleData, size_t frameCount, Mixer::ExtraMixFunction = {});
private:
UniverseClientPtr m_universeClient;
WorldPainterPtr m_worldPainter;
MixerPtr m_mixer;
Set<MixerGroup> m_mutedGroups;
Map<MixerGroup, float> m_groupVolumes;
};
}
#endif