1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 18:30:21 +00:00

Re-ups output level.

Though it's still quiet compared to the SN.
This commit is contained in:
Thomas Harte 2020-04-25 23:07:06 -04:00
parent cd2ab70a58
commit f52b40396a
2 changed files with 11 additions and 7 deletions

View File

@ -43,7 +43,7 @@ int Channel::update_melodic(const LowFrequencyOscillator &oscillator, Operator *
// Get modulator and carrier levels separately, return their sum.
modulator->update(modulator_state_, nullptr, oscillator, key_on_ || force_key_on, period_ << frequency_shift_, octave_, modulator_overrides);
carrier->update(carrier_state_, nullptr, oscillator, key_on_ || force_key_on, period_ << frequency_shift_, octave_, carrier_overrides);
return (modulator_state_.level() + carrier_state_.level());
return (modulator_state_.level() + carrier_state_.level()) >> 1;
}
}

View File

@ -197,11 +197,13 @@ void OPLL::update_all_chanels() {
int channel_levels[9];
#define VOLUME(x) ((x) * total_volume_) >> 11
// 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) {
channel_levels[c] = (channels_[c].update_melodic(oscillator_) * total_volume_) >> 12;
channel_levels[c] = VOLUME(channels_[c].update_melodic(oscillator_));
}
output_levels_[3] = channel_levels[0];
@ -217,11 +219,11 @@ void OPLL::update_all_chanels() {
// Update channel 6 as if melodic, but with the bass instrument.
output_levels_[2] = output_levels_[15] =
(channels_[6].update_bass(oscillator_, &operators_[32], depth_rhythm_control_ & 0x10) * total_volume_) >> 12;
VOLUME(channels_[6].update_bass(oscillator_, &operators_[32], depth_rhythm_control_ & 0x10));
// Use the modulator from channel 7 for the tom tom.
output_levels_[1] = output_levels_[14] =
(channels_[7].update_tom_tom(oscillator_, &operators_[34], depth_rhythm_control_ & 0x04) * total_volume_) >> 12;
VOLUME(channels_[7].update_tom_tom(oscillator_, &operators_[34], depth_rhythm_control_ & 0x04));
// TODO: snare.
output_levels_[6] = output_levels_[16] = 0;
@ -233,9 +235,9 @@ void OPLL::update_all_chanels() {
output_levels_[0] = output_levels_[13] = 0;
} else {
// Not in rhythm mode; channels 7, 8 and 9 are melodic.
// for(int c = 7; c < 9; ++ c) {
// channel_levels[c] = (channels_[c].update_melodic(oscillator_) * total_volume_) >> 12;
// }
for(int c = 7; c < 9; ++ c) {
channel_levels[c] = VOLUME(channels_[c].update_melodic(oscillator_));
}
output_levels_[0] = output_levels_[1] = output_levels_[2] =
output_levels_[6] = output_levels_[7] = output_levels_[8] =
@ -255,6 +257,8 @@ void OPLL::update_all_chanels() {
// }
// channels_[2].level = (channels_[2].update() * total_volume_) >> 14;
#undef VOLUME
}
/*