diff options
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.cc | 56 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.h | 7 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/streamview.cc | 27 | ||||
-rw-r--r-- | gtk2_ardour/streamview.h | 2 |
7 files changed, 48 insertions, 74 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 55370e7557..b2da3fdc4c 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -178,7 +178,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile) gettimeofday (&last_peak_grab, 0); gettimeofday (&last_shuttle_request, 0); - ARDOUR::AudioDiskstream::DeleteSources.connect (mem_fun(*this, &ARDOUR_UI::delete_sources_in_the_right_thread)); ARDOUR::Diskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler)); ARDOUR::Diskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler)); @@ -1041,8 +1040,7 @@ ARDOUR_UI::transport_record () switch (session->record_status()) { case Session::Disabled: if (session->ntracks() == 0) { - string txt = _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu."); - MessageDialog msg (*editor, txt); + MessageDialog msg (*editor, _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu.")); msg.run (); return; } @@ -2197,18 +2195,6 @@ ARDOUR_UI::halt_on_xrun_message () msg.run (); } -void -ARDOUR_UI::delete_sources_in_the_right_thread (list<boost::shared_ptr<ARDOUR::Source> >* deletion_list) -{ - ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::delete_sources_in_the_right_thread), deletion_list)); - - for (list<boost::shared_ptr<Source> >::iterator i = deletion_list->begin(); i != deletion_list->end(); ++i) { - (*i)->drop_references (); - } - - delete deletion_list; -} - void ARDOUR_UI::disk_overrun_handler () { diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index cf6cda526a..69f2cd0492 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -624,8 +624,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI struct timeval last_peak_grab; struct timeval last_shuttle_request; - void delete_sources_in_the_right_thread (list<boost::shared_ptr<ARDOUR::Source> >*); - void editor_display_control_changed (Editing::DisplayControl c); bool have_disk_overrun_displayed; diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 085f429f99..222c920709 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -128,6 +128,8 @@ AudioStreamView::set_amplitude_above_axis (gdouble app) void AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait_for_waves) { + AudioRegionView *region_view; + ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::add_region_view), r)); boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (r); @@ -136,19 +138,16 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai return; } - AudioRegionView *region_view; - list<RegionView *>::iterator i; - - for (i = region_views.begin(); i != region_views.end(); ++i) { + for (list<RegionView *>::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); return; } } - + switch (_trackview.audio_track()->mode()) { case Normal: region_view = new AudioRegionView (canvas_group, _trackview, region, @@ -170,15 +169,21 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai /* catch regionview going away */ - region->GoingAway.connect (bind (mem_fun (*this, &AudioStreamView::remove_region_view), region)); - + region->GoingAway.connect (bind (mem_fun (*this, &AudioStreamView::remove_region_view), boost::weak_ptr<Region> (r))); + RegionViewAdded (region_view); } void -AudioStreamView::remove_region_view (boost::shared_ptr<Region> r) +AudioStreamView::remove_region_view (boost::weak_ptr<Region> weak_r) { - ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::remove_region_view), r)); + ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::remove_region_view), weak_r)); + + boost::shared_ptr<Region> r (weak_r.lock()); + + if (!r) { + return; + } for (list<CrossfadeView *>::iterator i = crossfade_views.begin(); i != crossfade_views.end();) { list<CrossfadeView*>::iterator tmp; @@ -406,7 +411,7 @@ AudioStreamView::setup_rec_box () boost::shared_ptr<AudioFileSource> src = boost::static_pointer_cast<AudioFileSource> (ads->write_source (n)); if (src) { sources.push_back (src); - peak_ready_connections.push_back (src->PeakRangeReady.connect (bind (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), src))); + peak_ready_connections.push_back (src->PeakRangeReady.connect (bind (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), boost::weak_ptr<Source>(src)))); } } @@ -420,11 +425,8 @@ AudioStreamView::setup_rec_box () boost::shared_ptr<AudioRegion> region (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (sources, start, 1 , "", 0, (Region::Flag)(Region::DefaultFlags | Region::DoNotSaveState), false))); region->set_position (_trackview.session().transport_frame(), this); - rec_regions.push_back (region); - - // rec regions are destroyed in setup_rec_box - /* we add the region later */ + rec_regions.push_back (region); } /* start a new rec box */ @@ -503,13 +505,9 @@ AudioStreamView::setup_rec_box () last_rec_peak_frame = 0; /* remove temp regions */ - - for (list<boost::shared_ptr<Region> >::iterator iter = rec_regions.begin(); iter != rec_regions.end();) { - list<boost::shared_ptr<Region> >::iterator tmp; - tmp = iter; - ++tmp; + + for (list<boost::shared_ptr<Region> >::iterator iter = rec_regions.begin(); iter != rec_regions.end(); ++iter) { (*iter)->drop_references (); - iter = tmp; } rec_regions.clear(); @@ -537,18 +535,24 @@ AudioStreamView::foreach_crossfadeview (void (CrossfadeView::*pmf)(void)) } void -AudioStreamView::rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::shared_ptr<Source> src) +AudioStreamView::rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::weak_ptr<Source> weak_src) { - // this is called from the peak building thread + ENSURE_GUI_THREAD(bind (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), start, cnt, weak_src)); + + boost::shared_ptr<Source> src (weak_src.lock()); - ENSURE_GUI_THREAD(bind (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), start, cnt, src)); + if (!src) { + return; + } + + // this is called from the peak building thread if (rec_peak_ready_map.size() == 0 || start+cnt > last_rec_peak_frame) { last_rec_peak_frame = start + cnt; } - + rec_peak_ready_map[src] = true; - + if (rec_peak_ready_map.size() == _trackview.get_diskstream()->n_channels()) { this->update_rec_regions (); rec_peak_ready_map.clear(); diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index b61101f788..c6db40f336 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -23,6 +23,8 @@ #include <map> #include <cmath> +#include <boost/weak_ptr.hpp> + #include <ardour/location.h> #include "enums.h" #include "simplerect.h" @@ -76,13 +78,12 @@ class AudioStreamView : public StreamView private: void setup_rec_box (); - void rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::shared_ptr<ARDOUR::Source> src); + void rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::weak_ptr<ARDOUR::Source> src); void update_rec_regions (); void add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves); - void remove_region_view (boost::shared_ptr<ARDOUR::Region> ); + void remove_region_view (boost::weak_ptr<ARDOUR::Region> ); void remove_audio_region_view (boost::shared_ptr<ARDOUR::AudioRegion> ); - void remove_audio_rec_region (boost::shared_ptr<ARDOUR::AudioRegion>); void undisplay_diskstream (); void redisplay_diskstream (); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index f1fe88cd7a..fb0d0782dc 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -132,8 +132,8 @@ static const gchar *zoom_focus_strings[] = { N_("Focus Left"), N_("Focus Right"), N_("Focus Center"), - N_("Focus Play"), - N_("Focus Edit"), + N_("Focus Playhead"), + N_("Focus Edit Cursor"), 0 }; @@ -801,8 +801,8 @@ Editor::set_frames_per_unit (double fpu) return; } - if (fpu < 1.0) { - fpu = 1.0; + if (fpu < 2.0) { + fpu = 2.0; } // convert fpu to frame count @@ -817,6 +817,10 @@ Editor::set_frames_per_unit (double fpu) return; } + if (fpu == frames_per_unit) { + return; + } + frames_per_unit = fpu; if (frames != zoom_range_clock.current_duration()) { diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 097e581cdf..0a35709538 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -164,9 +164,11 @@ StreamView::add_region_view (boost::shared_ptr<Region> r) } void -StreamView::remove_region_view (boost::shared_ptr<Region> r) +StreamView::remove_region_view (boost::weak_ptr<Region> weak_r) { - ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::remove_region_view), r)); + ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::remove_region_view), weak_r)); + + boost::shared_ptr<Region> r (weak_r.lock()); for (list<RegionView *>::iterator i = region_views.begin(); i != region_views.end(); ++i) { if (((*i)->region()) == r) { @@ -177,27 +179,6 @@ StreamView::remove_region_view (boost::shared_ptr<Region> r) } } -#if 0 -(unused) -void -StreamView::remove_rec_region (boost::shared_ptr<Region> r) -{ - ENSURE_GUI_THREAD(bind (mem_fun (*this, &StreamView::remove_rec_region), r)); - - if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) { - fatal << "region deleted from non-GUI thread!" << endmsg; - /*NOTREACHED*/ - } - - for (list<boost::shared_ptr<Region> >::iterator i = rec_regions.begin(); i != rec_regions.end(); ++i) { - if (*i == r) { - rec_regions.erase (i); - break; - } - } -} -#endif - void StreamView::undisplay_diskstream () { diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index b1fd3c1b29..cc5f9cb414 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -108,7 +108,7 @@ protected: virtual void update_rec_regions () = 0; virtual void add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves) = 0; - virtual void remove_region_view (boost::shared_ptr<ARDOUR::Region> ); + virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> ); //void remove_rec_region (boost::shared_ptr<ARDOUR::Region>); (unused) void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream>); |