33 bool is_active()
const {
return active_.load(std::memory_order_relaxed); }
38 bool has_file()
const {
return file_data_ !=
nullptr; }
43 void set_loop(
bool loop) { file_loop_.store(loop, std::memory_order_relaxed); }
44 bool is_playing()
const {
return file_playing_.load(std::memory_order_relaxed); }
45 bool is_looping()
const {
return file_loop_.load(std::memory_order_relaxed); }
46 int64_t
file_position()
const {
return file_position_.load(std::memory_order_relaxed); }
51 void fill(
float*
const* output,
int num_channels,
int num_samples);
56 double sample_rate_ = 48000.0;
57 std::atomic<bool> active_{
false};
64 double sine_phase_ = 0.0;
68 std::array<std::uint32_t, 2> noise_state_ = {0x9e3779b9u, 0x1b56c4e9u};
71 std::unique_ptr<audio::AudioFileData> file_data_;
72 std::atomic<int64_t> file_position_{0};
73 std::atomic<bool> file_playing_{
false};
74 std::atomic<bool> file_loop_{
false};
Lock-free triple buffer for publishing the latest value from a writer thread to a reader thread witho...
Definition triple_buffer.hpp:45
Definition audio_file.hpp:24
Lock-free latest-value publication between two threads.