mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
Fix display of MIDI notes/regions while recording.
Make record rect transparency configurable. Factor out some copy-paste streamview code.
This commit is contained in:
parent
0f63ac06a4
commit
6e912a0aa3
7 changed files with 52 additions and 93 deletions
|
|
@ -237,62 +237,11 @@ AudioStreamView::setup_rec_box ()
|
||||||
|
|
||||||
/* start a new rec box */
|
/* start a new rec box */
|
||||||
|
|
||||||
boost::shared_ptr<AudioTrack> at;
|
boost::shared_ptr<AudioTrack> at = _trackview.audio_track();
|
||||||
|
|
||||||
at = _trackview.audio_track(); /* we know what it is already */
|
|
||||||
framepos_t const frame_pos = at->current_capture_start ();
|
framepos_t const frame_pos = at->current_capture_start ();
|
||||||
gdouble xstart = _trackview.editor().sample_to_pixel (frame_pos);
|
double const width = ((at->mode() == Destructive) ? 2 : 0);
|
||||||
gdouble xend = xstart; /* keeps gcc optimized happy, really set in switch() below */
|
|
||||||
uint32_t fill_color;
|
|
||||||
|
|
||||||
switch (_trackview.audio_track()->mode()) {
|
create_rec_box(frame_pos, width);
|
||||||
case Normal:
|
|
||||||
case NonLayered:
|
|
||||||
xend = xstart;
|
|
||||||
fill_color = ARDOUR_UI::config()->color ("recording rect");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Destructive:
|
|
||||||
xend = xstart + 2;
|
|
||||||
fill_color = ARDOUR_UI::config()->color ("recording rect");
|
|
||||||
/* make the recording rect translucent to allow
|
|
||||||
the user to see the peak data coming in, etc.
|
|
||||||
*/
|
|
||||||
fill_color = UINT_RGBA_CHANGE_A (fill_color, 120);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fatal << string_compose (_("programming error: %1: %2"),
|
|
||||||
"AudioStreamView: impossible track mode",
|
|
||||||
(int) _trackview.audio_track()->mode()) << endmsg;
|
|
||||||
abort(); /*NOTREACHED*/
|
|
||||||
}
|
|
||||||
|
|
||||||
ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::TimeRectangle (_canvas_group);
|
|
||||||
rec_rect->set_x0 (xstart);
|
|
||||||
rec_rect->set_y0 (0);
|
|
||||||
rec_rect->set_x1 (xend);
|
|
||||||
rec_rect->set_y1 (child_height ());
|
|
||||||
rec_rect->set_outline_what (ArdourCanvas::Rectangle::What (0));
|
|
||||||
rec_rect->set_outline_color (ARDOUR_UI::config()->color ("time axis frame"));
|
|
||||||
rec_rect->set_fill_color (fill_color);
|
|
||||||
|
|
||||||
RecBoxInfo recbox;
|
|
||||||
recbox.rectangle = rec_rect;
|
|
||||||
|
|
||||||
if (rec_rects.empty()) {
|
|
||||||
recbox.start = _trackview.session()->record_location ();
|
|
||||||
} else {
|
|
||||||
recbox.start = _trackview.session()->transport_frame ();
|
|
||||||
}
|
|
||||||
recbox.length = 0;
|
|
||||||
|
|
||||||
rec_rects.push_back (recbox);
|
|
||||||
|
|
||||||
screen_update_connection.disconnect();
|
|
||||||
screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (
|
|
||||||
sigc::mem_fun (*this, &AudioStreamView::update_rec_box));
|
|
||||||
rec_updating = true;
|
|
||||||
rec_active = true;
|
|
||||||
|
|
||||||
} else if (rec_active &&
|
} else if (rec_active &&
|
||||||
(_trackview.session()->record_status() != Session::Recording ||
|
(_trackview.session()->record_status() != Session::Recording ||
|
||||||
|
|
|
||||||
|
|
@ -497,6 +497,7 @@
|
||||||
<Modifier name="panner fill" modifier="= alpha:0.7882"/>
|
<Modifier name="panner fill" modifier="= alpha:0.7882"/>
|
||||||
<Modifier name="piano roll black" modifier="= alpha:0.331098"/>
|
<Modifier name="piano roll black" modifier="= alpha:0.331098"/>
|
||||||
<Modifier name="piano roll white" modifier="= alpha:0.4627"/>
|
<Modifier name="piano roll white" modifier="= alpha:0.4627"/>
|
||||||
|
<Modifier name="recording rect" modifier="= alpha:0.25"/>
|
||||||
<Modifier name="region base" modifier="= alpha:0.99"/>
|
<Modifier name="region base" modifier="= alpha:0.99"/>
|
||||||
<Modifier name="selected midi note" modifier="= alpha:0.7529"/>
|
<Modifier name="selected midi note" modifier="= alpha:0.7529"/>
|
||||||
<Modifier name="selection rect" modifier="= alpha:0.4666"/>
|
<Modifier name="selection rect" modifier="= alpha:0.4666"/>
|
||||||
|
|
|
||||||
|
|
@ -1559,7 +1559,8 @@ MidiRegionView::extend_active_notes()
|
||||||
|
|
||||||
for (unsigned i=0; i < 128; ++i) {
|
for (unsigned i=0; i < 128; ++i) {
|
||||||
if (_active_notes[i]) {
|
if (_active_notes[i]) {
|
||||||
_active_notes[i]->set_x1 (trackview.editor().sample_to_pixel(_region->length()));
|
_active_notes[i]->set_x1(
|
||||||
|
trackview.editor().sample_to_pixel(_region->position() + _region->length()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3781,8 +3782,6 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w)
|
||||||
|
|
||||||
boost::shared_ptr<MidiBuffer> buf = mtv->midi_track()->get_gui_feed_buffer ();
|
boost::shared_ptr<MidiBuffer> buf = mtv->midi_track()->get_gui_feed_buffer ();
|
||||||
|
|
||||||
BeatsFramesConverter converter (trackview.session()->tempo_map(), mtv->midi_track()->get_capture_start_frame (0));
|
|
||||||
|
|
||||||
framepos_t back = max_framepos;
|
framepos_t back = max_framepos;
|
||||||
|
|
||||||
for (MidiBuffer::iterator i = buf->begin(); i != buf->end(); ++i) {
|
for (MidiBuffer::iterator i = buf->begin(); i != buf->end(); ++i) {
|
||||||
|
|
@ -3796,12 +3795,8 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ev.time() is in session frames, so (ev.time() - converter.origin_b()) is
|
/* convert from session frames to source beats */
|
||||||
frames from the start of the source, and so time_beats is in terms of the
|
Evoral::MusicalTime const time_beats = _source_relative_time_converter.from(ev.time());
|
||||||
source.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Evoral::MusicalTime const time_beats = converter.from (ev.time () - converter.origin_b ());
|
|
||||||
|
|
||||||
if (ev.type() == MIDI_CMD_NOTE_ON) {
|
if (ev.type() == MIDI_CMD_NOTE_ON) {
|
||||||
boost::shared_ptr<NoteType> note (
|
boost::shared_ptr<NoteType> note (
|
||||||
|
|
|
||||||
|
|
@ -497,12 +497,12 @@ MidiStreamView::setup_rec_box ()
|
||||||
if (region) {
|
if (region) {
|
||||||
region->set_start (_trackview.track()->current_capture_start()
|
region->set_start (_trackview.track()->current_capture_start()
|
||||||
- _trackview.track()->get_capture_start_frame (0));
|
- _trackview.track()->get_capture_start_frame (0));
|
||||||
region->set_position (_trackview.track()->current_capture_start());
|
region->set_position (_trackview.session()->transport_frame());
|
||||||
|
|
||||||
RegionView* rv = add_region_view_internal (region, false, true);
|
RegionView* rv = add_region_view_internal (region, false, true);
|
||||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);
|
||||||
mrv->begin_write ();
|
mrv->begin_write ();
|
||||||
|
|
||||||
|
|
||||||
/* rec region will be destroyed in setup_rec_box */
|
/* rec region will be destroyed in setup_rec_box */
|
||||||
rec_regions.push_back (make_pair (region, rv));
|
rec_regions.push_back (make_pair (region, rv));
|
||||||
|
|
||||||
|
|
@ -515,32 +515,7 @@ MidiStreamView::setup_rec_box ()
|
||||||
|
|
||||||
/* start a new rec box */
|
/* start a new rec box */
|
||||||
|
|
||||||
boost::shared_ptr<MidiTrack> mt = _trackview.midi_track(); /* we know what it is already */
|
create_rec_box(_trackview.midi_track()->current_capture_start(), 0);
|
||||||
framepos_t const frame_pos = mt->current_capture_start ();
|
|
||||||
gdouble const xstart = _trackview.editor().sample_to_pixel (frame_pos);
|
|
||||||
gdouble const xend = xstart;
|
|
||||||
uint32_t fill_color;
|
|
||||||
|
|
||||||
fill_color = ARDOUR_UI::config()->color ("recording rect");
|
|
||||||
|
|
||||||
ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::Rectangle (_canvas_group);
|
|
||||||
rec_rect->set (ArdourCanvas::Rect (xstart, 1, xend, _trackview.current_height() - 1));
|
|
||||||
rec_rect->set_outline_color (ARDOUR_UI::config()->color ("recording rect"));
|
|
||||||
rec_rect->set_fill_color (fill_color);
|
|
||||||
rec_rect->lower_to_bottom();
|
|
||||||
|
|
||||||
RecBoxInfo recbox;
|
|
||||||
recbox.rectangle = rec_rect;
|
|
||||||
recbox.start = _trackview.session()->transport_frame();
|
|
||||||
recbox.length = 0;
|
|
||||||
|
|
||||||
rec_rects.push_back (recbox);
|
|
||||||
|
|
||||||
screen_update_connection.disconnect();
|
|
||||||
screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (
|
|
||||||
sigc::mem_fun (*this, &MidiStreamView::update_rec_box));
|
|
||||||
rec_updating = true;
|
|
||||||
rec_active = true;
|
|
||||||
|
|
||||||
} else if (rec_active &&
|
} else if (rec_active &&
|
||||||
(_trackview.session()->record_status() != Session::Recording ||
|
(_trackview.session()->record_status() != Session::Recording ||
|
||||||
|
|
@ -559,7 +534,6 @@ MidiStreamView::setup_rec_box ()
|
||||||
/* disconnect rapid update */
|
/* disconnect rapid update */
|
||||||
screen_update_connection.disconnect();
|
screen_update_connection.disconnect();
|
||||||
rec_data_ready_connections.drop_connections ();
|
rec_data_ready_connections.drop_connections ();
|
||||||
|
|
||||||
rec_updating = false;
|
rec_updating = false;
|
||||||
rec_active = false;
|
rec_active = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,12 @@ class MidiStreamView : public StreamView
|
||||||
void suspend_updates ();
|
void suspend_updates ();
|
||||||
void resume_updates ();
|
void resume_updates ();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
void setup_rec_box ();
|
void setup_rec_box ();
|
||||||
void update_rec_box ();
|
void update_rec_box ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
RegionView* add_region_view_internal (
|
RegionView* add_region_view_internal (
|
||||||
boost::shared_ptr<ARDOUR::Region>,
|
boost::shared_ptr<ARDOUR::Region>,
|
||||||
bool wait_for_waves,
|
bool wait_for_waves,
|
||||||
|
|
|
||||||
|
|
@ -404,6 +404,43 @@ StreamView::transport_looped()
|
||||||
Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&StreamView::setup_rec_box, this));
|
Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&StreamView::setup_rec_box, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StreamView::create_rec_box(framepos_t frame_pos, double width)
|
||||||
|
{
|
||||||
|
const double xstart = _trackview.editor().sample_to_pixel(frame_pos);
|
||||||
|
const double xend = xstart + width;
|
||||||
|
const uint32_t fill_color = ARDOUR_UI::config()->color_mod("recording rect", "recording_rect");
|
||||||
|
|
||||||
|
ArdourCanvas::Rectangle* rec_rect = new ArdourCanvas::TimeRectangle(_canvas_group);
|
||||||
|
rec_rect->set_x0(xstart);
|
||||||
|
rec_rect->set_y0(0);
|
||||||
|
rec_rect->set_x1(xend);
|
||||||
|
rec_rect->set_y1(child_height ());
|
||||||
|
rec_rect->set_outline_what(ArdourCanvas::Rectangle::What(0));
|
||||||
|
rec_rect->set_outline_color(ARDOUR_UI::config()->color("recording rect"));
|
||||||
|
rec_rect->set_fill_color(fill_color);
|
||||||
|
rec_rect->lower_to_bottom();
|
||||||
|
|
||||||
|
RecBoxInfo recbox;
|
||||||
|
recbox.rectangle = rec_rect;
|
||||||
|
recbox.length = 0;
|
||||||
|
|
||||||
|
if (rec_rects.empty()) {
|
||||||
|
recbox.start = _trackview.session()->record_location ();
|
||||||
|
} else {
|
||||||
|
recbox.start = _trackview.session()->transport_frame ();
|
||||||
|
}
|
||||||
|
|
||||||
|
rec_rects.push_back (recbox);
|
||||||
|
|
||||||
|
screen_update_connection.disconnect();
|
||||||
|
screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect(
|
||||||
|
sigc::mem_fun(*this, &StreamView::update_rec_box));
|
||||||
|
|
||||||
|
rec_updating = true;
|
||||||
|
rec_active = true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StreamView::update_rec_box ()
|
StreamView::update_rec_box ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ protected:
|
||||||
void transport_looped();
|
void transport_looped();
|
||||||
void rec_enable_changed();
|
void rec_enable_changed();
|
||||||
void sess_rec_enable_changed();
|
void sess_rec_enable_changed();
|
||||||
|
void create_rec_box(framepos_t frame_pos, double width);
|
||||||
virtual void setup_rec_box () = 0;
|
virtual void setup_rec_box () = 0;
|
||||||
virtual void update_rec_box ();
|
virtual void update_rec_box ();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue