X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Faudio_streamview.cc;h=3a7f985e303a99b3d9b1ea0042258e6e68947ce4;hb=90e73a3a6dc196f8295291eca7e67e85595b82d4;hp=8dcee5aaab1bf4d10f25c9bc8bb68578de0898ea;hpb=0d36301907afd612f93a7bfa53724cc9a17724de;p=ardour.git diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 8dcee5aaab..3a7f985e30 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001, 2006 Paul Davis + Copyright (C) 2001, 2006 Paul Davis 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 @@ -24,15 +24,17 @@ #include +#include "pbd/stacktrace.h" + #include "ardour/audioplaylist.h" #include "ardour/audioregion.h" #include "ardour/audiofilesource.h" -#include "ardour/audio_diskstream.h" #include "ardour/audio_track.h" -#include "ardour/playlist_templates.h" #include "ardour/source.h" #include "ardour/region_factory.h" #include "ardour/profile.h" +#include "ardour/rc_configuration.h" +#include "ardour/session.h" #include "audio_streamview.h" #include "audio_region_view.h" @@ -59,32 +61,30 @@ using namespace Editing; AudioStreamView::AudioStreamView (AudioTimeAxisView& tv) : StreamView (tv) { - crossfades_visible = true; - _waveform_scale = LinearWaveform; - _waveform_shape = Traditional; + crossfades_visible = tv.session()->config.get_xfades_visible (); color_handler (); _amplitude_above_axis = 1.0; - use_rec_regions = tv.editor().show_waveforms_recording (); + Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&AudioStreamView::parameter_changed, this, _1), gui_context()); } AudioStreamView::~AudioStreamView () { } -int +int AudioStreamView::set_samples_per_unit (gdouble spp) { StreamView::set_samples_per_unit(spp); for (CrossfadeViewList::iterator xi = crossfade_views.begin(); xi != crossfade_views.end(); ++xi) { - (*xi)->set_samples_per_unit (spp); + xi->second->set_samples_per_unit (spp); } return 0; } -int +int AudioStreamView::set_amplitude_above_axis (gdouble app) { RegionViewList::iterator i; @@ -105,49 +105,33 @@ AudioStreamView::set_amplitude_above_axis (gdouble app) } RegionView* -AudioStreamView::add_region_view_internal (boost::shared_ptr r, bool wait_for_waves, bool recording) +AudioStreamView::create_region_view (boost::shared_ptr r, bool wait_for_waves, bool recording) { AudioRegionView *region_view = 0; - boost::shared_ptr region = boost::dynamic_pointer_cast (r); if (region == 0) { - return NULL; - } - - for (list::iterator i = region_views.begin(); i != region_views.end(); ++i) { - if ((*i)->region() == r) { - - /* great. we already have a AudioRegionView for this Region. use it again. */ - - (*i)->set_valid (true); - - // this might not be necessary - AudioRegionView* const arv = dynamic_cast(*i); - if (arv) { - arv->set_waveform_scale (_waveform_scale); - arv->set_waveform_shape (_waveform_shape); - } - - return NULL; - } + return 0; } switch (_trackview.audio_track()->mode()) { - + case NonLayered: case Normal: if (recording) { - region_view = new AudioRegionView (canvas_group, _trackview, region, + region_view = new AudioRegionView (_canvas_group, _trackview, region, _samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility( - TimeAxisViewItem::ShowFrame | TimeAxisViewItem::HideFrameRight)); + TimeAxisViewItem::ShowFrame | + TimeAxisViewItem::HideFrameRight | + TimeAxisViewItem::HideFrameLeft | + TimeAxisViewItem::HideFrameTB)); } else { - region_view = new AudioRegionView (canvas_group, _trackview, region, + region_view = new AudioRegionView (_canvas_group, _trackview, region, _samples_per_unit, region_color); } break; case Destructive: - region_view = new TapeAudioRegionView (canvas_group, _trackview, region, + region_view = new TapeAudioRegionView (_canvas_group, _trackview, region, _samples_per_unit, region_color); break; default: @@ -159,43 +143,57 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr r, bool wai region_view->init (region_color, wait_for_waves); region_view->set_amplitude_above_axis(_amplitude_above_axis); region_view->set_height (child_height ()); - region_views.push_front (region_view); - /* if its the special single-sample length that we use for rec-regions, make it - insensitive to events + /* if its the special single-sample length that we use for rec-regions, make it + insensitive to events */ if (region->length() == 1) { region_view->set_sensitive (false); } - /* if this was the first one, then lets query the waveform scale and shape. - otherwise, we set it to the current value */ - - if (region_views.size() == 1) { - if (region_view->waveform_logscaled()) { - _waveform_scale = LogWaveform; - } else { - _waveform_scale = LinearWaveform; - } + region_view->set_waveform_scale (Config->get_waveform_scale ()); + region_view->set_waveform_shape (Config->get_waveform_shape ()); + region_view->set_waveform_visible (Config->get_show_waveforms ()); - if (region_view->waveform_rectified()) { - _waveform_shape = Rectified; - } else { - _waveform_shape = Traditional; - } - } - else { - region_view->set_waveform_scale(_waveform_scale); - region_view->set_waveform_shape(_waveform_shape); - } + return region_view; +} + +RegionView* +AudioStreamView::add_region_view_internal (boost::shared_ptr r, bool wait_for_waves, bool recording) +{ + RegionView *region_view = create_region_view (r, wait_for_waves, recording); - /* follow global waveform setting */ + if (region_view == 0) { + return 0; + } + +// if(!recording){ +// for (list::iterator i = region_views.begin(); i != region_views.end(); ++i) { +// if ((*i)->region() == r) { +// cerr << "audio_streamview in add_region_view_internal region found" << endl; + /* great. we already have a AudioRegionView for this Region. use it again. */ + +// (*i)->set_valid (true); - region_view->set_waveform_visible(_trackview.editor().show_waveforms()); + // this might not be necessary +// AudioRegionView* const arv = dynamic_cast(*i); - /* catch regionview going away */ - region->GoingAway.connect (bind (mem_fun (*this, &AudioStreamView::remove_region_view), boost::weak_ptr (r))); +// if (arv) { +// arv->set_waveform_scale (_waveform_scale); +// arv->set_waveform_shape (_waveform_shape); +// } + +// return NULL; +// } +// } +// } + + region_views.push_front (region_view); + + /* catch region going away */ + + r->DropReferences.connect (*this, invalidator (*this), boost::bind (&AudioStreamView::remove_region_view, this, boost::weak_ptr (r)), gui_context()); RegionViewAdded (region_view); @@ -205,7 +203,7 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr r, bool wai void AudioStreamView::remove_region_view (boost::weak_ptr weak_r) { - ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::remove_region_view), weak_r)); + ENSURE_GUI_THREAD (*this, &AudioStreamView::remove_region_view, weak_r); boost::shared_ptr r (weak_r.lock()); @@ -213,20 +211,20 @@ AudioStreamView::remove_region_view (boost::weak_ptr weak_r) return; } - if (!_trackview.session().deletion_in_progress()) { + if (!_trackview.session()->deletion_in_progress()) { + + for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end();) { + CrossfadeViewList::iterator tmp; - for (list::iterator i = crossfade_views.begin(); i != crossfade_views.end();) { - list::iterator tmp; - tmp = i; ++tmp; - + boost::shared_ptr ar = boost::dynamic_pointer_cast(r); - if (ar && (*i)->crossfade->involves (ar)) { - delete *i; + if (ar && i->second->crossfade->involves (ar)) { + delete i->second; crossfade_views.erase (i); } - + i = tmp; } } @@ -235,101 +233,78 @@ AudioStreamView::remove_region_view (boost::weak_ptr weak_r) } void -AudioStreamView::undisplay_diskstream () +AudioStreamView::undisplay_track () { - StreamView::undisplay_diskstream(); + StreamView::undisplay_track (); for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { - delete *i; + delete i->second; } crossfade_views.clear (); } void -AudioStreamView::playlist_modified_weak (boost::weak_ptr ds) +AudioStreamView::playlist_layered (boost::weak_ptr wtr) { - boost::shared_ptr sp (ds.lock()); - if (sp) { - playlist_modified (sp); + boost::shared_ptr tr (wtr.lock()); + + if (!tr) { + return; } -} -void -AudioStreamView::playlist_modified (boost::shared_ptr ds) -{ - /* we do not allow shared_ptr to be bound to slots */ - ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::playlist_modified_weak), ds)); + StreamView::playlist_layered (wtr); - StreamView::playlist_modified (ds); - /* make sure xfades are on top and all the regionviews are stacked correctly. */ - for (list::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { - (*i)->get_canvas_group()->raise_to_top(); + for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { + i->second->get_canvas_group()->raise_to_top(); } } void -AudioStreamView::playlist_changed_weak (boost::weak_ptr ds) +AudioStreamView::playlist_switched (boost::weak_ptr wtr) { - boost::shared_ptr sp (ds.lock()); - if (sp) { - playlist_changed (sp); + boost::shared_ptr tr (wtr.lock()); + + if (!tr) { + return; } -} -void -AudioStreamView::playlist_changed (boost::shared_ptr ds) -{ - ENSURE_GUI_THREAD (bind ( - mem_fun (*this, &AudioStreamView::playlist_changed_weak), - boost::weak_ptr (ds))); + playlist_connections.drop_connections (); - StreamView::playlist_changed(ds); + StreamView::playlist_switched (tr); + + boost::shared_ptr apl = boost::dynamic_pointer_cast (tr->playlist()); - boost::shared_ptr apl = boost::dynamic_pointer_cast(ds->playlist()); if (apl) { - playlist_connections.push_back (apl->NewCrossfade.connect ( - mem_fun (*this, &AudioStreamView::add_crossfade))); + apl->NewCrossfade.connect (playlist_connections, invalidator (*this), ui_bind (&AudioStreamView::add_crossfade, this, _1), gui_context()); } } void -AudioStreamView::add_crossfade_weak (boost::weak_ptr crossfade) +AudioStreamView::add_crossfade (boost::weak_ptr wc) { - boost::shared_ptr sp (crossfade.lock()); + boost::shared_ptr crossfade (wc.lock()); - if (!sp) { + if (!crossfade) { return; } - add_crossfade (sp); -} - -void -AudioStreamView::add_crossfade (boost::shared_ptr crossfade) -{ AudioRegionView* lview = 0; AudioRegionView* rview = 0; - /* we do not allow shared_ptr to be bound to slots */ - - ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::add_crossfade_weak), boost::weak_ptr (crossfade))); - /* first see if we already have a CrossfadeView for this Crossfade */ - for (list::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { - if ((*i)->crossfade == crossfade) { - - if (!crossfades_visible || _layer_display == Stacked) { - (*i)->hide(); - } else { - (*i)->show (); - } - (*i)->set_valid (true); - return; + CrossfadeViewList::iterator i = crossfade_views.find (crossfade); + if (i != crossfade_views.end()) { + if (!crossfades_visible) { + i->second->hide(); + } else { + i->second->show (); } + i->second->set_valid (true); + return; } /* create a new one */ @@ -352,23 +327,25 @@ AudioStreamView::add_crossfade (boost::shared_ptr crossfade) region_color, *lview, *rview); cv->set_valid (true); - crossfade->Invalidated.connect (mem_fun (*this, &AudioStreamView::remove_crossfade)); - crossfade_views.push_back (cv); - if (!Config->get_xfades_visible() || !crossfades_visible || _layer_display == Stacked) { + crossfade->Invalidated.connect (*this, invalidator (*this), ui_bind (&AudioStreamView::remove_crossfade, this, _1), gui_context()); + crossfade_views[cv->crossfade] = cv; + if (!crossfades_visible) { cv->hide (); } + + update_content_height (cv); } void AudioStreamView::remove_crossfade (boost::shared_ptr r) { - ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::remove_crossfade), r)); + ENSURE_GUI_THREAD (*this, &AudioStreamView::remove_crossfade, r) boost::shared_ptr xfade = boost::dynamic_pointer_cast (r); - for (list::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { - if ((*i)->crossfade == xfade) { - delete *i; + for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { + if (i->second->crossfade == xfade) { + delete i->second; crossfade_views.erase (i); break; } @@ -376,10 +353,10 @@ AudioStreamView::remove_crossfade (boost::shared_ptr r) } void -AudioStreamView::redisplay_diskstream () +AudioStreamView::redisplay_track () { list::iterator i; - list::iterator xi, tmpx; + CrossfadeViewList::iterator xi, tmpx; // Flag region views as invalid and disable drawing for (i = region_views.begin(); i != region_views.end(); ++i) { @@ -389,31 +366,35 @@ AudioStreamView::redisplay_diskstream () // Flag crossfade views as invalid for (xi = crossfade_views.begin(); xi != crossfade_views.end(); ++xi) { - (*xi)->set_valid (false); - if ((*xi)->visible() && _layer_display != Stacked) { - (*xi)->show (); + xi->second->set_valid (false); + if (xi->second->visible()) { + xi->second->show (); } } // Add and display region and crossfade views, and flag them as valid + if (_trackview.is_audio_track()) { - _trackview.get_diskstream()->playlist()->foreach_region( - static_cast(this), - &StreamView::add_region_view); + _trackview.track()->playlist()->foreach_region( + sigc::hide_return (sigc::mem_fun (*this, &StreamView::add_region_view)) + ); boost::shared_ptr apl = boost::dynamic_pointer_cast( - _trackview.get_diskstream()->playlist()); - if (apl) - apl->foreach_crossfade (this, &AudioStreamView::add_crossfade); + _trackview.track()->playlist() + ); + + if (apl) { + apl->foreach_crossfade (sigc::mem_fun (*this, &AudioStreamView::add_crossfade)); + } } - + // Remove invalid crossfade views for (xi = crossfade_views.begin(); xi != crossfade_views.end();) { tmpx = xi; tmpx++; - if (!(*xi)->valid()) { - delete *xi; + if (!xi->second->valid()) { + delete xi->second; crossfade_views.erase (xi); } @@ -443,78 +424,81 @@ AudioStreamView::set_waveform_shape (WaveformShape shape) if (arv) arv->set_waveform_shape (shape); } - _waveform_shape = shape; -} +} void AudioStreamView::set_waveform_scale (WaveformScale scale) { for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) { AudioRegionView* const arv = dynamic_cast(*i); - if (arv) + if (arv) { arv->set_waveform_scale (scale); + } } - _waveform_scale = scale; -} +} void AudioStreamView::setup_rec_box () { //cerr << _trackview.name() << " streamview SRB region_views.size() = " << region_views.size() << endl; - if (_trackview.session().transport_rolling()) { + if (_trackview.session()->transport_rolling()) { // cerr << "\trolling\n"; - if (!rec_active && - _trackview.session().record_status() == Session::Recording && - _trackview.get_diskstream()->record_enabled()) { - if (_trackview.audio_track()->mode() == Normal && use_rec_regions && rec_regions.size() == rec_rects.size()) { + if (!rec_active && + _trackview.session()->record_status() == Session::Recording && + _trackview.track()->record_enabled()) { + if (_trackview.audio_track()->mode() == Normal && Config->get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { - /* add a new region, but don't bother if they set use_rec_regions mid-record */ + /* add a new region, but don't bother if they set show-waveforms-while-recording mid-record */ SourceList sources; - for (list::iterator prc = rec_data_ready_connections.begin(); prc != rec_data_ready_connections.end(); ++prc) { - (*prc).disconnect(); - } - rec_data_ready_connections.clear(); - - // FIXME - boost::shared_ptr ads = boost::dynamic_pointer_cast(_trackview.get_diskstream()); - assert(ads); - - for (uint32_t n=0; n < ads->n_channels().n_audio(); ++n) { - boost::shared_ptr src = boost::static_pointer_cast (ads->write_source (n)); + rec_data_ready_connections.drop_connections (); + boost::shared_ptr tr = _trackview.audio_track(); + + for (uint32_t n = 0; n < tr->n_channels().n_audio(); ++n) { + boost::shared_ptr src = tr->write_source (n); if (src) { sources.push_back (src); - - rec_data_ready_connections.push_back (src->PeakRangeReady.connect (bind - (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), boost::weak_ptr(src)))); + src->PeakRangeReady.connect (rec_data_ready_connections, + invalidator (*this), + ui_bind (&AudioStreamView::rec_peak_range_ready, this, _1, _2, boost::weak_ptr(src)), + gui_context()); } } // handle multi - + nframes_t start = 0; if (rec_regions.size() > 0) { - start = rec_regions.back().first->start() + _trackview.get_diskstream()->get_captured_frames(rec_regions.size()-1); + start = rec_regions.back().first->start() + + _trackview.track()->get_captured_frames(rec_regions.size()-1); } + + PropertyList plist; - boost::shared_ptr region (boost::dynamic_pointer_cast - (RegionFactory::create (sources, start, 1 , "", 0, (Region::Flag)(Region::DefaultFlags | Region::DoNotSaveState), false))); + plist.add (Properties::start, start); + plist.add (Properties::length, 1); + plist.add (Properties::name, string()); + plist.add (Properties::layer, 0); + + boost::shared_ptr region ( + boost::dynamic_pointer_cast(RegionFactory::create (sources, plist, false))); + assert(region); - region->set_position (_trackview.session().transport_frame(), this); - rec_regions.push_back (make_pair(region, (RegionView*)0)); + region->suspend_property_changes (); + region->set_position (_trackview.session()->transport_frame(), this); + rec_regions.push_back (make_pair(region, (RegionView*) 0)); } - + /* start a new rec box */ boost::shared_ptr at; at = _trackview.audio_track(); /* we know what it is already */ - boost::shared_ptr ds = at->audio_diskstream(); - nframes_t frame_pos = ds->current_capture_start (); + nframes_t frame_pos = at->current_capture_start (); gdouble xstart = _trackview.editor().frame_to_pixel (frame_pos); gdouble xend; uint32_t fill_color; @@ -535,37 +519,38 @@ AudioStreamView::setup_rec_box () fill_color = UINT_RGBA_CHANGE_A (fill_color, 120); break; } - - ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*canvas_group); + + ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*_canvas_group); rec_rect->property_x1() = xstart; rec_rect->property_y1() = 1.0; rec_rect->property_x2() = xend; rec_rect->property_y2() = child_height (); + rec_rect->property_outline_what() = 0x0; rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get(); - rec_rect->property_outline_what() = 0x1 | 0x2 | 0x4 | 0x8; rec_rect->property_fill_color_rgba() = fill_color; rec_rect->lower_to_bottom(); - + RecBoxInfo recbox; recbox.rectangle = rec_rect; - recbox.start = _trackview.session().transport_frame(); + 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 (mem_fun (*this, &AudioStreamView::update_rec_box)); + 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 && - (_trackview.session().record_status() != Session::Recording || - !_trackview.get_diskstream()->record_enabled())) { + (_trackview.session()->record_status() != Session::Recording || + !_trackview.track()->record_enabled())) { screen_update_connection.disconnect(); rec_active = false; rec_updating = false; } - + } else { // cerr << "\tNOT rolling, rec_rects = " << rec_rects.size() << " rec_regions = " << rec_regions.size() << endl; @@ -574,15 +559,10 @@ AudioStreamView::setup_rec_box () /* disconnect rapid update */ screen_update_connection.disconnect(); - - for (list::iterator prc = rec_data_ready_connections.begin(); prc != rec_data_ready_connections.end(); ++prc) { - (*prc).disconnect(); - } - rec_data_ready_connections.clear(); - + rec_data_ready_connections.drop_connections (); rec_updating = false; rec_active = false; - + /* remove temp regions */ for (list,RegionView*> >::iterator iter = rec_regions.begin(); iter != rec_regions.end(); ) { @@ -595,7 +575,7 @@ AudioStreamView::setup_rec_box () iter = tmp; } - + rec_regions.clear(); // cerr << "\tclear " << rec_rects.size() << " rec rects\n"; @@ -605,9 +585,9 @@ AudioStreamView::setup_rec_box () RecBoxInfo &rect = (*iter); delete rect.rectangle; } - + rec_rects.clear(); - + } } } @@ -615,31 +595,31 @@ AudioStreamView::setup_rec_box () void AudioStreamView::foreach_crossfadeview (void (CrossfadeView::*pmf)(void)) { - for (list::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { - ((*i)->*pmf) (); + for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { + (i->second->*pmf) (); } } void AudioStreamView::rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::weak_ptr weak_src) { - ENSURE_GUI_THREAD(bind (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), start, cnt, weak_src)); - + ENSURE_GUI_THREAD (*this, &AudioStreamView::rec_peak_range_ready, start, cnt, weak_src) + boost::shared_ptr src (weak_src.lock()); if (!src) { - return; + return; } // this is called from the peak building thread - - if (rec_data_ready_map.size() == 0 || start+cnt > last_rec_data_frame) { + + if (rec_data_ready_map.size() == 0 || start + cnt > last_rec_data_frame) { last_rec_data_frame = start + cnt; } - + rec_data_ready_map[src] = true; - - if (rec_data_ready_map.size() == _trackview.get_diskstream()->n_channels().n_audio()) { + + if (rec_data_ready_map.size() == _trackview.track()->n_channels().n_audio()) { this->update_rec_regions (); rec_data_ready_map.clear(); } @@ -648,14 +628,13 @@ AudioStreamView::rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::we void AudioStreamView::update_rec_regions () { - if (use_rec_regions) { + if (Config->get_show_waveforms_while_recording ()) { uint32_t n = 0; - for (list,RegionView*> >::iterator iter = rec_regions.begin(); iter != rec_regions.end(); n++) { + for (list,RegionView*> >::iterator iter = rec_regions.begin(); + iter != rec_regions.end(); n++) { - list,RegionView*> >::iterator tmp; - - tmp = iter; + list,RegionView*> >::iterator tmp = iter; ++tmp; if (!canvas_item_visible (rec_rects[n].rectangle)) { @@ -663,9 +642,11 @@ AudioStreamView::update_rec_regions () iter = tmp; continue; } - + boost::shared_ptr region = boost::dynamic_pointer_cast(iter->first); + if (!region) { + iter = tmp; continue; } @@ -679,10 +660,10 @@ AudioStreamView::update_rec_regions () if (nlen != region->length()) { - region->freeze (); - region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this); + region->suspend_property_changes (); + region->set_position (_trackview.track()->get_capture_start_frame(n), this); region->set_length (nlen, this); - region->thaw ("updated"); + region->resume_property_changes (); if (origlen == 1) { /* our special initial length */ @@ -698,22 +679,22 @@ AudioStreamView::update_rec_regions () } else { - nframes_t nlen = _trackview.get_diskstream()->get_captured_frames(n); + nframes_t nlen = _trackview.track()->get_captured_frames(n); if (nlen != region->length()) { if (region->source_length(0) >= region->start() + nlen) { - region->freeze (); - region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this); + region->suspend_property_changes (); + region->set_position (_trackview.track()->get_capture_start_frame(n), this); region->set_length (nlen, this); - region->thaw ("updated"); - + region->resume_property_changes (); + if (origlen == 1) { /* our special initial length */ add_region_view_internal (region, false, true); } - + /* also hide rect */ ArdourCanvas::Item * rect = rec_rects[n].rectangle; rect->hide(); @@ -766,9 +747,9 @@ AudioStreamView::hide_all_xfades () void AudioStreamView::hide_xfades_involving (AudioRegionView& rv) { - for (list::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { - if ((*i)->crossfade->involves (rv.audio_region())) { - (*i)->fake_hide (); + for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { + if (i->second->crossfade->involves (rv.audio_region())) { + i->second->fake_hide (); } } } @@ -776,9 +757,9 @@ AudioStreamView::hide_xfades_involving (AudioRegionView& rv) void AudioStreamView::reveal_xfades_involving (AudioRegionView& rv) { - for (list::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { - if ((*i)->crossfade->involves (rv.audio_region()) && (*i)->visible() && _layer_display != Stacked) { - (*i)->show (); + for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { + if (i->second->crossfade->involves (rv.audio_region()) && i->second->visible()) { + i->second->show (); } } } @@ -789,7 +770,7 @@ AudioStreamView::color_handler () //case cAudioTrackBase: if (_trackview.is_track()) { canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioTrackBase.get(); - } + } //case cAudioBusBase: if (!_trackview.is_track()) { @@ -805,13 +786,44 @@ void AudioStreamView::update_contents_height () { StreamView::update_contents_height (); - + for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { - if (_layer_display == Overlaid) { - (*i)->show (); - (*i)->set_height (height); - } else { - (*i)->hide (); - } + update_content_height (i->second); + } +} + +void +AudioStreamView::update_content_height (CrossfadeView* cv) +{ + if (_layer_display == Overlaid) { + + cv->set_y (0); + cv->set_height (height); + + } else { + + layer_t const inl = cv->crossfade->in()->layer (); + layer_t const outl = cv->crossfade->out()->layer (); + + layer_t const high = max (inl, outl); + layer_t const low = min (inl, outl); + + const double h = child_height (); + + cv->set_y ((_layers - high - 1) * h); + cv->set_height ((high - low + 1) * h); + + } +} + +void +AudioStreamView::parameter_changed (string const & p) +{ + if (p == "show-waveforms") { + set_show_waveforms (Config->get_show_waveforms ()); + } else if (p == "waveform-scale") { + set_waveform_scale (Config->get_waveform_scale ()); + } else if (p == "waveform-shape") { + set_waveform_shape (Config->get_waveform_shape ()); } }