diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-10-11 22:07:47 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-10-11 22:07:47 +0000 |
commit | f7f9d6fdc40248b190ec9c6e1a886261d55777ae (patch) | |
tree | 080723e9dc35a66013b37acbafc67a6afa929302 /libs/ardour/ardour | |
parent | aa1f736a651376534acaa2268b65d42a3786fff7 (diff) |
merge from 2.0-ongoing by hand, minus key binding editor
git-svn-id: svn://localhost/ardour2/trunk@2539 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/ardour.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/audiofilesource.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/audiosource.h | 50 | ||||
-rw-r--r-- | libs/ardour/ardour/automatable.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/configuration.h | 12 | ||||
-rw-r--r-- | libs/ardour/ardour/configuration_vars.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/io.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/profile.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/resampled_source.h | 50 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 15 | ||||
-rw-r--r-- | libs/ardour/ardour/sndfilesource.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/source_factory.h | 17 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/utils.h | 2 |
15 files changed, 151 insertions, 49 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 1b9725a04c..6e7b494441 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -47,8 +47,6 @@ namespace ARDOUR { int init (bool with_vst, bool try_optimization); int cleanup (); - int setup_midi(AudioEngine& engine); - std::string get_ardour_revision (); microseconds_t get_microseconds (); diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 78d10f9d64..4d80c8ddf5 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -61,7 +61,8 @@ class AudioFileSource : public AudioSource { Glib::ustring path() const { return _path; } Glib::ustring peak_path (Glib::ustring audio_path); - Glib::ustring old_peak_path (Glib::ustring audio_path); + Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, + Glib::ustring audio_path); uint16_t channel() const { return _channel; } @@ -122,7 +123,7 @@ class AudioFileSource : public AudioSource { to cause issues. */ - virtual void handle_header_position_change (); + virtual void handle_header_position_change () {} protected: @@ -166,6 +167,10 @@ class AudioFileSource : public AudioSource { bool find (Glib::ustring& path, bool must_exist, bool& is_new, uint16_t& chan); bool removable() const; bool writable() const { return _flags & Writable; } + + private: + Glib::ustring old_peak_path (Glib::ustring audio_path); + Glib::ustring broken_peak_path (Glib::ustring audio_path); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 812c30e8c2..7b22528bd1 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -40,7 +40,6 @@ using std::list; using std::vector; -using Glib::ustring; namespace ARDOUR { @@ -49,10 +48,23 @@ const nframes_t frames_per_peak = 256; class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR::AudioSource> { public: - AudioSource (Session&, ustring name); + AudioSource (Session&, Glib::ustring name); AudioSource (Session&, const XMLNode&); virtual ~AudioSource (); + + /* one could argue that this should belong to Source, but other data types + generally do not come with a model of "offset along an audio timeline" + so its here in AudioSource for now. + */ + + virtual nframes_t natural_position() const { return 0; } + /* returns the number of items in this `audio_source' */ + + virtual nframes_t length() const { + return _length; + } + virtual nframes_t available_peaks (double zoom) const; virtual nframes_t read (Sample *dst, nframes_t start, nframes_t cnt) const; @@ -65,8 +77,8 @@ const nframes_t frames_per_peak = 256; virtual bool can_truncate_peaks() const { return true; } - void set_captured_for (ustring str) { _captured_for = str; } - ustring captured_for() const { return _captured_for; } + void set_captured_for (Glib::ustring str) { _captured_for = str; } + Glib::ustring captured_for() const { return _captured_for; } uint32_t read_data_count() const { return _read_data_count; } uint32_t write_data_count() const { return _write_data_count; } @@ -81,7 +93,7 @@ const nframes_t frames_per_peak = 256; XMLNode& get_state (); int set_state (const XMLNode&); - int rename_peakfile (ustring newpath); + int rename_peakfile (Glib::ustring newpath); void touch_peakfile (); static void set_build_missing_peakfiles (bool yn) { @@ -92,35 +104,43 @@ const nframes_t frames_per_peak = 256; _build_peakfiles = yn; } + static bool get_build_peakfiles () { + return _build_peakfiles; + } + virtual int setup_peakfile () { return 0; } int prepare_for_peakfile_writes (); - void done_with_peakfile_writes (); + void done_with_peakfile_writes (bool done = true); protected: static bool _build_missing_peakfiles; static bool _build_peakfiles; - bool _peaks_built; - mutable Glib::Mutex _lock; - ustring peakpath; - ustring _captured_for; + bool _peaks_built; + mutable Glib::Mutex _lock; + mutable Glib::Mutex _peaks_ready_lock; + nframes_t _length; + Glib::ustring peakpath; + Glib::ustring _captured_for; mutable uint32_t _read_data_count; // modified in read() mutable uint32_t _write_data_count; // modified in write() - int initialize_peakfile (bool newfile, ustring path); + int initialize_peakfile (bool newfile, Glib::ustring path); int build_peaks_from_scratch (); - int compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframes_t cnt, bool force); + int compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframes_t cnt, bool force, bool intermediate_peaks_ready_signal); void truncate_peakfile(); mutable off_t _peak_byte_max; // modified in compute_and_write_peak() virtual nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const = 0; virtual nframes_t write_unlocked (Sample *dst, nframes_t cnt) = 0; - virtual ustring peak_path(ustring audio_path) = 0; - virtual ustring old_peak_path(ustring audio_path) = 0; + virtual Glib::ustring peak_path(Glib::ustring audio_path) = 0; + virtual Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, Glib::ustring audio_path) = 0; + void update_length (nframes_t pos, nframes_t cnt); + private: int peakfile; nframes_t peak_leftover_cnt; @@ -128,7 +148,7 @@ const nframes_t frames_per_peak = 256; Sample* peak_leftovers; nframes_t peak_leftover_frame; - bool file_changed (ustring path); + bool file_changed (Glib::ustring path); }; } diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index fe47614a1f..f96ecc0bd1 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -83,6 +83,14 @@ public: Glib::Mutex& automation_lock() const { return _automation_lock; } + static void set_automation_interval (jack_nframes_t frames) { + _automation_interval = frames; + } + + static jack_nframes_t automation_interval() { + return _automation_interval; + } + protected: void can_automate(Parameter); @@ -102,6 +110,7 @@ protected: std::set<Parameter> _can_automate_list; nframes_t _last_automation_snapshot; + static nframes_t _automation_interval; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index 70b7e166c1..7b890500d8 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -42,17 +42,7 @@ class Configuration : public PBD::Stateful Configuration(); virtual ~Configuration(); - struct MidiPortDescriptor { - std::string tag; - std::string device; - std::string type; - std::string mode; - - MidiPortDescriptor (const XMLNode&); - XMLNode& get_state(); - }; - - std::map<std::string,MidiPortDescriptor *> midi_ports; + std::map<std::string,XMLNode> midi_ports; void map_parameters (sigc::slot<void,const char*> theSlot); diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 4d5579a9a0..b592a9f721 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -138,11 +138,15 @@ CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture", CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false) CONFIG_VARIABLE (bool, use_vst, "use-vst", true) CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100) -CONFIG_VARIABLE (uint32_t, saved_history_depth, "save-history-depth", 100) +CONFIG_VARIABLE (bool, save_history, "save-history", true) +CONFIG_VARIABLE (int32_t, saved_history_depth, "save-history-depth", 20) +CONFIG_VARIABLE (int32_t, history_depth, "history-depth", 20) CONFIG_VARIABLE (bool, use_overlap_equivalency, "use-overlap-equivalency", false) CONFIG_VARIABLE (bool, periodic_safety_backups, "periodic-safety-backups", true) CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-backup-interval", 120) -CONFIG_VARIABLE (string, possible_audio_file_regexp, "possible-audio-file-regexp", "\\.(wav|aiff|caf|w64|L|R)$") +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) /* denormal management */ diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 6c040be63e..6e68c01d8c 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -219,7 +219,7 @@ class IO : public Automatable, public Latent public: /* automation */ - + struct GainControl : public AutomationControl { GainControl (std::string name, IO& i, boost::shared_ptr<AutomationList> al) : AutomationControl (i._session, al, name) diff --git a/libs/ardour/ardour/profile.h b/libs/ardour/ardour/profile.h index 3347447915..b016063c4d 100644 --- a/libs/ardour/ardour/profile.h +++ b/libs/ardour/ardour/profile.h @@ -29,6 +29,8 @@ class RuntimeProfile { public: enum Element { SmallScreen, + SAE, + SinglePackage, LastElement }; @@ -38,6 +40,12 @@ class RuntimeProfile { void set_small_screen() { bits[SmallScreen] = true; } bool get_small_screen() const { return bits[SmallScreen]; } + void set_sae () { bits[SAE] = true; } + bool get_sae () const { return bits[SAE]; } + + void set_single_package () { bits[SinglePackage] = true; } + bool get_single_package () const { return bits[SinglePackage]; } + private: boost::dynamic_bitset<uint64_t> bits; diff --git a/libs/ardour/ardour/resampled_source.h b/libs/ardour/ardour/resampled_source.h new file mode 100644 index 0000000000..9a88ca9644 --- /dev/null +++ b/libs/ardour/ardour/resampled_source.h @@ -0,0 +1,50 @@ +/* + 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_resampled_source_h__ +#define __ardour_resampled_source_h__ + +#include <samplerate.h> + +#include <ardour/types.h> +#include <ardour/importable_source.h> + +namespace ARDOUR { + +class ResampledImportableSource : public ImportableSource +{ + public: + ResampledImportableSource (SNDFILE* sf, SF_INFO* info, nframes_t rate, SrcQuality); + ~ResampledImportableSource (); + + nframes_t read (Sample* buffer, nframes_t nframes); + + float ratio() const { return src_data.src_ratio; } + + static const uint32_t blocksize; + + private: + float* input; + SRC_STATE* src_state; + SRC_DATA src_data; +}; + +} + +#endif /* __ardour_resampled_source_h__ */ diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 1fd6eff0f8..fc17af06ee 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -258,6 +258,9 @@ class Route : public IO uint32_t remote_control_id () const; sigc::signal<void> RemoteControlIDChanged; + void sync_order_keys (); + static sigc::signal<void> SyncOrderKeys; + protected: friend class Session; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 94caf8a242..bbcae6e91d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -261,6 +261,8 @@ class Session : public PBD::StatefulDestructible std::string automation_dir () const; + Glib::ustring peak_path (Glib::ustring) const; + static string change_audio_path_by_name (string oldpath, string oldname, string newname, bool destructive); static string change_midi_path_by_name (string oldpath, string oldname, string newname, bool destructive); @@ -422,6 +424,7 @@ class Session : public PBD::StatefulDestructible int restore_history (string snapshot_name); void remove_state (string snapshot_name); void rename_state (string old_name, string new_name); + void remove_pending_capture_state (); sigc::signal<void,string> StateSaved; sigc::signal<void> StateReady; @@ -568,13 +571,14 @@ class Session : public PBD::StatefulDestructible string doing_what; /* control info */ - bool multichan; bool sample_convert; + SrcQuality quality; volatile bool freeze; std::vector<Glib::ustring> paths; /* result */ - std::vector<boost::shared_ptr<Region> > new_regions; + SourceList sources; + }; int import_audiofile (import_status&); @@ -650,8 +654,6 @@ class Session : public PBD::StatefulDestructible void add_curve(Curve*); void add_automation_list(AutomationList*); - nframes_t automation_interval () const { return _automation_interval; } - /* fade curves */ float get_default_fade_length () const { return default_fade_msecs; } @@ -1650,8 +1652,6 @@ class Session : public PBD::StatefulDestructible void allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, bool force); uint32_t _npan_buffers; - nframes_t _automation_interval; - /* VST support */ long _vst_callback (VSTPlugin*, @@ -1668,7 +1668,6 @@ class Session : public PBD::StatefulDestructible uint32_t n_physical_outputs; uint32_t n_physical_inputs; - void remove_pending_capture_state (); int find_all_sources (std::string path, std::set<std::string>& result); int find_all_sources_across_snapshots (std::set<std::string>& result, bool exclude_this_snapshot); @@ -1688,6 +1687,8 @@ class Session : public PBD::StatefulDestructible XMLNode& get_control_protocol_state (); + void set_history_depth (uint32_t depth); + void sync_order_keys (); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 916e9da49e..4fd71a4c96 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -76,9 +76,6 @@ class SndFileSource : public AudioFileSource { SF_INFO _info; SF_BROADCAST_INFO *_broadcast_info; - mutable float *interleave_buf; - mutable nframes_t interleave_bufsize; - void init (); int open(); void close(); @@ -105,6 +102,7 @@ class SndFileSource : public AudioFileSource { void handle_header_position_change (); static int64_t get_timecode_info (SNDFILE* sf, SF_BROADCAST_INFO* binfo, bool& exists); + static Sample* get_interleave_buffer (nframes_t size); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index fb591216bf..01f50126a4 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -36,16 +36,23 @@ class Session; class SourceFactory { public: + static void init (); + static sigc::signal<void,boost::shared_ptr<Source> > SourceCreated; - static boost::shared_ptr<Source> create (Session&, const XMLNode& node); + static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false); static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node, nframes_t nframes, float sample_rate); - static boost::shared_ptr<Source> createReadable (DataType type, Session&, std::string path, int chn, AudioFileSource::Flag flags, bool announce = true); - static boost::shared_ptr<Source> createWritable (DataType type, Session&, std::string name, bool destructive, nframes_t rate, bool announce = true); + static boost::shared_ptr<Source> createReadable (DataType type, Session&, std::string path, int chn, AudioFileSource::Flag flags, + bool announce = true, bool async = false); + static boost::shared_ptr<Source> createWritable (DataType type, Session&, std::string name, bool destructive, nframes_t rate, + bool announce = true, bool async = true); + + static Glib::Cond* PeaksToBuild; + static Glib::StaticMutex peak_building_lock; + static std::list<boost::weak_ptr<AudioSource> > files_with_peaks; - private: - static int setup_peakfile (boost::shared_ptr<Source>); + static int setup_peakfile (boost::shared_ptr<Source>, bool async); }; } diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index e13bd09d83..5b50713313 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -370,6 +370,15 @@ namespace ARDOUR { }; typedef std::vector<boost::shared_ptr<Source> > SourceList; + + enum SrcQuality { + SrcBest, + SrcGood, + SrcQuick, + SrcFast, + SrcFastest + }; + } // namespace ARDOUR std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf); diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index cde17d8b49..e52274eb1f 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -50,7 +50,7 @@ int cmp_nocase (const std::string& s, const std::string& s2); int touch_file(Glib::ustring path); Glib::ustring path_expand (Glib::ustring); -Glib::ustring region_name_from_path (Glib::ustring path, bool strip_channels); +Glib::ustring region_name_from_path (Glib::ustring path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0); bool path_is_paired (Glib::ustring path, Glib::ustring& pair_base); void compute_equal_power_fades (nframes_t nframes, float* in, float* out); |