diff options
Diffstat (limited to 'libs/ardour/ardour')
46 files changed, 920 insertions, 883 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index c138cbf32f..5cc2359632 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -43,11 +43,12 @@ namespace ARDOUR { extern OSC* osc; - static const jack_nframes_t max_frames = JACK_MAX_FRAMES; + static const nframes_t max_frames = JACK_MAX_FRAMES; int init (AudioEngine& engine, bool with_vst, bool try_optimization); int cleanup (); - + + std::string get_ardour_revision (); std::string get_user_ardour_path (); std::string get_system_data_path (); @@ -74,6 +75,7 @@ namespace ARDOUR { const char* old; }; + static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */ } /* how do we make these be within the Ardour namespace? */ diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 81206f2bb0..76b76b1061 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -131,7 +131,7 @@ class AudioDiskstream : public Diskstream } } - static void swap_by_ptr (Sample *first, Sample *last, jack_nframes_t n) { + static void swap_by_ptr (Sample *first, Sample *last, nframes_t n) { while (n--) { Sample tmp = *first; *first++ = *last; @@ -151,22 +151,22 @@ class AudioDiskstream : public Diskstream void set_pending_overwrite(bool); int overwrite_existing_buffers (); - void set_block_size (jack_nframes_t); - int internal_playback_seek (jack_nframes_t distance); - int can_internal_playback_seek (jack_nframes_t distance); + void set_block_size (nframes_t); + int internal_playback_seek (nframes_t distance); + int can_internal_playback_seek (nframes_t distance); int rename_write_sources (); void reset_write_sources (bool, bool force = false); void non_realtime_input_change (); protected: friend class Auditioner; - int seek (jack_nframes_t which_sample, bool complete_refill = false); + int seek (nframes_t which_sample, bool complete_refill = false); protected: friend class AudioTrack; - int process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input); - bool commit (jack_nframes_t nframes); + int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input); + bool commit (nframes_t nframes); private: @@ -197,7 +197,7 @@ class AudioDiskstream : public Diskstream RingBufferNPT<CaptureTransition> * capture_transition_buf; // the following are used in the butler thread only - jack_nframes_t curr_capture_cnt; + nframes_t curr_capture_cnt; }; /* The two central butler operations */ @@ -207,7 +207,7 @@ class AudioDiskstream : public Diskstream int do_refill_with_alloc(); int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, - jack_nframes_t& start, jack_nframes_t cnt, + nframes_t& start, nframes_t cnt, ChannelInfo& channel_info, int channel, bool reversed); void finish_capture (bool rec_monitors_input); @@ -227,7 +227,7 @@ class AudioDiskstream : public Diskstream int use_pending_capture_data (XMLNode& node); void get_input_sources (); - void check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record); + void check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record); void set_align_style_from_io(); void setup_destructive_playlist (); void use_destructive_playlist (); diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 1277b598d4..fdf373a1cb 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -37,27 +37,27 @@ class AudioTrack : public Track AudioTrack (Session&, const XMLNode&); ~AudioTrack (); - int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input); + 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); - int no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input); + 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); - int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool can_record, bool rec_monitors_input); + int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, bool can_record, bool rec_monitors_input); boost::shared_ptr<AudioDiskstream> audio_diskstream() const; int use_diskstream (string name); int use_diskstream (const PBD::ID& id); - int export_stuff (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t end_frame); + int export_stuff (BufferSet& bufs, nframes_t nframes, nframes_t end_frame); void freeze (InterThreadInfo&); void unfreeze (); void bounce (InterThreadInfo&); - void bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo&); + void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&); int set_state(const XMLNode& node); diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 56179125bb..8a51580f27 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -54,7 +54,7 @@ class AUPlugin : public ARDOUR::Plugin const char * maker () const; uint32_t parameter_count () const; float default_value (uint32_t port); - jack_nframes_t latency () const; + nframes_t latency () const; void set_parameter (uint32_t which, float val); float get_parameter (uint32_t which) const; @@ -62,9 +62,10 @@ class AUPlugin : public ARDOUR::Plugin uint32_t nth_parameter (uint32_t which, bool& ok) const; void activate (); void deactivate (); - void set_block_size (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); - int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, jack_nframes_t nframes, jack_nframes_t offset); + int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset); + std::set<uint32_t> automatable() const; void store_state (ARDOUR::PluginState&); void restore_state (ARDOUR::PluginState&); diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 5f9e53380f..207e3c6428 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -67,30 +67,30 @@ class AudioEngine : public sigc::trackable Glib::Mutex& process_lock() { return _process_lock; } - jack_nframes_t frame_rate(); - jack_nframes_t frames_per_cycle(); + nframes_t frame_rate(); + nframes_t frames_per_cycle(); int usecs_per_cycle () const { return _usecs_per_cycle; } - bool get_sync_offset (jack_nframes_t& offset) const; + bool get_sync_offset (nframes_t& offset) const; - jack_nframes_t frames_since_cycle_start () { + nframes_t frames_since_cycle_start () { if (!_running || !_jack) return 0; return jack_frames_since_cycle_start (_jack); } - jack_nframes_t frame_time () { + nframes_t frame_time () { if (!_running || !_jack) return 0; return jack_frame_time (_jack); } - jack_nframes_t transport_frame () const { + nframes_t transport_frame () const { if (!_running || !_jack) return 0; return jack_get_current_transport_frame (_jack); } - int request_buffer_size (jack_nframes_t); + int request_buffer_size (nframes_t); - jack_nframes_t set_monitor_check_interval (jack_nframes_t); + nframes_t set_monitor_check_interval (nframes_t); float get_cpu_load() { if (!_running || !_jack) return 0; @@ -134,7 +134,7 @@ class AudioEngine : public sigc::trackable return get_nth_physical (type, n, JackPortIsOutput); } - jack_nframes_t get_port_total_latency (const Port&); + nframes_t get_port_total_latency (const Port&); void update_total_latencies (); /** Caller may not delete the object pointed to by the return value @@ -150,7 +150,7 @@ class AudioEngine : public sigc::trackable void transport_start (); void transport_stop (); - void transport_locate (jack_nframes_t); + void transport_locate (nframes_t); TransportState transport_state (); int reset_timebase (); @@ -164,7 +164,7 @@ class AudioEngine : public sigc::trackable the regular process() call to session->process() is not made. */ - sigc::signal<int,jack_nframes_t> Freewheel; + sigc::signal<int,nframes_t> Freewheel; sigc::signal<void> Xrun; @@ -174,7 +174,7 @@ class AudioEngine : public sigc::trackable /* this signal is emitted if the sample rate changes */ - sigc::signal<void,jack_nframes_t> SampleRateChanged; + sigc::signal<void,nframes_t> SampleRateChanged; /* this signal is sent if JACK ever disconnects us */ @@ -200,21 +200,21 @@ class AudioEngine : public sigc::trackable bool session_remove_pending; bool _running; bool _has_run; - jack_nframes_t _buffer_size; - jack_nframes_t _frame_rate; - jack_nframes_t monitor_check_interval; - jack_nframes_t last_monitor_check; - jack_nframes_t _processed_frames; + nframes_t _buffer_size; + nframes_t _frame_rate; + nframes_t monitor_check_interval; + nframes_t last_monitor_check; + nframes_t _processed_frames; bool _freewheeling; bool _freewheel_thread_registered; - sigc::slot<int,jack_nframes_t> freewheel_action; + sigc::slot<int,nframes_t> freewheel_action; bool reconnect_on_halt; int _usecs_per_cycle; typedef std::set<Port*> Ports; SerializedRCUManager<Ports> ports; - int process_callback (jack_nframes_t nframes); + int process_callback (nframes_t nframes); void remove_all_ports (); typedef std::pair<std::string,std::string> PortConnection; @@ -227,17 +227,17 @@ class AudioEngine : public sigc::trackable static int _xrun_callback (void *arg); static int _graph_order_callback (void *arg); - static int _process_callback (jack_nframes_t nframes, void *arg); - static int _sample_rate_callback (jack_nframes_t nframes, void *arg); - static int _bufsize_callback (jack_nframes_t nframes, void *arg); - static void _jack_timebase_callback (jack_transport_state_t, jack_nframes_t, jack_position_t*, int, void*); + static int _process_callback (nframes_t nframes, void *arg); + static int _sample_rate_callback (nframes_t nframes, void *arg); + static int _bufsize_callback (nframes_t nframes, void *arg); + static void _jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int, void*); static int _jack_sync_callback (jack_transport_state_t, jack_position_t*, void *arg); static void _freewheel_callback (int , void *arg); - void jack_timebase_callback (jack_transport_state_t, jack_nframes_t, jack_position_t*, int); + void jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int); int jack_sync_callback (jack_transport_state_t, jack_position_t*); - int jack_bufsize_callback (jack_nframes_t); - int jack_sample_rate_callback (jack_nframes_t); + int jack_bufsize_callback (nframes_t); + int jack_sample_rate_callback (nframes_t); static void halted (void *); @@ -245,8 +245,10 @@ class AudioEngine : public sigc::trackable void meter_thread (); void start_metering_thread (); - Glib::Thread* m_meter_thread; - mutable gint m_meter_exit; + void stop_metering_thread (); + + Glib::Thread* m_meter_thread; + static gint m_meter_exit; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 0cab328fba..6184a45302 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -65,12 +65,12 @@ class AudioFileSource : public AudioSource { for files used in destructive recording. */ - virtual jack_nframes_t last_capture_start_frame() const { return 0; } - virtual void mark_capture_start (jack_nframes_t) {} + 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 int update_header (jack_nframes_t when, struct tm&, time_t) = 0; + virtual int update_header (nframes_t when, struct tm&, time_t) = 0; virtual int flush_header () = 0; int move_to_trash (const string trash_dir_name); @@ -86,7 +86,9 @@ class AudioFileSource : public AudioSource { static void set_bwf_serial_number (int); static void set_search_path (string); - static void set_header_position_offset (jack_nframes_t offset ); + static void set_header_position_offset (nframes_t offset ); + + int setup_peakfile (); static sigc::signal<void> HeaderPositionOffsetChanged; @@ -122,6 +124,7 @@ class AudioFileSource : public AudioSource { Flag _flags; string _take_id; uint64_t timeline_position; + bool file_is_new; static string peak_dir; static string search_path; @@ -132,7 +135,7 @@ class AudioFileSource : public AudioSource { static uint64_t header_position_offset; - virtual void set_timeline_position (jack_nframes_t pos); + virtual void set_timeline_position (nframes_t pos); virtual void set_header_timeline_position () = 0; bool find (std::string path, bool must_exist, bool& is_new); diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index 6a52f1c16f..341b08930c 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -56,11 +56,11 @@ class AudioPlaylist : public ARDOUR::Playlist AudioPlaylist (Session&, const XMLNode&, bool hidden = false); AudioPlaylist (Session&, string name, bool hidden = false); AudioPlaylist (const AudioPlaylist&, string name, bool hidden = false); - AudioPlaylist (const AudioPlaylist&, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden = false); + AudioPlaylist (const AudioPlaylist&, nframes_t start, nframes_t cnt, string name, bool hidden = false); void clear (bool with_save = true); - jack_nframes_t read (Sample *dst, Sample *mixdown, float *gain_buffer, jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0); + nframes_t read (Sample *dst, Sample *mixdown, float *gain_buffer, nframes_t start, nframes_t cnt, uint32_t chan_n=0); int set_state (const XMLNode&); UndoAction get_memento() const; @@ -68,7 +68,7 @@ class AudioPlaylist : public ARDOUR::Playlist sigc::signal<void,Crossfade *> NewCrossfade; template<class T> void foreach_crossfade (T *t, void (T::*func)(Crossfade *)); - void crossfades_at (jack_nframes_t frame, Crossfades&); + void crossfades_at (nframes_t frame, Crossfades&); template<class T> void apply_to_history (T& obj, void (T::*method)(const ARDOUR::StateManager::StateMap&, state_id_t)) { RegionLock rlock (this); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 71a66e52a0..3ac62da2ca 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -84,23 +84,24 @@ class AudioRegion : public Region Curve& fade_out() { return _fade_out; } Curve& envelope() { return _envelope; } - jack_nframes_t read_peaks (PeakData *buf, jack_nframes_t npeaks, - jack_nframes_t offset, jack_nframes_t cnt, + 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 jack_nframes_t read_at (Sample *buf, Sample *mixdown_buf, - float *gain_buf, jack_nframes_t position, jack_nframes_t cnt, + virtual nframes_t read_at (Sample *buf, Sample *mixdown_buf, + float *gain_buf, nframes_t position, nframes_t cnt, uint32_t chan_n = 0, - jack_nframes_t read_frames = 0, - jack_nframes_t skip_frames = 0) const; + nframes_t read_frames = 0, + nframes_t skip_frames = 0) const; - jack_nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, - jack_nframes_t position, jack_nframes_t cnt, uint32_t chan_n=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; XMLNode& state (bool); int set_state (const XMLNode&); - static void set_default_fade (float steepness, jack_nframes_t len); + static void set_default_fade (float steepness, nframes_t len); enum FadeShape { Linear, @@ -112,13 +113,13 @@ class AudioRegion : public Region void set_fade_in_active (bool yn); void set_fade_in_shape (FadeShape); - void set_fade_in_length (jack_nframes_t); - void set_fade_in (FadeShape, jack_nframes_t); + void set_fade_in_length (nframes_t); + void set_fade_in (FadeShape, nframes_t); void set_fade_out_active (bool yn); void set_fade_out_shape (FadeShape); - void set_fade_out_length (jack_nframes_t); - void set_fade_out (FadeShape, jack_nframes_t); + void set_fade_out_length (nframes_t); + void set_fade_out (FadeShape, nframes_t); void set_envelope_active (bool yn); @@ -144,10 +145,10 @@ class AudioRegion : public Region private: friend class RegionFactory; - AudioRegion (boost::shared_ptr<AudioSource>, jack_nframes_t start, jack_nframes_t length); - AudioRegion (boost::shared_ptr<AudioSource>, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); - AudioRegion (SourceList &, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); - AudioRegion (boost::shared_ptr<const AudioRegion>, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); + AudioRegion (boost::shared_ptr<AudioSource>, nframes_t start, nframes_t length); + AudioRegion (boost::shared_ptr<AudioSource>, 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<const AudioRegion>, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); AudioRegion (boost::shared_ptr<const AudioRegion>); AudioRegion (boost::shared_ptr<AudioSource>, const XMLNode&); AudioRegion (SourceList &, const XMLNode&); @@ -164,11 +165,11 @@ class AudioRegion : public Region void recompute_gain_at_end (); void recompute_gain_at_start (); - jack_nframes_t _read_at (const SourceList&, Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, jack_nframes_t position, jack_nframes_t cnt, + 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, - jack_nframes_t read_frames = 0, - jack_nframes_t skip_frames = 0) const; + nframes_t read_frames = 0, + nframes_t skip_frames = 0) const; void recompute_at_start (); void recompute_at_end (); diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 6a0a20d4b8..db82acf894 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -25,6 +25,9 @@ #include <vector> #include <string> +#include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> + #include <time.h> #include <glibmm/thread.h> @@ -42,19 +45,19 @@ using std::string; namespace ARDOUR { -const jack_nframes_t frames_per_peak = 256; +const nframes_t frames_per_peak = 256; -class AudioSource : public Source + class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR::AudioSource> { public: AudioSource (Session&, string name); AudioSource (Session&, const XMLNode&); virtual ~AudioSource (); - virtual jack_nframes_t available_peaks (double zoom) const; + virtual nframes_t available_peaks (double zoom) const; - virtual jack_nframes_t read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const; - virtual jack_nframes_t write (Sample *src, jack_nframes_t cnt); + virtual nframes_t read (Sample *dst, nframes_t start, nframes_t cnt) const; + virtual nframes_t write (Sample *src, nframes_t cnt); virtual float sample_rate () const = 0; @@ -67,12 +70,12 @@ class AudioSource : public Source uint32_t read_data_count() const { return _read_data_count; } uint32_t write_data_count() const { return _write_data_count; } - int read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t start, jack_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_unit) const; int build_peaks (); bool peaks_ready (sigc::slot<void>, sigc::connection&) const; mutable sigc::signal<void> PeaksReady; - mutable sigc::signal<void,jack_nframes_t,jack_nframes_t> PeakRangeReady; + mutable sigc::signal<void,nframes_t,nframes_t> PeakRangeReady; XMLNode& get_state (); int set_state (const XMLNode&); @@ -81,6 +84,7 @@ class AudioSource : public Source static void stop_peak_thread (); int rename_peakfile (std::string newpath); + void touch_peakfile (); static void set_build_missing_peakfiles (bool yn) { _build_missing_peakfiles = yn; @@ -90,6 +94,8 @@ class AudioSource : public Source _build_peakfiles = yn; } + virtual int setup_peakfile () { return 0; } + protected: static bool _build_missing_peakfiles; static bool _build_peakfiles; @@ -106,10 +112,10 @@ class AudioSource : public Source int initialize_peakfile (bool newfile, string path); void build_peaks_from_scratch (); - int do_build_peak (jack_nframes_t, jack_nframes_t); + int do_build_peak (nframes_t, nframes_t); - virtual jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const = 0; - virtual jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt) = 0; + 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 string peak_path(string audio_path) = 0; virtual string old_peak_path(string audio_path) = 0; @@ -126,17 +132,17 @@ class AudioSource : public Source }; }; - static vector<AudioSource*> pending_peak_sources; + static vector<boost::shared_ptr<AudioSource> > pending_peak_sources; static Glib::Mutex* pending_peak_sources_lock; - static void queue_for_peaks (AudioSource*); + static void queue_for_peaks (boost::shared_ptr<AudioSource>); static void clear_queue_for_peaks (); struct PeakBuildRecord { - jack_nframes_t frame; - jack_nframes_t cnt; + nframes_t frame; + nframes_t cnt; - PeakBuildRecord (jack_nframes_t f, jack_nframes_t c) + PeakBuildRecord (nframes_t f, nframes_t c) : frame (f), cnt (c) {} PeakBuildRecord (const PeakBuildRecord& other) { frame = other.frame; diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h index 424ede0009..e6091cfba0 100644 --- a/libs/ardour/ardour/auditioner.h +++ b/libs/ardour/ardour/auditioner.h @@ -45,7 +45,7 @@ class Auditioner : public AudioTrack ARDOUR::AudioPlaylist& prepare_playlist (); void audition_current_playlist (); - int play_audition (jack_nframes_t nframes); + int play_audition (nframes_t nframes); void cancel_audition () { g_atomic_int_set (&_active, 0); @@ -55,10 +55,10 @@ class Auditioner : public AudioTrack private: boost::shared_ptr<AudioRegion> the_region; - jack_nframes_t current_frame; + nframes_t current_frame; mutable gint _active; Glib::Mutex lock; - jack_nframes_t length; + nframes_t length; void drop_ports (); static void *_drop_ports (void *); diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index 8d51343ffb..bb49b2dce4 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -55,11 +55,17 @@ class Configuration : public Stateful std::map<std::string,MidiPortDescriptor *> midi_ports; + void map_parameters (sigc::slot<void,const char*> theSlot); + int load_state (); int save_state (); int set_state (const XMLNode&); XMLNode& get_state (void); + XMLNode& get_variables (sigc::slot<bool,ConfigVariableBase::Owner>); + void set_variables (const XMLNode&, ConfigVariableBase::Owner owner); + + void set_current_owner (ConfigVariableBase::Owner); XMLNode* control_protocol_state () { return _control_protocol_state; } @@ -71,14 +77,13 @@ class Configuration : public Stateful #undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(Type,var,name,value) \ Type get_##var () const { return var.get(); } \ - void set_##var (Type val) { var.set (val); var.set_is_user (user_configuration); ParameterChanged (name); } + bool set_##var (Type val) { bool ret = var.set (val, current_owner); if (ret) { ParameterChanged (name); } return ret; } #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \ Type get_##var () const { return var.get(); } \ - void set_##var (Type val) { var.set (val); var.set_is_user (user_configuration); ParameterChanged (name); } + bool set_##var (Type val) { bool ret = var.set (val, current_owner); if (ret) { ParameterChanged (name); } return ret; } #include "ardour/configuration_vars.h" #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - private: @@ -92,10 +97,11 @@ class Configuration : public Stateful #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - bool user_configuration; + ConfigVariableBase::Owner current_owner; XMLNode* _control_protocol_state; - XMLNode& state (bool user_only); + XMLNode& state (sigc::slot<bool,ConfigVariableBase::Owner>); + bool save_config_options_predicate (ConfigVariableBase::Owner owner); }; extern Configuration *Config; diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index cdd9b24284..6f0a8a3571 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -10,19 +10,26 @@ namespace ARDOUR { class ConfigVariableBase { public: - ConfigVariableBase (std::string str) : _name (str), _is_user (false) {} + enum Owner { + Default = 0x1, + System = 0x2, + Config = 0x4, + Session = 0x8, + Interface = 0x10 + }; + + ConfigVariableBase (std::string str) : _name (str), _owner (Default) {} virtual ~ConfigVariableBase() {} std::string name() const { return _name; } - bool is_user() const { return _is_user; } - void set_is_user (bool yn) { _is_user = yn; } - + Owner owner() const { return _owner; } + virtual void add_to_node (XMLNode& node) = 0; - virtual bool set_from_node (const XMLNode& node) = 0; + virtual bool set_from_node (const XMLNode& node, Owner owner) = 0; protected: std::string _name; - bool _is_user; + Owner _owner; }; template<class T> @@ -32,8 +39,13 @@ class ConfigVariable : public ConfigVariableBase ConfigVariable (std::string str) : ConfigVariableBase (str) {} ConfigVariable (std::string str, T val) : ConfigVariableBase (str), value (val) {} - virtual void set (T val) { + virtual bool set (T val, Owner owner) { + if (val == value) { + return false; + } value = val; + _owner = (ConfigVariableBase::Owner)(_owner |owner); + return true; } T get() const { @@ -49,30 +61,63 @@ class ConfigVariable : public ConfigVariableBase node.add_child_nocopy (*child); } - bool set_from_node (const XMLNode& node) { - const XMLProperty* prop; - XMLNodeList nlist; - XMLNodeConstIterator niter; - XMLNode* child; + bool set_from_node (const XMLNode& node, Owner owner) { + + if (node.name() == "Config") { + + /* ardour.rc */ - nlist = node.children(); - - for (niter = nlist.begin(); niter != nlist.end(); ++niter) { + const XMLProperty* prop; + XMLNodeList nlist; + XMLNodeConstIterator niter; + XMLNode* child; - child = *niter; + nlist = node.children(); - if (child->name() == "Option") { - if ((prop = child->property ("name")) != 0) { - if (prop->value() == _name) { - if ((prop = child->property ("value")) != 0) { - std::stringstream ss; - ss << prop->value(); - ss >> value; - return true; + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { + + child = *niter; + + if (child->name() == "Option") { + if ((prop = child->property ("name")) != 0) { + if (prop->value() == _name) { + if ((prop = child->property ("value")) != 0) { + std::stringstream ss; + ss << prop->value(); + ss >> value; + _owner = (ConfigVariableBase::Owner)(_owner |owner); + return true; + } } } } } + + } else if (node.name() == "Options") { + + /* session file */ + + XMLNodeList olist; + XMLNodeConstIterator oiter; + XMLNode* option; + const XMLProperty* opt_prop; + + olist = node.children(); + + for (oiter = olist.begin(); oiter != olist.end(); ++oiter) { + + option = *oiter; + + if (option->name() == _name) { + if ((opt_prop = option->property ("val")) != 0) { + std::stringstream ss; + ss << opt_prop->value(); + ss >> value; + _owner = (ConfigVariableBase::Owner)(_owner |owner); + return true; + } + } + } } return false; @@ -90,9 +135,12 @@ class ConfigVariableWithMutation : public ConfigVariable<T> ConfigVariableWithMutation (std::string name, T val, T (*m)(T)) : ConfigVariable<T> (name, val), mutator (m) {} - void set (T val) { - unmutated_value = val; - ConfigVariable<T>::set (mutator (val)); + bool set (T val, ConfigVariableBase::Owner owner) { + if (unmutated_value != val) { + unmutated_value = val; + return ConfigVariable<T>::set (mutator (val), owner); + } + return false; } protected: diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 5222eefb0a..7301b31d8a 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -1,62 +1,126 @@ +/* IO connection */ + +CONFIG_VARIABLE (AutoConnectOption, output_auto_connect, "output-auto-connect", AutoConnectOption (0)) +CONFIG_VARIABLE (AutoConnectOption, input_auto_connect, "input-auto-connect", AutoConnectOption (0)) + #ifdef __APPLE__ -CONFIG_VARIABLE(std::string, auditioner_output_left, "auditioner-output-left", "coreaudio:Built-in Audio:in1") -CONFIG_VARIABLE(std::string, auditioner_output_right, "auditioner-output-right", "coreaudio:Built-in Audio:in2") +CONFIG_VARIABLE (std::string, auditioner_output_left, "auditioner-output-left", "coreaudio:Built-in Audio:in1") +CONFIG_VARIABLE (std::string, auditioner_output_right, "auditioner-output-right", "coreaudio:Built-in Audio:in2") #else -CONFIG_VARIABLE(std::string, auditioner_output_left, "auditioner-output-left", "alsa_pcm:playback_1") -CONFIG_VARIABLE(std::string, auditioner_output_right, "auditioner-output-right", "alsa_pcm:playback_2") +CONFIG_VARIABLE (std::string, auditioner_output_left, "auditioner-output-left", "alsa_pcm:playback_1") +CONFIG_VARIABLE (std::string, auditioner_output_right, "auditioner-output-right", "alsa_pcm:playback_2") #endif + +/* MIDI and MIDI related */ + +CONFIG_VARIABLE (std::string, mtc_port_name, "mtc-port-name", "default") +CONFIG_VARIABLE (std::string, mmc_port_name, "mmc-port-name", "default") +CONFIG_VARIABLE (std::string, midi_port_name, "midi-port-name", "default") +CONFIG_VARIABLE (bool, trace_midi_input, "trace-midi-input", false) +CONFIG_VARIABLE (bool, trace_midi_output, "trace-midi-output", false) +CONFIG_VARIABLE (bool, send_mtc, "send-mtc", false) +CONFIG_VARIABLE (bool, send_mmc, "send-mmc", false) +CONFIG_VARIABLE (bool, mmc_control, "mmc-control", false) +CONFIG_VARIABLE (bool, midi_feedback, "midi-feedback", false) +CONFIG_VARIABLE (bool, midi_control, "midi-control", false) + +/* control surfaces */ + +CONFIG_VARIABLE (uint32_t, feedback_interval_ms, "feedback-interval-ms", 100) +CONFIG_VARIABLE (bool, use_tranzport, "use-tranzport", false) + +/* disk operations */ + +CONFIG_VARIABLE (uint32_t, minimum_disk_io_bytes, "minimum-disk-io-bytes", 1024 * 256) +CONFIG_VARIABLE (float, track_buffer_seconds, "track-buffer-seconds", 5.0) +CONFIG_VARIABLE (uint32_t, disk_choice_space_threshold, "disk-choice-space-threshold", 57600000) +CONFIG_VARIABLE (SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat) +CONFIG_VARIABLE (HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE) + +/* OSC */ + +CONFIG_VARIABLE (uint32_t, osc_port, "osc-port", 3819) +CONFIG_VARIABLE (bool, use_osc, "use-osc", true) +CONFIG_VARIABLE (bool, use_overlap_equivalency, "use-overlap-equivalency", true) + +/* crossfades */ + +CONFIG_VARIABLE (CrossfadeModel, xfade_model, "xfade-model", ShortCrossfade) +CONFIG_VARIABLE (bool, auto_xfade, "auto-xfade", true) +CONFIG_VARIABLE (float, short_xfade_seconds, "short-xfade-seconds", 0.015) +CONFIG_VARIABLE (bool, crossfades_active, "crossfades-active", false) +CONFIG_VARIABLE (bool, crossfades_visible, "crossfades-visible", false) +CONFIG_VARIABLE (uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2) + +/* editing related */ + +CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide) +CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher) + +/* monitoring, mute, solo etc */ + +CONFIG_VARIABLE (bool, mute_affects_pre_fader, "mute-affects-pre-fader", true) +CONFIG_VARIABLE (bool, mute_affects_post_fader, "mute-affects-post-fader", true) +CONFIG_VARIABLE (bool, mute_affects_control_outs, "mute-affects-control-outs", true) +CONFIG_VARIABLE (bool, mute_affects_main_outs, "mute-affects-main-outs", true) +CONFIG_VARIABLE (MonitorModel, monitoring_model, "monitoring-model", SoftwareMonitoring) +CONFIG_VARIABLE (SoloModel, solo_model, "solo-model", InverseMute) +CONFIG_VARIABLE (bool, solo_latched, "solo-latched", true) +CONFIG_VARIABLE (bool, latched_record_enable, "latched-record-enable", false) +CONFIG_VARIABLE (bool, all_safe, "all-safe", false) + +/* click */ + +CONFIG_VARIABLE (bool, clicking, "clicking", false) +CONFIG_VARIABLE (std::string, click_sound, "click-sound", "") +CONFIG_VARIABLE (std::string, click_emphasis_sound, "click-emphasis-sound", "") + +/* transport control and related */ + +CONFIG_VARIABLE (bool, auto_play, "auto-play", false) +CONFIG_VARIABLE (bool, auto_return, "auto-return", false) +CONFIG_VARIABLE (bool, auto_input, "auto-input", true) +CONFIG_VARIABLE (bool, auto_loop, "auto-loop", false) +CONFIG_VARIABLE (bool, punch_in, "punch-in", false) +CONFIG_VARIABLE (bool, punch_out, "punch-out", false) +CONFIG_VARIABLE (bool, plugins_stop_with_transport, "plugins-stop-with-transport", false) +CONFIG_VARIABLE (bool, do_not_record_plugins, "do-not-record-plugins", false) +CONFIG_VARIABLE (bool, stop_recording_on_xrun, "stop-recording-on-xrun", false) +CONFIG_VARIABLE (bool, stop_at_session_end, "stop-at-session-end", true) +CONFIG_VARIABLE (bool, seamless_loop, "seamless-loop", false) +CONFIG_VARIABLE (nframes_t, preroll, "preroll", 0) +CONFIG_VARIABLE (nframes_t, postroll, "postroll", 0) +CONFIG_VARIABLE (float, rf_speed, "rf-speed", 2.0f) +CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) +CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) +CONFIG_VARIABLE (SlaveSource, slave_source, "slave-source", None) +CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Sprung) +CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage) +CONFIG_VARIABLE (bool, quieten_at_speed, "quieten-at-speed", true) + +/* timecode and sync */ + +CONFIG_VARIABLE (bool, jack_time_master, "jack-time-master", true) +CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false) +CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true) +CONFIG_VARIABLE (float, smpte_frames_per_second, "smpte-frames-per-second", 30.0f) +CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f) +CONFIG_VARIABLE (bool, smpte_drop_frames, "smpte-drop-frames", false) + +/* metering */ + +CONFIG_VARIABLE (float, meter_hold, "meter-hold", 100.0f) +CONFIG_VARIABLE (float, meter_falloff, "meter-falloff", 0.375f) +CONFIG_VARIABLE (nframes_t, over_length_short, "over-length-short", 2) +CONFIG_VARIABLE (nframes_t, over_length_long, "over-length-long", 10) + +/* miscellany */ -CONFIG_VARIABLE(std::string, mtc_port_name, "mtc-port-name", "default") -CONFIG_VARIABLE(std::string, mmc_port_name, "mmc-port-name", "default") -CONFIG_VARIABLE(std::string, midi_port_name, "midi-port-name", "default") -CONFIG_VARIABLE(uint32_t, minimum_disk_io_bytes, "minimum-disk-io-bytes", 1024 * 256) -CONFIG_VARIABLE(float, track_buffer_seconds, "track-buffer-seconds", 5.0) -CONFIG_VARIABLE(bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true) -CONFIG_VARIABLE(bool, mute_affects_pre_fader, "mute-affects-pre-fader", true) -CONFIG_VARIABLE(bool, mute_affects_post_fader, "mute-affects-post-fader", true) -CONFIG_VARIABLE(bool, mute_affects_control_outs, "mute-affects-control-outs", true) -CONFIG_VARIABLE(bool, mute_affects_main_outs, "mute-affects-main-outs", true) -CONFIG_VARIABLE(bool, solo_latch, "solo-latch", true) -CONFIG_VARIABLE(bool, use_hardware_monitoring, "use-hardware-monitoring", false) -CONFIG_VARIABLE(bool, use_sw_monitoring, "use-sw-monitoring", false) -CONFIG_VARIABLE(bool, use_external_monitoring, "use-external-monitoring", true) -CONFIG_VARIABLE(bool, jack_time_master, "jack-time-master", true) -CONFIG_VARIABLE(bool, use_video_sync, "use-video-sync", false) -CONFIG_VARIABLE(bool, trace_midi_input, "trace-midi-input", false) -CONFIG_VARIABLE(bool, trace_midi_output, "trace-midi-output", false) -CONFIG_VARIABLE(bool, plugins_stop_with_transport, "plugins-stop-with-transport", false) -CONFIG_VARIABLE(bool, stop_recording_on_xrun, "stop-recording-on-xrun", false) -CONFIG_VARIABLE(bool, verify_remove_last_capture, "verify-remove-last-capture", true) -CONFIG_VARIABLE(bool, stop_at_session_end, "stop-at-session-end", true) -CONFIG_VARIABLE(bool, seamless_looping, "seamless-looping", true) -CONFIG_VARIABLE(bool, auto_xfade, "auto-xfade", true) -CONFIG_VARIABLE(bool, no_new_session_dialog, "no-new-session-dialog", false) -CONFIG_VARIABLE(bool, timecode_source_is_synced, "timecode-source-is-synced", true) -CONFIG_VARIABLE(bool, latched_record_enable, "latched-record-enable", false) -CONFIG_VARIABLE(bool, use_vst, "use-vst", true) -CONFIG_VARIABLE(bool, quieten_at_speed, "quieten-at-speed", true) -CONFIG_VARIABLE(uint32_t, feedback_interval_ms, "feedback-interval-ms", 100) -CONFIG_VARIABLE(uint32_t, disk_choice_space_threshold, "disk-choice-space-threshold", 57600000) -CONFIG_VARIABLE(uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2) -CONFIG_VARIABLE(SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat) -CONFIG_VARIABLE(HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE) -CONFIG_VARIABLE(bool, use_tranzport, "use-tranzport", false) -CONFIG_VARIABLE(uint32_t, osc_port, "osc-port", 3819) -CONFIG_VARIABLE(bool, use_osc, "use-osc", true) -CONFIG_VARIABLE(bool, use_overlap_equivalency, "use-overlap-equivalency", true) -CONFIG_VARIABLE(bool, meter_falloff_off, "meter-falloff-off", false) -CONFIG_VARIABLE(bool, meter_falloff_slowest, "meter-falloff-slowest", false) -CONFIG_VARIABLE(bool, meter_falloff_slower, "meter-falloff-slower", false) -CONFIG_VARIABLE(bool, meter_falloff_slow, "meter-falloff-slow", false) -CONFIG_VARIABLE(bool, meter_falloff_medium, "meter-falloff-medium", false) -CONFIG_VARIABLE(bool, meter_falloff_fast, "meter-falloff-fast", true) -CONFIG_VARIABLE(bool, meter_falloff_faster, "meter-falloff-faster", false) -CONFIG_VARIABLE(bool, meter_falloff_fastest, "meter-falloff-fastest", false) -CONFIG_VARIABLE(bool, meter_hold_off, "meter-hold-off", false) -CONFIG_VARIABLE(bool, meter_hold_short, "meter-hold-short", false) -CONFIG_VARIABLE(bool, meter_hold_medium, "meter-hold-medium", false) -CONFIG_VARIABLE(bool, meter_hold_long, "meter-hold-long", false) - -/* these variables have custom set() methods */ +CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true) +CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture", true) +CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false) +CONFIG_VARIABLE (bool, use_vst, "use-vst", true) + +/* these variables have custom set() methods (e.g. path globbing) */ CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", path_expand) diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index 8eda7a4555..39e4803637 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -23,7 +23,11 @@ struct ControlProtocolInfo { std::string path; bool requested; bool mandatory; + bool supports_feedback; XMLNode* state; + + ControlProtocolInfo() : descriptor (0), protocol (0), state (0) {} + ~ControlProtocolInfo() { if (state) { delete state; } } }; class ControlProtocolManager : public sigc::trackable, public Stateful @@ -46,6 +50,8 @@ struct ControlProtocolInfo { static const std::string state_node_name; + void set_protocol_states (const XMLNode&); + int set_state (const XMLNode&); XMLNode& get_state (void); diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index 49009caf53..668fe61102 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -33,24 +33,21 @@ class CoreAudioSource : public AudioFileSource { ~CoreAudioSource (); float sample_rate() const; - int update_header (jack_nframes_t when, struct tm&, time_t); + int update_header (nframes_t when, struct tm&, time_t); int flush_header () {return 0;}; void set_header_timeline_position () {}; protected: - jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const; - - jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt) - { return 0; } - + nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const; + nframes_t write_unlocked (Sample *dst, nframes_t cnt) { return 0; } private: mutable CAAudioFile af; uint16_t n_channels; mutable float *tmpbuf; - mutable jack_nframes_t tmpbufsize; + mutable nframes_t tmpbufsize; mutable Glib::Mutex _tmpbuf_lock; void init (const string &str); diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index ded41bbfda..7fd7323b36 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -46,8 +46,8 @@ struct CrossfadeState : public StateManager::State { UndoAction fade_in_memento; UndoAction fade_out_memento; - jack_nframes_t position; - jack_nframes_t length; + nframes_t position; + nframes_t length; AnchorPoint anchor_point; bool follow_overlap; bool active; @@ -65,8 +65,8 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager /* constructor for "fixed" xfades at each end of an internal overlap */ Crossfade (boost::shared_ptr<ARDOUR::AudioRegion> in, boost::shared_ptr<ARDOUR::AudioRegion> out, - jack_nframes_t position, - jack_nframes_t initial_length, + nframes_t position, + nframes_t initial_length, AnchorPoint); /* constructor for xfade between two regions that are overlapped in any way @@ -93,11 +93,11 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager boost::shared_ptr<ARDOUR::AudioRegion> in() const { return _in; } boost::shared_ptr<ARDOUR::AudioRegion> out() const { return _out; } - jack_nframes_t read_at (Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, jack_nframes_t position, jack_nframes_t cnt, + nframes_t read_at (Sample *buf, Sample *mixdown_buffer, + float *gain_buffer, nframes_t position, nframes_t cnt, uint32_t chan_n, - jack_nframes_t read_frames = 0, - jack_nframes_t skip_frames = 0); + nframes_t read_frames = 0, + nframes_t skip_frames = 0); bool refresh (); @@ -117,21 +117,21 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager return (_in == a && _out == b) || (_in == b && _out == a); } - jack_nframes_t length() const { return _length; } - jack_nframes_t overlap_length() const; - jack_nframes_t position() const { return _position; } + nframes_t length() const { return _length; } + nframes_t overlap_length() const; + nframes_t position() const { return _position; } sigc::signal<void,Crossfade*> Invalidated; - bool covers (jack_nframes_t frame) const { + bool covers (nframes_t frame) const { return _position <= frame && frame < _position + _length; } - OverlapType coverage (jack_nframes_t start, jack_nframes_t end) const; + OverlapType coverage (nframes_t start, nframes_t end) const; UndoAction get_memento() const; - static void set_buffer_size (jack_nframes_t); + static void set_buffer_size (nframes_t); bool active () const { return _active; } void set_active (bool yn); @@ -143,10 +143,10 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager Curve& fade_in() { return _fade_in; } Curve& fade_out() { return _fade_out; } - jack_nframes_t set_length (jack_nframes_t); + nframes_t set_length (nframes_t); - static jack_nframes_t short_xfade_length() { return _short_xfade_length; } - static void set_short_xfade_length (jack_nframes_t n); + static nframes_t short_xfade_length() { return _short_xfade_length; } + static void set_short_xfade_length (nframes_t n); static Change ActiveChanged; @@ -154,15 +154,15 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager friend struct CrossfadeComparePtr; friend class AudioPlaylist; - static jack_nframes_t _short_xfade_length; + static nframes_t _short_xfade_length; boost::shared_ptr<ARDOUR::AudioRegion> _in; boost::shared_ptr<ARDOUR::AudioRegion> _out; bool _active; bool _in_update; OverlapType overlap_type; - jack_nframes_t _length; - jack_nframes_t _position; + nframes_t _length; + nframes_t _position; AnchorPoint _anchor_point; bool _follow_overlap; bool _fixed; diff --git a/libs/ardour/ardour/destructive_filesource.h b/libs/ardour/ardour/destructive_filesource.h index fed84217e7..1e75042ce9 100644 --- a/libs/ardour/ardour/destructive_filesource.h +++ b/libs/ardour/ardour/destructive_filesource.h @@ -31,7 +31,7 @@ namespace ARDOUR { class DestructiveFileSource : public SndFileSource { public: - DestructiveFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, + DestructiveFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags = AudioFileSource::Flag (AudioFileSource::Writable)); DestructiveFileSource (Session&, std::string path, Flag flags); @@ -39,34 +39,34 @@ class DestructiveFileSource : public SndFileSource { DestructiveFileSource (Session&, const XMLNode&); ~DestructiveFileSource (); - jack_nframes_t last_capture_start_frame() const; - void mark_capture_start (jack_nframes_t); + nframes_t last_capture_start_frame() const; + void mark_capture_start (nframes_t); void mark_capture_end (); void clear_capture_marks(); XMLNode& get_state (); - static void setup_standard_crossfades (jack_nframes_t sample_rate); + static void setup_standard_crossfades (nframes_t sample_rate); protected: - jack_nframes_t write_unlocked (Sample *src, jack_nframes_t cnt); + nframes_t write_unlocked (Sample *src, nframes_t cnt); virtual void handle_header_position_change (); private: - static jack_nframes_t xfade_frames; + static nframes_t xfade_frames; static gain_t* out_coefficient; static gain_t* in_coefficient; bool _capture_start; bool _capture_end; - jack_nframes_t capture_start_frame; - jack_nframes_t file_pos; // unit is frames + nframes_t capture_start_frame; + nframes_t file_pos; // unit is frames Sample* xfade_buf; void init (); - jack_nframes_t crossfade (Sample* data, jack_nframes_t cnt, int dir); - void set_timeline_position (jack_nframes_t); + nframes_t crossfade (Sample* data, nframes_t cnt, int dir); + void set_timeline_position (nframes_t); }; } diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 048e9df90f..7a779b69bf 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -54,7 +54,7 @@ class Session; class Playlist; class IO; - class Diskstream : public sigc::trackable, public PBD::StatefulDestructible + class Diskstream : public PBD::StatefulDestructible { public: enum Flag { @@ -83,8 +83,8 @@ class IO; void set_align_style (AlignStyle); void set_persistent_align_style (AlignStyle a) { _persistent_alignment_style = a; } - jack_nframes_t roll_delay() const { return _roll_delay; } - void set_roll_delay (jack_nframes_t); + nframes_t roll_delay() const { return _roll_delay; } + void set_roll_delay (nframes_t); bool record_enabled() const { return g_atomic_int_get (&_record_enabled); } virtual void set_record_enabled (bool yn) = 0; @@ -109,14 +109,14 @@ class IO; virtual int use_new_playlist () = 0; virtual int use_copy_playlist () = 0; - jack_nframes_t current_capture_start() const { return capture_start_frame; } - jack_nframes_t current_capture_end() const { return capture_start_frame + capture_captured; } - jack_nframes_t get_capture_start_frame (uint32_t n=0); - jack_nframes_t get_captured_frames (uint32_t n=0); + nframes_t current_capture_start() const { return capture_start_frame; } + nframes_t current_capture_end() const { return capture_start_frame + capture_captured; } + nframes_t get_capture_start_frame (uint32_t n=0); + nframes_t get_captured_frames (uint32_t n=0); ChanCount n_channels() { return _n_channels; } - static jack_nframes_t disk_io_frames() { return disk_io_chunk_frames; } + static nframes_t disk_io_frames() { return disk_io_chunk_frames; } static void set_disk_io_chunk_frames (uint32_t n) { disk_io_chunk_frames = n; } /* Stateful */ @@ -125,7 +125,7 @@ class IO; virtual void monitor_input (bool) {} - jack_nframes_t capture_offset() const { return _capture_offset; } + nframes_t capture_offset() const { return _capture_offset; } virtual void set_capture_offset (); bool slaved() const { return _slaved; } @@ -146,7 +146,6 @@ class IO; static sigc::signal<void> DiskOverrun; static sigc::signal<void> DiskUnderrun; - static sigc::signal<void,std::list<boost::shared_ptr<Source> >*> DeleteSources; protected: friend class Session; @@ -157,9 +156,9 @@ class IO; virtual void set_pending_overwrite (bool) = 0; virtual int overwrite_existing_buffers () = 0; - virtual void set_block_size (jack_nframes_t) = 0; - virtual int internal_playback_seek (jack_nframes_t distance) = 0; - virtual int can_internal_playback_seek (jack_nframes_t distance) = 0; + virtual void set_block_size (nframes_t) = 0; + virtual int internal_playback_seek (nframes_t distance) = 0; + virtual int can_internal_playback_seek (nframes_t distance) = 0; virtual int rename_write_sources () = 0; virtual void reset_write_sources (bool, bool force = false) = 0; virtual void non_realtime_input_change () = 0; @@ -169,14 +168,14 @@ class IO; protected: friend class Auditioner; - virtual int seek (jack_nframes_t which_sample, bool complete_refill = false) = 0; + virtual int seek (nframes_t which_sample, bool complete_refill = false) = 0; protected: friend class Track; virtual void prepare (); - virtual int process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input) = 0; - virtual bool commit (jack_nframes_t nframes) = 0; + virtual int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input) = 0; + virtual bool commit (nframes_t nframes) = 0; virtual void recover (); /* called if commit will not be called, but process was */ //private: @@ -188,7 +187,7 @@ class IO; struct CaptureTransition { TransitionType type; - jack_nframes_t capture_val; ///< The start or end file frame position + nframes_t capture_val; ///< The start or end file frame position }; /* The two central butler operations */ @@ -227,12 +226,12 @@ class IO; virtual int use_pending_capture_data (XMLNode& node) = 0; virtual void get_input_sources () = 0; - virtual void check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record) = 0; + virtual void check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record) = 0; virtual void set_align_style_from_io() {} virtual void setup_destructive_playlist () {} virtual void use_destructive_playlist () {} - static jack_nframes_t disk_io_chunk_frames; + static nframes_t disk_io_chunk_frames; vector<CaptureInfo*> capture_info; Glib::Mutex capture_info_lock; @@ -252,34 +251,34 @@ class IO; bool _seek_required; bool force_refill; - jack_nframes_t capture_start_frame; - jack_nframes_t capture_captured; + nframes_t capture_start_frame; + nframes_t capture_captured; bool was_recording; - jack_nframes_t adjust_capture_position; - jack_nframes_t _capture_offset; - jack_nframes_t _roll_delay; - jack_nframes_t first_recordable_frame; - jack_nframes_t last_recordable_frame; + nframes_t adjust_capture_position; + nframes_t _capture_offset; + nframes_t _roll_delay; + nframes_t first_recordable_frame; + nframes_t last_recordable_frame; int last_possibly_recording; AlignStyle _alignment_style; bool _scrubbing; bool _slaved; bool _processed; Location* loop_location; - jack_nframes_t overwrite_frame; + nframes_t overwrite_frame; off_t overwrite_offset; bool pending_overwrite; bool overwrite_queued; IOChange input_change_pending; - jack_nframes_t wrap_buffer_size; - jack_nframes_t speed_buffer_size; + nframes_t wrap_buffer_size; + nframes_t speed_buffer_size; uint64_t last_phase; uint64_t phi; - jack_nframes_t file_frame; - jack_nframes_t playback_sample; - jack_nframes_t playback_distance; + nframes_t file_frame; + nframes_t playback_sample; + nframes_t playback_distance; uint32_t _read_data_count; uint32_t _write_data_count; @@ -290,9 +289,9 @@ class IO; Glib::Mutex state_lock; - jack_nframes_t scrub_start; - jack_nframes_t scrub_buffer_size; - jack_nframes_t scrub_offset; + nframes_t scrub_start; + nframes_t scrub_buffer_size; + nframes_t scrub_offset; sigc::connection ports_created_c; sigc::connection plmod_connection; diff --git a/libs/ardour/ardour/export.h b/libs/ardour/ardour/export.h index 075464767e..f66acec893 100644 --- a/libs/ardour/ardour/export.h +++ b/libs/ardour/ardour/export.h @@ -34,43 +34,43 @@ namespace ARDOUR void clear (); - int prepare (jack_nframes_t blocksize, jack_nframes_t frame_rate); + int prepare (nframes_t blocksize, nframes_t frame_rate); - int process (jack_nframes_t nframes); + int process (nframes_t nframes); /* set by the user */ string path; - jack_nframes_t sample_rate; + nframes_t sample_rate; int src_quality; SNDFILE* out; uint32_t channels; AudioExportPortMap port_map; - jack_nframes_t start_frame; - jack_nframes_t end_frame; + nframes_t start_frame; + nframes_t end_frame; GDitherType dither_type; bool do_freewheel; /* used exclusively during export */ - jack_nframes_t frame_rate; + nframes_t frame_rate; GDither dither; float* dataF; float* dataF2; float* leftoverF; - jack_nframes_t leftover_frames; - jack_nframes_t max_leftover_frames; + nframes_t leftover_frames; + nframes_t max_leftover_frames; void* output_data; - jack_nframes_t out_samples_max; + nframes_t out_samples_max; uint32_t sample_bytes; uint32_t data_width; - jack_nframes_t total_frames; + nframes_t total_frames; SF_INFO sfinfo; SRC_DATA src_data; SRC_STATE* src_state; - jack_nframes_t pos; + nframes_t pos; sigc::connection freewheel_connection; diff --git a/libs/ardour/ardour/gain.h b/libs/ardour/ardour/gain.h index 3bd2d3be61..3613ea1a5a 100644 --- a/libs/ardour/ardour/gain.h +++ b/libs/ardour/ardour/gain.h @@ -32,10 +32,10 @@ struct Gain : public Curve { Gain (const Gain&); Gain& operator= (const Gain&); - static void fill_linear_fade_in (Gain& curve, jack_nframes_t frames); - static void fill_linear_volume_fade_in (Gain& curve, jack_nframes_t frames); - static void fill_linear_fade_out (Gain& curve, jack_nframes_t frames); - static void fill_linear_volume_fade_out (Gain& curve, jack_nframes_t frames); + static void fill_linear_fade_in (Gain& curve, nframes_t frames); + static void fill_linear_volume_fade_in (Gain& curve, nframes_t frames); + static void fill_linear_fade_out (Gain& curve, nframes_t frames); + static void fill_linear_volume_fade_out (Gain& curve, nframes_t frames); }; diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h index a8a651df24..5d917a8c2c 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/insert.h @@ -53,7 +53,8 @@ class Insert : public Redirect virtual ~Insert() { } - virtual void run (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset) = 0; + virtual void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) = 0; + virtual void activate () {} virtual void deactivate () {} @@ -75,9 +76,10 @@ class PortInsert : public Insert int set_state(const XMLNode&); void init (); - void run (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset); + + void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); - jack_nframes_t latency(); + nframes_t latency(); ChanCount output_streams() const; ChanCount input_streams() const; @@ -113,12 +115,13 @@ class PluginInsert : public Insert StateManager::State* state_factory (std::string why) const; Change restore_state (StateManager::State&); - void run (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset); - void silence (jack_nframes_t nframes, jack_nframes_t offset); + void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); + void silence (nframes_t nframes, nframes_t offset); + void activate (); void deactivate (); - void set_block_size (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); ChanCount output_streams() const; ChanCount input_streams() const; @@ -154,10 +157,9 @@ class PluginInsert : public Insert string describe_parameter (uint32_t); - jack_nframes_t latency(); + nframes_t latency(); - void transport_stopped (jack_nframes_t now); - void automation_snapshot (jack_nframes_t now); + void transport_stopped (nframes_t now); protected: void store_state (PluginInsertState&) const; @@ -167,8 +169,9 @@ class PluginInsert : public Insert void parameter_changed (uint32_t, float); vector<boost::shared_ptr<Plugin> > _plugins; - void automation_run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset); - void connect_and_run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset, bool with_auto, jack_nframes_t now = 0); + + void automation_run (BufferSet& bufs, nframes_t nframes, nframes_t offset); + void connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now = 0); void init (); void set_automatable (); diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 6074376291..56566149c0 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -100,7 +100,7 @@ class IO : public PBD::StatefulDestructible, public ARDOUR::StateManager const string& name() const { return _name; } virtual int set_name (string str, void *src); - virtual void silence (jack_nframes_t, jack_nframes_t offset); + virtual void silence (nframes_t, nframes_t offset); void collect_input (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset); void deliver_output (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, @@ -144,9 +144,9 @@ class IO : public PBD::StatefulDestructible, public ARDOUR::StateManager int disconnect_inputs (void *src); int disconnect_outputs (void *src); - jack_nframes_t output_latency() const; - jack_nframes_t input_latency() const; - void set_port_latency (jack_nframes_t); + nframes_t output_latency() const; + nframes_t input_latency() const; + void set_port_latency (nframes_t); const PortSet& inputs() const { return _inputs; } const PortSet& outputs() const { return _outputs; } @@ -244,16 +244,7 @@ public: AutoStyle gain_automation_style () const { return _gain_automation_curve.automation_style(); } sigc::signal<void> gain_automation_style_changed; - static void set_automation_interval (jack_nframes_t frames) { - _automation_interval = frames; - } - - static jack_nframes_t automation_interval() { - return _automation_interval; - } - - virtual void transport_stopped (jack_nframes_t now); - virtual void automation_snapshot (jack_nframes_t now); + virtual void transport_stopped (nframes_t now); ARDOUR::Curve& gain_automation_curve () { return _gain_automation_curve; } @@ -277,24 +268,24 @@ public: mutable Glib::Mutex io_lock; protected: - Session& _session; - Panner* _panner; - BufferSet* _output_buffers; //< Set directly to our output port buffers - gain_t _gain; - gain_t _effective_gain; - gain_t _desired_gain; - Glib::Mutex declick_lock; - PortSet _outputs; - PortSet _inputs; - PeakMeter* _meter; - string _name; - Connection* _input_connection; - Connection* _output_connection; - bool no_panner_reset; - bool _phase_invert; - XMLNode* deferred_state; - DataType _default_type; - + Session& _session; + Panner* _panner; + BufferSet* _output_buffers; //< Set directly to output port buffers + gain_t _gain; + gain_t _effective_gain; + gain_t _desired_gain; + Glib::Mutex declick_lock; + PortSet _outputs; + PortSet _inputs; + PeakMeter* _meter; + string _name; + Connection* _input_connection; + Connection* _output_connection; + bool no_panner_reset; + bool _phase_invert; + XMLNode* deferred_state; + DataType _default_type; + virtual void set_deferred_state() {} void reset_panner (); @@ -303,7 +294,7 @@ public: { return _inputs.count().get(DataType::AUDIO); } struct GainControllable : public PBD::Controllable { - GainControllable (IO& i) : io (i) {} + GainControllable (std::string name, IO& i) : Controllable (name), io (i) {} void set_value (float val); float get_value (void) const; @@ -318,12 +309,7 @@ public: Change restore_state (State&); StateManager::State* state_factory (std::string why) const; - /* automation */ - - jack_nframes_t last_automation_snapshot; - static jack_nframes_t _automation_interval; - - AutoState _gain_automation_state; + AutoState _gain_automation_state; AutoStyle _gain_automation_style; bool apply_gain_automation; diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index c2bb10a843..27e8bc5e84 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -48,7 +48,7 @@ class Session; class LadspaPlugin : public ARDOUR::Plugin { public: - LadspaPlugin (void *module, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, jack_nframes_t sample_rate); + LadspaPlugin (void *module, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, nframes_t sample_rate); LadspaPlugin (const LadspaPlugin &); ~LadspaPlugin (); @@ -60,7 +60,7 @@ class LadspaPlugin : public ARDOUR::Plugin const char * maker() const { return descriptor->Maker; } uint32_t parameter_count() const { return descriptor->PortCount; } float default_value (uint32_t port); - jack_nframes_t latency() const; + nframes_t latency() const; void set_parameter (uint32_t port, float val); float get_parameter (uint32_t port) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; @@ -81,9 +81,9 @@ class LadspaPlugin : public ARDOUR::Plugin descriptor->cleanup (handle); } } - void set_block_size (jack_nframes_t nframes) {} + void set_block_size (nframes_t nframes) {} - int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, jack_nframes_t nframes, jack_nframes_t offset); + int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset); void store_state (ARDOUR::PluginState&); void restore_state (ARDOUR::PluginState&); string describe_parameter (uint32_t); @@ -126,15 +126,15 @@ class LadspaPlugin : public ARDOUR::Plugin void *module; const LADSPA_Descriptor *descriptor; LADSPA_Handle handle; - jack_nframes_t sample_rate; + nframes_t sample_rate; LADSPA_Data *control_data; LADSPA_Data *shadow_data; LADSPA_Data *latency_control_port; uint32_t _index; bool was_activated; - void init (void *mod, uint32_t index, jack_nframes_t rate); - void run (jack_nframes_t nsamples); + void init (void *mod, uint32_t index, nframes_t rate); + void run (nframes_t nsamples); void latency_compute_run (); }; diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 96fb1b1bcf..1f1c02d67c 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -42,7 +42,7 @@ using std::string; namespace ARDOUR { -class Location : public sigc::trackable, public PBD::StatefulDestructible +class Location : public PBD::StatefulDestructible { public: enum Flags { @@ -56,8 +56,8 @@ class Location : public sigc::trackable, public PBD::StatefulDestructible IsStart = 0x80 }; - Location (jack_nframes_t sample_start, - jack_nframes_t sample_end, + Location (nframes_t sample_start, + nframes_t sample_end, const string &name, Flags bits = Flags(0)) @@ -76,13 +76,13 @@ class Location : public sigc::trackable, public PBD::StatefulDestructible Location (const XMLNode&); Location* operator= (const Location& other); - jack_nframes_t start() { return _start; } - jack_nframes_t end() { return _end; } - jack_nframes_t length() { return _end - _start; } + nframes_t start() { return _start; } + nframes_t end() { return _end; } + nframes_t length() { return _end - _start; } - int set_start (jack_nframes_t s); - int set_end (jack_nframes_t e); - int set (jack_nframes_t start, jack_nframes_t end); + int set_start (nframes_t s); + int set_end (nframes_t e); + int set (nframes_t start, nframes_t end); const string& name() { return _name; } void set_name (const string &str) { _name = str; name_changed(this); } @@ -123,8 +123,8 @@ class Location : public sigc::trackable, public PBD::StatefulDestructible private: string _name; - jack_nframes_t _start; - jack_nframes_t _end; + nframes_t _start; + nframes_t _end; uint32_t _flags; void set_mark (bool yn); @@ -159,11 +159,11 @@ class Locations : public StateManager, public PBD::StatefulDestructible int set_current (Location *, bool want_lock = true); Location *current () const { return current_location; } - Location *first_location_before (jack_nframes_t); - Location *first_location_after (jack_nframes_t); + Location *first_location_before (nframes_t); + Location *first_location_after (nframes_t); - jack_nframes_t first_mark_before (jack_nframes_t); - jack_nframes_t first_mark_after (jack_nframes_t); + nframes_t first_mark_before (nframes_t); + nframes_t first_mark_after (nframes_t); sigc::signal<void,Location*> current_changed; sigc::signal<void> changed; diff --git a/libs/ardour/ardour/mix.h b/libs/ardour/ardour/mix.h index b351e3ef17..653b61cb95 100644 --- a/libs/ardour/ardour/mix.h +++ b/libs/ardour/ardour/mix.h @@ -28,47 +28,47 @@ extern "C" { /* SSE functions */ - float x86_sse_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current); + float x86_sse_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); - void x86_sse_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain); + void x86_sse_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); - void x86_sse_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain); + void x86_sse_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain); - void x86_sse_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes); + void x86_sse_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); } /* debug wrappers for SSE functions */ -float debug_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current); +float debug_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); -void debug_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain); +void debug_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); -void debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain); +void debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain); -void debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes); +void debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); #endif #if defined (__APPLE__) -float veclib_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current); +float veclib_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); -void veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain); +void veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); -void veclib_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain); +void veclib_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain); -void veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes); +void veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); #endif /* non-optimized functions */ -float compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current); +float compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); -void apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain); +void apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); -void mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain); +void mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain); -void mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes); +void mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); #endif /* __ardour_mix_h__ */ diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index a88180701e..5231120840 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -66,14 +66,14 @@ class StreamPanner : public sigc::trackable, public Stateful /* the basic StreamPanner API */ - virtual void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, jack_nframes_t nframes) = 0; + virtual void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes) = 0; virtual void distribute_automated (AudioBuffer& src, BufferSet& obufs, - jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, pan_t** buffers) = 0; + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) = 0; /* automation */ - virtual void snapshot (jack_nframes_t now) = 0; - virtual void transport_stopped (jack_nframes_t frame) = 0; + virtual void snapshot (nframes_t now) = 0; + virtual void transport_stopped (nframes_t frame) = 0; virtual void set_automation_state (AutoState) = 0; virtual void set_automation_style (AutoStyle) = 0; @@ -116,7 +116,7 @@ class StreamPanner : public sigc::trackable, public Stateful bool _muted; struct PanControllable : public PBD::Controllable { - PanControllable (StreamPanner& p) : panner (p) {} + PanControllable (std::string name, StreamPanner& p) : Controllable (name), panner (p) {} StreamPanner& panner; @@ -143,12 +143,12 @@ class BaseStereoPanner : public StreamPanner and a type name. See EqualPowerStereoPanner as an example. */ - void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, jack_nframes_t nframes); + void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes); int load (istream&, string path, uint32_t&); int save (ostream&) const; - void snapshot (jack_nframes_t now); - void transport_stopped (jack_nframes_t frame); + void snapshot (nframes_t now); + void transport_stopped (nframes_t frame); void set_automation_state (AutoState); void set_automation_style (AutoStyle); @@ -172,7 +172,7 @@ class EqualPowerStereoPanner : public BaseStereoPanner ~EqualPowerStereoPanner (); void distribute_automated (AudioBuffer& src, BufferSet& obufs, - jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, pan_t** buffers); + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); void get_current_coefficients (pan_t*) const; void get_desired_coefficients (pan_t*) const; @@ -194,8 +194,8 @@ class Multi2dPanner : public StreamPanner Multi2dPanner (Panner& parent); ~Multi2dPanner (); - void snapshot (jack_nframes_t now); - void transport_stopped (jack_nframes_t frame); + void snapshot (nframes_t now); + void transport_stopped (nframes_t frame); void set_automation_state (AutoState); void set_automation_style (AutoStyle); @@ -205,9 +205,9 @@ class Multi2dPanner : public StreamPanner Curve& automation() { return _automation; } - void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, jack_nframes_t nframes); + void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes); void distribute_automated (AudioBuffer& src, BufferSet& obufs, - jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, pan_t** buffers); + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); int load (istream&, string path, uint32_t&); int save (ostream&) const; @@ -242,7 +242,7 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: virtual ~Panner (); /// The fundamental Panner function - void distribute(BufferSet& src, BufferSet& dest, jack_nframes_t start_frame, jack_nframes_t end_frames, jack_nframes_t nframes, jack_nframes_t offset); + void distribute(BufferSet& src, BufferSet& dest, nframes_t start_frame, nframes_t end_frames, nframes_t nframes, nframes_t offset); void set_name (string); @@ -254,8 +254,8 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: void clear (); void reset (uint32_t noutputs, uint32_t npans); - void snapshot (jack_nframes_t now); - void transport_stopped (jack_nframes_t frame); + void snapshot (nframes_t now); + void transport_stopped (nframes_t frame); void clear_automation (); @@ -306,7 +306,7 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: void set_position (float x, float y, float z, StreamPanner& orig); private: - void distribute_no_automation(BufferSet& src, BufferSet& dest, jack_nframes_t nframes, jack_nframes_t offset, gain_t gain_coeff); + void distribute_no_automation(BufferSet& src, BufferSet& dest, nframes_t nframes, nframes_t offset, gain_t gain_coeff); string automation_path; diff --git a/libs/ardour/ardour/peak.h b/libs/ardour/ardour/peak.h index d08357024b..2c8abe7cf4 100644 --- a/libs/ardour/ardour/peak.h +++ b/libs/ardour/ardour/peak.h @@ -6,9 +6,9 @@ #include <ardour/utils.h> static inline float -compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current) +compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) { - for (jack_nframes_t i = 0; i < nsamples; ++i) { + for (nframes_t i = 0; i < nsamples; ++i) { current = f_max (current, fabsf (buf[i])); } return current; diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 4249007fff..d7b13ef684 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -55,7 +55,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { Playlist (Session&, const XMLNode&, DataType type, bool hidden = false); Playlist (Session&, string name, DataType type, bool hidden = false); Playlist (const Playlist&, string name, bool hidden = false); - Playlist (const Playlist&, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden = false); + Playlist (const Playlist&, nframes_t start, nframes_t cnt, string name, bool hidden = false); virtual void clear (bool with_save = true); virtual void dump () const; @@ -75,7 +75,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { bool hidden() const { return _hidden; } bool empty() const; - jack_nframes_t get_maximum_extent () const; + nframes_t get_maximum_extent () const; layer_t top_layer() const; EditMode get_edit_mode() const { return _edit_mode; } @@ -83,29 +83,29 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { /* Editing operations */ - void add_region (boost::shared_ptr<Region>, jack_nframes_t position, float times = 1, bool with_save = true); + void add_region (boost::shared_ptr<Region>, nframes_t position, float times = 1, bool with_save = true); void remove_region (boost::shared_ptr<Region>); void get_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&); void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&); - void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, jack_nframes_t pos); - void split_region (boost::shared_ptr<Region>, jack_nframes_t position); - void partition (jack_nframes_t start, jack_nframes_t end, bool just_top_level); - void duplicate (boost::shared_ptr<Region>, jack_nframes_t position, float times); - void nudge_after (jack_nframes_t start, jack_nframes_t distance, bool forwards); + void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, nframes_t pos); + void split_region (boost::shared_ptr<Region>, nframes_t position); + 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); boost::shared_ptr<Region> find_region (const PBD::ID&) const; Playlist* cut (list<AudioRange>&, bool result_is_hidden = true); Playlist* copy (list<AudioRange>&, bool result_is_hidden = true); - int paste (Playlist&, jack_nframes_t position, float times); + int paste (Playlist&, nframes_t position, float times); uint32_t read_data_count() { return _read_data_count; } - RegionList* regions_at (jack_nframes_t frame); - RegionList* regions_touched (jack_nframes_t start, jack_nframes_t end); - boost::shared_ptr<Region> top_region_at (jack_nframes_t frame); + RegionList* regions_at (nframes_t frame); + RegionList* regions_touched (nframes_t start, nframes_t end); + boost::shared_ptr<Region> top_region_at (nframes_t frame); - boost::shared_ptr<Region> find_next_region (jack_nframes_t frame, RegionPoint point, int dir); + boost::shared_ptr<Region> find_next_region (nframes_t frame, RegionPoint point, int dir); 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>)); @@ -171,7 +171,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { friend class RegionLock; - RegionList regions; + RegionList regions; /* the current list of regions in the playlist */ string _name; Session& _session; DataType _type; @@ -198,7 +198,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { uint32_t _read_data_count; PBD::ID _orig_diskstream_id; uint64_t layer_op_counter; - jack_nframes_t freeze_length; + nframes_t freeze_length; void init (bool hide); @@ -225,7 +225,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { void mark_session_dirty(); - void region_changed_proxy (Change, boost::shared_ptr<Region>); + void region_changed_proxy (Change, boost::weak_ptr<Region>); virtual bool region_changed (Change, boost::shared_ptr<Region>); void region_bounds_changed (Change, boost::shared_ptr<Region>); @@ -253,25 +253,25 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { void save_state (std::string why); void maybe_save_state (std::string why); - void add_region_internal (boost::shared_ptr<Region>, jack_nframes_t position, bool delay_sort = false); + void add_region_internal (boost::shared_ptr<Region>, nframes_t position, bool delay_sort = false); int remove_region_internal (boost::shared_ptr<Region>, bool delay_sort = false); - RegionList *find_regions_at (jack_nframes_t frame); + RegionList *find_regions_at (nframes_t frame); void copy_regions (RegionList&) const; - void partition_internal (jack_nframes_t start, jack_nframes_t end, bool cutting, RegionList& thawlist); + void partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist); - jack_nframes_t _get_maximum_extent() const; + nframes_t _get_maximum_extent() const; - Playlist* cut_copy (Playlist* (Playlist::*pmf)(jack_nframes_t, jack_nframes_t, bool), + Playlist* cut_copy (Playlist* (Playlist::*pmf)(nframes_t, nframes_t, bool), list<AudioRange>& ranges, bool result_is_hidden); - Playlist *cut (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden); - Playlist *copy (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden); + Playlist *cut (nframes_t start, nframes_t cnt, bool result_is_hidden); + 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 (); - static Playlist* copyPlaylist (const Playlist&, jack_nframes_t start, jack_nframes_t length, + static Playlist* copyPlaylist (const Playlist&, nframes_t start, nframes_t length, string name, bool result_is_hidden); void unset_freeze_parent (Playlist*); diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 2117a9d58a..431b55db8b 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -78,7 +78,7 @@ class PluginInfo { typedef boost::shared_ptr<PluginInfo> PluginInfoPtr; typedef std::list<PluginInfoPtr> PluginInfoList; -class Plugin : public PBD::StatefulDestructible, public sigc::trackable +class Plugin : public PBD::StatefulDestructible { public: Plugin (ARDOUR::AudioEngine&, ARDOUR::Session&); @@ -99,9 +99,8 @@ class Plugin : public PBD::StatefulDestructible, public sigc::trackable float step; float smallstep; float largestep; - - bool min_unbound; - bool max_unbound; + bool min_unbound; + bool max_unbound; }; virtual uint32_t unique_id() const = 0; @@ -110,7 +109,7 @@ class Plugin : public PBD::StatefulDestructible, public sigc::trackable virtual const char * maker() const = 0; virtual uint32_t parameter_count () const = 0; virtual float default_value (uint32_t port) = 0; - virtual jack_nframes_t latency() const = 0; + virtual nframes_t latency() const = 0; virtual void set_parameter (uint32_t which, float val) = 0; virtual float get_parameter(uint32_t which) const = 0; @@ -118,9 +117,10 @@ class Plugin : public PBD::StatefulDestructible, public sigc::trackable virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0; virtual void activate () = 0; virtual void deactivate () = 0; - virtual void set_block_size (jack_nframes_t nframes) = 0; + virtual void set_block_size (nframes_t nframes) = 0; - virtual int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, jack_nframes_t nframes, jack_nframes_t offset) = 0; + virtual int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset) = 0; + virtual std::set<uint32_t> automatable() const = 0; virtual void store_state (ARDOUR::PluginState&) = 0; virtual void restore_state (ARDOUR::PluginState&) = 0; @@ -163,7 +163,7 @@ class Plugin : public PBD::StatefulDestructible, public sigc::trackable void setup_controls (); struct PortControllable : public PBD::Controllable { - PortControllable (Plugin&, uint32_t abs_port_id, + PortControllable (std::string name, Plugin&, uint32_t abs_port_id, float lower, float upper, bool toggled, bool logarithmic); void set_value (float); diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index d6dcd55645..4e4ad0fec6 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -116,11 +116,11 @@ class Port : public sigc::trackable { jack_port_request_monitor (_port, yn); } - jack_nframes_t latency () const { + nframes_t latency () const { return jack_port_get_latency (_port); } - void set_latency (jack_nframes_t nframes) { + void set_latency (nframes_t nframes) { jack_port_set_latency (_port, nframes); } diff --git a/libs/ardour/ardour/redirect.h b/libs/ardour/ardour/redirect.h index 4015c708de..ae58fa9b70 100644 --- a/libs/ardour/ardour/redirect.h +++ b/libs/ardour/ardour/redirect.h @@ -81,12 +81,12 @@ class Redirect : public IO Placement placement() const { return _placement; } void set_placement (Placement, void *src); - virtual void run (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset) = 0; + virtual void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) = 0; virtual void activate () = 0; virtual void deactivate () = 0; - virtual jack_nframes_t latency() { return 0; } + virtual nframes_t latency() { return 0; } - virtual void set_block_size (jack_nframes_t nframes) {} + virtual void set_block_size (nframes_t nframes) {} sigc::signal<void,Redirect*,void*> active_changed; sigc::signal<void,Redirect*,void*> placement_changed; @@ -120,9 +120,9 @@ class Redirect : public IO void mark_automation_visible (uint32_t, bool); AutomationList& automation_list (uint32_t); - bool find_next_event (jack_nframes_t, jack_nframes_t, ControlEvent&) const; + bool find_next_event (nframes_t, nframes_t, ControlEvent&) const; - virtual void transport_stopped (jack_nframes_t frame) {}; + virtual void transport_stopped (nframes_t frame) {}; protected: void set_placement (const string&, void *src); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 821927f8c2..96663f79c8 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -48,11 +48,11 @@ struct RegionState : public StateManager::State { RegionState (std::string why) : StateManager::State (why) {} - jack_nframes_t _start; - jack_nframes_t _length; - jack_nframes_t _position; + nframes_t _start; + nframes_t _length; + nframes_t _position; uint32_t _flags; - jack_nframes_t _sync_position; + nframes_t _sync_position; layer_t _layer; string _name; mutable RegionEditState _first_edit; @@ -105,20 +105,20 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo const DataType& data_type() const { return _type; } - jack_nframes_t position () const { return _position; } - jack_nframes_t start () const { return _start; } - jack_nframes_t length() const { return _length; } - layer_t layer () const { return _layer; } + nframes_t position () const { return _position; } + nframes_t start () const { return _start; } + nframes_t length() const { return _length; } + layer_t layer () const { return _layer; } - jack_nframes_t sync_offset(int& dir) const; - jack_nframes_t sync_position() const; + nframes_t sync_offset(int& dir) const; + nframes_t sync_position() const; - jack_nframes_t adjust_to_sync (jack_nframes_t); + nframes_t adjust_to_sync (nframes_t); /* first_frame() is an alias; last_frame() just hides some math */ - jack_nframes_t first_frame() const { return _position; } - jack_nframes_t last_frame() const { return _position + _length - 1; } + nframes_t first_frame() const { return _position; } + nframes_t last_frame() const { return _position + _length - 1; } Flag flags() const { return _flags; } bool hidden() const { return _flags & Hidden; } @@ -134,12 +134,12 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo void freeze (); void thaw (const string& why); - bool covers (jack_nframes_t frame) const { - return _position <= frame && frame < _position + _length; + bool covers (nframes_t frame) const { + return first_frame() <= frame && frame < last_frame(); } - OverlapType coverage (jack_nframes_t start, jack_nframes_t end) const { - return ARDOUR::coverage (_position, _position + _length - 1, start, end); + OverlapType coverage (nframes_t start, nframes_t end) const { + return ARDOUR::coverage (first_frame(), last_frame(), start, end); } bool equivalent (boost::shared_ptr<const Region>) const; @@ -150,19 +150,19 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo /* EDITING OPERATIONS */ - void set_length (jack_nframes_t, void *src); - void set_start (jack_nframes_t, void *src); - void set_position (jack_nframes_t, void *src); - void set_position_on_top (jack_nframes_t, void *src); - void special_set_position (jack_nframes_t); + void set_length (nframes_t, void *src); + void set_start (nframes_t, void *src); + 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 move_to_natural_position (void *src); - void trim_start (jack_nframes_t new_position, void *src); - void trim_front (jack_nframes_t new_position, void *src); - void trim_end (jack_nframes_t new_position, void *src); - void trim_to (jack_nframes_t position, jack_nframes_t length, void *src); + void trim_start (nframes_t new_position, void *src); + void trim_front (nframes_t new_position, void *src); + void trim_end (nframes_t new_position, void *src); + void trim_to (nframes_t position, nframes_t length, void *src); void set_layer (layer_t l); /* ONLY Playlist can call this */ void raise (); @@ -170,7 +170,7 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo void raise_to_top (); void lower_to_bottom (); - void set_sync_position (jack_nframes_t n); + void set_sync_position (nframes_t n); void clear_sync_position (); void set_hidden (bool yn); void set_muted (bool yn); @@ -207,11 +207,12 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo protected: friend class RegionFactory; - Region (boost::shared_ptr<Source> src, jack_nframes_t start, jack_nframes_t length, + Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length, const string& name, DataType type, layer_t = 0, Flag flags = DefaultFlags); - Region (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, + Region (SourceList& srcs, nframes_t start, nframes_t length, const string& name, DataType type, layer_t = 0, Flag flags = DefaultFlags); - Region (boost::shared_ptr<const Region>, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Flag flags = DefaultFlags); + + Region (boost::shared_ptr<const Region>, nframes_t start, nframes_t length, const string& name, layer_t = 0, Flag flags = DefaultFlags); Region (boost::shared_ptr<const Region>); Region (boost::shared_ptr<Source> src, const XMLNode&); Region (SourceList& srcs, const XMLNode&); @@ -228,7 +229,7 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo void store_state (RegionState&) const; Change restore_and_return_flags (RegionState&); - void trim_to_internal (jack_nframes_t position, jack_nframes_t length, void *src); + void trim_to_internal (nframes_t position, nframes_t length, void *src); bool copied() const { return _flags & Copied; } void maybe_uncopy (); @@ -246,10 +247,10 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo string _name; DataType _type; Flag _flags; - jack_nframes_t _start; - jack_nframes_t _length; - jack_nframes_t _position; - jack_nframes_t _sync_position; + nframes_t _start; + nframes_t _length; + nframes_t _position; + nframes_t _sync_position; layer_t _layer; mutable RegionEditState _first_edit; int _frozen; diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index bd5089f512..04ce8fa3ad 100644 --- a/libs/ardour/ardour/region_factory.h +++ b/libs/ardour/ardour/region_factory.h @@ -22,14 +22,14 @@ class RegionFactory { */ static sigc::signal<void,boost::shared_ptr<Region> > CheckNewRegion; - static boost::shared_ptr<Region> create (boost::shared_ptr<Region>, jack_nframes_t start, - jack_nframes_t length, std::string name, + static boost::shared_ptr<Region> create (boost::shared_ptr<Region>, nframes_t start, + nframes_t length, std::string name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); - static boost::shared_ptr<Region> create (boost::shared_ptr<AudioRegion>, jack_nframes_t start, - jack_nframes_t length, std::string name, + static boost::shared_ptr<Region> create (boost::shared_ptr<AudioRegion>, nframes_t start, + nframes_t length, std::string name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); - static boost::shared_ptr<Region> create (boost::shared_ptr<Source>, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); - static boost::shared_ptr<Region> create (SourceList &, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); + static boost::shared_ptr<Region> create (boost::shared_ptr<Source>, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); + static boost::shared_ptr<Region> create (SourceList &, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); static boost::shared_ptr<Region> create (boost::shared_ptr<Region>); static boost::shared_ptr<Region> create (Session&, XMLNode&, bool); static boost::shared_ptr<Region> create (SourceList &, const XMLNode&); diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 7abc69f059..5c71bb16d3 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -89,14 +89,14 @@ class Route : public IO /* these are the core of the API of a Route. see the protected sections as well */ - virtual int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_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 (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_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 (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_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) {} @@ -174,9 +174,9 @@ class Route : public IO void all_redirects_flip(); void all_redirects_active (bool state); - virtual jack_nframes_t update_total_latency(); - jack_nframes_t signal_latency() const { return _own_latency; } - virtual void set_latency_delay (jack_nframes_t); + virtual nframes_t update_total_latency(); + nframes_t signal_latency() const { return _own_latency; } + virtual void set_latency_delay (nframes_t); sigc::signal<void,void*> solo_changed; sigc::signal<void,void*> solo_safe_changed; @@ -222,7 +222,7 @@ class Route : public IO SoloControl }; - ToggleControllable (Route&, ToggleType); + ToggleControllable (std::string name, Route&, ToggleType); void set_value (float); float get_value (void) const; @@ -238,8 +238,6 @@ class Route : public IO return _mute_control; } - void automation_snapshot (jack_nframes_t now); - void protect_automation (); void set_remote_control_id (uint32_t id); @@ -250,7 +248,7 @@ class Route : public IO friend class Session; void set_solo_mute (bool yn); - void set_block_size (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); bool has_external_redirects() const; void curve_reallocate (); @@ -282,11 +280,11 @@ class Route : public IO gain_t desired_solo_gain; gain_t desired_mute_gain; - jack_nframes_t check_initial_delay (jack_nframes_t, jack_nframes_t&, jack_nframes_t&); + nframes_t check_initial_delay (nframes_t, nframes_t&, nframes_t&); - jack_nframes_t _initial_delay; - jack_nframes_t _roll_delay; - jack_nframes_t _own_latency; + nframes_t _initial_delay; + nframes_t _roll_delay; + nframes_t _own_latency; RedirectList _redirects; Glib::RWLock redirect_lock; IO *_control_outs; @@ -299,23 +297,24 @@ class Route : public IO ToggleControllable _solo_control; ToggleControllable _mute_control; - void passthru (jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter_inputs); + void passthru (nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset, int declick, bool meter_inputs); virtual void process_output_buffers (BufferSet& bufs, - jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick, + nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset, bool with_redirects, int declick, bool meter); protected: virtual XMLNode& state(bool); - void passthru_silence (jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset, int declick, + void passthru_silence (nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset, int declick, bool meter); - void silence (jack_nframes_t nframes, jack_nframes_t offset); + void silence (nframes_t nframes, nframes_t offset); + sigc::connection input_signal_connection; state_id_t _current_state_id; diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 8a7beb8598..12a0cba3ec 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -40,7 +40,8 @@ class Send : public Redirect { Send (const Send&); ~Send (); - void run (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset); + void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); + void activate() {} void deactivate () {} diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 99616f9729..f06c4117a6 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -100,10 +100,8 @@ class AudioRegion; class Region; class Playlist; class VSTPlugin; -class ControlProtocolManager; +class ControlProtocolInfo; -//class MidiDiskstream; -class MidiSource; class MidiTrack; class MidiRegion; class SMFSource; @@ -116,7 +114,7 @@ using std::string; using std::map; using std::set; -class Session : public sigc::trackable, public PBD::StatefulDestructible +class Session : public PBD::StatefulDestructible { private: typedef std::pair<boost::shared_ptr<Route>,bool> RouteBooleanState; @@ -131,17 +129,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible Recording = 2 }; - enum SlaveSource { - None = 0, - MTC, - JACK - }; - - enum AutoConnectOption { - AutoConnectPhysical = 0x1, - AutoConnectMaster = 0x2 - }; - struct Event { enum Type { SetTransportSpeed, @@ -177,14 +164,14 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible Type type; Action action; - jack_nframes_t action_frame; - jack_nframes_t target_frame; + nframes_t action_frame; + nframes_t target_frame; float speed; union { void* ptr; bool yes_or_no; - Session::SlaveSource slave; + SlaveSource slave; Route* route; }; @@ -193,7 +180,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible list<AudioRange> audio_range; list<MusicRange> music_range; - Event(Type t, Action a, jack_nframes_t when, jack_nframes_t where, float spd, bool yn = false) + Event(Type t, Action a, nframes_t when, nframes_t where, float spd, bool yn = false) : type (t), action (a), action_frame (when), @@ -225,7 +212,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible pool.release (ptr); } - static const jack_nframes_t Immediate = 0; + static const nframes_t Immediate = 0; private: static MultiAllocSingleReleasePool pool; @@ -249,7 +236,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible uint32_t master_out_channels, uint32_t n_physical_in, uint32_t n_physical_out, - jack_nframes_t initial_length); + nframes_t initial_length); virtual ~Session (); @@ -259,12 +246,14 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible string path() const { return _path; } string name() const { return _name; } string snap_name() const { return _current_snapshot_name; } + string raid_path () const; void set_snap_name (); void set_dirty (); void set_clean (); bool dirty() const { return _state_of_the_state & Dirty; } + bool deletion_in_progress() const { return _state_of_the_state & Deletion; } sigc::signal<void> DirtyChanged; std::string sound_dir (bool with_path = true) const; @@ -285,7 +274,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible string audio_path_from_name (string, uint32_t nchans, uint32_t chan, bool destructive); string midi_path_from_name (string); - void process (jack_nframes_t nframes); + void process (nframes_t nframes); BufferSet& get_silent_buffers (ChanCount count = ChanCount::ZERO); BufferSet& get_scratch_buffers (ChanCount count = ChanCount::ZERO); @@ -360,22 +349,22 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* Transport mechanism signals */ sigc::signal<void> TransportStateChange; /* generic */ - sigc::signal<void,jack_nframes_t> PositionChanged; /* sent after any non-sequential motion */ + sigc::signal<void,nframes_t> PositionChanged; /* sent after any non-sequential motion */ sigc::signal<void> DurationChanged; sigc::signal<void> HaltOnXrun; sigc::signal<void,RouteList&> RouteAdded; void request_roll (); - void request_bounded_roll (jack_nframes_t start, jack_nframes_t end); + void request_bounded_roll (nframes_t start, nframes_t end); void request_stop (bool abort = false); - void request_locate (jack_nframes_t frame, bool with_roll = false); - void request_auto_loop (bool yn); - jack_nframes_t last_transport_start() const { return _last_roll_location; } + void request_locate (nframes_t frame, bool with_roll = false); + void request_play_loop (bool yn); + nframes_t last_transport_start() const { return _last_roll_location; } void goto_end () { request_locate (end_location->start(), false);} void goto_start () { request_locate (start_location->start(), false); } - void set_session_start (jack_nframes_t start) { start_location->set_start(start); } - void set_session_end (jack_nframes_t end) { end_location->set_start(end); _end_location_is_free = false; } + void set_session_start (nframes_t start) { start_location->set_start(start); } + void set_session_end (nframes_t end) { end_location->set_start(end); _end_location_is_free = false; } void use_rf_shuttle_speed (); void request_transport_speed (float speed); void request_overwrite_buffer (Diskstream*); @@ -390,14 +379,14 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible int remove_region_from_region_list (boost::shared_ptr<Region>); - jack_nframes_t get_maximum_extent () const; - jack_nframes_t current_end_frame() const { return end_location->start(); } - jack_nframes_t current_start_frame() const { return start_location->start(); } - jack_nframes_t frame_rate() const { return _current_frame_rate; } - jack_nframes_t frames_per_hour() const { return _frames_per_hour; } + 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(); } + nframes_t frame_rate() const { return _current_frame_rate; } + nframes_t frames_per_hour() const { return _frames_per_hour; } double frames_per_smpte_frame() const { return _frames_per_smpte_frame; } - jack_nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } + nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } /* Locations */ @@ -410,93 +399,16 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void set_auto_punch_location (Location *); void set_auto_loop_location (Location *); - - enum ControlType { - AutoPlay, - AutoLoop, - AutoReturn, - AutoInput, - PunchIn, - PunchOut, - SendMTC, - MMCControl, - SoloLatch, - SoloingModel, - RecordingPlugins, - CrossFadesActive, - SendMMC, - SlaveType, - Clicking, - EditingMode, - PlayRange, - LayeringModel, - CrossfadingModel, - SeamlessLoop, - MidiFeedback, - MidiControl, - TranzportControl, - Feedback, - SmpteMode, - }; - - sigc::signal<void,ControlType> ControlChanged; - - void set_auto_play (bool yn); - void set_auto_return (bool yn); - void set_auto_input (bool yn); void reset_input_monitor_state (); - void set_input_auto_connect (bool yn); - void set_output_auto_connect (AutoConnectOption); - void set_punch_in (bool yn); - void set_punch_out (bool yn); - void set_send_mtc (bool yn); - void set_send_mmc (bool yn); - void set_mmc_control (bool yn); - void set_midi_feedback (bool yn); - void set_midi_control (bool yn); - void set_do_not_record_plugins (bool yn); - void set_crossfades_active (bool yn); - void set_seamless_loop (bool yn); - - bool get_auto_play () const { return auto_play; } - bool get_auto_input () const { return auto_input; } - bool get_auto_loop () const { return auto_loop; } - bool get_seamless_loop () const { return seamless_loop; } - bool get_punch_in () const { return punch_in; } - bool get_punch_out () const { return punch_out; } - bool get_all_safe () const { return all_safe; } - bool get_auto_return () const { return auto_return; } - bool get_send_mtc () const; - bool get_send_mmc () const; - bool get_mmc_control () const; - bool get_midi_feedback () const; - bool get_midi_control () const; - bool get_do_not_record_plugins () const { return do_not_record_plugins; } - bool get_crossfades_active () const { return crossfades_active; } - - bool get_input_auto_connect () const; - AutoConnectOption get_output_auto_connect () const { return output_auto_connect; } - - enum LayerModel { - LaterHigher, - MoveAddHigher, - AddHigher - }; - - void set_layer_model (LayerModel); - LayerModel get_layer_model () const { return layer_model; } - - void set_xfade_model (CrossfadeModel); - CrossfadeModel get_xfade_model () const { return xfade_model; } - void add_event (jack_nframes_t action_frame, Event::Type type, jack_nframes_t target_frame = 0); - void remove_event (jack_nframes_t frame, Event::Type type); + void add_event (nframes_t action_frame, Event::Type type, nframes_t target_frame = 0); + void remove_event (nframes_t frame, Event::Type type); void clear_events (Event::Type type); - jack_nframes_t get_block_size() const { return current_block_size; } - jack_nframes_t worst_output_latency () const { return _worst_output_latency; } - jack_nframes_t worst_input_latency () const { return _worst_input_latency; } - jack_nframes_t worst_track_latency () const { return _worst_track_latency; } + 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; } int save_state (string snapshot_name, bool pending = false); int restore_state (string snapshot_name); @@ -517,7 +429,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible XMLNode& get_state(); int set_state(const XMLNode& node); // not idempotent XMLNode& get_template(); - + void add_instant_xml (XMLNode&, const std::string& dir); enum StateOfTheState { @@ -572,40 +484,13 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible AudioEngine &engine() { return _engine; }; - /* configuration. there should really be accessors/mutators - for these - */ - - float meter_hold () { return _meter_hold; } - void set_meter_hold (float); - sigc::signal<void> MeterHoldChanged; - - float meter_falloff () { return _meter_falloff; } - void set_meter_falloff (float); - sigc::signal<void> MeterFalloffChanged; - int32_t max_level; int32_t min_level; - string click_emphasis_sound; - string click_sound; - bool click_requested; - jack_nframes_t over_length_short; - jack_nframes_t over_length_long; - bool send_midi_timecode; - bool send_midi_machine_control; - float shuttle_speed_factor; - float shuttle_speed_threshold; - float rf_speed; - float smpte_frames_per_second; - float video_pullup; - bool smpte_drop_frames; - AnyTime preroll; - AnyTime postroll; - + /* Time */ - jack_nframes_t transport_frame () const {return _transport_frame; } - jack_nframes_t audible_frame () const; + nframes_t transport_frame () const {return _transport_frame; } + nframes_t audible_frame () const; enum SmpteFormat { smpte_23976, @@ -633,41 +518,38 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible }; int set_smpte_type (float fps, bool drop_frames); - int set_video_pullup (float pullup); void sync_time_vars(); - void bbt_time (jack_nframes_t when, BBT_Time&); - void smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes ) const; - void sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const; + 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_time (SMPTE::Time &); - void smpte_time (jack_nframes_t when, SMPTE::Time&); - void smpte_time_subframes (jack_nframes_t when, SMPTE::Time&); + void smpte_time (nframes_t when, SMPTE::Time&); + void smpte_time_subframes (nframes_t when, SMPTE::Time&); - void smpte_duration (jack_nframes_t, SMPTE::Time&) const; - void smpte_duration_string (char *, jack_nframes_t) const; + void smpte_duration (nframes_t, SMPTE::Time&) const; + void smpte_duration_string (char *, nframes_t) const; - void set_smpte_offset (jack_nframes_t); - jack_nframes_t smpte_offset () const { return _smpte_offset; } + void set_smpte_offset (nframes_t); + nframes_t smpte_offset () const { return _smpte_offset; } void set_smpte_offset_negative (bool); bool smpte_offset_negative () const { return _smpte_offset_negative; } - jack_nframes_t convert_to_frames_at (jack_nframes_t position, AnyTime&); + nframes_t convert_to_frames_at (nframes_t position, AnyTime&); static sigc::signal<void> StartTimeChanged; static sigc::signal<void> EndTimeChanged; static sigc::signal<void> SMPTEOffsetChanged; - static sigc::signal<void> SMPTETypeChanged; - static sigc::signal<void> PullupChanged; - void request_slave_source (SlaveSource, jack_nframes_t pos = 0); - SlaveSource slave_source() const { return _slave_type; } - bool synced_to_jack() const { return _slave_type == JACK; } + void request_slave_source (SlaveSource); + bool synced_to_jack() const { return Config->get_slave_source() == JACK; } + 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; } - int jack_slave_sync (jack_nframes_t); + int jack_slave_sync (nframes_t); TempoMap& tempo_map() { return *_tempo_map; } @@ -708,8 +590,8 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible bool sample_rate_convert (import_status&, string infile, string& outfile); string build_tmp_convert_name (string file); - Session::SlaveSource post_export_slave; - jack_nframes_t post_export_position; + SlaveSource post_export_slave; + nframes_t post_export_position; int start_audio_export (ARDOUR::AudioExportSpecification&); int stop_audio_export (ARDOUR::AudioExportSpecification&); @@ -797,25 +679,14 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* flattening stuff */ - int write_one_audio_track (AudioTrack&, jack_nframes_t start, jack_nframes_t cnt, bool overwrite, vector<boost::shared_ptr<Source> >&, + int write_one_audio_track (AudioTrack&, nframes_t start, nframes_t cnt, bool overwrite, vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot); int freeze (InterThreadInfo&); /* session-wide solo/mute/rec-enable */ - - enum SoloModel { - InverseMute, - SoloBus - }; bool soloing() const { return currently_soloing; } - SoloModel solo_model() const { return _solo_model; } - void set_solo_model (SoloModel); - - bool solo_latched() const { return _solo_latched; } - void set_solo_latched (bool yn); - void set_all_solo (bool); void set_all_mute (bool); @@ -840,7 +711,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* s/w "RAID" management */ - jack_nframes_t available_capture_duration(); + nframes_t available_capture_duration(); /* I/O Connections */ @@ -853,7 +724,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible sigc::signal<void,Connection *> ConnectionRemoved; /* MIDI */ - + int set_mtc_port (string port_tag); int set_mmc_port (string port_tag); int set_midi_port (string port_tag); @@ -877,10 +748,10 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* Scrubbing */ - void start_scrub (jack_nframes_t where); + void start_scrub (nframes_t where); void stop_scrub (); void set_scrub_speed (float); - jack_nframes_t scrub_buffer_size() const; + nframes_t scrub_buffer_size() const; sigc::signal<void> ScrubReady; /* History (for editors, mixers, UIs etc.) */ @@ -962,19 +833,9 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void mark(); }; - /* edit mode */ - - void set_edit_mode (EditMode); - EditMode get_edit_mode () const { return _edit_mode; } - /* clicking */ boost::shared_ptr<IO> click_io() { return _click_io; } - void set_clicking (bool yn); - bool get_clicking() const; - - void set_click_sound (string path); - void set_click_emphasis_sound (string path); /* tempo FX */ @@ -991,13 +852,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible boost::shared_ptr<AudioRegion> tempoize_region (TimeStretchRequest&); - string raid_path() const; - void set_raid_path(string); - - /* need to call this whenever we change native file formats */ - - void reset_native_file_format(); - /* disk, buffer loads */ uint32_t playback_load (); @@ -1053,10 +907,10 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void* ptr, float opt); - typedef float (*compute_peak_t) (Sample *, jack_nframes_t, float); - typedef void (*apply_gain_to_buffer_t) (Sample *, jack_nframes_t, float); - typedef void (*mix_buffers_with_gain_t) (Sample *, Sample *, jack_nframes_t, float); - typedef void (*mix_buffers_no_gain_t) (Sample *, Sample *, jack_nframes_t); + typedef float (*compute_peak_t) (Sample *, nframes_t, 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 apply_gain_to_buffer_t apply_gain_to_buffer; @@ -1069,10 +923,13 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible PBD::Controllable* controllable_by_id (const PBD::ID&); + void add_controllable (PBD::Controllable*); + void remove_controllable (PBD::Controllable*); + protected: friend class AudioEngine; - void set_block_size (jack_nframes_t nframes); - void set_frame_rate (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); + void set_frame_rate (nframes_t nframes); protected: friend class Diskstream; @@ -1085,7 +942,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void update_latency_compensation (bool, bool); private: - int create (bool& new_session, string* mix_template, jack_nframes_t initial_length); + int create (bool& new_session, string* mix_template, nframes_t initial_length); static const char* _template_suffix; static const char* _statefile_suffix; @@ -1104,35 +961,34 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible maximise cache hits */ - typedef void (Session::*process_function_type)(jack_nframes_t); + typedef void (Session::*process_function_type)(nframes_t); AudioEngine &_engine; mutable gint processing_prohibited; process_function_type process_function; process_function_type last_process_function; bool waiting_for_sync_offset; - jack_nframes_t _base_frame_rate; - jack_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; - jack_nframes_t _transport_frame; + nframes_t _transport_frame; Location* end_location; Location* start_location; Slave *_slave; - SlaveSource _slave_type; volatile float _transport_speed; volatile float _desired_transport_speed; float _last_transport_speed; - jack_nframes_t _last_slave_transport_frame; - jack_nframes_t maximum_output_latency; - jack_nframes_t last_stop_frame; + nframes_t _last_slave_transport_frame; + nframes_t maximum_output_latency; + nframes_t last_stop_frame; BufferSet* _scratch_buffers; BufferSet* _silent_buffers; BufferSet* _send_buffers; - jack_nframes_t current_block_size; - jack_nframes_t _worst_output_latency; - jack_nframes_t _worst_input_latency; - jack_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; @@ -1147,11 +1003,11 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void ensure_buffers (ChanCount howmany); - void process_scrub (jack_nframes_t); - void process_without_events (jack_nframes_t); - void process_with_events (jack_nframes_t); - void process_audition (jack_nframes_t); - int process_export (jack_nframes_t, ARDOUR::AudioExportSpecification*); + void process_scrub (nframes_t); + void process_without_events (nframes_t); + void process_with_events (nframes_t); + void process_audition (nframes_t); + int process_export (nframes_t, ARDOUR::AudioExportSpecification*); /* slave tracking */ @@ -1169,24 +1025,25 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible }; SlaveState slave_state; - jack_nframes_t slave_wait_end; + nframes_t slave_wait_end; void reset_slave_state (); - bool follow_slave (jack_nframes_t, jack_nframes_t); + bool follow_slave (nframes_t, nframes_t); + void set_slave_source (SlaveSource); bool _exporting; int prepare_to_export (ARDOUR::AudioExportSpecification&); void prepare_diskstreams (); - void commit_diskstreams (jack_nframes_t, bool& session_requires_butler); - int process_routes (jack_nframes_t, jack_nframes_t); - int silent_process_routes (jack_nframes_t, jack_nframes_t); + void commit_diskstreams (nframes_t, bool& session_requires_butler); + int process_routes (nframes_t, nframes_t); + int silent_process_routes (nframes_t, nframes_t); bool get_rec_monitors_input () { if (actively_recording()) { return true; } else { - if (auto_input) { + if (Config->get_auto_input()) { return false; } else { return true; @@ -1206,7 +1063,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible } } - bool maybe_stop (jack_nframes_t limit) { + bool maybe_stop (nframes_t limit) { if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) { stop_transport (); return true; @@ -1214,7 +1071,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible return false; } - bool maybe_sync_start (jack_nframes_t&, jack_nframes_t&); + bool maybe_sync_start (nframes_t&, nframes_t&); void check_declick_out (); @@ -1224,26 +1081,12 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible MIDI::Port* _midi_port; string _path; string _name; - bool do_not_record_plugins; - - /* toggles */ - - bool auto_play; - bool punch_in; - bool punch_out; - bool auto_loop; - bool seamless_loop; - bool loop_changing; - jack_nframes_t last_loopend; - bool auto_input; - bool crossfades_active; - bool all_safe; - bool auto_return; - bool monitor_in; - bool send_mtc; - bool send_mmc; - bool mmc_control; - bool midi_control; + bool session_send_mmc; + bool session_send_mtc; + bool session_midi_feedback; + bool play_loop; + bool loop_changing; + nframes_t last_loopend; RingBuffer<Event*> pending_events; @@ -1262,11 +1105,12 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible int load_options (const XMLNode&); XMLNode& get_options () const; int load_state (string snapshot_name); + bool save_config_options_predicate (ConfigVariableBase::Owner owner) const; - jack_nframes_t _last_roll_location; - jack_nframes_t _last_record_location; + nframes_t _last_roll_location; + nframes_t _last_record_location; bool pending_locate_roll; - jack_nframes_t pending_locate_frame; + nframes_t pending_locate_frame; bool pending_locate_flush; bool pending_abort; @@ -1331,7 +1175,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible uint32_t rf_scale; void set_rf_speed (float speed); - void reset_rf_scale (jack_nframes_t frames_moved); + void reset_rf_scale (nframes_t frames_moved); Locations _locations; void locations_changed (); @@ -1366,7 +1210,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void dump_events () const; void queue_event (Event *ev); void merge_event (Event*); - void replace_event (Event::Type, jack_nframes_t action_frame, jack_nframes_t target = 0); + void replace_event (Event::Type, nframes_t action_frame, nframes_t target = 0); bool _replace_event (Event*); bool _remove_event (Event *); void _clear_event_type (Event::Type); @@ -1407,7 +1251,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* MIDI Machine Control */ - void deliver_mmc (MIDI::MachineControl::Command, jack_nframes_t); + void deliver_mmc (MIDI::MachineControl::Command, nframes_t); //void deliver_midi_message (MIDI::Port * port, MIDI::eventType ev, MIDI::channel_t, MIDI::EventTwoBytes); //void deliver_data (MIDI::Port* port, MIDI::byte*, int32_t size); @@ -1443,14 +1287,14 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible MIDI::byte mtc_msg[16]; MIDI::byte mtc_smpte_bits; /* encoding of SMTPE type for MTC */ MIDI::byte midi_msg[16]; - jack_nframes_t outbound_mtc_smpte_frame; + nframes_t outbound_mtc_smpte_frame; SMPTE::Time transmitting_smpte_time; int next_quarter_frame_to_send; double _frames_per_smpte_frame; /* has to be floating point because of drop frame */ - jack_nframes_t _frames_per_hour; - jack_nframes_t _smpte_frames_per_hour; - jack_nframes_t _smpte_offset; + nframes_t _frames_per_hour; + nframes_t _smpte_frames_per_hour; + nframes_t _smpte_offset; bool _smpte_offset_negative; /* cache the most-recently requested time conversions. This helps when we @@ -1464,13 +1308,11 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible int send_full_time_code(jack_nframes_t nframes); int send_midi_time_code_for_cycle(jack_nframes_t nframes); - //void send_mmc_in_another_thread (MIDI::MachineControl::Command, jack_nframes_t frame = 0); - - jack_nframes_t adjust_apparent_position (jack_nframes_t frames); + nframes_t adjust_apparent_position (nframes_t frames); void reset_record_status (); - int no_roll (jack_nframes_t nframes, jack_nframes_t offset); + int no_roll (nframes_t nframes, nframes_t offset); bool non_realtime_work_pending() const { return static_cast<bool>(post_transport_work); } bool process_can_proceed() const { return !(post_transport_work & ProcessCannotProceedMask); } @@ -1489,7 +1331,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible Type type; MIDI::MachineControl::Command mmc_cmd; - jack_nframes_t locate_frame; + nframes_t locate_frame; // for SendMessage type @@ -1521,27 +1363,17 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible mutable gint butler_active; - //PBD::Lock midi_lock; - //pthread_t midi_thread; - //int midi_request_pipe[2]; - - //RingBuffer<MIDIRequest*> midi_requests; - /*int start_midi_thread (); - void terminate_midi_thread (); - void poke_midi_thread (); - static void *_midi_thread_work (void *arg); - void midi_thread_work ();*/ void change_midi_ports (); int use_config_midi_ports (); bool waiting_to_start; - void set_auto_loop (bool yn); + void set_play_loop (bool yn); void overwrite_some_buffers (Diskstream*); void flush_all_redirects (); - void locate (jack_nframes_t, bool with_roll, bool with_flush, bool with_loop=false); - void start_locate (jack_nframes_t, bool with_roll, bool with_flush, bool with_loop=false); - void force_locate (jack_nframes_t frame, bool with_roll = false); + void locate (nframes_t, bool with_roll, bool with_flush, bool with_loop=false); + void start_locate (nframes_t, bool with_roll, bool with_flush, bool with_loop=false); + void force_locate (nframes_t frame, bool with_roll = false); void set_diskstream_speed (Diskstream*, float speed); void set_transport_speed (float speed, bool abort = false); void stop_transport (bool abort = false); @@ -1590,13 +1422,11 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* mixer stuff */ - bool _solo_latched; - SoloModel _solo_model; bool solo_update_disabled; bool currently_soloing; void route_mute_changed (void *src); - void route_solo_changed (void *src, boost::shared_ptr<Route>); + void route_solo_changed (void *src, boost::weak_ptr<Route>); void catch_up_on_solo (); void update_route_solo_state (); void modify_solo_mute (bool, bool); @@ -1608,10 +1438,9 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible typedef map<PBD::ID,boost::shared_ptr<Region> > RegionList; RegionList regions; - void region_renamed (boost::shared_ptr<Region>); - void region_changed (Change, boost::shared_ptr<Region>); void add_region (boost::shared_ptr<Region>); - void remove_region (boost::shared_ptr<Region>); + void region_changed (Change, boost::weak_ptr<Region>); + void remove_region (boost::weak_ptr<Region>); int load_regions (const XMLNode& node); @@ -1676,7 +1505,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* FLATTEN */ - int flatten_one_track (AudioTrack&, jack_nframes_t start, jack_nframes_t cnt); + int flatten_one_track (AudioTrack&, nframes_t start, nframes_t cnt); /* INSERT AND SEND MANAGEMENT */ @@ -1735,8 +1564,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible ConnectionList _connections; int load_connections (const XMLNode&); - int set_slave_source (SlaveSource, jack_nframes_t); - void reverse_diskstream_buffers (); UndoHistory history; @@ -1752,7 +1579,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void set_global_solo (GlobalRouteBooleanState s, void *src); void set_global_record_enable (GlobalRouteBooleanState s, void *src); - void jack_timebase_callback (jack_transport_state_t, jack_nframes_t, jack_position_t*, int); + void jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int); int jack_sync_callback (jack_transport_state_t, jack_position_t*); void record_enable_change_all (bool yn); @@ -1761,12 +1588,12 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* click track */ struct Click { - jack_nframes_t start; - jack_nframes_t duration; - jack_nframes_t offset; + nframes_t start; + nframes_t duration; + nframes_t offset; const Sample *data; - Click (jack_nframes_t s, jack_nframes_t d, const Sample *b) + Click (nframes_t s, nframes_t d, const Sample *b) : start (s), duration (d), data (b) { offset = 0; } void *operator new(size_t ignored) { @@ -1788,25 +1615,22 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible boost::shared_ptr<IO> _click_io; Sample* click_data; Sample* click_emphasis_data; - jack_nframes_t click_length; - jack_nframes_t click_emphasis_length; + nframes_t click_length; + nframes_t click_emphasis_length; mutable Glib::RWLock click_lock; static const Sample default_click[]; - static const jack_nframes_t default_click_length; + static const nframes_t default_click_length; static const Sample default_click_emphasis[]; - static const jack_nframes_t default_click_emphasis_length; + static const nframes_t default_click_emphasis_length; Click *get_click(); void setup_click_sounds (int which); void clear_clicks (); - void click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t offset); + void click (nframes_t start, nframes_t nframes, nframes_t offset); vector<Route*> master_outs; - EditMode _edit_mode; - EditMode pending_edit_mode; - /* range playback */ list<AudioRange> current_audio_range; @@ -1820,12 +1644,9 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible boost::shared_ptr<IO> _master_out; boost::shared_ptr<IO> _control_out; - AutoConnectOption input_auto_connect; - AutoConnectOption output_auto_connect; - gain_t* _gain_automation_buffer; pan_t** _pan_automation_buffer; - void allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howmany, bool force); + void allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, bool force); uint32_t _npan_buffers; /* VST support */ @@ -1852,14 +1673,19 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible LayerModel layer_model; CrossfadeModel xfade_model; - typedef std::list<PBD::Controllable*> Controllables; + typedef std::set<PBD::Controllable*> Controllables; Glib::Mutex controllables_lock; Controllables controllables; - void add_controllable (PBD::Controllable*); - void remove_controllable (PBD::Controllable*); + void reset_native_file_format(); + bool first_file_data_format_reset; + bool first_file_header_format_reset; - void handle_configuration_change (const char*); + void config_changed (const char*); + + void add_control_protocol (const ControlProtocolInfo* const, XMLNode*); + XMLNode& get_control_protocol_state (); + }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 0079c10e0a..d4a7e2f22a 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -42,11 +42,11 @@ class Slave { Slave() { } virtual ~Slave() {} - virtual bool speed_and_position (float&, jack_nframes_t&) = 0; + virtual bool speed_and_position (float&, nframes_t&) = 0; virtual bool locked() const = 0; virtual bool ok() const = 0; virtual bool starting() const { return false; } - virtual jack_nframes_t resolution() const = 0; + virtual nframes_t resolution() const = 0; virtual bool requires_seekahead () const = 0; }; @@ -57,13 +57,13 @@ class MTC_Slave : public Slave, public sigc::trackable { ~MTC_Slave (); void rebind (MIDI::Port&); - bool speed_and_position (float&, jack_nframes_t&); + bool speed_and_position (float&, nframes_t&); bool locked() const; bool ok() const; void handle_locate (const MIDI::byte*); - jack_nframes_t resolution() const; + nframes_t resolution() const; bool requires_seekahead () const { return true; } private: @@ -76,8 +76,8 @@ class MTC_Slave : public Slave, public sigc::trackable { int guard1; //SMPTE_Time mtc; - jack_nframes_t position; - jack_nframes_t timestamp; + nframes_t position; + nframes_t timestamp; int guard2; SafeTime() { @@ -88,12 +88,12 @@ class MTC_Slave : public Slave, public sigc::trackable { }; SafeTime current; - jack_nframes_t mtc_frame; /* current time */ - jack_nframes_t last_inbound_frame; /* when we got it; audio clocked */ + nframes_t mtc_frame; /* current time */ + nframes_t last_inbound_frame; /* when we got it; audio clocked */ float mtc_speed; - jack_nframes_t first_mtc_frame; - jack_nframes_t first_mtc_time; + nframes_t first_mtc_frame; + nframes_t first_mtc_time; static const int32_t accumulator_size = 128; float accumulator[accumulator_size]; @@ -113,7 +113,7 @@ class ADAT_Slave : public Slave ADAT_Slave () {} ~ADAT_Slave () {} - bool speed_and_position (float& speed, jack_nframes_t& pos) { + bool speed_and_position (float& speed, nframes_t& pos) { speed = 0; pos = 0; return false; @@ -121,7 +121,7 @@ class ADAT_Slave : public Slave bool locked() const { return false; } bool ok() const { return false; } - jack_nframes_t resolution() const { return 1; } + nframes_t resolution() const { return 1; } bool requires_seekahead () const { return true; } }; @@ -131,12 +131,12 @@ class JACK_Slave : public Slave JACK_Slave (jack_client_t*); ~JACK_Slave (); - bool speed_and_position (float& speed, jack_nframes_t& pos); + bool speed_and_position (float& speed, nframes_t& pos); bool starting() const { return _starting; } bool locked() const; bool ok() const; - jack_nframes_t resolution() const { return 1; } + nframes_t resolution() const { return 1; } bool requires_seekahead () const { return false; } private: diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index cb6bd2e920..50fd5e6839 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -35,7 +35,7 @@ class SndFileSource : public AudioFileSource { /* constructor to be called for new in-session files */ - SndFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, + SndFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags = AudioFileSource::Flag (AudioFileSource::Writable| AudioFileSource::Removable| AudioFileSource::RemovableIfEmpty| @@ -48,18 +48,18 @@ class SndFileSource : public AudioFileSource { ~SndFileSource (); float sample_rate () const; - int update_header (jack_nframes_t when, struct tm&, time_t); + int update_header (nframes_t when, struct tm&, time_t); int flush_header (); - jack_nframes_t natural_position () const; + nframes_t natural_position () const; protected: void set_header_timeline_position (); - jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const; - jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt); + nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const; + nframes_t write_unlocked (Sample *dst, nframes_t cnt); - jack_nframes_t write_float (Sample* data, jack_nframes_t pos, jack_nframes_t cnt); + nframes_t write_float (Sample* data, nframes_t pos, nframes_t cnt); private: SNDFILE *sf; @@ -67,12 +67,12 @@ class SndFileSource : public AudioFileSource { SF_BROADCAST_INFO *_broadcast_info; mutable float *interleave_buf; - mutable jack_nframes_t interleave_bufsize; + mutable nframes_t interleave_bufsize; void init (const string &str); int open(); void close(); - int setup_broadcast_info (jack_nframes_t when, struct tm&, time_t); + int setup_broadcast_info (nframes_t when, struct tm&, time_t); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 591e7181a1..8bf66f8b8d 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -34,7 +34,7 @@ namespace ARDOUR { class Session; -class Source : public PBD::StatefulDestructible, public sigc::trackable +class Source : public PBD::StatefulDestructible { public: Source (Session&, std::string name, DataType type); diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index 073532c6ab..be1551f518 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -23,7 +23,10 @@ class SourceFactory { // MIDI sources will have to be hacked in here somehow static boost::shared_ptr<Source> createReadable (DataType type, Session&, std::string idstr, AudioFileSource::Flag flags, bool announce = true); - static boost::shared_ptr<Source> createWritable (DataType type, Session&, std::string name, bool destructive, jack_nframes_t rate, bool announce = true); + static boost::shared_ptr<Source> createWritable (DataType type, Session&, std::string name, bool destructive, nframes_t rate, bool announce = true); + + private: + static int setup_peakfile (boost::shared_ptr<Source>); }; } diff --git a/libs/ardour/ardour/state_manager.h b/libs/ardour/ardour/state_manager.h index 99bfcfc3ce..e123b2cb37 100644 --- a/libs/ardour/ardour/state_manager.h +++ b/libs/ardour/ardour/state_manager.h @@ -13,7 +13,7 @@ namespace ARDOUR { typedef uint32_t state_id_t; -class StateManager : public sigc::trackable +class StateManager : public virtual sigc::trackable { public: struct State { diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 0b37579ecb..7cdbe56cf2 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -57,7 +57,7 @@ class Tempo { } double beats_per_minute () const { return _beats_per_minute; } - double frames_per_beat (jack_nframes_t sr) const { + double frames_per_beat (nframes_t sr) const { return ((60.0 * sr) / _beats_per_minute); } @@ -85,7 +85,7 @@ class Meter { double beats_per_bar () const { return _beats_per_bar; } double note_divisor() const { return _note_type; } - double frames_per_bar (const Tempo&, jack_nframes_t sr) const; + double frames_per_bar (const Tempo&, nframes_t sr) const; protected: @@ -112,12 +112,12 @@ class MetricSection { virtual ~MetricSection() {} const BBT_Time& start() const { return _start; } - const jack_nframes_t frame() const { return _frame; } + const nframes_t frame() const { return _frame; } void set_movable (bool yn) { _movable = yn; } bool movable() const { return _movable; } - virtual void set_frame (jack_nframes_t f) { + virtual void set_frame (nframes_t f) { _frame = f; }; @@ -134,7 +134,7 @@ class MetricSection { private: BBT_Time _start; - jack_nframes_t _frame; + nframes_t _frame; bool _movable; }; @@ -176,7 +176,7 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible { public: - TempoMap (jack_nframes_t frame_rate); + TempoMap (nframes_t frame_rate); ~TempoMap(); /* measure-based stuff */ @@ -188,13 +188,13 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible struct BBTPoint { BBTPointType type; - jack_nframes_t frame; + nframes_t frame; const Meter* meter; const Tempo* tempo; uint32_t bar; uint32_t beat; - BBTPoint (const Meter& m, const Tempo& t, jack_nframes_t f, BBTPointType ty, uint32_t b, uint32_t e) + BBTPoint (const Meter& m, const Tempo& t, nframes_t f, BBTPointType ty, uint32_t b, uint32_t e) : type (ty), frame (f), meter (&m), tempo (&t), bar (b), beat (e) {} }; @@ -205,17 +205,17 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible (obj.*method)(*metrics); } - BBTPointList *get_points (jack_nframes_t start, jack_nframes_t end) const; + BBTPointList *get_points (nframes_t start, nframes_t end) const; - void bbt_time (jack_nframes_t when, BBT_Time&) const; - jack_nframes_t frame_time (const BBT_Time&) const; - jack_nframes_t bbt_duration_at (jack_nframes_t, const BBT_Time&, int dir) const; + void bbt_time (nframes_t when, BBT_Time&) const; + nframes_t frame_time (const BBT_Time&) const; + nframes_t bbt_duration_at (nframes_t, const BBT_Time&, int dir) const; static const Tempo& default_tempo() { return _default_tempo; } static const Meter& default_meter() { return _default_meter; } - const Tempo& tempo_at (jack_nframes_t); - const Meter& meter_at (jack_nframes_t); + const Tempo& tempo_at (nframes_t); + const Meter& meter_at (nframes_t); void add_tempo(const Tempo&, BBT_Time where); void add_meter(const Meter&, BBT_Time where); @@ -230,15 +230,15 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible void replace_meter (MeterSection& existing, const Meter& replacement); - jack_nframes_t round_to_bar (jack_nframes_t frame, int dir); + nframes_t round_to_bar (nframes_t frame, int dir); - jack_nframes_t round_to_beat (jack_nframes_t frame, int dir); + nframes_t round_to_beat (nframes_t frame, int dir); - jack_nframes_t round_to_beat_subdivision (jack_nframes_t fr, int sub_num); + nframes_t round_to_beat_subdivision (nframes_t fr, int sub_num); - jack_nframes_t round_to_tick (jack_nframes_t frame, int dir); + nframes_t round_to_tick (nframes_t frame, int dir); - void set_length (jack_nframes_t frames); + void set_length (nframes_t frames); XMLNode& get_state (void); int set_state (const XMLNode&); @@ -259,33 +259,33 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible void set_tempo (const Tempo& t) { _tempo = &t; } void set_meter (const Meter& m) { _meter = &m; } - void set_frame (jack_nframes_t f) { _frame = f; } + void set_frame (nframes_t f) { _frame = f; } void set_start (const BBT_Time& t) { _start = t; } const Meter& meter() const { return *_meter; } const Tempo& tempo() const { return *_tempo; } - jack_nframes_t frame() const { return _frame; } + nframes_t frame() const { return _frame; } const BBT_Time& start() const { return _start; } private: const Meter* _meter; const Tempo* _tempo; - jack_nframes_t _frame; + nframes_t _frame; BBT_Time _start; }; Metric metric_at (BBT_Time bbt) const; - Metric metric_at (jack_nframes_t) const; - void bbt_time_with_metric (jack_nframes_t, BBT_Time&, const Metric&) const; + Metric metric_at (nframes_t) const; + void bbt_time_with_metric (nframes_t, BBT_Time&, const Metric&) const; private: static Tempo _default_tempo; static Meter _default_meter; Metrics *metrics; - jack_nframes_t _frame_rate; - jack_nframes_t last_bbt_when; + nframes_t _frame_rate; + nframes_t last_bbt_when; bool last_bbt_valid; BBT_Time last_bbt; mutable Glib::RWLock lock; @@ -293,19 +293,19 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible void timestamp_metrics (); - jack_nframes_t round_to_type (jack_nframes_t fr, int dir, BBTPointType); + nframes_t round_to_type (nframes_t fr, int dir, BBTPointType); - jack_nframes_t frame_time_unlocked (const BBT_Time&) const; + nframes_t frame_time_unlocked (const BBT_Time&) const; - void bbt_time_unlocked (jack_nframes_t, BBT_Time&) const; + void bbt_time_unlocked (nframes_t, BBT_Time&) const; - jack_nframes_t bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const; + nframes_t bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const; const MeterSection& first_meter() const; const TempoSection& first_tempo() const; - jack_nframes_t count_frames_between (const BBT_Time&, const BBT_Time&) const; - jack_nframes_t count_frames_between_metrics (const Meter&, const Tempo&, const BBT_Time&, const BBT_Time&) const; + nframes_t count_frames_between (const BBT_Time&, const BBT_Time&) const; + nframes_t count_frames_between_metrics (const Meter&, const Tempo&, const BBT_Time&, const BBT_Time&) const; int move_metric_section (MetricSection&, const BBT_Time& to); void do_insert (MetricSection* section); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index a49aa60d31..243d0db46d 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -39,14 +39,14 @@ class Track : public Route int set_name (string str, void *src); - virtual int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input) = 0; + 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) = 0; - virtual int no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input) = 0; + 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) = 0; - virtual int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool can_record, bool rec_monitors_input) = 0; + 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) = 0; void toggle_monitor_input (); @@ -60,8 +60,8 @@ class Track : public Route TrackMode mode() const { return _mode; } void set_mode (TrackMode m); - jack_nframes_t update_total_latency(); - void set_latency_delay (jack_nframes_t); + nframes_t update_total_latency(); + void set_latency_delay (nframes_t); enum FreezeState { NoFreeze, @@ -75,7 +75,7 @@ class Track : public Route virtual void unfreeze () = 0; virtual void bounce (InterThreadInfo&) = 0; - virtual void bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo&) = 0; + virtual void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&) = 0; XMLNode& get_state(); XMLNode& get_template(); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index c0975be922..61e5f35c95 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -52,6 +52,7 @@ namespace ARDOUR { typedef float gain_t; typedef uint32_t layer_t; typedef uint64_t microseconds_t; + typedef uint32_t nframes_t; typedef jack_midi_event_t MidiEvent; typedef unsigned char RawMidi; @@ -70,8 +71,8 @@ namespace ARDOUR { OverlapExternal // overlap extends to (at least) begin+end }; - OverlapType coverage (jack_nframes_t start_a, jack_nframes_t end_a, - jack_nframes_t start_b, jack_nframes_t end_b); + OverlapType coverage (nframes_t start_a, nframes_t end_a, + nframes_t start_b, nframes_t end_b); enum AutomationType { GainAutomation = 0x1, @@ -151,19 +152,21 @@ namespace ARDOUR { BBT_Time bbt; union { - jack_nframes_t frames; + nframes_t frames; double seconds; }; + + AnyTime() { type = Frames; frames = 0; } }; struct AudioRange { - jack_nframes_t start; - jack_nframes_t end; + nframes_t start; + nframes_t end; uint32_t id; - AudioRange (jack_nframes_t s, jack_nframes_t e, uint32_t i) : start (s), end (e) , id (i) {} + AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {} - jack_nframes_t length() { return end - start + 1; } + nframes_t length() { return end - start + 1; } bool operator== (const AudioRange& other) const { return start == other.start && end == other.end && id == other.id; @@ -173,7 +176,7 @@ namespace ARDOUR { return start == other.start && end == other.end; } - OverlapType coverage (jack_nframes_t s, jack_nframes_t e) const { + OverlapType coverage (nframes_t s, nframes_t e) const { return ARDOUR::coverage (start, end, s, e); } }; @@ -195,6 +198,28 @@ namespace ARDOUR { } }; + /* + Slowest = 6.6dB/sec falloff at update rate of 40ms + Slow = 6.8dB/sec falloff at update rate of 40ms + */ + + enum MeterFalloff { + MeterFalloffOff = 0, + MeterFalloffSlowest = 1, + MeterFalloffSlow = 2, + MeterFalloffMedium = 3, + MeterFalloffFast = 4, + MeterFalloffFaster = 5, + MeterFalloffFastest = 6 + }; + + enum MeterHold { + MeterHoldOff = 0, + MeterHoldShort = 40, + MeterHoldMedium = 100, + MeterHoldLong = 200 + }; + enum EditMode { Slide, Splice @@ -216,10 +241,32 @@ namespace ARDOUR { PostFader }; + enum MonitorModel { + HardwareMonitoring, + SoftwareMonitoring, + ExternalMonitoring, + }; + enum CrossfadeModel { FullCrossfade, ShortCrossfade }; + + enum LayerModel { + LaterHigher, + MoveAddHigher, + AddHigher + }; + + enum SoloModel { + InverseMute, + SoloBus + }; + + enum AutoConnectOption { + AutoConnectPhysical = 0x1, + AutoConnectMaster = 0x2 + }; struct InterThreadInfo { volatile bool done; @@ -256,23 +303,50 @@ namespace ARDOUR { LADSPA, VST }; - + + enum SlaveSource { + None = 0, + MTC, + JACK + }; + + enum ShuttleBehaviour { + Sprung, + Wheel + }; + + enum ShuttleUnits { + Percentage, + Semitones + }; + typedef std::vector<boost::shared_ptr<Source> > SourceList; } // namespace ARDOUR std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf); std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf); - -static inline jack_nframes_t -session_frame_to_track_frame (jack_nframes_t session_frame, double speed) +std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf); +std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf); +std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf); +std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf); +std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf); +std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf); +std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf); +std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf); +std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf); + +using ARDOUR::nframes_t; + +static inline nframes_t +session_frame_to_track_frame (nframes_t session_frame, double speed) { - return (jack_nframes_t)( (double)session_frame * speed ); + return (nframes_t)( (double)session_frame * speed ); } -static inline jack_nframes_t -track_frame_to_session_frame (jack_nframes_t track_frame, double speed) +static inline nframes_t +track_frame_to_session_frame (nframes_t track_frame, double speed) { - return (jack_nframes_t)( (double)track_frame / speed ); + return (nframes_t)( (double)track_frame / speed ); } diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 214e74156c..d926f52f82 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -57,7 +57,16 @@ int touch_file(std::string path); std::string region_name_from_path (std::string path); std::string path_expand (std::string); -void compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out); +void compute_equal_power_fades (nframes_t nframes, float* in, float* out); + +const char* slave_source_to_string (ARDOUR::SlaveSource src); +ARDOUR::SlaveSource string_to_slave_source (std::string str); + +const char* edit_mode_to_string (ARDOUR::EditMode); +ARDOUR::EditMode string_to_edit_mode (std::string); + +float meter_falloff_to_float (ARDOUR::MeterFalloff); +float meter_hold_to_float (ARDOUR::MeterHold); #if defined(HAVE_COREAUDIO) || defined(HAVE_AUDIOUNITS) std::string CFStringRefToStdString(CFStringRef stringRef); diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 4fb5b0babb..7b8246868c 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -64,7 +64,7 @@ class VSTPlugin : public ARDOUR::Plugin const char * maker() const; uint32_t parameter_count() const; float default_value (uint32_t port); - jack_nframes_t latency() const; + nframes_t latency() const; void set_parameter (uint32_t port, float val); float get_parameter (uint32_t port) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; @@ -72,8 +72,8 @@ class VSTPlugin : public ARDOUR::Plugin uint32_t nth_parameter (uint32_t port, bool& ok) const; void activate (); void deactivate (); - void set_block_size (jack_nframes_t nframes); - int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset); + void set_block_size (nframes_t nframes); + int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset); void store_state (ARDOUR::PluginState&); void restore_state (ARDOUR::PluginState&); string describe_parameter (uint32_t); |