X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Faudioregion.h;h=f844d45ef122a0290f96d4dcde36cd37ed0ff0bb;hb=4b95621853072c44b1df698df8a96d7d9167319f;hp=4be5d27a6ba8bd1724c0cfd3a333cce5b1caab26;hpb=2592a320d42dd4a157ee16101c042d875d3142be;p=ardour.git diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 4be5d27a6b..f844d45ef1 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2001 Paul Davis + Copyright (C) 2000-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 @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __ardour_audio_region_h__ @@ -55,47 +54,43 @@ class AudioRegion : public Region ~AudioRegion(); - bool source_equivalent (boost::shared_ptr) const; - bool speed_mismatch (float) const; - boost::shared_ptr source (uint32_t n=0) const { if (n < sources.size()) return sources[n]; else return sources[0]; } + boost::shared_ptr audio_source (uint32_t n=0) const; - void set_scale_amplitude (gain_t); + void set_scale_amplitude (gain_t); gain_t scale_amplitude() const { return _scale_amplitude; } void normalize_to (float target_in_dB = 0.0f); - uint32_t n_channels() { return sources.size(); } - vector master_source_names(); - bool envelope_active () const { return _flags & Region::EnvelopeActive; } bool fade_in_active () const { return _flags & Region::FadeIn; } bool fade_out_active () const { return _flags & Region::FadeOut; } - bool captured() const { return !(_flags & (Region::Flag (Region::Import|Region::External))); } Curve& fade_in() { return _fade_in; } Curve& fade_out() { return _fade_out; } Curve& envelope() { return _envelope; } - nframes_t read_peaks (PeakData *buf, nframes_t npeaks, - nframes_t offset, nframes_t cnt, - uint32_t chan_n=0, double samples_per_unit= 1.0) const; - + virtual nframes_t read_peaks (PeakData *buf, nframes_t npeaks, + nframes_t offset, nframes_t cnt, + uint32_t chan_n=0, double samples_per_unit= 1.0) const; + virtual nframes_t read_at (Sample *buf, Sample *mixdown_buf, - float *gain_buf, nframes_t position, nframes_t cnt, - uint32_t chan_n = 0, - nframes_t read_frames = 0, - nframes_t skip_frames = 0) const; - - nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, - float *gain_buf, - nframes_t position, nframes_t cnt, uint32_t chan_n=0) const; + float *gain_buf, nframes_t position, nframes_t cnt, + uint32_t chan_n = 0) const; + + virtual nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, + float *gain_buf, + nframes_t position, nframes_t cnt, uint32_t chan_n=0) const; + + virtual nframes_t read_raw_internal (Sample*, nframes_t, nframes_t) const; XMLNode& state (bool); int set_state (const XMLNode&); static void set_default_fade (float steepness, nframes_t len); + bool fade_in_is_default () const; + bool fade_out_is_default () const; enum FadeShape { Linear, @@ -116,8 +111,9 @@ class AudioRegion : public Region void set_fade_out (FadeShape, nframes_t); void set_envelope_active (bool yn); + void set_default_envelope (); - int separate_by_channel (ARDOUR::Session&, vector&) const; + int separate_by_channel (ARDOUR::Session&, vector >&) const; /* filter */ @@ -127,8 +123,6 @@ class AudioRegion : public Region int exportme (ARDOUR::Session&, ARDOUR::AudioExportSpecification&); - boost::shared_ptr get_parent(); - /* xfade/fade interactions */ void suspend_fade_in (); @@ -143,41 +137,30 @@ class AudioRegion : public Region AudioRegion (boost::shared_ptr, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); AudioRegion (SourceList &, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); AudioRegion (boost::shared_ptr, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); - AudioRegion (boost::shared_ptr); AudioRegion (boost::shared_ptr, const XMLNode&); AudioRegion (SourceList &, const XMLNode&); private: + void init (); void set_default_fades (); void set_default_fade_in (); void set_default_fade_out (); - void set_default_envelope (); void recompute_gain_at_end (); void recompute_gain_at_start (); nframes_t _read_at (const SourceList&, Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, nframes_t position, nframes_t cnt, - uint32_t chan_n = 0, - nframes_t read_frames = 0, - nframes_t skip_frames = 0) const; - - bool verify_start (nframes_t position); - bool verify_length (nframes_t position); - bool verify_start_mutable (nframes_t& start); - bool verify_start_and_length (nframes_t start, nframes_t length); + float *gain_buffer, nframes_t position, nframes_t cnt, + uint32_t chan_n = 0) const; + void recompute_at_start (); void recompute_at_end (); - void envelope_changed (Change); + void envelope_changed (); + void fade_in_changed (); + void fade_out_changed (); void source_offset_changed (); - - void source_deleted (); - - SourceList sources; - - /** Used when timefx are applied, so we can always use the original source. */ - SourceList master_sources; + void listen_to_my_curves (); mutable Curve _fade_in; FadeShape _fade_in_shape; @@ -189,7 +172,19 @@ class AudioRegion : public Region uint32_t _fade_out_disabled; protected: + /* default constructor for derived (compound) types */ + + AudioRegion (nframes_t, nframes_t, std::string name); + AudioRegion (boost::shared_ptr); + int set_live_state (const XMLNode&, Change&, bool send); + + virtual bool verify_start (nframes_t); + virtual bool verify_start_and_length (nframes_t, nframes_t); + virtual bool verify_start_mutable (nframes_t&_start); + virtual bool verify_length (nframes_t); + /*virtual void recompute_at_start () = 0; + virtual void recompute_at_end () = 0;*/ }; } /* namespace ARDOUR */