Sequencer documentation

This commit is contained in:
Christian Colglazier 2022-02-07 21:35:46 -05:00
parent 01d7384eb3
commit 45fc7ea9a5
2 changed files with 23 additions and 8 deletions

View File

@ -5,7 +5,7 @@ SequencerDroplet::SequencerDroplet(DaisyPatch* m_patch,
float sample_rate) : float sample_rate) :
Droplet(m_patch, Droplet(m_patch,
m_state) { m_state) {
SetColumns(); SetDimensions();
SetControls(); SetControls();
AdjustSelected(-1); AdjustSelected(-1);
} }
@ -36,18 +36,20 @@ void SequencerDroplet::Process(AudioHandle::InputBuffer in,
if (control_rate_count == CONTROL_RATE_LIMIT) { if (control_rate_count == CONTROL_RATE_LIMIT) {
for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) { for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) {
if (std::abs(control[chn].Process()-last_control_value[chn]) > CONTROL_DEADZONE) { if (std::abs(control[chn].Process()
-last_control_value[chn]) > CONTROL_DEADZONE) {
if (!InMenu()) { if (!InMenu()) {
sequence[chn+selected*num_columns] = control[chn].Process(); sequence[chn+selected*num_columns] = control[chn].Process();
} else { } else {
if (chn == GetChannelMin()) { if (chn == GetChannelMin()) {
sequence_length = std::max(1.0f,control[chn].Process()/4.9f*MAX_SEQUENCE_LENGTH); sequence_length = std::max(1.0f,control[chn].Process() /
SetColumns(); 4.9f*MAX_SEQUENCE_LENGTH);
SetDimensions();
selected = 0; selected = 0;
AdjustSelected(-1); AdjustSelected(-1);
} }
} }
} }
last_control_value[chn] = control[chn].Process(); last_control_value[chn] = control[chn].Process();
} }
control_rate_count = 0; control_rate_count = 0;
@ -104,7 +106,7 @@ void SequencerDroplet::Draw() {
} }
void SequencerDroplet::UpdateStateCallback() { void SequencerDroplet::UpdateStateCallback() {
SetColumns(); SetDimensions();
} }
void SequencerDroplet::SetControls() { void SequencerDroplet::SetControls() {
@ -126,7 +128,7 @@ void SequencerDroplet::Reset() {
step = 0; step = 0;
} }
void SequencerDroplet::SetColumns() { void SequencerDroplet::SetDimensions() {
if (GetState() != DropletState::kFull) { if (GetState() != DropletState::kFull) {
num_columns = 2; num_columns = 2;
} else { } else {

View File

@ -37,10 +37,23 @@ private:
*/ */
void Reset(); void Reset();
void SetColumns(); /*
* Set the screeen dimensions of the sequence.
*/
void SetDimensions();
/*
* Change the selected menu input.
*
* @param adj amount to adjust menu
*/
void AdjustSelected(int adj); void AdjustSelected(int adj);
/*
* Returns if the sequencer menu is selected.
*
* @return menu state
*/
bool InMenu(); bool InMenu();
public: public:
/* /*