mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Attempts better to balance attenuations.
This commit is contained in:
parent
b943441901
commit
1a4321d7d0
@ -79,10 +79,10 @@ template <int envelope_precision, int period_precision> class EnvelopeGenerator
|
||||
}
|
||||
|
||||
/*!
|
||||
@returns The current attenuation from this envelope generator.
|
||||
@returns The current attenuation from this envelope generator. This is independent of the envelope precision.
|
||||
*/
|
||||
int attenuation() const {
|
||||
return attenuation_ + tremolo_;
|
||||
return (attenuation_ + tremolo_) << 3;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -298,10 +298,11 @@ void OPLL::update_all_channels() {
|
||||
|
||||
|
||||
int OPLL::melodic_output(int channel) {
|
||||
// TODO: key-rate scaling.
|
||||
// TODO: proper scales of all attenuations below.
|
||||
// TODO: verify attenuation scales.
|
||||
auto modulation = WaveformGenerator<period_precision>::wave(channels_[channel].modulator_waveform, phase_generators_[channel + 9].phase());
|
||||
modulation += envelope_generators_[channel + 9].attenuation() + channels_[channel].modulator_attenuation;
|
||||
modulation += envelope_generators_[channel + 9].attenuation() + (channels_[channel].modulator_attenuation << 5) + key_level_scalers_[channel + 9].attenuation();
|
||||
|
||||
return WaveformGenerator<period_precision>::wave(channels_[channel].carrier_waveform, phase_generators_[channel].scaled_phase(), modulation).level() + channels_[channel].attenuation;
|
||||
auto carrier = WaveformGenerator<period_precision>::wave(channels_[channel].carrier_waveform, phase_generators_[channel].scaled_phase(), modulation);
|
||||
carrier += envelope_generators_[channel].attenuation() + (channels_[channel].attenuation << 7) + key_level_scalers_[channel].attenuation();
|
||||
return carrier.level();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user