mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-29 16:55:59 +00:00
Make a further deployment of std::fill
.
This commit is contained in:
parent
f4d8c04f3c
commit
228012cd0c
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "Audio.hpp"
|
#include "Audio.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace Apple::Macintosh;
|
using namespace Apple::Macintosh;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -79,11 +81,8 @@ void Audio::get_samples(std::size_t number_of_samples, int16_t *target) {
|
|||||||
const auto cycles_left_in_sample = std::min(number_of_samples, sample_length - subcycle_offset_);
|
const auto cycles_left_in_sample = std::min(number_of_samples, sample_length - subcycle_offset_);
|
||||||
|
|
||||||
// Determine the output level, and output that many samples.
|
// Determine the output level, and output that many samples.
|
||||||
// (Hoping that the copiler substitutes an effective memset16-type operation here).
|
|
||||||
const int16_t output_level = volume_multiplier_ * (int16_t(sample_queue_.buffer[sample_queue_.read_pointer].load(std::memory_order::memory_order_relaxed)) - 128);
|
const int16_t output_level = volume_multiplier_ * (int16_t(sample_queue_.buffer[sample_queue_.read_pointer].load(std::memory_order::memory_order_relaxed)) - 128);
|
||||||
for(size_t c = 0; c < cycles_left_in_sample; ++c) {
|
std::fill(target, target + cycles_left_in_sample, output_level);
|
||||||
target[c] = output_level;
|
|
||||||
}
|
|
||||||
target += cycles_left_in_sample;
|
target += cycles_left_in_sample;
|
||||||
|
|
||||||
// Advance the sample pointer.
|
// Advance the sample pointer.
|
||||||
|
Loading…
Reference in New Issue
Block a user