Update codebase to use PBD::Progress (1/2)

This commit is contained in:
Robin Gareus 2023-05-18 21:47:27 +02:00
parent 65f2be76f6
commit 92fbab32c6
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
21 changed files with 49 additions and 34 deletions

View File

@ -17,8 +17,9 @@
*/ */
#include "pbd/progress.h"
#include "ardour/analysis_graph.h" #include "ardour/analysis_graph.h"
#include "ardour/progress.h"
#include "ardour/route.h" #include "ardour/route.h"
#include "ardour/session.h" #include "ardour/session.h"
@ -57,11 +58,11 @@ AnalysisGraph::~AnalysisGraph ()
void void
AnalysisGraph::analyze_region (std::shared_ptr<AudioRegion> region, bool raw) AnalysisGraph::analyze_region (std::shared_ptr<AudioRegion> region, bool raw)
{ {
analyze_region (region.get(), raw, (ARDOUR::Progress*)0); analyze_region (region.get(), raw, (PBD::Progress*)0);
} }
void 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(); int n_channels = region->n_channels();
if (n_channels == 0 || n_channels > _max_chunksize) { if (n_channels == 0 || n_channels > _max_chunksize) {

View File

@ -37,15 +37,18 @@ namespace AudioGrapher {
template <typename T> class Interleaver; template <typename T> class Interleaver;
} }
namespace ARDOUR { namespace PBD {
class Progress; class Progress;
}
namespace ARDOUR {
class LIBARDOUR_API AnalysisGraph { class LIBARDOUR_API AnalysisGraph {
public: public:
AnalysisGraph (ARDOUR::Session*); AnalysisGraph (ARDOUR::Session*);
~AnalysisGraph (); ~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<ARDOUR::AudioRegion>, bool raw = false); void analyze_region (std::shared_ptr<ARDOUR::AudioRegion>, bool raw = false);
void analyze_range (std::shared_ptr<ARDOUR::Route>, std::shared_ptr<ARDOUR::AudioPlaylist>, const std::list<TimelineRange>&); void analyze_range (std::shared_ptr<ARDOUR::Route>, std::shared_ptr<ARDOUR::AudioPlaylist>, const std::list<TimelineRange>&);

View File

@ -85,14 +85,14 @@ class LIBARDOUR_API AudioRegion : public Region, public AudioReadable
/** @return the maximum (linear) amplitude of the region, or a -ve /** @return the maximum (linear) amplitude of the region, or a -ve
* number if the Progress object reports that the process was cancelled. * 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 /** @return the maximum (rms) signal power of the region, or a -1
* if the Progress object reports that the process was cancelled. * 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 envelope_active () const { return _envelope_active; }
bool fade_in_active () const { return _fade_in_active; } bool fade_in_active () const { return _fade_in_active; }

View File

@ -25,18 +25,21 @@
#include "ardour/libardour_visibility.h" #include "ardour/libardour_visibility.h"
#include "ardour/types.h" #include "ardour/types.h"
namespace PBD {
class Progress;
}
namespace ARDOUR { namespace ARDOUR {
class Region; class Region;
class Session; class Session;
class Progress;
class LIBARDOUR_API Filter { class LIBARDOUR_API Filter {
public: public:
virtual ~Filter() {} virtual ~Filter() {}
virtual int run (std::shared_ptr<ARDOUR::Region>, Progress* progress = 0) = 0; virtual int run (std::shared_ptr<ARDOUR::Region>, PBD::Progress* progress = 0) = 0;
std::vector<std::shared_ptr<ARDOUR::Region> > results; std::vector<std::shared_ptr<ARDOUR::Region> > results;
protected: protected:

View File

@ -30,7 +30,7 @@ class LIBARDOUR_API MidiStretch : public Filter {
MidiStretch (ARDOUR::Session&, const TimeFXRequest&); MidiStretch (ARDOUR::Session&, const TimeFXRequest&);
~MidiStretch (); ~MidiStretch ();
int run (std::shared_ptr<ARDOUR::Region>, Progress* progress = 0); int run (std::shared_ptr<ARDOUR::Region>, PBD::Progress* progress = 0);
private: private:
const TimeFXRequest& _request; const TimeFXRequest& _request;

View File

@ -32,7 +32,7 @@ class LIBARDOUR_API RBEffect : public Filter {
RBEffect (ARDOUR::Session&, TimeFXRequest&); RBEffect (ARDOUR::Session&, TimeFXRequest&);
~RBEffect (); ~RBEffect ();
int run (std::shared_ptr<ARDOUR::Region>, Progress* progress = 0); int run (std::shared_ptr<ARDOUR::Region>, PBD::Progress* progress = 0);
private: private:
TimeFXRequest& tsr; TimeFXRequest& tsr;

View File

@ -45,6 +45,10 @@
class XMLNode; class XMLNode;
namespace PBD {
class Progress;
}
namespace ARDOUR { namespace ARDOUR {
namespace Properties { namespace Properties {
@ -78,7 +82,6 @@ namespace Properties {
class Playlist; class Playlist;
class Filter; class Filter;
class ExportSpecification; class ExportSpecification;
class Progress;
enum LIBARDOUR_API RegionEditState { enum LIBARDOUR_API RegionEditState {
EditChangesNothing = 0, EditChangesNothing = 0,
@ -314,7 +317,7 @@ public:
Temporal::Beats absolute_time_to_region_beats (Temporal::timepos_t const &) const; 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<ARDOUR::Playlist> playlist () const { return _playlist.lock(); } std::shared_ptr<ARDOUR::Playlist> playlist () const { return _playlist.lock(); }
virtual void set_playlist (std::weak_ptr<ARDOUR::Playlist>); virtual void set_playlist (std::weak_ptr<ARDOUR::Playlist>);

View File

@ -29,7 +29,7 @@ class LIBARDOUR_API Reverse : public Filter {
Reverse (ARDOUR::Session&); Reverse (ARDOUR::Session&);
~Reverse (); ~Reverse ();
int run (std::shared_ptr<ARDOUR::Region>, Progress *); int run (std::shared_ptr<ARDOUR::Region>, PBD::Progress *);
}; };
} /* namespace */ } /* namespace */

View File

@ -108,6 +108,7 @@ class Parser;
namespace PBD { namespace PBD {
class Controllable; class Controllable;
class Progress;
} }
namespace luabridge { namespace luabridge {
@ -161,7 +162,6 @@ class PluginInfo;
class Port; class Port;
class PortInsert; class PortInsert;
class ProcessThread; class ProcessThread;
class Progress;
class Processor; class Processor;
class Region; class Region;
class Return; class Return;
@ -609,7 +609,7 @@ public:
ArchiveEncode compress_audio = FLAC_16BIT, ArchiveEncode compress_audio = FLAC_16BIT,
PBD::FileArchive::CompressionLevel compression_level = PBD::FileArchive::CompressGood, PBD::FileArchive::CompressionLevel compression_level = PBD::FileArchive::CompressGood,
bool only_used_sources = false, bool only_used_sources = false,
Progress* p = 0); PBD::Progress* p = 0);
int restore_state (std::string snapshot_name); int restore_state (std::string snapshot_name);
int save_template (const std::string& template_name, const std::string& description = "", bool replace_existing = false); int save_template (const std::string& template_name, const std::string& description = "", bool replace_existing = false);

View File

@ -29,7 +29,10 @@
#include "ardour/audiofilesource.h" #include "ardour/audiofilesource.h"
#include "ardour/broadcast_info.h" #include "ardour/broadcast_info.h"
#include "ardour/progress.h"
namespace PBD {
class Progress;
}
namespace ARDOUR { namespace ARDOUR {
@ -56,7 +59,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
SndFileSource (Session&, const XMLNode&); SndFileSource (Session&, const XMLNode&);
/** Constructor to losslessly compress existing source */ /** 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 (); ~SndFileSource ();

View File

@ -50,7 +50,7 @@ class LIBARDOUR_API STStretch : public Filter {
STStretch (ARDOUR::Session&, TimeFXRequest&); STStretch (ARDOUR::Session&, TimeFXRequest&);
~STStretch (); ~STStretch ();
int run (std::shared_ptr<ARDOUR::Region>, Progress* progress = 0); int run (std::shared_ptr<ARDOUR::Region>, PBD::Progress* progress = 0);
private: private:
TimeFXRequest& tsr; TimeFXRequest& tsr;

View File

@ -28,7 +28,7 @@ class LIBARDOUR_API StripSilence : public Filter
public: public:
StripSilence (Session &, const AudioIntervalMap&, samplecnt_t fade_length); StripSilence (Session &, const AudioIntervalMap&, samplecnt_t fade_length);
int run (std::shared_ptr<ARDOUR::Region>, Progress* progress = 0); int run (std::shared_ptr<ARDOUR::Region>, PBD::Progress* progress = 0);
private: private:
const AudioIntervalMap& _smap; const AudioIntervalMap& _smap;

View File

@ -39,6 +39,7 @@
#include "pbd/xml++.h" #include "pbd/xml++.h"
#include "pbd/enumwriter.h" #include "pbd/enumwriter.h"
#include "pbd/convert.h" #include "pbd/convert.h"
#include "pbd/progress.h"
#include "evoral/Curve.h" #include "evoral/Curve.h"
@ -56,7 +57,6 @@
#include "ardour/sndfilesource.h" #include "ardour/sndfilesource.h"
#include "ardour/transient_detector.h" #include "ardour/transient_detector.h"
#include "ardour/parameter_descriptor.h" #include "ardour/parameter_descriptor.h"
#include "ardour/progress.h"
#include "audiographer/general/interleaver.h" #include "audiographer/general/interleaver.h"
#include "audiographer/general/sample_format_converter.h" #include "audiographer/general/sample_format_converter.h"

View File

@ -24,6 +24,7 @@
#include "pbd/stateful_diff_command.h" #include "pbd/stateful_diff_command.h"
#include "pbd/openuri.h" #include "pbd/openuri.h"
#include "pbd/progress.h"
#include "temporal/bbt_time.h" #include "temporal/bbt_time.h"
#include "temporal/range.h" #include "temporal/range.h"
@ -80,7 +81,6 @@
#include "ardour/plugin_manager.h" #include "ardour/plugin_manager.h"
#include "ardour/polarity_processor.h" #include "ardour/polarity_processor.h"
#include "ardour/port_manager.h" #include "ardour/port_manager.h"
#include "ardour/progress.h"
#include "ardour/raw_midi_parser.h" #include "ardour/raw_midi_parser.h"
#include "ardour/runtime_functions.h" #include "ardour/runtime_functions.h"
#include "ardour/region.h" #include "ardour/region.h"
@ -483,6 +483,9 @@ LuaBindings::common (lua_State* L)
.addFunction ("name", &XMLNode::name) .addFunction ("name", &XMLNode::name)
.endClass () .endClass ()
.beginClass <PBD::Progress> ("Progress")
.endClass ()
.beginClass <PBD::Stateful> ("Stateful") .beginClass <PBD::Stateful> ("Stateful")
.addFunction ("id", &PBD::Stateful::id) .addFunction ("id", &PBD::Stateful::id)
.addFunction ("properties", &PBD::Stateful::properties) .addFunction ("properties", &PBD::Stateful::properties)
@ -1079,9 +1082,6 @@ LuaBindings::common (lua_State* L)
.addData ("progress", const_cast<float InterThreadInfo::*>(&InterThreadInfo::progress)) .addData ("progress", const_cast<float InterThreadInfo::*>(&InterThreadInfo::progress))
.endClass () .endClass ()
.beginClass <Progress> ("Progress")
.endClass ()
.beginClass <TimelineRange> ("TimelineRange") .beginClass <TimelineRange> ("TimelineRange")
.addConstructor <void (*) (Temporal::timepos_t, Temporal::timepos_t, uint32_t)> () .addConstructor <void (*) (Temporal::timepos_t, Temporal::timepos_t, uint32_t)> ()
.addFunction ("length", &TimelineRange::length) .addFunction ("length", &TimelineRange::length)

View File

@ -27,11 +27,11 @@
#include <rubberband/RubberBandStretcher.h> #include <rubberband/RubberBandStretcher.h>
#include "pbd/error.h" #include "pbd/error.h"
#include "pbd/progress.h"
#include "ardour/audioregion.h" #include "ardour/audioregion.h"
#include "ardour/audiosource.h" #include "ardour/audiosource.h"
#include "ardour/pitch.h" #include "ardour/pitch.h"
#include "ardour/progress.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/stretch.h" #include "ardour/stretch.h"
#include "ardour/types.h" #include "ardour/types.h"

View File

@ -54,7 +54,6 @@ using namespace ARDOUR;
using namespace PBD; using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
class Progress;
namespace Properties { namespace Properties {
PBD::PropertyDescriptor<bool> muted; PBD::PropertyDescriptor<bool> muted;
PBD::PropertyDescriptor<bool> opaque; PBD::PropertyDescriptor<bool> opaque;

View File

@ -28,7 +28,9 @@
using namespace std; using namespace std;
using namespace ARDOUR; using namespace ARDOUR;
namespace ARDOUR { class Progress; class Session; } namespace ARDOUR {
class Session;
}
Reverse::Reverse (Session& s) Reverse::Reverse (Session& s)
: Filter (s) : Filter (s)
@ -40,7 +42,7 @@ Reverse::~Reverse ()
} }
int int
Reverse::run (std::shared_ptr<Region> r, Progress*) Reverse::run (std::shared_ptr<Region> r, PBD::Progress*)
{ {
SourceList nsrcs; SourceList nsrcs;
SourceList::iterator si; SourceList::iterator si;

View File

@ -84,6 +84,7 @@
#include "pbd/file_utils.h" #include "pbd/file_utils.h"
#include "pbd/pathexpand.h" #include "pbd/pathexpand.h"
#include "pbd/pthread_utils.h" #include "pbd/pthread_utils.h"
#include "pbd/progress.h"
#include "pbd/scoped_file_descriptor.h" #include "pbd/scoped_file_descriptor.h"
#include "pbd/types_convert.h" #include "pbd/types_convert.h"
#include "pbd/localtime_r.h" #include "pbd/localtime_r.h"
@ -118,7 +119,6 @@
#include "ardour/playlist_source.h" #include "ardour/playlist_source.h"
#include "ardour/port.h" #include "ardour/port.h"
#include "ardour/processor.h" #include "ardour/processor.h"
#include "ardour/progress.h"
#include "ardour/profile.h" #include "ardour/profile.h"
#include "ardour/proxy_controllable.h" #include "ardour/proxy_controllable.h"
#include "ardour/recent_sessions.h" #include "ardour/recent_sessions.h"

View File

@ -36,6 +36,7 @@
#include <glib.h> #include <glib.h>
#include "pbd/gstdio_compat.h" #include "pbd/gstdio_compat.h"
#include "pbd/progress.h"
#ifdef COMPILER_MSVC #ifdef COMPILER_MSVC
#include <sys/utime.h> #include <sys/utime.h>

View File

@ -22,13 +22,13 @@
#include <cmath> #include <cmath>
#include "pbd/error.h" #include "pbd/error.h"
#include "pbd/progress.h"
#include "ardour/types.h" #include "ardour/types.h"
#include "ardour/stretch.h" #include "ardour/stretch.h"
#include "ardour/audiofilesource.h" #include "ardour/audiofilesource.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/audioregion.h" #include "ardour/audioregion.h"
#include "ardour/progress.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"

View File

@ -19,12 +19,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "pbd/progress.h"
#include "pbd/property_list.h" #include "pbd/property_list.h"
#include "ardour/strip_silence.h" #include "ardour/strip_silence.h"
#include "ardour/audioregion.h" #include "ardour/audioregion.h"
#include "ardour/region_factory.h" #include "ardour/region_factory.h"
#include "ardour/progress.h"
using namespace ARDOUR; using namespace ARDOUR;
@ -43,7 +43,7 @@ StripSilence::StripSilence (Session & s, const AudioIntervalMap& sm, samplecnt_t
} }
int int
StripSilence::run (std::shared_ptr<Region> r, Progress* progress) StripSilence::run (std::shared_ptr<Region> r, PBD::Progress* progress)
{ {
results.clear (); results.clear ();