From 92fbab32c65c0ad5fd10a6720318d43c3cc97ebd Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 18 May 2023 21:47:27 +0200 Subject: [PATCH] Update codebase to use PBD::Progress (1/2) --- libs/ardour/analysis_graph.cc | 7 ++++--- libs/ardour/ardour/analysis_graph.h | 7 +++++-- libs/ardour/ardour/audioregion.h | 6 +++--- libs/ardour/ardour/filter.h | 7 +++++-- libs/ardour/ardour/midi_stretch.h | 2 +- libs/ardour/ardour/rb_effect.h | 2 +- libs/ardour/ardour/region.h | 7 +++++-- libs/ardour/ardour/reverse.h | 2 +- libs/ardour/ardour/session.h | 4 ++-- libs/ardour/ardour/sndfilesource.h | 7 +++++-- libs/ardour/ardour/stretch.h | 2 +- libs/ardour/ardour/strip_silence.h | 2 +- libs/ardour/audioregion.cc | 2 +- libs/ardour/luabindings.cc | 8 ++++---- libs/ardour/rb_effect.cc | 2 +- libs/ardour/region.cc | 1 - libs/ardour/reverse.cc | 6 ++++-- libs/ardour/session_state.cc | 2 +- libs/ardour/sndfilesource.cc | 1 + libs/ardour/st_stretch.cc | 2 +- libs/ardour/strip_silence.cc | 4 ++-- 21 files changed, 49 insertions(+), 34 deletions(-) diff --git a/libs/ardour/analysis_graph.cc b/libs/ardour/analysis_graph.cc index 3120c0fa33..c5c3a3c66a 100644 --- a/libs/ardour/analysis_graph.cc +++ b/libs/ardour/analysis_graph.cc @@ -17,8 +17,9 @@ */ +#include "pbd/progress.h" + #include "ardour/analysis_graph.h" -#include "ardour/progress.h" #include "ardour/route.h" #include "ardour/session.h" @@ -57,11 +58,11 @@ AnalysisGraph::~AnalysisGraph () void AnalysisGraph::analyze_region (std::shared_ptr region, bool raw) { - analyze_region (region.get(), raw, (ARDOUR::Progress*)0); + analyze_region (region.get(), raw, (PBD::Progress*)0); } void -AnalysisGraph::analyze_region (AudioRegion const* region, bool raw, ARDOUR::Progress* p) +AnalysisGraph::analyze_region (AudioRegion const* region, bool raw, PBD::Progress* p) { int n_channels = region->n_channels(); if (n_channels == 0 || n_channels > _max_chunksize) { diff --git a/libs/ardour/ardour/analysis_graph.h b/libs/ardour/ardour/analysis_graph.h index 4637846a77..48b354501c 100644 --- a/libs/ardour/ardour/analysis_graph.h +++ b/libs/ardour/ardour/analysis_graph.h @@ -37,15 +37,18 @@ namespace AudioGrapher { template class Interleaver; } -namespace ARDOUR { +namespace PBD { class Progress; +} + +namespace ARDOUR { class LIBARDOUR_API AnalysisGraph { public: AnalysisGraph (ARDOUR::Session*); ~AnalysisGraph (); - void analyze_region (ARDOUR::AudioRegion const*, bool raw = false, ARDOUR::Progress* = 0); + void analyze_region (ARDOUR::AudioRegion const*, bool raw = false, PBD::Progress* = 0); void analyze_region (std::shared_ptr, bool raw = false); void analyze_range (std::shared_ptr, std::shared_ptr, const std::list&); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index dace501d94..e11eaa439c 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -85,14 +85,14 @@ class LIBARDOUR_API AudioRegion : public Region, public AudioReadable /** @return the maximum (linear) amplitude of the region, or a -ve * number if the Progress object reports that the process was cancelled. */ - double maximum_amplitude (Progress* p = 0) const; + double maximum_amplitude (PBD::Progress* p = 0) const; /** @return the maximum (rms) signal power of the region, or a -1 * if the Progress object reports that the process was cancelled. */ - double rms (Progress* p = 0) const; + double rms (PBD::Progress* p = 0) const; - bool loudness (float& tp, float& i, float& s, float& m, Progress* p = 0) const; + bool loudness (float& tp, float& i, float& s, float& m, PBD::Progress* p = 0) const; bool envelope_active () const { return _envelope_active; } bool fade_in_active () const { return _fade_in_active; } diff --git a/libs/ardour/ardour/filter.h b/libs/ardour/ardour/filter.h index 7f24bf6db3..f4fbcabf33 100644 --- a/libs/ardour/ardour/filter.h +++ b/libs/ardour/ardour/filter.h @@ -25,18 +25,21 @@ #include "ardour/libardour_visibility.h" #include "ardour/types.h" +namespace PBD { + class Progress; +} + namespace ARDOUR { class Region; class Session; -class Progress; class LIBARDOUR_API Filter { public: virtual ~Filter() {} - virtual int run (std::shared_ptr, Progress* progress = 0) = 0; + virtual int run (std::shared_ptr, PBD::Progress* progress = 0) = 0; std::vector > results; protected: diff --git a/libs/ardour/ardour/midi_stretch.h b/libs/ardour/ardour/midi_stretch.h index 6a765417ab..11cbb283a2 100644 --- a/libs/ardour/ardour/midi_stretch.h +++ b/libs/ardour/ardour/midi_stretch.h @@ -30,7 +30,7 @@ class LIBARDOUR_API MidiStretch : public Filter { MidiStretch (ARDOUR::Session&, const TimeFXRequest&); ~MidiStretch (); - int run (std::shared_ptr, Progress* progress = 0); + int run (std::shared_ptr, PBD::Progress* progress = 0); private: const TimeFXRequest& _request; diff --git a/libs/ardour/ardour/rb_effect.h b/libs/ardour/ardour/rb_effect.h index f4ed9ef7b0..0232996828 100644 --- a/libs/ardour/ardour/rb_effect.h +++ b/libs/ardour/ardour/rb_effect.h @@ -32,7 +32,7 @@ class LIBARDOUR_API RBEffect : public Filter { RBEffect (ARDOUR::Session&, TimeFXRequest&); ~RBEffect (); - int run (std::shared_ptr, Progress* progress = 0); + int run (std::shared_ptr, PBD::Progress* progress = 0); private: TimeFXRequest& tsr; diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 214e63e991..e1e737ad35 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -45,6 +45,10 @@ class XMLNode; +namespace PBD { + class Progress; +} + namespace ARDOUR { namespace Properties { @@ -78,7 +82,6 @@ namespace Properties { class Playlist; class Filter; class ExportSpecification; -class Progress; enum LIBARDOUR_API RegionEditState { EditChangesNothing = 0, @@ -314,7 +317,7 @@ public: Temporal::Beats absolute_time_to_region_beats (Temporal::timepos_t const &) const; - int apply (Filter &, Progress* progress = 0); + int apply (Filter &, PBD::Progress* progress = 0); std::shared_ptr playlist () const { return _playlist.lock(); } virtual void set_playlist (std::weak_ptr); diff --git a/libs/ardour/ardour/reverse.h b/libs/ardour/ardour/reverse.h index 02b8753f8d..62faa6aeaa 100644 --- a/libs/ardour/ardour/reverse.h +++ b/libs/ardour/ardour/reverse.h @@ -29,7 +29,7 @@ class LIBARDOUR_API Reverse : public Filter { Reverse (ARDOUR::Session&); ~Reverse (); - int run (std::shared_ptr, Progress *); + int run (std::shared_ptr, PBD::Progress *); }; } /* namespace */ diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 38191ae007..2b3a76aace 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -108,6 +108,7 @@ class Parser; namespace PBD { class Controllable; +class Progress; } namespace luabridge { @@ -161,7 +162,6 @@ class PluginInfo; class Port; class PortInsert; class ProcessThread; -class Progress; class Processor; class Region; class Return; @@ -609,7 +609,7 @@ public: ArchiveEncode compress_audio = FLAC_16BIT, PBD::FileArchive::CompressionLevel compression_level = PBD::FileArchive::CompressGood, bool only_used_sources = false, - Progress* p = 0); + PBD::Progress* p = 0); int restore_state (std::string snapshot_name); int save_template (const std::string& template_name, const std::string& description = "", bool replace_existing = false); diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 64ceb3ec01..f29de93872 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -29,7 +29,10 @@ #include "ardour/audiofilesource.h" #include "ardour/broadcast_info.h" -#include "ardour/progress.h" + +namespace PBD { + class Progress; +} namespace ARDOUR { @@ -56,7 +59,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource { SndFileSource (Session&, const XMLNode&); /** Constructor to losslessly compress existing source */ - SndFileSource (Session& s, const AudioFileSource& other, const std::string& path, bool use16bits = false, Progress* p = NULL); + SndFileSource (Session& s, const AudioFileSource& other, const std::string& path, bool use16bits = false, PBD::Progress* p = NULL); ~SndFileSource (); diff --git a/libs/ardour/ardour/stretch.h b/libs/ardour/ardour/stretch.h index a26cf7dff1..c045571125 100644 --- a/libs/ardour/ardour/stretch.h +++ b/libs/ardour/ardour/stretch.h @@ -50,7 +50,7 @@ class LIBARDOUR_API STStretch : public Filter { STStretch (ARDOUR::Session&, TimeFXRequest&); ~STStretch (); - int run (std::shared_ptr, Progress* progress = 0); + int run (std::shared_ptr, PBD::Progress* progress = 0); private: TimeFXRequest& tsr; diff --git a/libs/ardour/ardour/strip_silence.h b/libs/ardour/ardour/strip_silence.h index c6dd9f9260..bfd5a6668b 100644 --- a/libs/ardour/ardour/strip_silence.h +++ b/libs/ardour/ardour/strip_silence.h @@ -28,7 +28,7 @@ class LIBARDOUR_API StripSilence : public Filter public: StripSilence (Session &, const AudioIntervalMap&, samplecnt_t fade_length); - int run (std::shared_ptr, Progress* progress = 0); + int run (std::shared_ptr, PBD::Progress* progress = 0); private: const AudioIntervalMap& _smap; diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index c2ed5f1594..8cc2d2eb37 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -39,6 +39,7 @@ #include "pbd/xml++.h" #include "pbd/enumwriter.h" #include "pbd/convert.h" +#include "pbd/progress.h" #include "evoral/Curve.h" @@ -56,7 +57,6 @@ #include "ardour/sndfilesource.h" #include "ardour/transient_detector.h" #include "ardour/parameter_descriptor.h" -#include "ardour/progress.h" #include "audiographer/general/interleaver.h" #include "audiographer/general/sample_format_converter.h" diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index c3aeb7fd1b..df1fe28162 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -24,6 +24,7 @@ #include "pbd/stateful_diff_command.h" #include "pbd/openuri.h" +#include "pbd/progress.h" #include "temporal/bbt_time.h" #include "temporal/range.h" @@ -80,7 +81,6 @@ #include "ardour/plugin_manager.h" #include "ardour/polarity_processor.h" #include "ardour/port_manager.h" -#include "ardour/progress.h" #include "ardour/raw_midi_parser.h" #include "ardour/runtime_functions.h" #include "ardour/region.h" @@ -483,6 +483,9 @@ LuaBindings::common (lua_State* L) .addFunction ("name", &XMLNode::name) .endClass () + .beginClass ("Progress") + .endClass () + .beginClass ("Stateful") .addFunction ("id", &PBD::Stateful::id) .addFunction ("properties", &PBD::Stateful::properties) @@ -1079,9 +1082,6 @@ LuaBindings::common (lua_State* L) .addData ("progress", const_cast(&InterThreadInfo::progress)) .endClass () - .beginClass ("Progress") - .endClass () - .beginClass ("TimelineRange") .addConstructor () .addFunction ("length", &TimelineRange::length) diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc index df668d9748..0665cfc221 100644 --- a/libs/ardour/rb_effect.cc +++ b/libs/ardour/rb_effect.cc @@ -27,11 +27,11 @@ #include #include "pbd/error.h" +#include "pbd/progress.h" #include "ardour/audioregion.h" #include "ardour/audiosource.h" #include "ardour/pitch.h" -#include "ardour/progress.h" #include "ardour/session.h" #include "ardour/stretch.h" #include "ardour/types.h" diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 325dadf242..5b1b92c172 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -54,7 +54,6 @@ using namespace ARDOUR; using namespace PBD; namespace ARDOUR { - class Progress; namespace Properties { PBD::PropertyDescriptor muted; PBD::PropertyDescriptor opaque; diff --git a/libs/ardour/reverse.cc b/libs/ardour/reverse.cc index 7d797006a8..32aadfe3ba 100644 --- a/libs/ardour/reverse.cc +++ b/libs/ardour/reverse.cc @@ -28,7 +28,9 @@ using namespace std; using namespace ARDOUR; -namespace ARDOUR { class Progress; class Session; } +namespace ARDOUR { +class Session; +} Reverse::Reverse (Session& s) : Filter (s) @@ -40,7 +42,7 @@ Reverse::~Reverse () } int -Reverse::run (std::shared_ptr r, Progress*) +Reverse::run (std::shared_ptr r, PBD::Progress*) { SourceList nsrcs; SourceList::iterator si; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 8d2bd28ebd..74770295c4 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -84,6 +84,7 @@ #include "pbd/file_utils.h" #include "pbd/pathexpand.h" #include "pbd/pthread_utils.h" +#include "pbd/progress.h" #include "pbd/scoped_file_descriptor.h" #include "pbd/types_convert.h" #include "pbd/localtime_r.h" @@ -118,7 +119,6 @@ #include "ardour/playlist_source.h" #include "ardour/port.h" #include "ardour/processor.h" -#include "ardour/progress.h" #include "ardour/profile.h" #include "ardour/proxy_controllable.h" #include "ardour/recent_sessions.h" diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index f9a93cdc54..30bc390172 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -36,6 +36,7 @@ #include #include "pbd/gstdio_compat.h" +#include "pbd/progress.h" #ifdef COMPILER_MSVC #include diff --git a/libs/ardour/st_stretch.cc b/libs/ardour/st_stretch.cc index 4a5f05f66f..424a3663a0 100644 --- a/libs/ardour/st_stretch.cc +++ b/libs/ardour/st_stretch.cc @@ -22,13 +22,13 @@ #include #include "pbd/error.h" +#include "pbd/progress.h" #include "ardour/types.h" #include "ardour/stretch.h" #include "ardour/audiofilesource.h" #include "ardour/session.h" #include "ardour/audioregion.h" -#include "ardour/progress.h" #include "pbd/i18n.h" diff --git a/libs/ardour/strip_silence.cc b/libs/ardour/strip_silence.cc index 926a2305a0..c24b3fc1a6 100644 --- a/libs/ardour/strip_silence.cc +++ b/libs/ardour/strip_silence.cc @@ -19,12 +19,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "pbd/progress.h" #include "pbd/property_list.h" #include "ardour/strip_silence.h" #include "ardour/audioregion.h" #include "ardour/region_factory.h" -#include "ardour/progress.h" using namespace ARDOUR; @@ -43,7 +43,7 @@ StripSilence::StripSilence (Session & s, const AudioIntervalMap& sm, samplecnt_t } int -StripSilence::run (std::shared_ptr r, Progress* progress) +StripSilence::run (std::shared_ptr r, PBD::Progress* progress) { results.clear ();