mirror of
https://github.com/erik-toth/audio-synth.git
synced 2025-12-06 20:00:01 +00:00
Impplemenation of EN-Pins for CV-Gates, Metronome
This commit is contained in:
@@ -302,7 +302,7 @@ void SequencerBlock::addStep(uint16_t voltage_ch1, uint16_t voltage_ch2)
|
||||
unsigned long now = millis();
|
||||
|
||||
// NEU: Rate-Limiting - ignoriere zu häufige Aufrufe
|
||||
if((now - _lastAddStepTime) < 5) // Mindestens 5ms zwischen Updates
|
||||
if((unsigned long)(now - _lastAddStepTime) < 5)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -333,6 +333,7 @@ void SequencerBlock::addStep(uint16_t voltage_ch1, uint16_t voltage_ch2)
|
||||
_sequence[_stepCount].voltage_ch1 = voltage_ch1;
|
||||
_sequence[_stepCount].voltage_ch2 = voltage_ch2;
|
||||
_sequence[_stepCount].duration = 0;
|
||||
_sequence[_stepCount].active = (voltage_ch1 > 0 || voltage_ch2 > 0); // NEU: Prüfe ob Note aktiv
|
||||
_stepCount++;
|
||||
|
||||
_lastStepTime = now;
|
||||
@@ -452,6 +453,7 @@ void SequencerBlock::clear()
|
||||
_sequence[i].voltage_ch1 = 0;
|
||||
_sequence[i].voltage_ch2 = 0;
|
||||
_sequence[i].duration = 0;
|
||||
_sequence[i].active = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,6 +508,14 @@ uint16_t SequencerBlock::getTotalDuration()
|
||||
return (total > 65535) ? 65535 : (uint16_t)total; // Clamp auf uint16
|
||||
}
|
||||
|
||||
bool SequencerBlock::isCurrentStepActive()
|
||||
{
|
||||
if(!_isPlaying || _stepCount == 0) return false;
|
||||
if(_currentStep >= _stepCount || _currentStep >= _MAX_SEQUENCE_STEPS) return false;
|
||||
|
||||
return _sequence[_currentStep].active;
|
||||
}
|
||||
|
||||
void SequencerBlock::_finishCurrentStep()
|
||||
{
|
||||
if(_stepCount == 0) return;
|
||||
|
||||
Reference in New Issue
Block a user