| 99 | } |
| 100 | |
| 101 | void DotSequencer::DrawModule() |
| 102 | { |
| 103 | if (Minimized() || IsVisible() == false) |
| 104 | return; |
| 105 | |
| 106 | ofPushStyle(); |
| 107 | ofSetLineWidth(mDotGrid->GetDotSize() * .25f); |
| 108 | float ysize = mHeight / mDotGrid->GetRows(); |
| 109 | for (int i = 0; i < mDotGrid->GetRows(); ++i) |
| 110 | { |
| 111 | ofVec2f pos = mDotGrid->GetCellPosition(0, i - 1) + mDotGrid->GetPosition(true); |
| 112 | ofVec2f lineAcrossStart(pos.x + 5, pos.y - ysize * .5f + 2); |
| 113 | ofVec2f lineAcrossEnd(pos.x + mDotGrid->GetWidth() - 10, pos.y - ysize * .5f + 2); |
| 114 | |
| 115 | if (RowToPitch(i) % TheScale->GetPitchesPerOctave() == TheScale->ScaleRoot() % TheScale->GetPitchesPerOctave()) |
| 116 | { |
| 117 | ofSetColor(0, 255, 0, gModuleDrawAlpha * .05f); |
| 118 | ofLine(lineAcrossStart, lineAcrossEnd); |
| 119 | ofSetColor(0, 255, 0, gModuleDrawAlpha * .8f); |
| 120 | } |
| 121 | else if (TheScale->GetPitchesPerOctave() == 12 && RowToPitch(i) % TheScale->GetPitchesPerOctave() == (TheScale->ScaleRoot() + 7) % TheScale->GetPitchesPerOctave()) |
| 122 | { |
| 123 | ofSetColor(200, 150, 0, gModuleDrawAlpha * .05f); |
| 124 | ofLine(lineAcrossStart, lineAcrossEnd); |
| 125 | ofSetColor(200, 150, 0, gModuleDrawAlpha * .8f); |
| 126 | } |
| 127 | else if (mNoteMode == NoteMode::Chromatic && TheScale->IsInScale(RowToPitch(i))) |
| 128 | { |
| 129 | ofSetColor(175, 100, 0, gModuleDrawAlpha * .05f); |
| 130 | ofLine(lineAcrossStart, lineAcrossEnd); |
| 131 | ofSetColor(175, 100, 0, gModuleDrawAlpha * .8f); |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | ofSetColor(128, 128, 128, gModuleDrawAlpha * .8f); |
| 136 | } |
| 137 | |
| 138 | float scale = std::min(mDotGrid->IClickable::GetDimensions().y / mDotGrid->GetRows() - 2, 10.0f); |
| 139 | DrawTextRightJustify(NoteName(RowToPitch(i), false, true) + "(" + ofToString(RowToPitch(i)) + ")", pos.x - 3, pos.y - ysize * .5f + (scale / 2), scale); |
| 140 | } |
| 141 | ofPopStyle(); |
| 142 | |
| 143 | mIntervalSelector->Draw(); |
| 144 | mNoteModeSelector->Draw(); |
| 145 | mClearButton->Draw(); |
| 146 | mOctaveSlider->Draw(); |
| 147 | mColsSlider->Draw(); |
| 148 | mRowsSlider->Draw(); |
| 149 | mRowOffsetSlider->Draw(); |
| 150 | mDoubleButton->Draw(); |
| 151 | mDotGrid->Draw(); |
| 152 | } |
| 153 | |
| 154 | void DotSequencer::OnTimeEvent(double time) |
| 155 | { |
nothing calls this directly
no test coverage detected