Port FluidSim core and scenarios to C++20
This commit is contained in:
39
src/sound_engine.cpp
Normal file
39
src/sound_engine.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "FluidSim/SoundEngine.hpp"
|
||||
|
||||
namespace fluidsim::port {
|
||||
|
||||
SoundEngine::SoundEngine(SimulationRingBuffer& source_buffer) : stream_(source_buffer) {}
|
||||
|
||||
SoundEngine::~SoundEngine() {
|
||||
stop();
|
||||
}
|
||||
|
||||
void SoundEngine::start() {
|
||||
if (is_playing_) return;
|
||||
stream_.play();
|
||||
is_playing_ = true;
|
||||
}
|
||||
|
||||
void SoundEngine::stop() {
|
||||
if (!is_playing_) return;
|
||||
stream_.stop();
|
||||
is_playing_ = false;
|
||||
}
|
||||
|
||||
void SoundEngine::set_speed(double speed_value) {
|
||||
stream_.set_speed(speed_value);
|
||||
}
|
||||
|
||||
double SoundEngine::speed() const {
|
||||
return stream_.speed();
|
||||
}
|
||||
|
||||
void SoundEngine::set_volume(float volume_value) {
|
||||
stream_.setVolume(volume_value);
|
||||
}
|
||||
|
||||
float SoundEngine::volume() const {
|
||||
return stream_.getVolume();
|
||||
}
|
||||
|
||||
} // namespace fluidsim::port
|
||||
Reference in New Issue
Block a user