comments
This commit is contained in:
@@ -5,11 +5,13 @@ ScopeBuffer::ScopeBuffer(size_t size) : buffer_(size) {
|
||||
|
||||
}
|
||||
|
||||
// add a single sample to the scope buffer, called by synth
|
||||
void ScopeBuffer::push(float sample) {
|
||||
size_t w = writeIndex_.fetch_add(1, std::memory_order_relaxed);
|
||||
buffer_[w % buffer_.size()] = sample;
|
||||
}
|
||||
|
||||
// outputs value from the scope buffer, called by the scope widget
|
||||
void ScopeBuffer::read(std::vector<float>& out) const {
|
||||
size_t w = writeIndex_.load(std::memory_order_relaxed);
|
||||
for (size_t i = 0; i < out.size(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user