40 lines
758 B
C++
40 lines
758 B
C++
#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
|