mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
Scale MIDI track vertical range to match widgest range of notes in child regions.
Fiddled with canvas theme a bit to make tempo more visible and probably annoy pure audio MIDI/tempo haters. Fix track-specific-color display on mixer strips for MIDI tracks. git-svn-id: svn://localhost/ardour2/trunk@2112 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0c3944f7dd
commit
cfe29a14ee
8 changed files with 86 additions and 24 deletions
|
|
@ -3,12 +3,12 @@
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Option name="waveform" value="000000cc"/>
|
<Option name="waveform" value="000000cc"/>
|
||||||
<Option name="clipped waveform" value="ff0000e5"/>
|
<Option name="clipped waveform" value="ff0000e5"/>
|
||||||
<Option name="region base" value="bfbfc1aa"/>
|
<Option name="region base" value="bfbfc172"/>
|
||||||
<Option name="selected region base" value="b591a8ff"/>
|
<Option name="selected region base" value="b591a8d0"/>
|
||||||
<Option name="audio track base" value="c6d3d868"/>
|
<Option name="audio track base" value="b6c3cb88"/>
|
||||||
<Option name="audio bus base" value="dbd1ea68"/>
|
<Option name="audio bus base" value="cbc1de78"/>
|
||||||
<Option name="midi track base" value="ff8f8f3d"/>
|
<Option name="midi track base" value="ffd0d850"/>
|
||||||
<Option name="midi bus base" value="ff0000ee"/>
|
<Option name="midi bus base" value="ffceea40"/>
|
||||||
<Option name="time-stretch-fill" value="e2b5b596"/>
|
<Option name="time-stretch-fill" value="e2b5b596"/>
|
||||||
<Option name="time-stretch-outline" value="63636396"/>
|
<Option name="time-stretch-outline" value="63636396"/>
|
||||||
<Option name="automation line" value="44bc59ff"/>
|
<Option name="automation line" value="44bc59ff"/>
|
||||||
|
|
@ -60,8 +60,8 @@
|
||||||
<Option name="EnteredMarker" value="dd6363ff"/>
|
<Option name="EnteredMarker" value="dd6363ff"/>
|
||||||
<Option name="MeterMarker" value="f2425bff"/>
|
<Option name="MeterMarker" value="f2425bff"/>
|
||||||
<Option name="TempoMarker" value="f2425bff"/>
|
<Option name="TempoMarker" value="f2425bff"/>
|
||||||
<Option name="MeasureLineBeat" value="72727266"/>
|
<Option name="MeasureLineBeat" value="82828276"/>
|
||||||
<Option name="MeasureLineBar" value="8c8c988c"/>
|
<Option name="MeasureLineBar" value="9c9ca89c"/>
|
||||||
<Option name="GhostTrackBase" value="44007c7f"/>
|
<Option name="GhostTrackBase" value="44007c7f"/>
|
||||||
<Option name="GhostTrackWave" value="02fd004c"/>
|
<Option name="GhostTrackWave" value="02fd004c"/>
|
||||||
<Option name="GhostTrackWaveClip" value="ff000000"/>
|
<Option name="GhostTrackWaveClip" value="ff000000"/>
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "streamview.h"
|
#include "streamview.h"
|
||||||
#include "midi_region_view.h"
|
#include "midi_region_view.h"
|
||||||
|
#include "midi_streamview.h"
|
||||||
#include "midi_time_axis.h"
|
#include "midi_time_axis.h"
|
||||||
#include "simplerect.h"
|
#include "simplerect.h"
|
||||||
#include "simpleline.h"
|
#include "simpleline.h"
|
||||||
|
|
@ -223,10 +224,17 @@ MidiRegionView::add_event (const MidiEvent& ev)
|
||||||
}
|
}
|
||||||
printf("\n\n");*/
|
printf("\n\n");*/
|
||||||
|
|
||||||
double y1 = trackview.height / 2.0;
|
MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
|
||||||
|
MidiStreamView* const view = mtv->midi_view();
|
||||||
|
|
||||||
|
const uint8_t note_range = view->highest_note() - view->lowest_note() + 1;
|
||||||
|
const double footer_height = name_highlight->property_y2() - name_highlight->property_y1();
|
||||||
|
const double pixel_range = (trackview.height - footer_height - 5.0) / (double)note_range;
|
||||||
|
|
||||||
if ((ev.buffer[0] & 0xF0) == MIDI_CMD_NOTE_ON) {
|
if ((ev.buffer[0] & 0xF0) == MIDI_CMD_NOTE_ON) {
|
||||||
const Byte& note = ev.buffer[1];
|
const Byte& note = ev.buffer[1];
|
||||||
y1 = trackview.height - ((trackview.height / 127.0) * note);
|
const double y1 = trackview.height - (pixel_range * (note - view->lowest_note() + 1))
|
||||||
|
- footer_height - 3.0;
|
||||||
|
|
||||||
ArdourCanvas::SimpleRect * ev_rect = new Gnome::Canvas::SimpleRect(
|
ArdourCanvas::SimpleRect * ev_rect = new Gnome::Canvas::SimpleRect(
|
||||||
*(ArdourCanvas::Group*)get_canvas_group());
|
*(ArdourCanvas::Group*)get_canvas_group());
|
||||||
|
|
@ -235,7 +243,7 @@ MidiRegionView::add_event (const MidiEvent& ev)
|
||||||
ev_rect->property_y1() = y1;
|
ev_rect->property_y1() = y1;
|
||||||
ev_rect->property_x2() = trackview.editor.frame_to_pixel (
|
ev_rect->property_x2() = trackview.editor.frame_to_pixel (
|
||||||
_region->length());
|
_region->length());
|
||||||
ev_rect->property_y2() = y1 + ceil(trackview.height / 127.0);
|
ev_rect->property_y2() = y1 + ceil(pixel_range);
|
||||||
ev_rect->property_outline_color_rgba() = 0xFFFFFFAA;
|
ev_rect->property_outline_color_rgba() = 0xFFFFFFAA;
|
||||||
/* outline all but right edge */
|
/* outline all but right edge */
|
||||||
ev_rect->property_outline_what() = (guint32) (0x1 & 0x4 & 0x8);
|
ev_rect->property_outline_what() = (guint32) (0x1 & 0x4 & 0x8);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001, 2006 Paul Davis
|
Copyright (C) 2001-2007 Paul Davis
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include <ardour/midi_source.h>
|
#include <ardour/midi_source.h>
|
||||||
#include <ardour/midi_diskstream.h>
|
#include <ardour/midi_diskstream.h>
|
||||||
#include <ardour/midi_track.h>
|
#include <ardour/midi_track.h>
|
||||||
|
#include <ardour/midi_events.h>
|
||||||
#include <ardour/smf_source.h>
|
#include <ardour/smf_source.h>
|
||||||
#include <ardour/region_factory.h>
|
#include <ardour/region_factory.h>
|
||||||
|
|
||||||
|
|
@ -53,6 +54,8 @@ using namespace Editing;
|
||||||
|
|
||||||
MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
|
MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
|
||||||
: StreamView (tv)
|
: StreamView (tv)
|
||||||
|
, _lowest_note(0)
|
||||||
|
, _highest_note(127)
|
||||||
{
|
{
|
||||||
if (tv.is_track())
|
if (tv.is_track())
|
||||||
stream_base_color = ARDOUR_UI::config()->canvasvar_MidiTrackBase.get();
|
stream_base_color = ARDOUR_UI::config()->canvasvar_MidiTrackBase.get();
|
||||||
|
|
@ -89,6 +92,8 @@ MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait
|
||||||
/* great. we already have a MidiRegionView for this Region. use it again. */
|
/* great. we already have a MidiRegionView for this Region. use it again. */
|
||||||
|
|
||||||
(*i)->set_valid (true);
|
(*i)->set_valid (true);
|
||||||
|
display_region(dynamic_cast<MidiRegionView*>(*i), false);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -107,11 +112,11 @@ MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait
|
||||||
// FIXME
|
// FIXME
|
||||||
//region_view->set_waveform_visible(_trackview.editor.show_waveforms());
|
//region_view->set_waveform_visible(_trackview.editor.show_waveforms());
|
||||||
|
|
||||||
/* display events */
|
/* display events and find note range */
|
||||||
region_view->begin_write();
|
display_region(region_view, false);
|
||||||
for (size_t i=0; i < region->midi_source(0)->model()->n_events(); ++i)
|
|
||||||
region_view->add_event(region->midi_source(0)->model()->event_at(i));
|
/* always display at least 1 octave range */
|
||||||
region_view->end_write();
|
_highest_note = max(_highest_note, static_cast<uint8_t>(_lowest_note + 11));
|
||||||
|
|
||||||
/* catch regionview going away */
|
/* catch regionview going away */
|
||||||
region->GoingAway.connect (bind (mem_fun (*this, &MidiStreamView::remove_region_view), region));
|
region->GoingAway.connect (bind (mem_fun (*this, &MidiStreamView::remove_region_view), region));
|
||||||
|
|
@ -121,7 +126,35 @@ MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait
|
||||||
return region_view;
|
return region_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: code duplication with AudioStreamVIew
|
void
|
||||||
|
MidiStreamView::display_region(MidiRegionView* region_view, bool redisplay_events)
|
||||||
|
{
|
||||||
|
if ( ! region_view)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (redisplay_events)
|
||||||
|
region_view->begin_write();
|
||||||
|
|
||||||
|
boost::shared_ptr<MidiSource> source(region_view->midi_region()->midi_source(0));
|
||||||
|
|
||||||
|
for (size_t i=0; i < source->model()->n_events(); ++i) {
|
||||||
|
const MidiEvent& ev = source->model()->event_at(i);
|
||||||
|
|
||||||
|
// Look at all note on events to find our note range
|
||||||
|
if ((ev.buffer[0] & 0xF0) == MIDI_CMD_NOTE_ON) {
|
||||||
|
_lowest_note = min(_lowest_note, ev.buffer[1]);
|
||||||
|
_highest_note = max(_highest_note, ev.buffer[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (redisplay_events)
|
||||||
|
region_view->add_event(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (redisplay_events)
|
||||||
|
region_view->end_write();
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: code duplication with AudioStreamView
|
||||||
void
|
void
|
||||||
MidiStreamView::redisplay_diskstream ()
|
MidiStreamView::redisplay_diskstream ()
|
||||||
{
|
{
|
||||||
|
|
@ -131,6 +164,9 @@ MidiStreamView::redisplay_diskstream ()
|
||||||
(*i)->set_valid (false);
|
(*i)->set_valid (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lowest_note = 60; // middle C
|
||||||
|
_highest_note = _lowest_note + 11;
|
||||||
|
|
||||||
if (_trackview.is_midi_track()) {
|
if (_trackview.is_midi_track()) {
|
||||||
_trackview.get_diskstream()->playlist()->foreach_region (static_cast<StreamView*>(this), &StreamView::add_region_view);
|
_trackview.get_diskstream()->playlist()->foreach_region (static_cast<StreamView*>(this), &StreamView::add_region_view);
|
||||||
}
|
}
|
||||||
|
|
@ -142,6 +178,8 @@ MidiStreamView::redisplay_diskstream ()
|
||||||
if (!(*i)->is_valid()) {
|
if (!(*i)->is_valid()) {
|
||||||
delete *i;
|
delete *i;
|
||||||
region_views.erase (i);
|
region_views.erase (i);
|
||||||
|
} else {
|
||||||
|
(*i)->set_y_position_and_height(0, height); // apply note range
|
||||||
}
|
}
|
||||||
|
|
||||||
i = tmp;
|
i = tmp;
|
||||||
|
|
|
||||||
|
|
@ -58,16 +58,23 @@ class MidiStreamView : public StreamView
|
||||||
void get_selectables (jack_nframes_t start, jack_nframes_t end, list<Selectable* >&);
|
void get_selectables (jack_nframes_t start, jack_nframes_t end, list<Selectable* >&);
|
||||||
void get_inverted_selectables (Selection&, list<Selectable* >& results);
|
void get_inverted_selectables (Selection&, list<Selectable* >& results);
|
||||||
|
|
||||||
|
uint8_t lowest_note() const { return _lowest_note; }
|
||||||
|
uint8_t highest_note() const { return _highest_note; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setup_rec_box ();
|
void setup_rec_box ();
|
||||||
void rec_data_range_ready (boost::shared_ptr<ARDOUR::MidiBuffer> data, jack_nframes_t start, jack_nframes_t dur, boost::weak_ptr<ARDOUR::Source> src);
|
void rec_data_range_ready (boost::shared_ptr<ARDOUR::MidiBuffer> data, jack_nframes_t start, jack_nframes_t dur, boost::weak_ptr<ARDOUR::Source> src);
|
||||||
void update_rec_regions (boost::shared_ptr<ARDOUR::MidiBuffer> data, jack_nframes_t start, jack_nframes_t dur);
|
void update_rec_regions (boost::shared_ptr<ARDOUR::MidiBuffer> data, jack_nframes_t start, jack_nframes_t dur);
|
||||||
|
|
||||||
RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves);
|
RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves);
|
||||||
|
void display_region(MidiRegionView* region_view, bool redisplay_events);
|
||||||
|
|
||||||
void redisplay_diskstream ();
|
void redisplay_diskstream ();
|
||||||
|
|
||||||
void color_handler ();
|
void color_handler ();
|
||||||
|
|
||||||
|
uint8_t _lowest_note;
|
||||||
|
uint8_t _highest_note;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_midi_streamview_h__ */
|
#endif /* __ardour_midi_streamview_h__ */
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,12 @@ MidiTimeAxisView::~MidiTimeAxisView ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MidiStreamView*
|
||||||
|
MidiTimeAxisView::midi_view()
|
||||||
|
{
|
||||||
|
return dynamic_cast<MidiStreamView*>(_view);
|
||||||
|
}
|
||||||
|
|
||||||
guint32
|
guint32
|
||||||
MidiTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent)
|
MidiTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ namespace ARDOUR {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PublicEditor;
|
class PublicEditor;
|
||||||
|
class MidiStreamView;
|
||||||
|
|
||||||
class MidiTimeAxisView : public RouteTimeAxisView
|
class MidiTimeAxisView : public RouteTimeAxisView
|
||||||
{
|
{
|
||||||
|
|
@ -56,6 +57,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
||||||
MidiTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
|
MidiTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
|
||||||
virtual ~MidiTimeAxisView ();
|
virtual ~MidiTimeAxisView ();
|
||||||
|
|
||||||
|
MidiStreamView* midi_view();
|
||||||
|
|
||||||
/* overridden from parent to store display state */
|
/* overridden from parent to store display state */
|
||||||
guint32 show_at (double y, int& nth, Gtk::VBox *parent);
|
guint32 show_at (double y, int& nth, Gtk::VBox *parent);
|
||||||
void hide ();
|
void hide ();
|
||||||
|
|
|
||||||
|
|
@ -669,7 +669,7 @@ MixerStrip::add_bundle_to_output_menu (ARDOUR::Bundle* c)
|
||||||
void
|
void
|
||||||
MixerStrip::update_diskstream_display ()
|
MixerStrip::update_diskstream_display ()
|
||||||
{
|
{
|
||||||
if (is_audio_track()) {
|
if (is_track()) {
|
||||||
|
|
||||||
map_frozen ();
|
map_frozen ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
|
||||||
layout->set_font_description (*NAME_FONT);
|
layout->set_font_description (*NAME_FONT);
|
||||||
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
|
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
|
||||||
|
|
||||||
NAME_Y_OFFSET = height + 6;
|
NAME_Y_OFFSET = height + 5;
|
||||||
NAME_HIGHLIGHT_SIZE = height + 6;
|
NAME_HIGHLIGHT_SIZE = height + 6;
|
||||||
NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 2;
|
NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 2;
|
||||||
|
|
||||||
|
|
@ -683,7 +683,7 @@ TimeAxisViewItem::compute_colors(Gdk::Color& base_color)
|
||||||
r = base_color.get_red()/256 ;
|
r = base_color.get_red()/256 ;
|
||||||
g = base_color.get_green()/256 ;
|
g = base_color.get_green()/256 ;
|
||||||
b = base_color.get_blue()/256 ;
|
b = base_color.get_blue()/256 ;
|
||||||
fill_color = RGBA_TO_UINT(r,g,b,255) ;
|
fill_color = RGBA_TO_UINT(r,g,b,160) ;
|
||||||
|
|
||||||
/* for minor colors:
|
/* for minor colors:
|
||||||
if the overall saturation is strong, make the minor colors light.
|
if the overall saturation is strong, make the minor colors light.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue