summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audiofilesource.h87
-rw-r--r--libs/ardour/ardour/audiosource.h6
-rw-r--r--libs/ardour/ardour/file_source.h83
-rw-r--r--libs/ardour/ardour/midi_source.h10
-rw-r--r--libs/ardour/ardour/route.h117
-rw-r--r--libs/ardour/ardour/session.h116
-rw-r--r--libs/ardour/ardour/silentfilesource.h27
-rw-r--r--libs/ardour/ardour/smf_source.h72
-rw-r--r--libs/ardour/ardour/sndfilesource.h18
-rw-r--r--libs/ardour/ardour/source.h20
-rw-r--r--libs/ardour/ardour/source_factory.h6
11 files changed, 294 insertions, 268 deletions
diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h
index 249651c3cf..2b59de63ca 100644
--- a/libs/ardour/ardour/audiofilesource.h
+++ b/libs/ardour/ardour/audiofilesource.h
@@ -21,18 +21,12 @@
#define __ardour_audiofilesource_h__
#include <exception>
-
#include <time.h>
-
#include <ardour/audiosource.h>
+#include <ardour/file_source.h>
namespace ARDOUR {
-class non_existent_source : public std::exception {
- public:
- virtual const char *what() const throw() { return "audio file does not exist"; }
-};
-
struct SoundFileInfo {
float samplerate;
uint16_t channels;
@@ -41,107 +35,78 @@ struct SoundFileInfo {
int64_t timecode;
};
-class AudioFileSource : public AudioSource {
- public:
+class AudioFileSource : public AudioSource, public FileSource {
+public:
virtual ~AudioFileSource ();
bool set_name (const std::string& newname) {
return (set_source_name(newname, destructive()) == 0);
}
- int set_source_name (Glib::ustring newname, bool destructive);
- Glib::ustring path() const { return _path; }
Glib::ustring 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; }
-
static void set_peak_dir (Glib::ustring dir) { peak_dir = dir; }
static bool get_soundfile_info (Glib::ustring path, SoundFileInfo& _info, std::string& error);
- static bool safe_file_extension (Glib::ustring path);
-
- void set_allow_remove_if_empty (bool yn);
- void mark_for_remove();
+ bool safe_file_extension (const Glib::ustring& path) const {
+ return safe_audio_file_extension(path);
+ }
/* this block of methods do nothing for regular file sources, but are significant
for files used in destructive recording.
*/
virtual nframes_t last_capture_start_frame() const { return 0; }
- virtual void mark_capture_start (nframes_t) {}
- virtual void mark_capture_end () {}
- virtual void clear_capture_marks() {}
- virtual bool one_of_several_channels () const { return false; }
+ virtual void mark_capture_start (nframes_t) {}
+ virtual void mark_capture_end () {}
+ virtual void clear_capture_marks() {}
+ virtual bool one_of_several_channels () const { return false; }
virtual int update_header (nframes_t when, struct tm&, time_t) = 0;
virtual int flush_header () = 0;
- int move_to_trash (const Glib::ustring& trash_dir_name);
-
- static bool is_empty (Session&, Glib::ustring path);
void mark_streaming_write_completed ();
- void mark_take (Glib::ustring);
- Glib::ustring take_id() const { return _take_id; }
-
- bool is_embedded() const { return _is_embedded; }
-
- static void set_bwf_serial_number (int);
-
- static void set_search_path (Glib::ustring string);
- static void set_header_position_offset (nframes_t offset );
-
int setup_peakfile ();
XMLNode& get_state ();
int set_state (const XMLNode&);
- bool destructive() const { return (_flags & Destructive); }
- virtual bool set_destructive (bool yn) { return false; }
- bool can_truncate_peaks() const { return !destructive(); }
- bool can_be_analysed() const { return _length > 0; }
-
- void mark_immutable ();
+ bool can_truncate_peaks() const { return !destructive(); }
+ bool can_be_analysed() const { return _length > 0; }
+ static bool safe_audio_file_extension (const Glib::ustring& path);
+
+ static bool is_empty (Session&, Glib::ustring path);
+
+ static void set_bwf_serial_number (int);
+ static void set_header_position_offset (nframes_t offset );
+
static sigc::signal<void> HeaderPositionOffsetChanged;
- protected:
-
+protected:
/** Constructor to be called for existing external-to-session files */
- AudioFileSource (Session&, Glib::ustring path, Source::Flag flags);
+ AudioFileSource (Session&, const Glib::ustring& path, bool embedded, Source::Flag flags);
/** Constructor to be called for new in-session files */
- AudioFileSource (Session&, Glib::ustring path, Source::Flag flags,
+ AudioFileSource (Session&, const Glib::ustring& path, bool embedded, Source::Flag flags,
SampleFormat samp_format, HeaderFormat hdr_format);
/** Constructor to be called for existing in-session files */
- AudioFileSource (Session&, const XMLNode&, bool must_exit = true);
+ AudioFileSource (Session&, const XMLNode&, bool must_exist = true);
- int init (Glib::ustring idstr, bool must_exist);
-
- static bool determine_embeddedness (Glib::ustring path);
+ int init (const Glib::ustring& idstr, bool must_exist);
- virtual void set_timeline_position (int64_t pos);
virtual void set_header_timeline_position () = 0;
virtual void handle_header_position_change () {}
-
- bool find (Glib::ustring& path, bool must_exist, bool& is_new, uint16_t& chan);
- bool removable() const;
- bool writable() const { return _flags & Writable; }
+
+ int move_dependents_to_trash();
static Sample* get_interleave_buffer (nframes_t size);
- Glib::ustring _path;
- Glib::ustring _take_id;
- int64_t _timeline_position;
- bool _file_is_new;
- uint16_t _channel;
- bool _is_embedded;
-
static Glib::ustring peak_dir;
- static Glib::ustring search_path;
static char bwf_country_code[3];
static char bwf_organization_code[4];
diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h
index 43273301b1..eff21b898c 100644
--- a/libs/ardour/ardour/audiosource.h
+++ b/libs/ardour/ardour/audiosource.h
@@ -43,7 +43,7 @@ using std::vector;
namespace ARDOUR {
-class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR::AudioSource>
+class AudioSource : virtual public Source, public boost::enable_shared_from_this<ARDOUR::AudioSource>
{
public:
AudioSource (Session&, Glib::ustring name);
@@ -68,7 +68,6 @@ class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR:
virtual float sample_rate () const = 0;
- virtual void mark_for_remove() = 0;
virtual void mark_streaming_write_completed () {}
virtual bool can_truncate_peaks() const { return true; }
@@ -116,7 +115,6 @@ class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR:
static bool _build_peakfiles;
bool _peaks_built;
- mutable Glib::Mutex _lock;
mutable Glib::Mutex _peaks_ready_lock;
Glib::ustring peakpath;
Glib::ustring _captured_for;
@@ -138,8 +136,6 @@ class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR:
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);
-
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;
diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h
new file mode 100644
index 0000000000..0d6cae9b18
--- /dev/null
+++ b/libs/ardour/ardour/file_source.h
@@ -0,0 +1,83 @@
+/*
+ Copyright (C) 2006-2009 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_filesource_h__
+#define __ardour_filesource_h__
+
+#include <exception>
+#include <time.h>
+#include <ardour/source.h>
+
+namespace ARDOUR {
+
+class MissingSource : public std::exception {
+public:
+ virtual const char *what() const throw() { return "source file does not exist"; }
+};
+
+/** A source associated with a file on disk somewhere */
+class FileSource : virtual public Source {
+public:
+ const Glib::ustring& path() const { return _path; }
+
+ virtual bool safe_file_extension (const Glib::ustring& path) const = 0;
+
+ int move_to_trash (const Glib::ustring& trash_dir_name);
+ void mark_take (const Glib::ustring& id);
+ void mark_immutable ();
+
+ const Glib::ustring& take_id () const { return _take_id; }
+ bool is_embedded () const { return _is_embedded; }
+ uint16_t channel() const { return _channel; }
+
+ int set_state (const XMLNode&);
+
+ int set_source_name (const Glib::ustring& newname, bool destructive);
+
+ static void set_search_path (DataType type, const Glib::ustring& path);
+
+protected:
+ FileSource (Session& session, DataType type,
+ const Glib::ustring& path, bool embedded,
+ Source::Flag flags = Source::Flag(0));
+
+ FileSource (Session& session, const XMLNode& node, bool must_exist);
+
+ virtual int init (const Glib::ustring& idstr, bool must_exist);
+
+ virtual int move_dependents_to_trash() { return 0; }
+
+ bool find (DataType type, const Glib::ustring& path,
+ bool must_exist, bool& is_new, uint16_t& chan);
+
+ bool removable () const;
+
+ Glib::ustring _path;
+ Glib::ustring _take_id;
+ bool _file_is_new;
+ uint16_t _channel;
+ bool _is_embedded;
+
+ static map<DataType, Glib::ustring> search_paths;
+};
+
+} // namespace ARDOUR
+
+#endif /* __ardour_filesource_h__ */
+
diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h
index 0dedb3282d..0bc431a8d8 100644
--- a/libs/ardour/ardour/midi_source.h
+++ b/libs/ardour/ardour/midi_source.h
@@ -38,7 +38,7 @@ class MidiModel;
template<typename T> class MidiRingBuffer;
/** Source for MIDI data */
-class MidiSource : public Source
+class MidiSource : virtual public Source
{
public:
typedef double TimeType;
@@ -60,14 +60,10 @@ class MidiSource : public Source
virtual void append_event_unlocked_beats(const Evoral::Event<double>& ev) = 0;
virtual void append_event_unlocked_frames(const Evoral::Event<nframes_t>& ev) = 0;
- virtual void mark_for_remove() = 0;
virtual void mark_streaming_midi_write_started (NoteMode mode, nframes_t start_time);
virtual void mark_streaming_write_started ();
virtual void mark_streaming_write_completed ();
- uint64_t timeline_position () { return _timeline_position; }
- void set_timeline_position (nframes_t when);
-
virtual void session_saved();
std::string captured_for() const { return _captured_for; }
@@ -90,6 +86,8 @@ class MidiSource : public Source
virtual void destroy_model() = 0;
void set_note_mode(NoteMode mode);
+
+ void set_timeline_position (int64_t pos);
boost::shared_ptr<MidiModel> model() { return _model; }
void set_model(boost::shared_ptr<MidiModel> m) { _model = m; }
@@ -106,9 +104,7 @@ class MidiSource : public Source
nframes_t stamp_offset, nframes_t negative_stamp_offset) const = 0;
virtual nframes_t write_unlocked (MidiRingBuffer<nframes_t>& dst, nframes_t cnt) = 0;
- mutable Glib::Mutex _lock;
std::string _captured_for;
- uint64_t _timeline_position;
mutable uint32_t _read_data_count; ///< modified in read()
mutable uint32_t _write_data_count; ///< modified in write()
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 98b7fa0d64..217ce36fe9 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -70,7 +70,6 @@ class Route : public IO
ControlOut = 0x4
};
-
Route (Session&, std::string name, int input_min, int input_max, int output_min, int output_max,
Flag flags = Flag(0), DataType default_type = DataType::AUDIO);
Route (Session&, const XMLNode&, DataType default_type = DataType::AUDIO);
@@ -91,14 +90,15 @@ class Route : public IO
/* these are the core of the API of a Route. see the protected sections as well */
- virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
- nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
+ virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
+
+ virtual int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
- virtual int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
- nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
+ virtual int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ nframes_t offset, bool can_record, bool rec_monitors_input);
- virtual int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
- nframes_t offset, bool can_record, bool rec_monitors_input);
virtual void toggle_monitor_input ();
virtual bool can_record() { return false; }
virtual void set_record_enable (bool yn, void *src) {}
@@ -136,8 +136,8 @@ class Route : public IO
void drop_mix_group (void *);
RouteGroup *mix_group () { return _mix_group; }
- virtual void set_meter_point (MeterPoint, void *src);
- MeterPoint meter_point() const { return _meter_point; }
+ virtual void set_meter_point (MeterPoint, void *src);
+ MeterPoint meter_point() const { return _meter_point; }
/* Processors */
@@ -271,56 +271,53 @@ class Route : public IO
void curve_reallocate ();
protected:
- Flag _flags;
-
- /* tight cache-line access here is more important than sheer speed of
- access.
- */
-
- bool _muted : 1;
- bool _soloed : 1;
- bool _solo_safe : 1;
- bool _recordable : 1;
- bool _mute_affects_pre_fader : 1;
- bool _mute_affects_post_fader : 1;
- bool _mute_affects_control_outs : 1;
- bool _mute_affects_main_outs : 1;
- bool _silent : 1;
- bool _declickable : 1;
- int _pending_declick;
+ nframes_t check_initial_delay (nframes_t, nframes_t&, nframes_t&);
- MeterPoint _meter_point;
-
- gain_t solo_gain;
- gain_t mute_gain;
- gain_t desired_solo_gain;
- gain_t desired_mute_gain;
-
-
-
- nframes_t _initial_delay;
- nframes_t _roll_delay;
- ProcessorList _processors;
- Glib::RWLock _processor_lock;
- IO *_control_outs;
- Glib::Mutex _control_outs_lock;
- RouteGroup *_edit_group;
- RouteGroup *_mix_group;
- std::string _comment;
- bool _have_internal_generator;
+ void passthru (nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, nframes_t offset, int declick, bool meter_inputs);
- boost::shared_ptr<ToggleControllable> _solo_control;
- boost::shared_ptr<ToggleControllable> _mute_control;
+ virtual void process_output_buffers (BufferSet& bufs,
+ nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, nframes_t offset, bool with_processors, int declick,
+ bool meter);
+
+ Flag _flags;
+ int _pending_declick;
+ MeterPoint _meter_point;
+
+ gain_t solo_gain;
+ gain_t mute_gain;
+ gain_t desired_solo_gain;
+ gain_t desired_mute_gain;
- nframes_t check_initial_delay (nframes_t, nframes_t&, nframes_t&);
+ nframes_t _initial_delay;
+ nframes_t _roll_delay;
+ ProcessorList _processors;
+ Glib::RWLock _processor_lock;
+ IO *_control_outs;
+ Glib::Mutex _control_outs_lock;
+ RouteGroup *_edit_group;
+ RouteGroup *_mix_group;
+ std::string _comment;
+ bool _have_internal_generator;
- void passthru (nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset, int declick, bool meter_inputs);
+ boost::shared_ptr<ToggleControllable> _solo_control;
+ boost::shared_ptr<ToggleControllable> _mute_control;
- virtual void process_output_buffers (BufferSet& bufs,
- nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset, bool with_processors, int declick,
- bool meter);
+ /* tight cache-line access here is more important than sheer speed of access.
+ keep these after things that should be aligned
+ */
+
+ bool _muted : 1;
+ bool _soloed : 1;
+ bool _solo_safe : 1;
+ bool _recordable : 1;
+ bool _mute_affects_pre_fader : 1;
+ bool _mute_affects_post_fader : 1;
+ bool _mute_affects_control_outs : 1;
+ bool _mute_affects_main_outs : 1;
+ bool _silent : 1;
+ bool _declickable : 1;
protected:
@@ -348,10 +345,8 @@ class Route : public IO
static uint32_t order_key_cnt;
- struct ltstr
- {
- bool operator()(const char* s1, const char* s2) const
- {
+ struct ltstr {
+ bool operator()(const char* s1, const char* s2) const {
return strcmp(s1, s2) < 0;
}
};
@@ -365,8 +360,7 @@ class Route : public IO
int reset_processor_counts (ProcessorStreams*); /* locked */
int _reset_processor_counts (ProcessorStreams*); /* unlocked */
- /* processor I/O channels and plugin count handling */
-
+ /** processor I/O channels and plugin count handling */
struct ProcessorCount {
boost::shared_ptr<ARDOUR::Processor> processor;
ChanCount in;
@@ -376,7 +370,8 @@ class Route : public IO
};
int32_t apply_some_processor_counts (std::list<ProcessorCount>& iclist);
- bool check_some_processor_counts (std::list<ProcessorCount>& iclist, ChanCount required_inputs, ProcessorStreams* err_streams);
+ bool check_some_processor_counts (std::list<ProcessorCount>& iclist,
+ ChanCount required_inputs, ProcessorStreams* err_streams);
void set_deferred_state ();
void add_processor_from_xml (const XMLNode&);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index ef67d0cc79..2e56e99722 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -150,9 +150,7 @@ class Session : public PBD::StatefulDestructible
SetAudioRange,
SetPlayRange,
- /* only one of each of these events
- can be queued at any one time
- */
+ /* only one of each of these events can be queued at any one time */
StopOnce,
AutoLoop
@@ -165,32 +163,33 @@ class Session : public PBD::StatefulDestructible
Clear
};
- Type type;
- Action action;
- nframes_t action_frame;
- nframes_t target_frame;
- double speed;
+ Type type;
+ Action action;
+ nframes_t action_frame;
+ nframes_t target_frame;
+ double speed;
union {
- void* ptr;
- bool yes_or_no;
- nframes_t target2_frame;
- SlaveSource slave;
- Route* route;
+ void* ptr;
+ bool yes_or_no;
+ nframes_t target2_frame;
+ SlaveSource slave;
+ Route* route;
};
- boost::shared_ptr<Region> region;
-
- list<AudioRange> audio_range;
- list<MusicRange> music_range;
+ list<AudioRange> audio_range;
+ list<MusicRange> music_range;
+
+ boost::shared_ptr<Region> region;
Event(Type t, Action a, nframes_t when, nframes_t where, double spd, bool yn = false)
- : type (t),
- action (a),
- action_frame (when),
- target_frame (where),
- speed (spd),
- yes_or_no (yn) {}
+ : type (t)
+ , action (a)
+ , action_frame (when)
+ , target_frame (where)
+ , speed (spd)
+ , yes_or_no (yn)
+ {}
void set_ptr (void* p) {
ptr = p;
@@ -275,12 +274,12 @@ class Session : public PBD::StatefulDestructible
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);
+ static string change_source_path_by_name (string oldpath, string oldname, string newname, bool destructive);
string peak_path_from_audio_path (string) const;
- string audio_path_from_name (string, uint32_t nchans, uint32_t chan, bool destructive);
- string midi_path_from_name (string);
+ string new_audio_source_name (const string&, uint32_t nchans, uint32_t chan, bool destructive);
+ string new_midi_source_name (const string&);
+ string new_source_path_from_name (DataType type, const string&);
void process (nframes_t nframes);
@@ -400,16 +399,15 @@ class Session : public PBD::StatefulDestructible
bool transport_locked () const;
int wipe ();
- //int wipe_diskstream (AudioDiskstream *);
int remove_region_from_region_list (boost::shared_ptr<Region>);
nframes_t get_maximum_extent () const;
nframes_t current_end_frame() const { return end_location->start(); }
nframes_t current_start_frame() const { return start_location->start(); }
- // "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
+ /// "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
nframes_t frame_rate() const { return _current_frame_rate; }
- // "native" sample rate of session, regardless of current audioengine rate, pullup/down etc
+ /// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc
nframes_t nominal_frame_rate() const { return _nominal_frame_rate; }
nframes_t frames_per_hour() const { return _frames_per_hour; }
@@ -441,10 +439,10 @@ class Session : public PBD::StatefulDestructible
void remove_event (nframes_t frame, Event::Type type);
void clear_events (Event::Type type);
- nframes_t get_block_size() const { return current_block_size; }
+ nframes_t get_block_size() const { return current_block_size; }
nframes_t worst_output_latency () const { return _worst_output_latency; }
- nframes_t worst_input_latency () const { return _worst_input_latency; }
- nframes_t worst_track_latency () const { return _worst_track_latency; }
+ nframes_t worst_input_latency () const { return _worst_input_latency; }
+ nframes_t worst_track_latency () const { return _worst_track_latency; }
int save_state (std::string snapshot_name, bool pending = false);
int restore_state (std::string snapshot_name);
@@ -470,7 +468,7 @@ class Session : public PBD::StatefulDestructible
/// The instant xml file is written to the session directory
void add_instant_xml (XMLNode&, bool write_to_config = true);
- XMLNode * instant_xml (const std::string& str);
+ XMLNode* instant_xml (const std::string& str);
enum StateOfTheState {
Clean = 0x0,
@@ -495,8 +493,8 @@ class Session : public PBD::StatefulDestructible
sigc::signal<void,RouteGroup*> edit_group_added;
sigc::signal<void,RouteGroup*> mix_group_added;
- sigc::signal<void> edit_group_removed;
- sigc::signal<void> mix_group_removed;
+ sigc::signal<void> edit_group_removed;
+ sigc::signal<void> mix_group_removed;
void foreach_edit_group (sigc::slot<void,RouteGroup*> sl) {
for (list<RouteGroup *>::iterator i = edit_groups.begin(); i != edit_groups.end(); i++) {
@@ -512,11 +510,13 @@ class Session : public PBD::StatefulDestructible
/* fundamental operations. duh. */
- std::list<boost::shared_ptr<AudioTrack> > new_audio_track (int input_channels, int output_channels, TrackMode mode = Normal, uint32_t how_many = 1);
+ std::list<boost::shared_ptr<AudioTrack> > new_audio_track (
+ int input_channels, int output_channels, TrackMode mode = Normal, uint32_t how_many = 1);
+
RouteList new_audio_route (int input_channels, int output_channels, uint32_t how_many);
- std::list<boost::shared_ptr<MidiTrack> > new_midi_track (TrackMode mode = Normal, uint32_t how_many = 1);
- //boost::shared_ptr<Route> new_midi_route (uint32_t how_many = 1);
+ std::list<boost::shared_ptr<MidiTrack> > new_midi_track (
+ TrackMode mode = Normal, uint32_t how_many = 1);
void remove_route (boost::shared_ptr<Route>);
void resort_routes ();
@@ -552,8 +552,8 @@ class Session : public PBD::StatefulDestructible
void sync_time_vars();
void bbt_time (nframes_t when, BBT_Time&);
- void smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes ) const;
- void sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const;
+ void smpte_to_sample(SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes) const;
+ void sample_to_smpte(nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes) const;
void smpte_time (SMPTE::Time &);
void smpte_time (nframes_t when, SMPTE::Time&);
void smpte_time_subframes (nframes_t when, SMPTE::Time&);
@@ -656,23 +656,19 @@ class Session : public PBD::StatefulDestructible
int remove_last_capture ();
- /* handlers should return -1 for "stop cleanup", 0 for
- "yes, delete this playlist" and 1 for "no, don't delete
- this playlist.
+ /** handlers should return -1 for "stop cleanup",
+ 0 for "yes, delete this playlist",
+ 1 for "no, don't delete this playlist".
*/
-
sigc::signal<int,boost::shared_ptr<ARDOUR::Playlist> > AskAboutPlaylistDeletion;
- /* handlers should return 0 for "ignore the rate mismatch"
- and !0 for "do not use this session"
+ /** handlers should return 0 for "ignore the rate mismatch",
+ !0 for "do not use this session"
*/
-
static sigc::signal<int,nframes_t, nframes_t> AskAboutSampleRateMismatch;
- /* handlers should return !0 for use pending state, 0 for
- ignore it.
+ /** handlers should return !0 for use pending state, 0 for ignore it.
*/
-
static sigc::signal<int> AskAboutPendingState;
boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive);
@@ -780,7 +776,7 @@ class Session : public PBD::StatefulDestructible
sigc::signal<void,boost::shared_ptr<Bundle> > BundleAdded;
sigc::signal<void,boost::shared_ptr<Bundle> > BundleRemoved;
- /* MIDI */
+ /* MIDI control */
void midi_panic(void);
int set_mtc_port (string port_tag);
@@ -917,7 +913,7 @@ class Session : public PBD::StatefulDestructible
/* clicking */
- boost::shared_ptr<IO> click_io() { return _click_io; }
+ boost::shared_ptr<IO> click_io() { return _click_io; }
/* disk, buffer loads */
@@ -1078,10 +1074,10 @@ class Session : public PBD::StatefulDestructible
bool follow_slave (nframes_t, nframes_t);
void calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta);
void track_slave_state(
- float slave_speed,
+ float slave_speed,
nframes_t slave_transport_frame,
nframes_t this_delta,
- bool starting);
+ bool starting);
void follow_slave_silently(nframes_t nframes, nframes_t offset, float slave_speed);
void set_slave_source (SlaveSource);
@@ -1119,7 +1115,6 @@ class Session : public PBD::StatefulDestructible
}
int get_transport_declick_required () {
-
if (transport_sub_state & PendingDeclickIn) {
transport_sub_state &= ~PendingDeclickIn;
return 1;
@@ -1131,7 +1126,8 @@ class Session : public PBD::StatefulDestructible
}
bool maybe_stop (nframes_t limit) {
- if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) {
+ if ( (_transport_speed > 0.0f && _transport_frame >= limit)
+ || (_transport_speed < 0.0f && _transport_frame == 0) ) {
stop_transport ();
return true;
}
@@ -1194,7 +1190,9 @@ class Session : public PBD::StatefulDestructible
mutable gint butler_should_do_transport_work;
int butler_request_pipe[2];
- inline bool transport_work_requested() const { return g_atomic_int_get(&butler_should_do_transport_work); }
+ inline bool transport_work_requested() const {
+ return g_atomic_int_get(&butler_should_do_transport_work);
+ }
struct ButlerRequest {
enum Type {
@@ -1498,8 +1496,6 @@ class Session : public PBD::StatefulDestructible
SourceMap get_sources() { return sources; }
private:
-
-
int load_sources (const XMLNode& node);
XMLNode& get_sources_as_xml ();
diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h
index cbb123139a..ad433e5f94 100644
--- a/libs/ardour/ardour/silentfilesource.h
+++ b/libs/ardour/ardour/silentfilesource.h
@@ -26,26 +26,27 @@
namespace ARDOUR {
class SilentFileSource : public AudioFileSource {
- public:
- virtual ~SilentFileSource ();
-
+public:
int update_header (nframes_t when, struct tm&, time_t) { return 0; }
int flush_header () { return 0; }
float sample_rate () const { return _sample_rate; }
- void set_length (nframes_t len);
+ void set_length (nframes_t len) { _length = len; }
bool destructive() const { return false; }
bool can_be_analysed() const { return false; }
- protected:
-
- float _sample_rate;
-
- SilentFileSource (Session&, const XMLNode&, nframes_t nframes, float sample_rate);
-
+protected:
friend class SourceFactory;
+ SilentFileSource (Session& s, const XMLNode& x, nframes_t len, float srate)
+ : Source (s, x)
+ , AudioFileSource (s, x, false)
+ , _sample_rate(srate)
+ {
+ _length = len;
+ }
+
nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const {
memset (dst, 0, sizeof (Sample) * cnt);
return cnt;
@@ -55,11 +56,13 @@ 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 {
+ 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;
}
-
+
+ float _sample_rate;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h
index 4855cb6e31..259328c5fa 100644
--- a/libs/ardour/ardour/smf_source.h
+++ b/libs/ardour/ardour/smf_source.h
@@ -18,14 +18,14 @@
*/
-#ifndef __ardour_smf_filesource_h__
-#define __ardour_smf_filesource_h__
+#ifndef __ardour_smf_source_h__
+#define __ardour_smf_source_h__
#include <cstdio>
#include <time.h>
-
-#include <ardour/midi_source.h>
#include <evoral/SMF.hpp>
+#include <ardour/midi_source.h>
+#include <ardour/file_source.h>
namespace Evoral { template<typename T> class Event; }
@@ -34,51 +34,42 @@ namespace ARDOUR {
template<typename T> class MidiRingBuffer;
/** Standard Midi File (Type 0) Source */
-class SMFSource : public MidiSource, public Evoral::SMF {
- public:
+class SMFSource : public MidiSource, public FileSource, public Evoral::SMF {
+public:
/** Constructor for existing external-to-session files */
- SMFSource (Session& session, std::string path, Source::Flag flags = Source::Flag(0));
+ SMFSource (Session& session, const Glib::ustring& path, bool embedded,
+ Source::Flag flags = Source::Flag(0));
- /* Constructor for existing in-session files */
- SMFSource (Session& session, const XMLNode&);
+ /** Constructor for existing in-session files */
+ SMFSource (Session& session, const XMLNode&, bool must_exist = false);
virtual ~SMFSource ();
-
- bool set_name (const std::string& newname) { return (set_source_name(newname, false) == 0); }
- int set_source_name (string newname, bool destructive);
-
- static bool safe_file_extension (const Glib::ustring& path);
- Glib::ustring path() const { return _path; }
+ bool safe_file_extension (const Glib::ustring& path) const {
+ return safe_midi_file_extension(path);
+ }
- void set_allow_remove_if_empty (bool yn);
- void mark_for_remove();
+ bool set_name (const std::string& newname) { return (set_source_name(newname, false) == 0); }
- void append_event_unlocked_beats(const Evoral::Event<double>& ev);
- void append_event_unlocked_frames(const Evoral::Event<nframes_t>& ev);
-
- int move_to_trash (const string trash_dir_name);
+ void append_event_unlocked_beats (const Evoral::Event<double>& ev);
+ void append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev);
void mark_streaming_midi_write_started (NoteMode mode, nframes_t start_time);
void mark_streaming_write_completed ();
- void mark_take (string);
- string take_id() const { return _take_id; }
-
- static void set_search_path (string);
- static void set_header_position_offset (nframes_t offset, bool negative);
-
XMLNode& get_state ();
int set_state (const XMLNode&);
- void load_model(bool lock=true, bool force_reload=false);
- void destroy_model();
+ void load_model (bool lock=true, bool force_reload=false);
+ void destroy_model ();
- void flush_midi();
+ void flush_midi ();
+
+ static void set_header_position_offset (nframes_t offset, bool negative);
- private:
- int init (string idstr, bool must_exist);
+ static bool safe_midi_file_extension (const Glib::ustring& path);
+private:
nframes_t read_unlocked (
MidiRingBuffer<nframes_t>& dst,
nframes_t start,
@@ -90,22 +81,13 @@ class SMFSource : public MidiSource, public Evoral::SMF {
MidiRingBuffer<nframes_t>& src,
nframes_t cnt);
- bool find (std::string path, bool must_exist, bool& is_new);
- bool removable() const;
- bool writable() const { return _flags & Writable; }
-
- void set_default_controls_interpolation();
-
- Glib::ustring _path;
- string _take_id;
- bool _allow_remove_if_empty;
- double _last_ev_time_beats;
- nframes_t _last_ev_time_frames;
+ void set_default_controls_interpolation ();
- static string _search_path;
+ double _last_ev_time_beats;
+ nframes_t _last_ev_time_frames;
};
}; /* namespace ARDOUR */
-#endif /* __ardour_smf_filesource_h__ */
+#endif /* __ardour_smf_source_h__ */
diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h
index acb03391a4..5154a7a80c 100644
--- a/libs/ardour/ardour/sndfilesource.h
+++ b/libs/ardour/ardour/sndfilesource.h
@@ -29,17 +29,15 @@ namespace ARDOUR {
class SndFileSource : public AudioFileSource {
public:
- /* constructor to be called for existing external-to-session files */
+ /** Constructor to be called for existing external-to-session files */
+ SndFileSource (Session&, const Glib::ustring& path, bool embedded, int chn, Flag flags);
- SndFileSource (Session&, Glib::ustring path, int chn, Flag flags);
-
- /* constructor to be called for new in-session files */
-
- SndFileSource (Session&, Glib::ustring path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate,
- Flag flags = SndFileSource::default_writable_flags);
+ /* Constructor to be called for new in-session files */
+ SndFileSource (Session&, const Glib::ustring& path, bool embedded,
+ SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate,
+ Flag flags = SndFileSource::default_writable_flags);
- /* constructor to be called for existing in-session files */
-
+ /** Constructor to be called for existing in-session files */
SndFileSource (Session&, const XMLNode&);
~SndFileSource ();
@@ -77,7 +75,7 @@ class SndFileSource : public AudioFileSource {
SF_INFO _info;
BroadcastInfo *_broadcast_info;
- void init ();
+ void init_sndfile ();
int open();
int setup_broadcast_info (nframes_t when, struct tm&, time_t);
diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h
index 137aad5fbe..7b5fc43659 100644
--- a/libs/ardour/ardour/source.h
+++ b/libs/ardour/ardour/source.h
@@ -51,7 +51,7 @@ class Source : public SessionObject, public ARDOUR::Readable
Destructive = 0x80
};
- Source (Session&, const std::string& name, DataType type, Flag flags=Flag(0));
+ Source (Session&, DataType type, const std::string& name, Flag flags=Flag(0));
Source (Session&, const XMLNode&);
virtual ~Source ();
@@ -63,11 +63,12 @@ class Source : public SessionObject, public ARDOUR::Readable
nframes_t length() const { return _length; }
- virtual Glib::ustring path() const = 0;
+ virtual const Glib::ustring& path() const = 0;
virtual nframes_t natural_position() const { return 0; }
- virtual void mark_for_remove() = 0;
+ void mark_for_remove();
+
virtual void mark_streaming_write_started () {}
virtual void mark_streaming_write_completed () = 0;
@@ -76,8 +77,10 @@ class Source : public SessionObject, public ARDOUR::Readable
XMLNode& get_state ();
int set_state (const XMLNode&);
- virtual bool destructive() const { return false; }
- virtual bool length_mutable() const { return false; }
+ bool destructive() const { return (_flags & Destructive); }
+ bool writable () const { return _flags & Writable; }
+ virtual bool set_destructive (bool yn) { return false; }
+ virtual bool length_mutable() const { return false; }
void use () { _in_use++; }
void disuse () { if (_in_use) { _in_use--; } }
@@ -103,6 +106,11 @@ class Source : public SessionObject, public ARDOUR::Readable
void update_length (nframes_t pos, nframes_t cnt);
+ int64_t timeline_position() const { return _timeline_position; }
+ virtual void set_timeline_position (int64_t pos);
+
+ void set_allow_remove_if_empty (bool yn);
+
virtual const Evoral::TimeConverter<double, nframes_t>& time_converter() const {
return Evoral::IdentityConverter<double, nframes_t>();
}
@@ -114,7 +122,9 @@ class Source : public SessionObject, public ARDOUR::Readable
Flag _flags;
time_t _timestamp;
nframes_t _length;
+ int64_t _timeline_position;
bool _analysed;
+ mutable Glib::Mutex _lock;
mutable Glib::Mutex _analysis_lock;
Glib::Mutex _playlist_lock;
diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h
index 5370ad845d..69aa641657 100644
--- a/libs/ardour/ardour/source_factory.h
+++ b/libs/ardour/ardour/source_factory.h
@@ -44,10 +44,12 @@ class SourceFactory {
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,
+ static boost::shared_ptr<Source> createReadable (DataType type, Session&,
+ const std::string& path, bool embedded,
int chn, Source::Flag flags, bool announce = true, bool async = false);
- static boost::shared_ptr<Source> createWritable (DataType type, Session&, std::string name,
+ static boost::shared_ptr<Source> createWritable (DataType type, Session&,
+ const std::string& path, bool embedded,
bool destructive, nframes_t rate, bool announce = true, bool async = false);
static Glib::Cond* PeaksToBuild;