@@ -494,8 +494,38 @@ void MIDIContentViewer::updateNoteImageTemp() {
494
494
/* * Clear Temp */
495
495
this ->noteTemp ->clear (this ->noteTemp ->getBounds ());
496
496
juce::Graphics g (*(this ->noteTemp .get ()));
497
+ int width = this ->noteTemp ->getWidth (), height = this ->noteTemp ->getHeight ();
497
498
498
- /* * TODO */
499
+ /* * Size */
500
+ auto screenSize = utils::getScreenSize (this );
501
+ float noteCornerSize = screenSize.getHeight () * 0.003 ;
502
+ float noteOutlineThickness = screenSize.getHeight () * 0.001 ;
503
+
504
+ /* * Colors */
505
+ auto & laf = this ->getLookAndFeel ();
506
+ juce::Colour noteOutlineColor = laf.findColour (
507
+ juce::Label::ColourIds::outlineColourId);
508
+
509
+ /* * Notes */
510
+ int minNoteNum = std::floor (this ->keyBottom ), maxNoteNum = std::floor (this ->keyTop );
511
+ for (auto & note : this ->midiDataTemp ) {
512
+ if (note.startSec <= this ->secEnd &&
513
+ this ->secStart <= note.endSec ) {
514
+ if (note.num >= minNoteNum &&
515
+ note.num <= maxNoteNum) {
516
+ float startXPos = (note.startSec - this ->secStart ) / (this ->secEnd - this ->secStart ) * width;
517
+ float endXPos = (note.endSec - this ->secStart ) / (this ->secEnd - this ->secStart ) * width;
518
+ float noteYPos = ((note.num + 1 ) - this ->keyTop ) / (this ->keyBottom - this ->keyTop ) * height;
519
+ juce::Rectangle<float > noteRect (
520
+ startXPos, noteYPos,
521
+ endXPos - startXPos, (float )this ->vItemSize );
522
+ g.setColour (this ->noteColorGradient [note.channel ]);
523
+ g.fillRoundedRectangle (noteRect,noteCornerSize);
524
+ g.setColour (noteOutlineColor);
525
+ g.drawRoundedRectangle (noteRect, noteCornerSize, noteOutlineThickness);
526
+ }
527
+ }
528
+ }
499
529
}
500
530
501
531
std::tuple<double , double > MIDIContentViewer::getHViewArea (double pos, double itemSize) const {
0 commit comments