| 109 | } |
| 110 | |
| 111 | void Rewriter::DrawModule() |
| 112 | { |
| 113 | if (Minimized() || IsVisible() == false) |
| 114 | return; |
| 115 | |
| 116 | mRewriteButton->Draw(); |
| 117 | mStartRecordTimeButton->Draw(); |
| 118 | |
| 119 | if (mStartRecordTime != -1) |
| 120 | { |
| 121 | ofSetColor(255, 100, 0, 100 + 50 * (cosf(TheTransport->GetMeasurePos(gTime) * 4 * FTWO_PI))); |
| 122 | ofRect(mStartRecordTimeButton->GetRect(true)); |
| 123 | } |
| 124 | |
| 125 | if (mConnectedLooper) |
| 126 | { |
| 127 | int loopSamples = abs(int(TheTransport->MsPerBar() / 1000 * gSampleRate)) * mConnectedLooper->GetNumBars(); |
| 128 | ofRectangle rect(3, mHeight - kBufferHeight - 3, mWidth - 6, kBufferHeight); |
| 129 | float playhead = fmod(TheTransport->GetMeasureTime(gTime), mConnectedLooper->GetNumBars()) / mConnectedLooper->GetNumBars(); |
| 130 | //mRecordBuffer.Draw(rect.x, rect.y, rect.width, rect.height, loopSamples, L(channel,0), loopSamples * playhead); |
| 131 | //mRecordBuffer.Draw(rect.x, rect.y, rect.width * playhead, rect.height, loopSamples * playhead, L(channel, 0)); |
| 132 | |
| 133 | ofPushMatrix(); |
| 134 | ofTranslate(rect.x, rect.y); |
| 135 | int nowOffset = mRecordBuffer.GetRawBufferOffset(0); |
| 136 | int startSample = nowOffset - loopSamples * playhead; |
| 137 | if (startSample < 0) |
| 138 | startSample += mRecordBuffer.Size(); |
| 139 | int endSample = startSample - 1; |
| 140 | if (endSample < 0) |
| 141 | endSample += loopSamples; |
| 142 | int loopBeginSample = startSample - loopSamples * (1 - playhead); |
| 143 | if (loopBeginSample < 0) |
| 144 | loopBeginSample += mRecordBuffer.Size(); |
| 145 | |
| 146 | DrawAudioBuffer(rect.width, rect.height, mRecordBuffer.GetRawBuffer()->GetChannel(0), startSample, endSample, -1, 1, ofColor::black, nowOffset, loopBeginSample, mRecordBuffer.Size()); |
| 147 | ofPopMatrix(); |
| 148 | |
| 149 | ofSetColor(0, 255, 0); |
| 150 | ofLine(rect.x + rect.width * playhead, rect.y, rect.x + rect.width * playhead, rect.y + rect.height); |
| 151 | } |
| 152 | else |
| 153 | { |
| 154 | DrawTextNormal("connect a looper", 5, mHeight - 3 - kBufferHeight / 2); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | void Rewriter::ButtonClicked(ClickButton* button, double time) |
| 159 | { |
nothing calls this directly
no test coverage detected