diff options
author | Robin Gareus <robin@gareus.org> | 2015-09-15 14:42:43 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-09-15 14:44:05 +0200 |
commit | b05912b0cb20b1827f8f82d0234d7659475b988c (patch) | |
tree | 94f97e181c5f6e42b39f8c3db6d39208b6f821c8 | |
parent | 04e7cfabbe58605e6770adbd9e27bf871a957bef (diff) |
GUI part: cleanup peak-files
-rw-r--r-- | gtk2_ardour/ardour.menus.in | 3 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 42 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 1 |
7 files changed, 67 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 27c030669e..f997347a7b 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -36,7 +36,8 @@ <menuitem action='ExportVideo'/> </menu> <menu name='Cleanup' action='Cleanup'> - <menuitem action='bring-into-session'/> + <menuitem action='bring-into-session'/> + <menuitem action='CleanupPeakFiles'/> <menuitem action='CleanupUnused'/> <menuitem action='FlushWastebasket'/> </menu> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 89f0bb4f90..c041e7d89f 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -107,6 +107,7 @@ typedef uint64_t microseconds_t; #include "ambiguous_file_dialog.h" #include "ardour_ui.h" #include "audio_clock.h" +#include "audio_region_view.h" #include "big_clock_window.h" #include "bundle_manager.h" #include "engine_dialog.h" @@ -3713,6 +3714,47 @@ ARDOUR_UI::flush_trash () } void +ARDOUR_UI::cleanup_peakfiles () +{ + if (_session == 0) { + /* shouldn't happen: menu item is insensitive */ + return; + } + + if (! _session->can_cleanup_peakfiles ()) { + return; + } + + // get all region-views in this session + RegionSelection rs; + TrackViewList empty; + empty.clear(); + editor->get_regions_after(rs, (framepos_t) 0, empty); + std::list<RegionView*> views = rs.by_layer(); + + // remove displayed audio-region-views waveforms + for (list<RegionView*>::iterator i = views.begin(); i != views.end(); ++i) { + AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*i); + if (!arv) { continue ; } + arv->delete_waves(); + } + + // cleanup peak files: + // - stop pending peakfile threads + // - close peakfiles if any + // - remove peak dir in session + // - setup peakfiles (background thread) + _session->cleanup_peakfiles (); + + // re-add waves to ARV + for (list<RegionView*>::iterator i = views.begin(); i != views.end(); ++i) { + AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*i); + if (!arv) { continue ; } + arv->create_waves(); + } +} + +void ARDOUR_UI::setup_order_hint (AddRouteDialog::InsertAt place) { uint32_t order_hint = UINT32_MAX; diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index f279ebd6ad..244972d838 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -688,6 +688,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void display_cleanup_results (ARDOUR::CleanupReport& rep, const gchar* list_title, const bool msg_delete); void cleanup (); + void cleanup_peakfiles (); void flush_trash (); bool have_configure_timeout; diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 4455e72832..d08f47f76a 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -182,6 +182,10 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); + act = ActionManager::register_action (main_actions, X_("CleanupPeakFiles"), _("Clean-up Peak Files..."), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup_peakfiles)); + ActionManager::session_sensitive_actions.push_back (act); + ActionManager::write_sensitive_actions.push_back (act); + act = ActionManager::register_action (main_actions, X_("FlushWastebasket"), _("Flush Wastebasket"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::flush_trash)); ActionManager::write_sensitive_actions.push_back (act); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index fef4868dc8..18d17af380 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -1116,6 +1116,22 @@ AudioRegionView::update_envelope_visibility () } void +AudioRegionView::delete_waves () +{ + for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) { + delete *i; + } + _data_ready_connections.clear (); + + for (vector<WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) { + group->remove(*w); + } + waves.clear(); + tmp_waves.clear(); + pending_peak_data->show (); +} + +void AudioRegionView::create_waves () { // cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index 367a701ea8..e82b5fc5ed 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -74,6 +74,7 @@ class AudioRegionView : public RegionView boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const; void create_waves (); + void delete_waves (); void set_height (double); void set_samples_per_pixel (double); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 63778dfaec..fcc53464a6 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -421,6 +421,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi bool for_mark = false) = 0; virtual void get_regions_at (RegionSelection &, framepos_t where, TrackViewList const &) const = 0; + virtual void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const = 0; virtual RegionSelection get_regions_from_selection_and_mouse (framepos_t) = 0; virtual void get_regionviews_by_id (PBD::ID const id, RegionSelection & regions) const = 0; virtual void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > >&) const = 0; |