View Issue Details

IDProjectCategoryView StatusLast Update
0003197ardourfeaturespublic2020-04-19 20:14
Reporterlincoln Assigned Topaul  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Target Version3.0-beta1 
Summary0003197: [PATCH] Introduce a max note height in a midi region view
DescriptionAt present when resizing a midi track the notes will grow in proportion to the height of the track and the view is maintained.

It would be good if notes had a maximum height and when resizing beyond this limit, the region of visible notes is increased.
TagsNo tags attached.

Activities

2010-05-31 20:02

 

clamp-max-midi-note-visual-height.patch (1,544 bytes)   
Index: gtk2_ardour/midi_streamview.cc
===================================================================
--- gtk2_ardour/midi_streamview.cc	(revision 7198)
+++ gtk2_ardour/midi_streamview.cc	(working copy)
@@ -299,7 +299,7 @@
 	StreamView::update_contents_height();
 	_note_lines->property_y2() = height;
 	
-	draw_note_lines();
+	apply_note_range( lowest_note(), highest_note(), true);
 }
 
 void
@@ -362,13 +362,42 @@
 {
 	_highest_note = highest;
 	_lowest_note = lowest;
+	
+	int range = _highest_note - _lowest_note;  
+	int pixels_per_note = floor (height/range);
+	
+	/* do not grow note display beyont 10 pixels */
+	if (pixels_per_note > 10){
+		
+		int available_note_range = floor ((height)/10);
+		int additional_notes = available_note_range - range;
+		
+		/* distribute additional notes to higher and lower ranges, clamp at 0 and 127 */
+		for (int i = 0; i < additional_notes; i++){
+			
+			if (i % 2 && _highest_note < 127){
+				_highest_note++;
+			}
+			else if (i % 2) {
+				_lowest_note--;
+			}
+			else if (_lowest_note > 0){
+				_lowest_note--;
+			}
+			else {
+				_highest_note++;
+			}
+		}
+	}
+	
 	note_range_adjustment.set_page_size(_highest_note - _lowest_note);
 	note_range_adjustment.set_value(_lowest_note);
+	
 	draw_note_lines();
 
 	if (to_region_views) {
 		for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
-			((MidiRegionView*)(*i))->apply_note_range(lowest, highest);
+			((MidiRegionView*)(*i))->apply_note_range(_lowest_note, _highest_note);
 		}
 	}
 

lincoln

2010-05-31 20:02

reporter   ~0008108

Added patch file to implement this. Max note height set to 10 pixels.

paul

2010-06-03 16:03

administrator   ~0008148

committed to svn. i admit that i thought it would be *bit* more work than this, which is a good thing :) thanks!

system

2020-04-19 20:14

developer   ~0022101

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2010-05-27 10:15 lincoln New Issue
2010-05-27 13:43 paul Status new => acknowledged
2010-05-31 20:02 lincoln File Added: clamp-max-midi-note-visual-height.patch
2010-05-31 20:02 lincoln Note Added: 0008108
2010-05-31 21:13 cth103 cost => 0.00
2010-05-31 21:13 cth103 Target Version => 3.0-beta1
2010-05-31 21:13 cth103 Summary Introduce a max note height in a midi region view => [PATCH] Introduce a max note height in a midi region view
2010-06-03 16:03 paul Note Added: 0008148
2010-06-03 16:03 paul Status acknowledged => resolved
2010-06-03 16:03 paul Resolution open => fixed
2010-06-03 16:03 paul Assigned To => paul
2020-04-19 20:14 system Note Added: 0022101
2020-04-19 20:14 system Status resolved => closed