2024-02-25 14:46:47 +00:00
|
|
|
#pragma once
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
#include "StarMixer.hpp"
|
|
|
|
#include "StarGameTypes.hpp"
|
|
|
|
|
|
|
|
namespace Star {
|
|
|
|
|
|
|
|
STAR_CLASS(UniverseClient);
|
2023-06-26 09:25:37 +00:00
|
|
|
STAR_CLASS(WorldPainter);
|
2023-06-20 04:33:09 +00:00
|
|
|
STAR_CLASS(MainMixer);
|
|
|
|
|
|
|
|
class MainMixer {
|
|
|
|
public:
|
|
|
|
MainMixer(unsigned sampleRate, unsigned channels);
|
|
|
|
|
|
|
|
void setUniverseClient(UniverseClientPtr universeClient);
|
2023-06-26 09:25:37 +00:00
|
|
|
void setWorldPainter(WorldPainterPtr worldPainter);
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2023-07-20 14:58:49 +00:00
|
|
|
void update(float dt, bool muteSfx = false, bool muteMusic = false);
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
MixerPtr mixer() const;
|
|
|
|
|
2023-07-20 14:58:49 +00:00
|
|
|
void setSpeed(float speed);
|
2023-06-20 04:33:09 +00:00
|
|
|
void setVolume(float volume, float rampTime = 0.0f);
|
2023-07-12 12:16:12 +00:00
|
|
|
void read(int16_t* sampleData, size_t frameCount, Mixer::ExtraMixFunction = {});
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
UniverseClientPtr m_universeClient;
|
2023-06-26 09:25:37 +00:00
|
|
|
WorldPainterPtr m_worldPainter;
|
2023-06-20 04:33:09 +00:00
|
|
|
MixerPtr m_mixer;
|
|
|
|
Set<MixerGroup> m_mutedGroups;
|
|
|
|
Map<MixerGroup, float> m_groupVolumes;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|