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

Adjusts range of output, makes declaration of level full owner of type information.

This commit is contained in:
Thomas Harte 2020-04-17 23:29:09 -04:00
parent 3948304172
commit 3da2e91acf
2 changed files with 4 additions and 5 deletions

View File

@ -38,10 +38,8 @@ int Channel::update(Operator *modulator, Operator *carrier, OperatorOverrides *m
modulator->update(modulator_state_, key_on_, period_ << frequency_shift_, octave_, modulator_overrides);
carrier->update(carrier_state_, key_on_, period_ << frequency_shift_, octave_, carrier_overrides);
// TODO: almost everything. This is a quick test.
// Specifically: use lookup tables.
const auto modulator_level = level(modulator_state_, 0);
return level(carrier_state_, modulator_level);
const auto modulator_level = level(modulator_state_);
return level(carrier_state_, modulator_level) << 2;
}
bool Channel::is_audible(Operator *carrier, OperatorOverrides *carrier_overrides) {

View File

@ -46,7 +46,8 @@ class Channel {
bool is_audible(Operator *carrier, OperatorOverrides *carrier_overrides = nullptr);
private:
int level(OperatorState &state, int modulator_level);
/// @returns The linear output level for the operator with state @c state and with an [optional] modulation input of @c modulator_level.
int level(OperatorState &state, int modulator_level = 0);
/// 'F-Num' in the spec; this plus the current octave determines channel frequency.
int period_ = 0;