mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-28 21:49:27 +00:00
Switches to maximum-rate multiplexing. Hopefully to eliminate the mixer as a consideration for now.
This commit is contained in:
parent
6d4e29c851
commit
6ebc93c995
@ -64,12 +64,12 @@ void OPLL::get_samples(std::size_t number_of_samples, std::int16_t *target) {
|
|||||||
// unlike the OPL2 the OPLL time-divides the output for 'mixing'.
|
// unlike the OPL2 the OPLL time-divides the output for 'mixing'.
|
||||||
|
|
||||||
const int update_period = 72 / audio_divider_;
|
const int update_period = 72 / audio_divider_;
|
||||||
const int channel_output_period = 8 / audio_divider_;
|
const int channel_output_period = 1;//2 / audio_divider_;
|
||||||
|
|
||||||
while(number_of_samples--) {
|
while(number_of_samples--) {
|
||||||
if(!audio_offset_) update_all_chanels();
|
if(!audio_offset_) update_all_chanels();
|
||||||
|
|
||||||
*target = int16_t(channels_[audio_offset_ / channel_output_period].level);
|
*target = int16_t(channels_[(audio_offset_ / channel_output_period) % 9].level);
|
||||||
++target;
|
++target;
|
||||||
audio_offset_ = (audio_offset_ + 1) % update_period;
|
audio_offset_ = (audio_offset_ + 1) % update_period;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,9 @@ void OPLL::update_all_chanels() {
|
|||||||
// Update the LFO.
|
// Update the LFO.
|
||||||
oscillator_.update();
|
oscillator_.update();
|
||||||
|
|
||||||
// Channels that are updated for melodic output regardless.
|
// Channels that are updated for melodic output regardless;
|
||||||
|
// in rhythm mode the final three channels — 6, 7, and 8 —
|
||||||
|
// are lost as their operators are used for drum noises.
|
||||||
for(int c = 0; c < 6; ++ c) {
|
for(int c = 0; c < 6; ++ c) {
|
||||||
channels_[c].level = (channels_[c].update(oscillator_) * total_volume_) >> 11;
|
channels_[c].level = (channels_[c].update(oscillator_) * total_volume_) >> 11;
|
||||||
}
|
}
|
||||||
@ -200,8 +202,8 @@ void OPLL::update_all_chanels() {
|
|||||||
if(depth_rhythm_control_ & 0x20) {
|
if(depth_rhythm_control_ & 0x20) {
|
||||||
// Rhythm mode. Somehow?
|
// Rhythm mode. Somehow?
|
||||||
} else {
|
} else {
|
||||||
// All melody, all the time.
|
// Not in rhythm mode; channels 7, 8 and 9 are melodic.
|
||||||
for(int c = 6; c < 9; ++ c) {
|
for(int c = 7; c < 9; ++ c) {
|
||||||
channels_[c].level = (channels_[c].update(oscillator_) * total_volume_) >> 11;
|
channels_[c].level = (channels_[c].update(oscillator_) * total_volume_) >> 11;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr int audio_divider = 2;
|
constexpr int audio_divider = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Sega {
|
namespace Sega {
|
||||||
|
Loading…
Reference in New Issue
Block a user