Skip to content

Commit

Permalink
Removing triplets support and following the play cursor when playing
Browse files Browse the repository at this point in the history
  • Loading branch information
Rcomian committed Dec 7, 2018
1 parent 9008830 commit ae9d21f
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/PianoRollModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ struct PianoRollWidget : ModuleWidget {
int currentOctave = 4;
int currentMeasure = 0;
float topMargins = 15;
int lastDrawnStep = -1;

ModuleDragType *currentDragType = NULL;

Expand Down Expand Up @@ -954,6 +955,12 @@ struct PianoRollWidget : ModuleWidget {

Rect roll = getRollArea();

int measure = module->currentStep / module->getDivisionsPerMeasure();
if (measure != currentMeasure && lastDrawnStep != module->currentStep) {
lastDrawnStep = module->currentStep;
currentMeasure = measure;
}

Rect keysArea = reserveKeysArea(roll);
auto keys = getKeys(keysArea, this->octaves);
drawKeys(ctx, keys);
Expand Down Expand Up @@ -1261,14 +1268,14 @@ PatternWidget::PatternWidget() {
addChild(divisionsPerBeatChoice);
this->divisionsPerBeatChoice = divisionsPerBeatChoice;

this->divisionsPerBeatSeparator = Widget::create<LedDisplaySeparator>(pos);
this->divisionsPerBeatSeparator->box.size.y = this->beatsPerMeasureChoice->box.size.y;
addChild(this->divisionsPerBeatSeparator);
// this->divisionsPerBeatSeparator = Widget::create<LedDisplaySeparator>(pos);
// this->divisionsPerBeatSeparator->box.size.y = this->beatsPerMeasureChoice->box.size.y;
// addChild(this->divisionsPerBeatSeparator);

TripletsChoice *tripletsChoice = Widget::create<TripletsChoice>(pos);
tripletsChoice->widget = this;
addChild(tripletsChoice);
this->tripletsChoice = tripletsChoice;
// TripletsChoice *tripletsChoice = Widget::create<TripletsChoice>(pos);
// tripletsChoice->widget = this;
// addChild(tripletsChoice);
// this->tripletsChoice = tripletsChoice;

}

Expand All @@ -1277,12 +1284,16 @@ void PatternWidget::step() {
this->patternSeparator->box.size.x = box.size.x;
this->measuresChoice->box.size.x = box.size.x;
this->measuresSeparator->box.size.x = box.size.x;
this->beatsPerMeasureChoice->box.size.x = box.size.x / 3;
this->beatsPerMeasureSeparator->box.pos.x = box.size.x / 3;
this->divisionsPerBeatChoice->box.pos.x = box.size.x / 3;
this->divisionsPerBeatChoice->box.size.x = box.size.x / 3;
this->divisionsPerBeatSeparator->box.pos.x = box.size.x * (2.f/3.f);
this->tripletsChoice->box.pos.x = box.size.x * (2.f/3.f);
this->tripletsChoice->box.size.x = box.size.x / 3;
// this->beatsPerMeasureChoice->box.size.x = box.size.x / 3;
// this->beatsPerMeasureSeparator->box.pos.x = box.size.x / 3;
// this->divisionsPerBeatChoice->box.pos.x = box.size.x / 3;
// this->divisionsPerBeatChoice->box.size.x = box.size.x / 3;
// this->divisionsPerBeatSeparator->box.pos.x = box.size.x * (2.f/3.f);
// this->tripletsChoice->box.pos.x = box.size.x * (2.f/3.f);
// this->tripletsChoice->box.size.x = box.size.x / 3;
this->beatsPerMeasureChoice->box.size.x = box.size.x / 2;
this->beatsPerMeasureSeparator->box.pos.x = box.size.x / 2;
this->divisionsPerBeatChoice->box.pos.x = box.size.x / 2;
this->divisionsPerBeatChoice->box.size.x = box.size.x / 2;
LedDisplay::step();
}

0 comments on commit ae9d21f

Please sign in to comment.