Files
FluidSimCpp/include/FluidSim/SoundEngine.hpp
2026-10-22 23:52:20 +02:00

32 lines
807 B
C++

#pragma once
#include "FluidSim/AudioOutputStream.hpp"
namespace fluidsim::port {
// Lifecycle wrapper matching the C# Audio.SoundEngine. The output stream owns
// the device callback, while this class gives the application one explicit
// start/stop and playback-control surface.
class SoundEngine {
public:
explicit SoundEngine(SimulationRingBuffer& source_buffer);
~SoundEngine();
SoundEngine(const SoundEngine&) = delete;
SoundEngine& operator=(const SoundEngine&) = delete;
void start();
void stop();
void set_speed(double speed);
double speed() const;
void set_volume(float volume);
float volume() const;
bool is_playing() const { return is_playing_; }
private:
AudioOutputStream stream_;
bool is_playing_{};
};
} // namespace fluidsim::port