@brief Draw note display (the small section between the keyboard and arc spectrogram) */
| 278 | @brief Draw note display (the small section between the keyboard and arc spectrogram) |
| 279 | */ |
| 280 | void GRainbowAudioProcessorEditor::paintOverChildren(juce::Graphics& g) { |
| 281 | // Right now just give last note played, not truely polyphony yet |
| 282 | // TODO: new note displaying |
| 283 | |
| 284 | // When dragging a file over, give feedback it will be accepted when released |
| 285 | if (mIsFileHovering) { |
| 286 | g.setColour(juce::Colours::white.withAlpha(0.2f)); |
| 287 | g.fillRect(getLocalBounds()); |
| 288 | } |
| 289 | |
| 290 | // Rain |
| 291 | if (mParameters.ui.centerComponent == ParamUI::CenterComponent::ARC_SPEC) { |
| 292 | // Make it rain girl (while loading) |
| 293 | if (mProgressBar.isVisible()) { |
| 294 | g.setColour(juce::Colours::blue); |
| 295 | // Exploit fact left and right are same dimension |
| 296 | const int rainHeight = mLeftRain.getHeight(); |
| 297 | const int rainWidth = mLeftRain.getWidth(); |
| 298 | g.drawImage(mRainImage, mLeftRain.getX(), mLeftRain.getY(), rainWidth, rainHeight, 0, mLeftRainDeltY, rainWidth, rainHeight); |
| 299 | g.drawImage(mRainImage, mRightRain.getX(), mRightRain.getY(), rainWidth, rainHeight, 0, mRightRainDeltY, rainWidth, |
| 300 | rainHeight); |
| 301 | |
| 302 | // make rain slow up as closer to full progress (which is the value 1.0) |
| 303 | const int speed = 10; |
| 304 | mLeftRainDeltY -= speed; |
| 305 | mRightRainDeltY -= speed; |
| 306 | if (mLeftRainDeltY < rainHeight) { |
| 307 | mLeftRainDeltY = mRainImage.getHeight() - rainHeight; |
| 308 | } |
| 309 | if (mRightRainDeltY < rainHeight) { |
| 310 | mRightRainDeltY = mRainImage.getHeight() - rainHeight; |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | void GRainbowAudioProcessorEditor::resized() { |
| 317 | auto r = getLocalBounds(); |