midi notes avaiable on ui
This commit is contained in:
@ -18,18 +18,23 @@ static inline float mtof(float m)
|
||||
|
||||
|
||||
void ShifterVoice::Init(float sample_rate) {
|
||||
portamento_.Init(sample_rate, 0.05f); //default portamento time
|
||||
amplitude_envelope_.Init(sample_rate);
|
||||
sample_rate_ = sample_rate;
|
||||
portamento_.Init(sample_rate_, 0.05f); //default portamento time
|
||||
amplitude_envelope_.Init(sample_rate_);
|
||||
amplitude_envelope_.SetAttackTime(0.2f);
|
||||
amplitude_envelope_.SetDecayTime(0.1f);
|
||||
amplitude_envelope_.SetReleaseTime(.1f);
|
||||
amplitude_envelope_.SetReleaseTime(.05f);
|
||||
onoff_ = false;
|
||||
overflow_ = false;
|
||||
current_midi = 60;
|
||||
current_period_ = 48000.0f / mtof((float)current_midi);
|
||||
current_period_ = sample_rate_ / mtof((float)current_midi);
|
||||
current_amplitude = 0.0f;
|
||||
period_counter = 0.0f;
|
||||
panning = 0.5f;
|
||||
//on reset, make sure envelope is not running
|
||||
while (amplitude_envelope_.IsRunning()) {
|
||||
amplitude_envelope_.Process(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +54,7 @@ void ShifterVoice::Release() {
|
||||
|
||||
void ShifterVoice::Process() {
|
||||
current_amplitude = amplitude_envelope_.Process(onoff_);
|
||||
current_period_ = 48000.0f / mtof(portamento_.Process((float)current_midi));
|
||||
current_period_ = sample_rate_ / mtof(portamento_.Process((float)current_midi));
|
||||
period_counter++;
|
||||
overflow_ = period_counter >= current_period_;
|
||||
if (overflow_) {
|
||||
|
||||
Reference in New Issue
Block a user