diff options
author | David Robillard <d@drobilla.net> | 2008-01-10 21:20:59 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-01-10 21:20:59 +0000 |
commit | bb457bb960c5bd7ed538f9d31477293415739f68 (patch) | |
tree | 84324a63b87c03589cd165b9e474296eaebb4772 /libs/ardour/ardour | |
parent | 73dd9d37e7d715e0d78c0e51569968f9494dac7f (diff) |
Merge libs/ardour and gtk2_ardour with 2.0-ongoing R2837.
git-svn-id: svn://localhost/ardour2/trunk@2883 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
26 files changed, 340 insertions, 102 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 6e7b494441..fcec83394f 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -48,6 +48,8 @@ namespace ARDOUR { int cleanup (); std::string get_ardour_revision (); + + const layer_t max_layer = UCHAR_MAX; microseconds_t get_microseconds (); diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h index 09bf5946fa..1f6c2f63bf 100644 --- a/libs/ardour/ardour/audio_buffer.h +++ b/libs/ardour/ardour/audio_buffer.h @@ -43,6 +43,7 @@ public: /** Read @a len frames FROM THE START OF @a src into self at @a offset */ void read_from(const Buffer& src, nframes_t len, nframes_t offset) { + assert(&src != this); assert(_capacity > 0); assert(src.type() == DataType::AUDIO); assert(offset + len <= _capacity); diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 7b31b1937f..b0e4d34c28 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -22,6 +22,7 @@ #define __ardour_audio_unit_h__ #include <stdint.h> +#include <boost/shared_ptr.hpp> #include <list> #include <set> @@ -30,6 +31,8 @@ #include <ardour/plugin.h> +#include <AudioUnit/AudioUnit.h> + #include <boost/shared_ptr.hpp> class CAComponent; @@ -45,13 +48,13 @@ class Session; class AUPlugin : public ARDOUR::Plugin { public: - AUPlugin (AudioEngine& engine, Session& session, CAComponent* comp); + AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> comp); virtual ~AUPlugin (); - uint32_t unique_id () const; + std::string unique_id () const; const char * label () const; const char * name () const { return _info->name.c_str(); } - const char * maker () const; + const char * maker () const { return _info->creator.c_str(); } uint32_t parameter_count () const; float default_value (uint32_t port); nframes_t signal_latency () const; @@ -87,34 +90,65 @@ class AUPlugin : public ARDOUR::Plugin bool has_editor () const; - CAAudioUnit* get_au () { return unit; } - CAComponent* get_comp () { return comp; } - + bool fixed_io() const { return false; } + int32_t can_support_input_configuration (int32_t in); + int32_t compute_output_streams (int32_t nplugins); + uint32_t output_streams() const; + uint32_t input_streams() const; + + boost::shared_ptr<CAAudioUnit> get_au () { return unit; } + boost::shared_ptr<CAComponent> get_comp () { return comp; } + + OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags, + const AudioTimeStamp *inTimeStamp, + UInt32 inBusNumber, + UInt32 inNumberFrames, + AudioBufferList* ioData); private: - CAComponent* comp; - CAAudioUnit* unit; - - AudioBufferList* in_list; - AudioBufferList* out_list; + boost::shared_ptr<CAComponent> comp; + boost::shared_ptr<CAAudioUnit> unit; + + AudioStreamBasicDescription streamFormat; + bool initialized; + int format_set; + AudioBufferList* buffers; + + UInt32 global_elements; + UInt32 output_elements; + UInt32 input_elements; + + int set_output_format (); + int set_input_format (); + int set_stream_format (int scope, uint32_t cnt); + int _set_block_size (nframes_t nframes); std::vector<std::pair<uint32_t, uint32_t> > parameter_map; + uint32_t current_maxbuf; + nframes_t current_offset; + nframes_t cb_offset; + vector<Sample*>* current_buffers; + nframes_t frames_processed; }; - + typedef boost::shared_ptr<AUPlugin> AUPluginPtr; class AUPluginInfo : public PluginInfo { public: - AUPluginInfo () { }; + AUPluginInfo (boost::shared_ptr<CAComponentDescription>); ~AUPluginInfo (); - CAComponentDescription* desc; + PluginPtr load (Session& session); static PluginInfoList discover (); - PluginPtr load (Session& session); + static void get_names (CAComponentDescription&, std::string& name, Glib::ustring& maker); + static std::string stringify_descriptor (const CAComponentDescription&); private: - static std::string get_name (CAComponentDescription&); - void setup_nchannels (CAComponentDescription&); + boost::shared_ptr<CAComponentDescription> descriptor; + + static void discover_music (PluginInfoList&); + static void discover_fx (PluginInfoList&); + static void discover_by_description (PluginInfoList&, CAComponentDescription&); }; typedef boost::shared_ptr<AUPluginInfo> AUPluginInfoPtr; diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index dc7ae8e000..88f1111a6c 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -106,7 +106,13 @@ class AudioEngine : public sigc::trackable class PortRegistrationFailure : public std::exception { public: - virtual const char *what() const throw() { return "failed port registration"; } + PortRegistrationFailure (const char* why = "") { + reason = why; + } + virtual const char *what() const throw() { return reason; } + + private: + const char* reason; }; class NoBackendAvailable : public std::exception { @@ -235,6 +241,8 @@ class AudioEngine : public sigc::trackable std::string get_nth_physical (DataType type, uint32_t n, int flags); + void port_registration_failure (const std::string& portname); + static int _xrun_callback (void *arg); static int _graph_order_callback (void *arg); static int _process_callback (nframes_t nframes, void *arg); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index ba2bbaee22..b84d197c3f 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -76,8 +76,10 @@ class AudioRegion : public Region 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) const; + 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; virtual nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, @@ -146,8 +148,10 @@ class AudioRegion : public Region 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) const; + 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; void recompute_at_start (); void recompute_at_end (); @@ -174,13 +178,6 @@ class AudioRegion : public Region AudioRegion (boost::shared_ptr<const AudioRegion>); 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 */ diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index f02b28d9f5..93708a5b07 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -43,9 +43,7 @@ using std::vector; namespace ARDOUR { -const nframes_t frames_per_peak = 256; - - class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR::AudioSource> +class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR::AudioSource> { public: AudioSource (Session&, Glib::ustring name); @@ -72,7 +70,8 @@ const nframes_t frames_per_peak = 256; uint32_t read_data_count() const { return _read_data_count; } uint32_t write_data_count() const { return _write_data_count; } - virtual int read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const; + int read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_visual_peak) const; + int build_peaks (); bool peaks_ready (sigc::slot<void>, sigc::connection&) const; @@ -129,6 +128,12 @@ const nframes_t frames_per_peak = 256; void update_length (nframes_t pos, nframes_t cnt); + virtual int read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, + double samples_per_visual_peak, nframes_t fpp) const; + + int compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframes_t cnt, bool force, + bool intermediate_peaks_ready_signal, nframes_t frames_per_peak); + private: int peakfile; nframes_t peak_leftover_cnt; diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index edae45a56a..aa27a3ef24 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -72,6 +72,8 @@ CONFIG_VARIABLE (uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide) CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher) +CONFIG_VARIABLE (bool, link_region_and_track_selection, "link-region-and-track-selection", false) +CONFIG_VARIABLE (std::string, keyboard_layout_name, "keyboard-layout-name", "ansi") /* monitoring, mute, solo etc */ @@ -148,6 +150,8 @@ CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-bac CONFIG_VARIABLE (float, automation_interval, "automation-interval", 50) CONFIG_VARIABLE (bool, sync_all_route_ordering, "sync-all-route-ordering", true) CONFIG_VARIABLE (bool, only_copy_imported_files, "only-copy-imported-files", true) +CONFIG_VARIABLE (std::string, keyboard_layout, "keyboard-layout", "ansi") +CONFIG_VARIABLE (std::string, default_bindings, "default-bindings", "ardour") /* denormal management */ diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index 78a137bde3..9ba3689e82 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -81,8 +81,10 @@ class Crossfade : public ARDOUR::AudioRegion boost::shared_ptr<ARDOUR::AudioRegion> out() const { return _out; } nframes_t read_at (Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, nframes_t position, nframes_t cnt, - uint32_t chan_n) const; + float *gain_buffer, nframes_t position, nframes_t cnt, + uint32_t chan_n, + nframes_t read_frames = 0, + nframes_t skip_frames = 0) const; bool refresh (); diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index e466e53215..7c0b0b2abe 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -53,7 +53,7 @@ class LadspaPlugin : public ARDOUR::Plugin /* Plugin interface */ - uint32_t unique_id() const { return descriptor->UniqueID; } + std::string unique_id() const; const char * label() const { return descriptor->Label; } const char * name() const { return descriptor->Name; } const char * maker() const { return descriptor->Maker; } diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 5ffb716598..53d9489823 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -146,6 +146,8 @@ class Locations : public PBD::StatefulDestructible Locations (); ~Locations (); + const LocationList& list() { return locations; } + void add (Location *, bool make_current = false); void remove (Location *); void clear (); diff --git a/libs/ardour/ardour/pitch.h b/libs/ardour/ardour/pitch.h new file mode 100644 index 0000000000..38d8380f5d --- /dev/null +++ b/libs/ardour/ardour/pitch.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2007 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_pitch_h__ +#define __ardour_pitch_h__ + +#include <ardour/filter.h> + +namespace ARDOUR { + class AudioRegion; +} + +#ifdef USE_RUBBERBAND + +#include <ardour/rb_effect.h> + +namespace ARDOUR { + +class Pitch : public RBEffect { + public: + Pitch (ARDOUR::Session&, TimeFXRequest&); + ~Pitch () {} +}; + +} /* namespace */ + +# else + +namespace ARDOUR { + +class Pitch : public Filter { + public: + Pitch (ARDOUR::Session&, TimeFXRequest&); + ~Pitch () {} + + int run (boost::shared_ptr<ARDOUR::Region>); + + private: + TimeFXRequest& tsr; +}; + +} /* namespace */ + +#endif + +#endif /* __ardour_pitch_h__ */ diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index f2e07aa067..3f328de005 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -95,6 +95,7 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this<Pla void partition (nframes_t start, nframes_t end, bool just_top_level); void duplicate (boost::shared_ptr<Region>, nframes_t position, float times); void nudge_after (nframes_t start, nframes_t distance, bool forwards); + void shuffle (boost::shared_ptr<Region>, int dir); boost::shared_ptr<Playlist> cut (list<AudioRange>&, bool result_is_hidden = true); boost::shared_ptr<Playlist> copy (list<AudioRange>&, bool result_is_hidden = true); @@ -102,9 +103,12 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this<Pla RegionList* regions_at (nframes_t frame); RegionList* regions_touched (nframes_t start, nframes_t end); + RegionList* regions_to_read (nframes_t start, nframes_t end); boost::shared_ptr<Region> find_region (const PBD::ID&) const; boost::shared_ptr<Region> top_region_at (nframes_t frame); boost::shared_ptr<Region> find_next_region (nframes_t frame, RegionPoint point, int dir); + nframes64_t find_next_region_boundary (nframes64_t frame, int dir); + bool region_is_shuffle_constrained (boost::shared_ptr<Region>); template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>, void *), void *arg); template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>)); @@ -124,6 +128,8 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this<Pla void freeze (); void thaw (); + void raise_region (boost::shared_ptr<Region>); + void lower_region (boost::shared_ptr<Region>); void raise_region_to_top (boost::shared_ptr<Region>); void lower_region_to_bottom (boost::shared_ptr<Region>); @@ -182,6 +188,7 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this<Pla bool first_set_state; bool _hidden; bool _splicing; + bool _shuffling; bool _nudging; uint32_t _refcnt; EditMode _edit_mode; @@ -227,12 +234,12 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this<Pla void sort_regions (); - void possibly_splice (); - void possibly_splice_unlocked(); - void core_splice (); - void splice_locked (); - void splice_unlocked (); + void possibly_splice (nframes_t at, nframes64_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>()); + void possibly_splice_unlocked(nframes_t at, nframes64_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>()); + void core_splice (nframes_t at, nframes64_t distance, boost::shared_ptr<Region> exclude); + void splice_locked (nframes_t at, nframes64_t distance, boost::shared_ptr<Region> exclude); + void splice_unlocked (nframes_t at, nframes64_t distance, boost::shared_ptr<Region> exclude); virtual void finalize_split_region (boost::shared_ptr<Region> original, boost::shared_ptr<Region> left, boost::shared_ptr<Region> right) {} @@ -258,6 +265,7 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this<Pla boost::shared_ptr<Playlist> cut (nframes_t start, nframes_t cnt, bool result_is_hidden); boost::shared_ptr<Playlist> copy (nframes_t start, nframes_t cnt, bool result_is_hidden); + int move_region_to_layer (layer_t, boost::shared_ptr<Region> r, int dir); void relayer (); void unset_freeze_parent (Playlist*); diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 830ed7c025..d721476db7 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -77,7 +77,7 @@ class PluginInfo { ChanCount n_outputs; ARDOUR::PluginType type; - long unique_id; + std::string unique_id; virtual PluginPtr load (Session& session) = 0; @@ -114,7 +114,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent bool max_unbound; }; - virtual uint32_t unique_id() const = 0; + virtual std::string unique_id() const = 0; virtual const char * label() const = 0; virtual const char * name() const = 0; virtual const char * maker() const = 0; @@ -170,7 +170,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent bool save_preset(string name, string domain /* vst, ladspa etc. */); }; -PluginPtr find_plugin(ARDOUR::Session&, string name, long unique_id, ARDOUR::PluginType); +PluginPtr find_plugin(ARDOUR::Session&, string unique_id, ARDOUR::PluginType); } // namespace ARDOUR diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index bce723d857..64b871104b 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -40,6 +40,7 @@ class PluginManager { ARDOUR::PluginInfoList &vst_plugin_info () { return _vst_plugin_info; } ARDOUR::PluginInfoList &ladspa_plugin_info () { return _ladspa_plugin_info; } + ARDOUR::PluginInfoList &au_plugin_info () { return _au_plugin_info; } void refresh (); @@ -51,6 +52,8 @@ class PluginManager { private: ARDOUR::PluginInfoList _vst_plugin_info; ARDOUR::PluginInfoList _ladspa_plugin_info; + ARDOUR::PluginInfoList _au_plugin_info; + std::map<uint32_t, std::string> rdf_type; std::string ladspa_path; @@ -64,6 +67,9 @@ class PluginManager { void add_vst_presets (); void add_presets (std::string domain); + int au_discover (); + void au_refresh (); + int vst_discover_from_path (std::string path); int vst_discover (std::string path); @@ -71,6 +77,7 @@ class PluginManager { int ladspa_discover (std::string path); std::string get_ladspa_category (uint32_t id); + std::vector<uint32_t> ladspa_plugin_whitelist; static PluginManager* _manager; // singleton }; diff --git a/libs/ardour/ardour/rb_effect.h b/libs/ardour/ardour/rb_effect.h new file mode 100644 index 0000000000..bde0422335 --- /dev/null +++ b/libs/ardour/ardour/rb_effect.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2007 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_rbeffect_h__ +#define __ardour_rbeffect_h__ + +#include <ardour/audiofilter.h> + +namespace ARDOUR { + +class AudioRegion; + +class RBEffect : public Filter { + public: + RBEffect (ARDOUR::Session&, TimeFXRequest&); + ~RBEffect (); + + int run (boost::shared_ptr<ARDOUR::Region>); + + private: + TimeFXRequest& tsr; +}; + +} /* namespace */ + +#endif /* __ardour_rbeffect_h__ */ diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index c246da9cce..76b41a04cb 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -96,11 +96,17 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> nframes_t length() const { return _length; } layer_t layer () const { return _layer; } + /* these two are valid ONLY during a StateChanged signal handler */ + + nframes_t last_position() const { return _last_position; } + nframes_t last_length() const { return _last_length; } + nframes64_t ancestral_start () const { return _ancestral_start; } nframes64_t ancestral_length () const { return _ancestral_length; } float stretch() const { return _stretch; } + float shift() const { return _shift; } - void set_ancestral_data (nframes64_t start, nframes64_t length, float stretch); + void set_ancestral_data (nframes64_t start, nframes64_t length, float stretch, float shift); nframes_t sync_offset(int& dir) const; nframes_t sync_position() const; @@ -129,7 +135,7 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> void thaw (const string& why); bool covers (nframes_t frame) const { - return first_frame() <= frame && frame < last_frame(); + return first_frame() <= frame && frame <= last_frame(); } OverlapType coverage (nframes_t start, nframes_t end) const { @@ -149,7 +155,7 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> void set_position (nframes_t, void *src); void set_position_on_top (nframes_t, void *src); void special_set_position (nframes_t); - void nudge_position (long, void *src); + void nudge_position (nframes64_t, void *src); bool at_natural_position () const; void move_to_natural_position (void *src); @@ -160,6 +166,8 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> void trim_to (nframes_t position, nframes_t length, void *src); void set_layer (layer_t l); /* ONLY Playlist can call this */ + void raise (); + void lower (); void raise_to_top (); void lower_to_bottom (); @@ -232,10 +240,11 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> void maybe_uncopy (); void first_edit (); - 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); + bool verify_start (nframes_t); + bool verify_start_and_length (nframes_t, nframes_t&); + bool verify_start_mutable (nframes_t&_start); + bool verify_length (nframes_t); + virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0; @@ -243,7 +252,9 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> Flag _flags; nframes_t _start; nframes_t _length; + nframes_t _last_length; nframes_t _position; + nframes_t _last_position; nframes_t _sync_position; layer_t _layer; mutable RegionEditState _first_edit; @@ -251,6 +262,7 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> nframes64_t _ancestral_start; nframes64_t _ancestral_length; float _stretch; + float _shift; mutable uint32_t _read_data_count; ///< modified in read() Change _pending_changed; uint64_t _last_layer_op; ///< timestamp diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index fc17af06ee..d2e40501f1 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -109,7 +109,7 @@ class Route : public IO void set_gain (gain_t val, void *src); void inc_gain (gain_t delta, void *src); - + bool active() const { return _active; } void set_active (bool yn); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index d0add4e2aa..90a9563ad1 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -138,6 +138,7 @@ class Session : public PBD::StatefulDestructible SetDiskstreamSpeed, Locate, LocateRoll, + LocateRollLocate, SetLoop, PunchIn, PunchOut, @@ -224,9 +225,9 @@ class Session : public PBD::StatefulDestructible /* creating from an XML file */ Session (AudioEngine&, - string fullpath, - string snapshot_name, - string* mix_template = 0); + const string& fullpath, + const string& snapshot_name, + string mix_template = ""); /* creating a new Session */ @@ -354,7 +355,7 @@ class Session : public PBD::StatefulDestructible sigc::signal<void,RouteList&> RouteAdded; - void request_roll (); + void request_roll_at_and_return (nframes_t start, nframes_t return_to); void request_bounded_roll (nframes_t start, nframes_t end); void request_stop (bool abort = false); void request_locate (nframes_t frame, bool with_roll = false); @@ -499,6 +500,7 @@ class Session : public PBD::StatefulDestructible nframes_t transport_frame () const {return _transport_frame; } nframes_t audible_frame () const; + nframes64_t requested_return_frame() const { return _requested_return_frame; } enum PullupFormat { pullup_Plus4Plus1, @@ -542,6 +544,9 @@ class Session : public PBD::StatefulDestructible float transport_speed() const { return _transport_speed; } bool transport_stopped() const { return _transport_speed == 0.0f; } bool transport_rolling() const { return _transport_speed != 0.0f; } + + void set_silent (bool yn); + bool silent () { return _silent; } int jack_slave_sync (nframes_t); @@ -701,6 +706,13 @@ class Session : public PBD::StatefulDestructible uint32_t n_port_inserts() const { return _port_inserts.size(); } uint32_t n_plugin_inserts() const { return _plugin_inserts.size(); } uint32_t n_sends() const { return _sends.size(); } + + static void set_disable_all_loaded_plugins (bool yn) { + _disable_all_loaded_plugins = yn; + } + static bool get_disable_all_loaded_plugins() { + return _disable_all_loaded_plugins; + } uint32_t next_send_id(); uint32_t next_insert_id(); @@ -901,6 +913,18 @@ class Session : public PBD::StatefulDestructible long value, void* ptr, float opt); + + typedef float (*compute_peak_t) (Sample *, nframes_t, float); + typedef void (*find_peaks_t) (Sample *, nframes_t, float *, float*); + typedef void (*apply_gain_to_buffer_t) (Sample *, nframes_t, float); + typedef void (*mix_buffers_with_gain_t) (Sample *, Sample *, nframes_t, float); + typedef void (*mix_buffers_no_gain_t) (Sample *, Sample *, nframes_t); + + static compute_peak_t compute_peak; + static find_peaks_t find_peaks; + static apply_gain_to_buffer_t apply_gain_to_buffer; + static mix_buffers_with_gain_t mix_buffers_with_gain; + static mix_buffers_no_gain_t mix_buffers_no_gain; static sigc::signal<void> SendFeedback; @@ -927,12 +951,9 @@ class Session : public PBD::StatefulDestructible void update_latency_compensation (bool, bool); private: + int create (bool& new_session, const string& mix_template, nframes_t initial_length); void destroy (); - - void initialize_start_and_end_locations(nframes_t start, nframes_t end); - bool create_session_file(); - bool create_session_file_from_template (const string& template_path); - + nframes_t compute_initial_length (); enum SubState { @@ -949,35 +970,36 @@ class Session : public PBD::StatefulDestructible */ typedef void (Session::*process_function_type)(nframes_t); - - AudioEngine &_engine; - mutable gint processing_prohibited; - /// the function called when the main JACK process callback happens + + AudioEngine& _engine; + mutable gint processing_prohibited; process_function_type process_function; process_function_type last_process_function; bool waiting_for_sync_offset; - nframes_t _base_frame_rate; - nframes_t _current_frame_rate; //this includes video pullup offset + nframes_t _base_frame_rate; + nframes_t _current_frame_rate; //this includes video pullup offset int transport_sub_state; - mutable gint _record_status; - nframes_t _transport_frame; + mutable gint _record_status; + volatile nframes_t _transport_frame; Location* end_location; Location* start_location; - Slave *_slave; + Slave* _slave; + bool _silent; volatile float _transport_speed; volatile float _desired_transport_speed; float _last_transport_speed; bool auto_play_legal; - nframes_t _last_slave_transport_frame; - nframes_t maximum_output_latency; - nframes_t last_stop_frame; + nframes_t _last_slave_transport_frame; + nframes_t maximum_output_latency; + nframes_t last_stop_frame; + volatile nframes64_t _requested_return_frame; BufferSet* _scratch_buffers; BufferSet* _silent_buffers; BufferSet* _mix_buffers; - nframes_t current_block_size; - nframes_t _worst_output_latency; - nframes_t _worst_input_latency; - nframes_t _worst_track_latency; + nframes_t current_block_size; + nframes_t _worst_output_latency; + nframes_t _worst_input_latency; + nframes_t _worst_track_latency; bool _have_captured; float _meter_hold; float _meter_falloff; @@ -1675,6 +1697,8 @@ class Session : public PBD::StatefulDestructible void set_history_depth (uint32_t depth); void sync_order_keys (); + + static bool _disable_all_loaded_plugins; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h index 92ef076a9b..e0103185c2 100644 --- a/libs/ardour/ardour/silentfilesource.h +++ b/libs/ardour/ardour/silentfilesource.h @@ -34,11 +34,6 @@ class SilentFileSource : public AudioFileSource { void set_length (nframes_t len); - int read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const { - memset (peaks, 0, sizeof (PeakData) * npeaks); - return 0; - } - bool destructive() const { return false; } protected: @@ -58,6 +53,11 @@ class SilentFileSource : public AudioFileSource { void set_header_timeline_position () {} + int read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit, nframes_t fpp) const { + memset (peaks, 0, sizeof (PeakData) * npeaks); + return 0; + } + }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 73b66ca20e..509f8fa9d2 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -47,6 +47,7 @@ class Slave { virtual bool starting() const { return false; } virtual nframes_t resolution() const = 0; virtual bool requires_seekahead () const = 0; + virtual bool is_always_synced() const { return false; } }; @@ -139,6 +140,7 @@ class JACK_Slave : public Slave nframes_t resolution() const { return 1; } bool requires_seekahead () const { return false; } void reset_client (jack_client_t* jack); + bool is_always_synced() const { return true; } private: jack_client_t* jack; diff --git a/libs/ardour/ardour/sndfile_helpers.h b/libs/ardour/ardour/sndfile_helpers.h index 26a93ad124..cf6b15f3a4 100644 --- a/libs/ardour/ardour/sndfile_helpers.h +++ b/libs/ardour/ardour/sndfile_helpers.h @@ -28,7 +28,7 @@ using std::string; // Use this define when initializing arrarys for use in sndfile_*_format() #define SNDFILE_STR_LENGTH 32 -#define SNDFILE_HEADER_FORMATS 7 +#define SNDFILE_HEADER_FORMATS 5 extern const char * const sndfile_header_formats_strings[SNDFILE_HEADER_FORMATS+1]; extern const char * const sndfile_file_endings_strings[SNDFILE_HEADER_FORMATS+1]; diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 6f323dd878..869111bb07 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -63,6 +63,8 @@ class Source : public SessionObject XMLNode& get_state (); int set_state (const XMLNode&); + virtual bool destructive() const { return false; } + void use () { _in_use++; } void disuse () { if (_in_use) { _in_use--; } } diff --git a/libs/ardour/ardour/stretch.h b/libs/ardour/ardour/stretch.h index 4d00c9b17b..020d03270d 100644 --- a/libs/ardour/ardour/stretch.h +++ b/libs/ardour/ardour/stretch.h @@ -21,31 +21,46 @@ #define __ardour_stretch_h__ #include <ardour/filter.h> -#include <soundtouch/SoundTouch.h> namespace ARDOUR { + class AudioRegion; +} + +#ifdef USE_RUBBERBAND -class AudioRegion; +#include <ardour/rb_effect.h> + +namespace ARDOUR { -struct TimeStretchRequest : public InterThreadInfo { - float fraction; - bool quick_seek; - bool antialias; +class Stretch : public RBEffect { + public: + Stretch (ARDOUR::Session&, TimeFXRequest&); + ~Stretch() {} }; +} /* namespace */ + +#else + +#include <soundtouch/SoundTouch.h> + +namespace ARDOUR { + class Stretch : public Filter { public: - Stretch (ARDOUR::Session&, TimeStretchRequest&); + Stretch (ARDOUR::Session&, TimeFXRequest&); ~Stretch (); int run (boost::shared_ptr<ARDOUR::Region>); private: - TimeStretchRequest& tsr; - soundtouch::SoundTouch st; + TimeFXRequest& tsr; + soundtouch::SoundTouch st; }; } /* namespace */ +#endif + #endif /* __ardour_stretch_h__ */ diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 2d8462a751..72f24c1054 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -40,27 +40,29 @@ using std::list; using std::vector; namespace ARDOUR { - +class Meter; class Tempo { public: - Tempo (double bpm) - : _beats_per_minute (bpm) {} + Tempo (double bpm, double type=4.0) // defaulting to quarter note + : _beats_per_minute (bpm), _note_type(type) {} Tempo (const Tempo& other) { _beats_per_minute = other._beats_per_minute; + _note_type = other._note_type; } void operator= (const Tempo& other) { if (&other != this) { _beats_per_minute = other._beats_per_minute; + _note_type = other._note_type; } } - double beats_per_minute () const { return _beats_per_minute; } - double frames_per_beat (nframes_t sr) const { - return ((60.0 * sr) / _beats_per_minute); - } + double beats_per_minute () const { return _beats_per_minute;} + double note_type () const { return _note_type;} + double frames_per_beat (nframes_t sr, const Meter& meter) const; protected: double _beats_per_minute; + double _note_type; }; class Meter { @@ -149,8 +151,8 @@ class MeterSection : public MetricSection, public Meter { class TempoSection : public MetricSection, public Tempo { public: - TempoSection (const BBT_Time& start, double qpm) - : MetricSection (start), Tempo (qpm) {} + TempoSection (const BBT_Time& start, double qpm, double note_type) + : MetricSection (start), Tempo (qpm, note_type) {} TempoSection (const XMLNode&); static const string xml_state_node_name; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 0d32d35c7d..d7961babbd 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -379,6 +379,13 @@ namespace ARDOUR { SrcFastest }; + struct TimeFXRequest : public InterThreadInfo { + float time_fraction; + float pitch_fraction; + bool quick_seek; + bool antialias; + }; + } // namespace ARDOUR std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf); diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 1622df0c1a..3a05360f15 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -56,7 +56,7 @@ class VSTPlugin : public ARDOUR::Plugin /* Plugin interface */ - uint32_t unique_id() const; + std::string unique_id() const; const char * label() const; const char * name() const; const char * maker() const; |