Port FluidSim core and scenarios to C++20
This commit is contained in:
31
include/FluidSim/SoundEngine.hpp
Normal file
31
include/FluidSim/SoundEngine.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user