| 337 | } |
| 338 | |
| 339 | void BeatColumn::Draw(int x, int y) |
| 340 | { |
| 341 | if (mBeatData.mBeat && mSampleIndex != -1) |
| 342 | { |
| 343 | int w = BEAT_COLUMN_WIDTH - 6; |
| 344 | int h = 35; |
| 345 | |
| 346 | ofPushMatrix(); |
| 347 | ofTranslate(x, y); |
| 348 | DrawAudioBuffer(w, h, mBeatData.mBeat->Data(), 0, mBeatData.mBeat->LengthInSamples(), mBeatData.mBeat->GetPlayPosition()); |
| 349 | |
| 350 | /*//frequency response |
| 351 | ofSetColor(52, 204, 235); |
| 352 | ofSetLineWidth(3); |
| 353 | ofBeginShape(); |
| 354 | const int kPixelStep = 2; |
| 355 | bool updateFrequencyResponseGraph = false; |
| 356 | if (mNeedToUpdateFrequencyResponseGraph) |
| 357 | { |
| 358 | updateFrequencyResponseGraph = true; |
| 359 | mNeedToUpdateFrequencyResponseGraph = false; |
| 360 | } |
| 361 | for (int x = 0; x < w + kPixelStep; x += kPixelStep) |
| 362 | { |
| 363 | float response = 1; |
| 364 | float freq = FreqForPos(x / w); |
| 365 | if (freq < gSampleRate / 2) |
| 366 | { |
| 367 | int responseGraphIndex = x / kPixelStep; |
| 368 | if (updateFrequencyResponseGraph || responseGraphIndex >= mFrequencyResponse.size()) |
| 369 | { |
| 370 | for (auto& filter : mFilters) |
| 371 | { |
| 372 | if (filter.mEnabled) |
| 373 | response *= filter.mFilter[0].GetMagnitudeResponseAt(freq); |
| 374 | } |
| 375 | if (responseGraphIndex < mFrequencyResponse.size()) |
| 376 | mFrequencyResponse[responseGraphIndex] = response; |
| 377 | } |
| 378 | else |
| 379 | { |
| 380 | response = mFrequencyResponse[responseGraphIndex]; |
| 381 | } |
| 382 | ofVertex(x, (.5f - .666f * log10(response)) * h); |
| 383 | } |
| 384 | } |
| 385 | ofEndShape(false);*/ |
| 386 | |
| 387 | ofPopMatrix(); |
| 388 | } |
| 389 | |
| 390 | mVolumeSlider->SetPosition(x, y + 40); |
| 391 | mVolumeSlider->Draw(); |
| 392 | mFilterSlider->SetPosition(x, y + 56); |
| 393 | mFilterSlider->Draw(); |
| 394 | mPanSlider->SetPosition(x, y + 72); |
| 395 | mPanSlider->Draw(); |
| 396 | mDoubleTimeCheckbox->SetPosition(x, y + 88); |