mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-12 09:25:19 +00:00
Rejig marginally.
This commit is contained in:
@@ -28,31 +28,33 @@ public:
|
|||||||
void apply_samples(std::size_t size, Outputs::Speaker::MonoSample *const target) {
|
void apply_samples(std::size_t size, Outputs::Speaker::MonoSample *const target) {
|
||||||
const auto count_frequency = [&](int index) {
|
const auto count_frequency = [&](int index) {
|
||||||
++counts_[index];
|
++counts_[index];
|
||||||
if(counts_[index] == frequencies_[index] * frequency_multiplier_) {
|
if(counts_[index] == (frequencies_[index] /* ^ 1023 */) * frequency_multiplier_) {
|
||||||
states_[index] ^= 1;
|
states_[index] ^= 1;
|
||||||
}
|
counts_[index] = 0;
|
||||||
if( counts_[index] == frequencies_[index] * frequency_multiplier_ ||
|
} else if(counts_[index] == 1024 * frequency_multiplier_) {
|
||||||
counts_[index] == 1024 * frequency_multiplier_
|
|
||||||
) {
|
|
||||||
counts_[index] = 0;
|
counts_[index] = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: noise generation.
|
// if(sound_dc_) {
|
||||||
|
// Outputs::Speaker::fill<action>(target, target + size, Outputs::Speaker::MonoSample(volume_ * 2));
|
||||||
|
// } else {
|
||||||
|
// TODO: noise generation.
|
||||||
|
|
||||||
for(size_t c = 0; c < size; c++) {
|
for(size_t c = 0; c < size; c++) {
|
||||||
count_frequency(0);
|
count_frequency(0);
|
||||||
count_frequency(1);
|
count_frequency(1);
|
||||||
|
|
||||||
Outputs::Speaker::apply<action>(
|
Outputs::Speaker::apply<action>(
|
||||||
target[c],
|
target[c],
|
||||||
Outputs::Speaker::MonoSample(
|
Outputs::Speaker::MonoSample(
|
||||||
(
|
(
|
||||||
((states_[0] & masks_[0]) * external_volume_) +
|
((states_[0] & masks_[0]) * external_volume_) +
|
||||||
((states_[1] & masks_[1]) * external_volume_)
|
((states_[1] & masks_[1]) * external_volume_)
|
||||||
) * volume_
|
) * volume_
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
r_ += size;
|
r_ += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user