summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-10-21 19:01:50 +0000
committerDavid Robillard <d@drobilla.net>2006-10-21 19:01:50 +0000
commitfedf3d34f32264ac57c6a222b678dc90f2bb1a88 (patch)
treee816c676d12ccc32b7e666792b9a01ab5b5a0367 /libs/ardour
parent7bd41538d951c3e476655df741adfbebbb990bde (diff)
Merged with trunk R992.
Completely untested other than it compiles, runs, and records somewhat (need to merge again). git-svn-id: svn://localhost/ardour2/branches/midi@999 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/SConscript2
-rw-r--r--libs/ardour/ardour/ardour.h6
-rw-r--r--libs/ardour/ardour/audio_diskstream.h20
-rw-r--r--libs/ardour/ardour/audio_track.h16
-rw-r--r--libs/ardour/ardour/audio_unit.h7
-rw-r--r--libs/ardour/ardour/audioengine.h58
-rw-r--r--libs/ardour/ardour/audiofilesource.h13
-rw-r--r--libs/ardour/ardour/audioplaylist.h6
-rw-r--r--libs/ardour/ardour/audioregion.h43
-rw-r--r--libs/ardour/ardour/audiosource.h36
-rw-r--r--libs/ardour/ardour/auditioner.h6
-rw-r--r--libs/ardour/ardour/configuration.h16
-rw-r--r--libs/ardour/ardour/configuration_variable.h102
-rw-r--r--libs/ardour/ardour/configuration_vars.h176
-rw-r--r--libs/ardour/ardour/control_protocol_manager.h6
-rw-r--r--libs/ardour/ardour/coreaudiosource.h11
-rw-r--r--libs/ardour/ardour/crossfade.h40
-rw-r--r--libs/ardour/ardour/destructive_filesource.h20
-rw-r--r--libs/ardour/ardour/diskstream.h69
-rw-r--r--libs/ardour/ardour/export.h22
-rw-r--r--libs/ardour/ardour/gain.h8
-rw-r--r--libs/ardour/ardour/insert.h25
-rw-r--r--libs/ardour/ardour/io.h64
-rw-r--r--libs/ardour/ardour/ladspa_plugin.h14
-rw-r--r--libs/ardour/ardour/location.h30
-rw-r--r--libs/ardour/ardour/mix.h32
-rw-r--r--libs/ardour/ardour/panner.h34
-rw-r--r--libs/ardour/ardour/peak.h4
-rw-r--r--libs/ardour/ardour/playlist.h48
-rw-r--r--libs/ardour/ardour/plugin.h16
-rw-r--r--libs/ardour/ardour/port.h4
-rw-r--r--libs/ardour/ardour/redirect.h10
-rw-r--r--libs/ardour/ardour/region.h71
-rw-r--r--libs/ardour/ardour/region_factory.h12
-rw-r--r--libs/ardour/ardour/route.h47
-rw-r--r--libs/ardour/ardour/send.h3
-rw-r--r--libs/ardour/ardour/session.h450
-rw-r--r--libs/ardour/ardour/slave.h28
-rw-r--r--libs/ardour/ardour/sndfilesource.h16
-rw-r--r--libs/ardour/ardour/source.h2
-rw-r--r--libs/ardour/ardour/source_factory.h5
-rw-r--r--libs/ardour/ardour/state_manager.h2
-rw-r--r--libs/ardour/ardour/tempo.h64
-rw-r--r--libs/ardour/ardour/track.h18
-rw-r--r--libs/ardour/ardour/types.h106
-rw-r--r--libs/ardour/ardour/utils.h11
-rw-r--r--libs/ardour/ardour/vst_plugin.h6
-rw-r--r--libs/ardour/audio_diskstream.cc140
-rw-r--r--libs/ardour/audio_playlist.cc27
-rw-r--r--libs/ardour/audio_track.cc45
-rw-r--r--libs/ardour/audio_unit.cc6
-rw-r--r--libs/ardour/audioengine.cc65
-rw-r--r--libs/ardour/audiofilesource.cc33
-rw-r--r--libs/ardour/audioregion.cc110
-rw-r--r--libs/ardour/audiosource.cc87
-rw-r--r--libs/ardour/auditioner.cc4
-rw-r--r--libs/ardour/automation_event.cc4
-rw-r--r--libs/ardour/configuration.cc116
-rw-r--r--libs/ardour/control_protocol_manager.cc49
-rw-r--r--libs/ardour/coreaudiosource.cc11
-rw-r--r--libs/ardour/crossfade.cc50
-rw-r--r--libs/ardour/default_click.cc4
-rw-r--r--libs/ardour/destructive_filesource.cc58
-rw-r--r--libs/ardour/diskstream.cc13
-rw-r--r--libs/ardour/gain.cc8
-rw-r--r--libs/ardour/globals.cc35
-rw-r--r--libs/ardour/import.cc2
-rw-r--r--libs/ardour/insert.cc42
-rw-r--r--libs/ardour/io.cc67
-rw-r--r--libs/ardour/jack_slave.cc4
-rw-r--r--libs/ardour/ladspa_plugin.cc17
-rw-r--r--libs/ardour/location.cc20
-rw-r--r--libs/ardour/meter.cc4
-rw-r--r--libs/ardour/midi_diskstream.cc28
-rw-r--r--libs/ardour/midi_region.cc2
-rw-r--r--libs/ardour/midi_track.cc23
-rw-r--r--libs/ardour/mix.cc32
-rw-r--r--libs/ardour/mtc_slave.cc20
-rw-r--r--libs/ardour/panner.cc63
-rw-r--r--libs/ardour/playlist.cc126
-rw-r--r--libs/ardour/playlist_factory.cc2
-rw-r--r--libs/ardour/plugin.cc10
-rw-r--r--libs/ardour/plugin_manager.cc3
-rw-r--r--libs/ardour/redirect.cc4
-rw-r--r--libs/ardour/region.cc86
-rw-r--r--libs/ardour/region_factory.cc12
-rw-r--r--libs/ardour/reverse.cc12
-rw-r--r--libs/ardour/route.cc107
-rw-r--r--libs/ardour/send.cc2
-rw-r--r--libs/ardour/session.cc440
-rw-r--r--libs/ardour/session_click.cc65
-rw-r--r--libs/ardour/session_events.cc30
-rw-r--r--libs/ardour/session_export.cc20
-rw-r--r--libs/ardour/session_midi.cc200
-rw-r--r--libs/ardour/session_process.cc62
-rw-r--r--libs/ardour/session_state.cc900
-rw-r--r--libs/ardour/session_time.cc87
-rw-r--r--libs/ardour/session_timefx.cc12
-rw-r--r--libs/ardour/session_transport.cc167
-rw-r--r--libs/ardour/sndfilesource.cc75
-rw-r--r--libs/ardour/source.cc2
-rw-r--r--libs/ardour/source_factory.cc73
-rw-r--r--libs/ardour/sse_functions.s4
-rw-r--r--libs/ardour/tempo.cc86
-rw-r--r--libs/ardour/track.cc6
-rw-r--r--libs/ardour/utils.cc108
-rw-r--r--libs/ardour/vst_plugin.cc9
107 files changed, 2674 insertions, 3030 deletions
diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript
index 2e5253ec25..58a2bbf825 100644
--- a/libs/ardour/SConscript
+++ b/libs/ardour/SConscript
@@ -294,5 +294,5 @@ env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), li
env.Alias('tarball', env.Distribute (env['DISTTREE'],
[ 'SConscript', 'i18n.h', 'gettext.h', 'sse_functions.s', 'sse_functions_64bit.s' ] +
- ardour_files + vst_files + coreaudio_files + audiounit_files +
+ ardour_files + osc_files + vst_files + coreaudio_files + audiounit_files +
glob.glob('po/*.po') + glob.glob('ardour/*.h')))
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);
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index 9572297ac5..f08d38a9b9 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -250,7 +250,7 @@ AudioDiskstream::non_realtime_input_change ()
/* now refill channel buffers */
if (speed() != 1.0f || speed() != -1.0f) {
- seek ((jack_nframes_t) (_session.transport_frame() * (double) speed()));
+ seek ((nframes_t) (_session.transport_frame() * (double) speed()));
} else {
seek (_session.transport_frame());
}
@@ -376,9 +376,7 @@ AudioDiskstream::setup_destructive_playlist ()
/* a single full-sized region */
- cerr << "setup DS using " << srcs.front()->natural_position () << endl;
-
- boost::shared_ptr<Region> region (RegionFactory::create (srcs, 0, max_frames, _name));
+ boost::shared_ptr<Region> region (RegionFactory::create (srcs, 0, max_frames - srcs.front()->natural_position(), _name));
_playlist->add_region (region, srcs.front()->natural_position());
}
@@ -391,21 +389,19 @@ AudioDiskstream::use_destructive_playlist ()
with the (presumed single, full-extent) region.
*/
- Playlist::RegionList* rl = _playlist->regions_at (0);
+ boost::shared_ptr<Region> rp = _playlist->find_next_region (_session.current_start_frame(), Start, 1);
- if (rl->empty()) {
+ if (!rp) {
reset_write_sources (false, true);
return;
}
- boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (rl->front());
+ boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (rp);
if (region == 0) {
throw failed_constructor();
}
- delete rl;
-
uint32_t n;
ChannelList::iterator chan;
@@ -419,7 +415,7 @@ AudioDiskstream::use_destructive_playlist ()
}
void
-AudioDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record)
+AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record)
{
int possibly_recording;
int rolling;
@@ -469,8 +465,7 @@ AudioDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nfram
if (_alignment_style == ExistingMaterial) {
-
- if (!_session.get_punch_in()) {
+ if (!Config->get_punch_in()) {
/* manual punch in happens at the correct transport frame
because the user hit a button. but to get alignment correct
@@ -499,7 +494,7 @@ AudioDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nfram
} else {
- if (_session.get_punch_in()) {
+ if (Config->get_punch_in()) {
first_recordable_frame += _roll_delay;
} else {
capture_start_frame -= _roll_delay;
@@ -544,13 +539,13 @@ AudioDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nfram
}
int
-AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input)
+AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input)
{
uint32_t n;
ChannelList::iterator c;
int ret = -1;
- jack_nframes_t rec_offset = 0;
- jack_nframes_t rec_nframes = 0;
+ nframes_t rec_offset = 0;
+ nframes_t rec_nframes = 0;
bool nominally_recording;
bool re = record_enabled ();
bool collect_playback = false;
@@ -593,7 +588,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
(*c).current_playback_buffer = 0;
}
- if (nominally_recording || (_session.get_record_enabled() && _session.get_punch_in())) {
+ if (nominally_recording || (_session.get_record_enabled() && Config->get_punch_in())) {
OverlapType ot;
ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
@@ -673,7 +668,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
} else {
- jack_nframes_t total = chan.capture_vector.len[0] + chan.capture_vector.len[1];
+ nframes_t total = chan.capture_vector.len[0] + chan.capture_vector.len[1];
if (rec_nframes > total) {
DiskOverrun ();
@@ -684,7 +679,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
assert(ap);
Sample* buf = ap->get_audio_buffer().data(nframes, offset);
- jack_nframes_t first = chan.capture_vector.len[0];
+ nframes_t first = chan.capture_vector.len[0];
memcpy (chan.capture_wrap_buffer, buf, sizeof (Sample) * first);
memcpy (chan.capture_vector.buf[0], buf, sizeof (Sample) * first);
@@ -747,12 +742,12 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
/* we're doing playback */
- jack_nframes_t necessary_samples;
+ nframes_t necessary_samples;
/* no varispeed playback if we're recording, because the output .... TBD */
if (rec_nframes == 0 && _actual_speed != 1.0f) {
- necessary_samples = (jack_nframes_t) floor ((nframes * fabs (_actual_speed))) + 1;
+ necessary_samples = (nframes_t) floor ((nframes * fabs (_actual_speed))) + 1;
} else {
necessary_samples = nframes;
}
@@ -772,7 +767,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
chan.current_playback_buffer = chan.playback_vector.buf[0];
} else {
- jack_nframes_t total = chan.playback_vector.len[0] + chan.playback_vector.len[1];
+ nframes_t total = chan.playback_vector.len[0] + chan.playback_vector.len[1];
if (necessary_samples > total) {
DiskUnderrun ();
@@ -793,7 +788,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
if (rec_nframes == 0 && _actual_speed != 1.0f && _actual_speed != -1.0f) {
uint64_t phase = last_phase;
- jack_nframes_t i = 0;
+ nframes_t i = 0;
// Linearly interpolate into the alt buffer
// using 40.24 fixp maths (swh)
@@ -806,7 +801,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
i = 0;
phase = last_phase;
- for (jack_nframes_t outsample = 0; outsample < nframes; ++outsample) {
+ for (nframes_t outsample = 0; outsample < nframes; ++outsample) {
i = phase >> 24;
fr = (phase & 0xFFFFFF) / 16777216.0f;
chan.speed_buffer[outsample] =
@@ -845,7 +840,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
}
bool
-AudioDiskstream::commit (jack_nframes_t nframes)
+AudioDiskstream::commit (nframes_t nframes)
{
bool need_butler = false;
@@ -905,7 +900,7 @@ AudioDiskstream::overwrite_existing_buffers ()
overwrite_queued = false;
/* assume all are the same size */
- jack_nframes_t size = channels[0].playback_buf->bufsize();
+ nframes_t size = channels[0].playback_buf->bufsize();
mixdown_buffer = new Sample[size];
gain_buffer = new float[size];
@@ -914,12 +909,12 @@ AudioDiskstream::overwrite_existing_buffers ()
size--;
uint32_t n=0;
- jack_nframes_t start;
+ nframes_t start;
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan, ++n) {
start = overwrite_frame;
- jack_nframes_t cnt = size;
+ nframes_t cnt = size;
/* to fill the buffer without resetting the playback sample, we need to
do it one or two chunks (normally two).
@@ -932,7 +927,7 @@ AudioDiskstream::overwrite_existing_buffers ()
*/
- jack_nframes_t to_read = size - overwrite_offset;
+ nframes_t to_read = size - overwrite_offset;
if (read ((*chan).playback_buf->buffer() + overwrite_offset, mixdown_buffer, gain_buffer, start, to_read, *chan, n, reversed)) {
error << string_compose(_("AudioDiskstream %1: when refilling, cannot read %2 from playlist at frame %3"),
@@ -963,7 +958,7 @@ AudioDiskstream::overwrite_existing_buffers ()
}
int
-AudioDiskstream::seek (jack_nframes_t frame, bool complete_refill)
+AudioDiskstream::seek (nframes_t frame, bool complete_refill)
{
Glib::Mutex::Lock lm (state_lock);
uint32_t n;
@@ -994,7 +989,7 @@ AudioDiskstream::seek (jack_nframes_t frame, bool complete_refill)
}
int
-AudioDiskstream::can_internal_playback_seek (jack_nframes_t distance)
+AudioDiskstream::can_internal_playback_seek (nframes_t distance)
{
ChannelList::iterator chan;
@@ -1007,7 +1002,7 @@ AudioDiskstream::can_internal_playback_seek (jack_nframes_t distance)
}
int
-AudioDiskstream::internal_playback_seek (jack_nframes_t distance)
+AudioDiskstream::internal_playback_seek (nframes_t distance)
{
ChannelList::iterator chan;
@@ -1022,15 +1017,15 @@ AudioDiskstream::internal_playback_seek (jack_nframes_t distance)
}
int
-AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, jack_nframes_t& start, jack_nframes_t cnt,
+AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, nframes_t& start, nframes_t cnt,
ChannelInfo& channel_info, int channel, bool reversed)
{
- jack_nframes_t this_read = 0;
+ nframes_t this_read = 0;
bool reloop = false;
- jack_nframes_t loop_end = 0;
- jack_nframes_t loop_start = 0;
- jack_nframes_t loop_length = 0;
- jack_nframes_t offset = 0;
+ nframes_t loop_end = 0;
+ nframes_t loop_start = 0;
+ nframes_t loop_length = 0;
+ nframes_t offset = 0;
Location *loc = 0;
if (!reversed) {
@@ -1130,14 +1125,14 @@ int
AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer)
{
int32_t ret = 0;
- jack_nframes_t to_read;
+ nframes_t to_read;
RingBufferNPT<Sample>::rw_vector vector;
bool reversed = (_visible_speed * _session.transport_speed()) < 0.0f;
- jack_nframes_t total_space;
- jack_nframes_t zero_fill;
+ nframes_t total_space;
+ nframes_t zero_fill;
uint32_t chan_n;
ChannelList::iterator i;
- jack_nframes_t ts;
+ nframes_t ts;
assert(mixdown_buffer);
assert(gain_buffer);
@@ -1249,14 +1244,14 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer)
}
}
- jack_nframes_t file_frame_tmp = 0;
+ nframes_t file_frame_tmp = 0;
for (chan_n = 0, i = channels.begin(); i != channels.end(); ++i, ++chan_n) {
ChannelInfo& chan (*i);
Sample* buf1;
Sample* buf2;
- jack_nframes_t len1, len2;
+ nframes_t len1, len2;
chan.playback_buf->get_write_vector (&vector);
@@ -1337,7 +1332,7 @@ AudioDiskstream::do_flush (Session::RunContext context, bool force_flush)
int32_t ret = 0;
RingBufferNPT<Sample>::rw_vector vector;
RingBufferNPT<CaptureTransition>::rw_vector transvec;
- jack_nframes_t total;
+ nframes_t total;
_write_data_count = 0;
@@ -1367,7 +1362,7 @@ AudioDiskstream::do_flush (Session::RunContext context, bool force_flush)
ret = 1;
}
- to_write = min (disk_io_chunk_frames, (jack_nframes_t) vector.len[0]);
+ to_write = min (disk_io_chunk_frames, (nframes_t) vector.len[0]);
// check the transition buffer when recording destructive
// important that we get this after the capture buf
@@ -1437,7 +1432,7 @@ AudioDiskstream::do_flush (Session::RunContext context, bool force_flush)
of vector.len[1] to be flushed to disk as well.
*/
- to_write = min ((jack_nframes_t)(disk_io_chunk_frames - to_write), (jack_nframes_t) vector.len[1]);
+ to_write = min ((nframes_t)(disk_io_chunk_frames - to_write), (nframes_t) vector.len[1]);
if ((*chan).write_source->write (vector.buf[1], to_write) != to_write) {
error << string_compose(_("AudioDiskstream %1: cannot write to disk"), _id) << endmsg;
@@ -1462,7 +1457,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
bool more_work = true;
int err = 0;
boost::shared_ptr<AudioRegion> region;
- jack_nframes_t total_capture;
+ nframes_t total_capture;
SourceList srcs;
SourceList::iterator src;
ChannelList::iterator chan;
@@ -1498,29 +1493,21 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
if (abort_capture) {
- ChannelList::iterator chan;
-
- list<boost::shared_ptr<Source> >* deletion_list = new list<boost::shared_ptr<Source> >;
+ if (destructive()) {
+ goto outout;
+ }
- for ( chan = channels.begin(); chan != channels.end(); ++chan) {
+ for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
if ((*chan).write_source) {
(*chan).write_source->mark_for_remove ();
-
- deletion_list->push_back ((*chan).write_source);
-
+ (*chan).write_source->drop_references ();
(*chan).write_source.reset ();
}
/* new source set up in "out" below */
}
-
- if (!deletion_list->empty()) {
- DeleteSources (deletion_list);
- } else {
- delete deletion_list;
- }
goto out;
}
@@ -1620,9 +1607,11 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
mark_write_completed = true;
+ out:
reset_write_sources (mark_write_completed);
- out:
+ outout:
+
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
delete *ci;
}
@@ -1722,10 +1711,10 @@ AudioDiskstream::engage_record_enable ()
g_atomic_int_set (&_record_enabled, 1);
capturing_sources.clear ();
- if (Config->get_use_hardware_monitoring()) {
+ if (Config->get_monitoring_model() == HardwareMonitoring) {
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
if ((*chan).source) {
- (*chan).source->ensure_monitor_input (!(_session.get_auto_input() && rolling));
+ (*chan).source->ensure_monitor_input (!(Config->get_auto_input() && rolling));
}
capturing_sources.push_back ((*chan).write_source);
}
@@ -1742,7 +1731,7 @@ void
AudioDiskstream::disengage_record_enable ()
{
g_atomic_int_set (&_record_enabled, 0);
- if (Config->get_use_hardware_monitoring()) {
+ if (Config->get_monitoring_model() == HardwareMonitoring) {
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
if ((*chan).source) {
(*chan).source->ensure_monitor_input (false);
@@ -1769,11 +1758,11 @@ AudioDiskstream::get_state ()
node->add_property ("playlist", _playlist->name());
- snprintf (buf, sizeof(buf), "%f", _visible_speed);
+ snprintf (buf, sizeof(buf), "%.12g", _visible_speed);
node->add_property ("speed", buf);
node->add_property("name", _name);
- id().print (buf);
+ id().print (buf, sizeof (buf));
node->add_property("id", buf);
if (!capturing_sources.empty() && _session.get_record_enabled()) {
@@ -1791,7 +1780,7 @@ AudioDiskstream::get_state ()
Location* pi;
- if (_session.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
+ if (Config->get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
snprintf (buf, sizeof (buf), "%" PRIu32, pi->start());
} else {
snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame());
@@ -1947,13 +1936,8 @@ AudioDiskstream::use_new_write_source (uint32_t n)
ChannelInfo &chan = channels[n];
if (chan.write_source) {
-
- if (AudioFileSource::is_empty (_session, chan.write_source->path())) {
- chan.write_source->mark_for_remove ();
- chan.write_source.reset ();
- } else {
- chan.write_source.reset ();
- }
+ chan.write_source->set_allow_remove_if_empty (true);
+ chan.write_source.reset ();
}
try {
@@ -2035,7 +2019,7 @@ AudioDiskstream::rename_write_sources ()
}
void
-AudioDiskstream::set_block_size (jack_nframes_t nframes)
+AudioDiskstream::set_block_size (nframes_t nframes)
{
if (_session.get_block_size() > speed_buffer_size) {
speed_buffer_size = _session.get_block_size();
@@ -2057,7 +2041,7 @@ AudioDiskstream::allocate_temporary_buffers ()
*/
double sp = max (fabsf (_actual_speed), 1.2f);
- jack_nframes_t required_wrap_size = (jack_nframes_t) floor (_session.get_block_size() * sp) + 1;
+ nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() * sp) + 1;
if (required_wrap_size > wrap_buffer_size) {
@@ -2167,7 +2151,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node)
boost::shared_ptr<AudioFileSource> fs;
boost::shared_ptr<AudioFileSource> first_fs;
SourceList pending_sources;
- jack_nframes_t position;
+ nframes_t position;
if ((prop = node.property (X_("at"))) == 0) {
return -1;
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index bd09b1e6b3..7c4052d8ac 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -118,7 +118,7 @@ AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, string name, bool hidd
}
}
-AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden)
+AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, nframes_t start, nframes_t cnt, string name, bool hidden)
: Playlist (other, start, cnt, name, hidden)
{
save_state (_("initial state"));
@@ -164,14 +164,14 @@ struct RegionSortByLayer {
}
};
-jack_nframes_t
-AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, jack_nframes_t start,
- jack_nframes_t cnt, unsigned chan_n)
+ARDOUR::nframes_t
+AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t start,
+ nframes_t cnt, unsigned chan_n)
{
- jack_nframes_t ret = cnt;
- jack_nframes_t end;
- jack_nframes_t read_frames;
- jack_nframes_t skip_frames;
+ nframes_t ret = cnt;
+ nframes_t end;
+ nframes_t read_frames;
+ nframes_t skip_frames;
/* optimizing this memset() away involves a lot of conditionals
that may well cause more of a hit due to cache misses
@@ -206,7 +206,6 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, ja
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
if ((*i)->coverage (start, end) != OverlapNone) {
-
relevant_regions[(*i)->layer()].push_back (*i);
relevant_layers.push_back ((*i)->layer());
}
@@ -442,7 +441,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
audio engineering.
*/
- jack_nframes_t xfade_length = min ((jack_nframes_t) 720, top->length());
+ nframes_t xfade_length = min ((nframes_t) 720, top->length());
/* in, out */
xfade = new Crossfade (top, bottom, xfade_length, top->first_frame(), StartOfIn);
@@ -452,7 +451,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
} else {
- xfade = new Crossfade (other, region, _session.get_xfade_model(), _session.get_crossfades_active());
+ xfade = new Crossfade (other, region, Config->get_xfade_model(), Config->get_crossfades_active());
add_crossfade (*xfade);
}
}
@@ -558,7 +557,7 @@ AudioPlaylist::set_state (const XMLNode& node)
_crossfades.push_back (xfade);
xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
- /* no need to notify here */
+ NewCrossfade(xfade);
} else {
delete xfade;
}
@@ -884,12 +883,12 @@ AudioPlaylist::region_changed (Change what_changed, boost::shared_ptr<Region> re
}
void
-AudioPlaylist::crossfades_at (jack_nframes_t frame, Crossfades& clist)
+AudioPlaylist::crossfades_at (nframes_t frame, Crossfades& clist)
{
RegionLock rlock (this);
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
- jack_nframes_t start, end;
+ nframes_t start, end;
start = (*i)->position();
end = start + (*i)->overlap_length(); // not length(), important difference
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 4f7c45235d..a6cbce2c1e 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -246,6 +246,10 @@ AudioTrack::set_state (const XMLNode& node)
sscanf (prop->value().c_str(), "%d", &x);
set_remote_control_id (x);
}
+
+ } else if (child->name() == X_("recenable")) {
+ _rec_enable_control.set_state (*child);
+ _session.add_controllable (&_rec_enable_control);
}
}
@@ -273,7 +277,7 @@ AudioTrack::state(bool full_state)
for (vector<FreezeRecordInsertInfo*>::iterator i = _freeze_record.insert_info.begin(); i != _freeze_record.insert_info.end(); ++i) {
inode = new XMLNode (X_("insert"));
- (*i)->id.print (buf);
+ (*i)->id.print (buf, sizeof (buf));
inode->add_property (X_("id"), buf);
inode->add_child_copy ((*i)->state);
@@ -317,9 +321,11 @@ AudioTrack::state(bool full_state)
diskstream.
*/
- _diskstream->id().print (buf);
+ _diskstream->id().print (buf, sizeof (buf));
root.add_property ("diskstream-id", buf);
+ root.add_child_nocopy (_rec_enable_control.get_state());
+
return root;
}
@@ -399,7 +405,7 @@ AudioTrack::set_state_part_two ()
}
int
-AudioTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset,
+AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool session_state_changing, bool can_record, bool rec_monitors_input)
{
if (n_outputs().get_total() == 0) {
@@ -431,15 +437,15 @@ AudioTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nf
send_silence = true;
} else {
- if (_session.get_auto_input()) {
- if (Config->get_use_sw_monitoring()) {
+ if (Config->get_auto_input()) {
+ if (Config->get_monitoring_model() == SoftwareMonitoring) {
send_silence = false;
} else {
send_silence = true;
}
} else {
if (_diskstream->record_enabled()) {
- if (Config->get_use_sw_monitoring()) {
+ if (Config->get_monitoring_model() == SoftwareMonitoring) {
send_silence = false;
} else {
send_silence = true;
@@ -479,24 +485,15 @@ AudioTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nf
}
int
-AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, int declick,
+AudioTrack::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 dret;
Sample* b;
Sample* tmpb;
- jack_nframes_t transport_frame;
+ nframes_t transport_frame;
boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream();
- {
- Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
- if (lm.locked()) {
- // automation snapshot can also be called from the non-rt context
- // and it uses the redirect list, so we take the lock out here
- automation_snapshot (start_frame);
- }
- }
-
if (n_outputs().get_total() == 0 && _redirects.empty()) {
return 0;
}
@@ -532,7 +529,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram
just_meter_input (start_frame, end_frame, nframes, offset);
}
- if (diskstream->record_enabled() && !can_record && !_session.get_auto_input()) {
+ if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) {
/* not actually recording, but we want to hear the input material anyway,
at least potentially (depending on monitoring options)
@@ -579,7 +576,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram
}
}
- process_output_buffers (bufs, start_frame, end_frame, nframes, offset, (!_session.get_record_enabled() || !_session.get_do_not_record_plugins()), declick, (_meter_point != MeterInput));
+ process_output_buffers (bufs, start_frame, end_frame, nframes, offset, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, (_meter_point != MeterInput));
} else {
/* problem with the diskstream; just be quiet for a bit */
@@ -590,7 +587,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram
}
int
-AudioTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset,
+AudioTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool can_record, bool rec_monitors_input)
{
if (n_outputs().get_total() == 0 && _redirects.empty()) {
@@ -611,7 +608,7 @@ AudioTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jac
}
int
-AudioTrack::export_stuff (BufferSet& buffers, jack_nframes_t start, jack_nframes_t nframes)
+AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes)
{
gain_t gain_automation[nframes];
gain_t gain_buffer[nframes];
@@ -676,7 +673,7 @@ AudioTrack::export_stuff (BufferSet& buffers, jack_nframes_t start, jack_nframes
for (BufferSet::audio_iterator bi = buffers.audio_begin(); bi != buffers.audio_end(); ++bi) {
Sample *b = bi->data(nframes);
- for (jack_nframes_t n = 0; n < nframes; ++n) {
+ for (nframes_t n = 0; n < nframes; ++n) {
b[n] *= gain_automation[n];
}
}
@@ -685,7 +682,7 @@ AudioTrack::export_stuff (BufferSet& buffers, jack_nframes_t start, jack_nframes
for (BufferSet::audio_iterator bi = buffers.audio_begin(); bi != buffers.audio_end(); ++bi) {
Sample *b = bi->data(nframes);
- for (jack_nframes_t n = 0; n < nframes; ++n) {
+ for (nframes_t n = 0; n < nframes; ++n) {
b[n] *= this_gain;
}
}
@@ -720,7 +717,7 @@ AudioTrack::bounce (InterThreadInfo& itt)
void
-AudioTrack::bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo& itt)
+AudioTrack::bounce_range (nframes_t start, nframes_t end, InterThreadInfo& itt)
{
vector<boost::shared_ptr<Source> > srcs;
_session.write_one_audio_track (*this, start, end, false, srcs, itt);
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 57d5505a0f..ac240828b5 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -112,7 +112,7 @@ AUPlugin::default_value (uint32_t port)
return 0;
}
-jack_nframes_t
+nframes_t
AUPlugin::latency () const
{
return unit->Latency ();
@@ -159,13 +159,13 @@ AUPlugin::deactivate ()
}
void
-AUPlugin::set_block_size (jack_nframes_t nframes)
+AUPlugin::set_block_size (nframes_t nframes)
{
}
int
-AUPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset)
+AUPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset)
{
AudioUnitRenderActionFlags flags = 0;
AudioTimeStamp ts;
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index b2a1fb6a0f..70541fce55 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -46,6 +46,8 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
+gint AudioEngine::m_meter_exit;
+
AudioEngine::AudioEngine (string client_name)
: ports (new Ports)
{
@@ -65,7 +67,7 @@ AudioEngine::AudioEngine (string client_name)
_freewheel_thread_registered = false;
m_meter_thread = 0;
- m_meter_exit = false;
+ g_atomic_int_set (&m_meter_exit, 0);
if (connect_to_jack (client_name)) {
throw NoBackendAvailable ();
@@ -81,9 +83,7 @@ AudioEngine::~AudioEngine ()
jack_client_close (_jack);
}
- if(m_meter_thread) {
- g_atomic_int_inc(&m_meter_exit);
- }
+ stop_metering_thread ();
}
void
@@ -102,7 +102,7 @@ AudioEngine::start ()
if (!_running) {
if (session) {
- jack_nframes_t blocksize = jack_get_buffer_size (_jack);
+ nframes_t blocksize = jack_get_buffer_size (_jack);
session->set_block_size (blocksize);
session->set_frame_rate (jack_get_sample_rate (_jack));
@@ -165,7 +165,7 @@ AudioEngine::stop ()
bool
-AudioEngine::get_sync_offset (jack_nframes_t& offset) const
+AudioEngine::get_sync_offset (nframes_t& offset) const
{
#ifdef HAVE_JACK_VIDEO_SUPPORT
@@ -185,14 +185,14 @@ AudioEngine::get_sync_offset (jack_nframes_t& offset) const
}
void
-AudioEngine::_jack_timebase_callback (jack_transport_state_t state, jack_nframes_t nframes,
+AudioEngine::_jack_timebase_callback (jack_transport_state_t state, nframes_t nframes,
jack_position_t* pos, int new_position, void *arg)
{
static_cast<AudioEngine*> (arg)->jack_timebase_callback (state, nframes, pos, new_position);
}
void
-AudioEngine::jack_timebase_callback (jack_transport_state_t state, jack_nframes_t nframes,
+AudioEngine::jack_timebase_callback (jack_transport_state_t state, nframes_t nframes,
jack_position_t* pos, int new_position)
{
if (session && session->synced_to_jack()) {
@@ -231,7 +231,7 @@ AudioEngine::_graph_order_callback (void *arg)
}
int
-AudioEngine::_process_callback (jack_nframes_t nframes, void *arg)
+AudioEngine::_process_callback (nframes_t nframes, void *arg)
{
return static_cast<AudioEngine *> (arg)->process_callback (nframes);
}
@@ -243,11 +243,11 @@ AudioEngine::_freewheel_callback (int onoff, void *arg)
}
int
-AudioEngine::process_callback (jack_nframes_t nframes)
+AudioEngine::process_callback (nframes_t nframes)
{
// CycleTimer ct ("AudioEngine::process");
Glib::Mutex::Lock tm (_process_lock, Glib::TRY_LOCK);
- jack_nframes_t next_processed_frames;
+ nframes_t next_processed_frames;
/* handle wrap around of total frames counter */
@@ -324,13 +324,13 @@ AudioEngine::process_callback (jack_nframes_t nframes)
}
int
-AudioEngine::_sample_rate_callback (jack_nframes_t nframes, void *arg)
+AudioEngine::_sample_rate_callback (nframes_t nframes, void *arg)
{
return static_cast<AudioEngine *> (arg)->jack_sample_rate_callback (nframes);
}
int
-AudioEngine::jack_sample_rate_callback (jack_nframes_t nframes)
+AudioEngine::jack_sample_rate_callback (nframes_t nframes)
{
_frame_rate = nframes;
_usecs_per_cycle = (int) floor ((((double) frames_per_cycle() / nframes)) * 1000000.0);
@@ -350,13 +350,13 @@ AudioEngine::jack_sample_rate_callback (jack_nframes_t nframes)
}
int
-AudioEngine::_bufsize_callback (jack_nframes_t nframes, void *arg)
+AudioEngine::_bufsize_callback (nframes_t nframes, void *arg)
{
return static_cast<AudioEngine *> (arg)->jack_bufsize_callback (nframes);
}
int
-AudioEngine::jack_bufsize_callback (jack_nframes_t nframes)
+AudioEngine::jack_bufsize_callback (nframes_t nframes)
{
_buffer_size = nframes;
_usecs_per_cycle = (int) floor ((((double) nframes / frame_rate())) * 1000000.0);
@@ -376,10 +376,20 @@ AudioEngine::jack_bufsize_callback (jack_nframes_t nframes)
}
void
+AudioEngine::stop_metering_thread ()
+{
+ if (m_meter_thread) {
+ g_atomic_int_set (&m_meter_exit, 1);
+ }
+ m_meter_thread->join ();
+ m_meter_thread = 0;
+}
+
+void
AudioEngine::start_metering_thread ()
{
- if(m_meter_thread == 0) {
- m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread), false);
+ if (m_meter_thread == 0) {
+ m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread), true);
}
}
@@ -387,10 +397,9 @@ void
AudioEngine::meter_thread ()
{
while (g_atomic_int_get(&m_meter_exit) != true) {
- Glib::usleep (10000); /* 1/100th sec interval */
- IO::update_meters ();
+ Glib::usleep (10000); /* 1/100th sec interval */
+ IO::update_meters ();
}
- return;
}
void
@@ -566,6 +575,10 @@ AudioEngine::connect (const string& source, const string& destination)
if (ret == 0) {
pair<string,string> c (s, d);
port_connections.push_back (c);
+ } else if (ret == EEXIST) {
+ error << string_compose(_("AudioEngine: connection already exists: %1 (%2) to %3 (%4)"),
+ source, s, destination, d)
+ << endmsg;
} else {
error << string_compose(_("AudioEngine: cannot connect %1 (%2) to %3 (%4)"),
source, s, destination, d)
@@ -626,7 +639,7 @@ AudioEngine::disconnect (Port& port)
}
-jack_nframes_t
+ARDOUR::nframes_t
AudioEngine::frame_rate ()
{
if (_jack) {
@@ -643,7 +656,7 @@ AudioEngine::frame_rate ()
}
}
-jack_nframes_t
+ARDOUR::nframes_t
AudioEngine::frames_per_cycle ()
{
if (_jack) {
@@ -837,7 +850,7 @@ AudioEngine::get_nth_physical (DataType type, uint32_t n, int flag)
return ret;
}
-jack_nframes_t
+ARDOUR::nframes_t
AudioEngine::get_port_total_latency (const Port& port)
{
if (!_jack) {
@@ -874,7 +887,7 @@ AudioEngine::transport_start ()
}
void
-AudioEngine::transport_locate (jack_nframes_t where)
+AudioEngine::transport_locate (nframes_t where)
{
// cerr << "tell JACK to locate to " << where << endl;
if (_jack) {
@@ -1085,7 +1098,7 @@ AudioEngine::reconnect_to_jack ()
if (session) {
- jack_nframes_t blocksize = jack_get_buffer_size (_jack);
+ nframes_t blocksize = jack_get_buffer_size (_jack);
session->set_block_size (blocksize);
session->set_frame_rate (jack_get_sample_rate (_jack));
}
@@ -1134,7 +1147,7 @@ AudioEngine::reconnect_to_jack ()
}
int
-AudioEngine::request_buffer_size (jack_nframes_t nframes)
+AudioEngine::request_buffer_size (nframes_t nframes)
{
if (_jack) {
int ret = jack_set_buffer_size (_jack, nframes);
diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc
index adfd352d12..0ba2904f57 100644
--- a/libs/ardour/audiofilesource.cc
+++ b/libs/ardour/audiofilesource.cc
@@ -59,8 +59,11 @@ string AudioFileSource::search_path;
sigc::signal<void> AudioFileSource::HeaderPositionOffsetChanged;
uint64_t AudioFileSource::header_position_offset = 0;
+/* XXX turn this into a Config option */
char AudioFileSource::bwf_country_code[3] = "US";
+/* XXX turn this into a Config option */
char AudioFileSource::bwf_organization_code[4] = "LAS";
+/* XXX maybe this too */
char AudioFileSource::bwf_serial_number[13] = "000000000000";
AudioFileSource::AudioFileSource (Session& s, string idstr, Flag flags)
@@ -101,7 +104,6 @@ AudioFileSource::AudioFileSource (Session& s, const XMLNode& node)
AudioFileSource::~AudioFileSource ()
{
if (removable()) {
- cerr << "Removing file " << _path << " because its removable\n";
unlink (_path.c_str());
unlink (peakpath.c_str());
}
@@ -119,8 +121,11 @@ AudioFileSource::init (string pathstr, bool must_exist)
bool is_new = false;
_length = 0;
+ timeline_position = 0;
next_peak_clear_should_notify = false;
-
+ _peaks_built = false;
+ file_is_new = false;
+
if (!find (pathstr, must_exist, is_new)) {
return -1;
}
@@ -285,7 +290,8 @@ AudioFileSource::mark_for_remove ()
if (!writable()) {
return;
}
- _flags = Flag (_flags | RemoveAtDestroy);
+
+ _flags = Flag (_flags | Removable | RemoveAtDestroy);
}
void
@@ -503,7 +509,7 @@ AudioFileSource::set_search_path (string p)
}
void
-AudioFileSource::set_header_position_offset (jack_nframes_t offset)
+AudioFileSource::set_header_position_offset (nframes_t offset)
{
header_position_offset = offset;
HeaderPositionOffsetChanged ();
@@ -519,7 +525,7 @@ AudioFileSource::handle_header_position_change ()
}
void
-AudioFileSource::set_timeline_position (jack_nframes_t pos)
+AudioFileSource::set_timeline_position (nframes_t pos)
{
timeline_position = pos;
}
@@ -527,8 +533,14 @@ AudioFileSource::set_timeline_position (jack_nframes_t pos)
void
AudioFileSource::set_allow_remove_if_empty (bool yn)
{
- if (writable()) {
+ if (!writable()) {
+ return;
+ }
+
+ if (yn) {
_flags = Flag (_flags | RemovableIfEmpty);
+ } else {
+ _flags = Flag (_flags & ~RemovableIfEmpty);
}
}
@@ -576,3 +588,12 @@ AudioFileSource::is_empty (Session& s, string path)
return ret;
}
+int
+AudioFileSource::setup_peakfile ()
+{
+ if (!(_flags & NoPeakFile)) {
+ return initialize_peakfile (file_is_new, _path);
+ } else {
+ return 0;
+ }
+}
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 959177d0cf..d7724f3a39 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -31,6 +31,7 @@
#include <pbd/basename.h>
#include <pbd/xml++.h>
+#include <pbd/stacktrace.h>
#include <ardour/audioregion.h>
#include <ardour/session.h>
@@ -39,6 +40,7 @@
#include <ardour/playlist.h>
#include <ardour/audiofilter.h>
#include <ardour/audiofilesource.h>
+#include <ardour/destructive_filesource.h>
#include "i18n.h"
#include <locale.h>
@@ -65,7 +67,7 @@ AudioRegionState::AudioRegionState (string why)
}
/** Basic AudioRegion constructor (one channel) */
-AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, jack_nframes_t start, jack_nframes_t length)
+AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, nframes_t length)
: Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::AUDIO, 0, Region::Flag(Region::DefaultFlags|Region::External)),
_fade_in (0.0, 2.0, 1.0, false),
_fade_out (0.0, 2.0, 1.0, false),
@@ -87,7 +89,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, jack_nframes_t sta
}
/* Basic AudioRegion constructor (one channel) */
-AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Flag flags)
+AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (src, start, length, name, DataType::AUDIO, layer, flags)
, _fade_in (0.0, 2.0, 1.0, false)
, _fade_out (0.0, 2.0, 1.0, false)
@@ -108,7 +110,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, jack_nframes_t sta
}
/* Basic AudioRegion constructor (many channels) */
-AudioRegion::AudioRegion (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Flag flags)
+AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (srcs, start, length, name, DataType::AUDIO, layer, flags)
, _fade_in (0.0, 2.0, 1.0, false)
, _fade_out (0.0, 2.0, 1.0, false)
@@ -125,7 +127,7 @@ AudioRegion::AudioRegion (SourceList& srcs, jack_nframes_t start, jack_nframes_t
/** Create a new AudioRegion, that is part of an existing one */
-AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, jack_nframes_t offset, jack_nframes_t length, const string& name, layer_t layer, Flag flags)
+AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (other, offset, length, name, layer, flags),
_fade_in (other->_fade_in),
_fade_out (other->_fade_out),
@@ -230,6 +232,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
AudioRegion::~AudioRegion ()
{
+ notify_callbacks ();
GoingAway (); /* EMIT SIGNAL */
}
@@ -335,8 +338,8 @@ AudioRegion::set_envelope_active (bool yn)
}
}
-jack_nframes_t
-AudioRegion::read_peaks (PeakData *buf, jack_nframes_t npeaks, jack_nframes_t offset, jack_nframes_t cnt, uint32_t chan_n, double samples_per_unit) const
+ARDOUR::nframes_t
+AudioRegion::read_peaks (PeakData *buf, nframes_t npeaks, nframes_t offset, nframes_t cnt, uint32_t chan_n, double samples_per_unit) const
{
if (chan_n >= _sources.size()) {
return 0;
@@ -346,7 +349,7 @@ AudioRegion::read_peaks (PeakData *buf, jack_nframes_t npeaks, jack_nframes_t of
return 0;
} else {
if (_scale_amplitude != 1.0) {
- for (jack_nframes_t n = 0; n < npeaks; ++n) {
+ for (nframes_t n = 0; n < npeaks; ++n) {
buf[n].max *= _scale_amplitude;
buf[n].min *= _scale_amplitude;
}
@@ -355,30 +358,30 @@ AudioRegion::read_peaks (PeakData *buf, jack_nframes_t npeaks, jack_nframes_t of
}
}
-jack_nframes_t
-AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, jack_nframes_t position,
- jack_nframes_t cnt,
- uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
+ARDOUR::nframes_t
+AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t position,
+ nframes_t cnt,
+ uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const
{
return _read_at (_sources, buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, read_frames, skip_frames);
}
-jack_nframes_t
-AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, jack_nframes_t position,
- jack_nframes_t cnt, uint32_t chan_n) const
+ARDOUR::nframes_t
+AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t position,
+ nframes_t cnt, uint32_t chan_n) const
{
return _read_at (_master_sources, buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, 0, 0);
}
-jack_nframes_t
+ARDOUR::nframes_t
AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
- jack_nframes_t position, jack_nframes_t cnt,
- uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
+ nframes_t position, nframes_t cnt,
+ uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const
{
- jack_nframes_t internal_offset;
- jack_nframes_t buf_offset;
- jack_nframes_t to_read;
-
+ nframes_t internal_offset;
+ nframes_t buf_offset;
+ nframes_t to_read;
+
/* precondition: caller has verified that we cover the desired section */
if (chan_n >= _sources.size()) {
@@ -397,7 +400,6 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
if (internal_offset >= _length) {
return 0; /* read nothing */
}
-
if ((to_read = min (cnt, _length - internal_offset)) == 0) {
return 0; /* read nothing */
@@ -427,19 +429,19 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
if (_flags & FadeIn) {
- jack_nframes_t fade_in_length = (jack_nframes_t) _fade_in.back()->when;
+ nframes_t fade_in_length = (nframes_t) _fade_in.back()->when;
/* see if this read is within the fade in */
if (internal_offset < fade_in_length) {
- jack_nframes_t limit;
+ nframes_t limit;
limit = min (to_read, fade_in_length - internal_offset);
_fade_in.get_vector (internal_offset, internal_offset+limit, gain_buffer, limit);
- for (jack_nframes_t n = 0; n < limit; ++n) {
+ for (nframes_t n = 0; n < limit; ++n) {
mixdown_buffer[n] *= gain_buffer[n];
}
}
@@ -449,9 +451,6 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
if (_flags & FadeOut) {
-
-
-
/* see if some part of this read is within the fade out */
/* ................. >| REGION
@@ -471,20 +470,20 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
*/
- jack_nframes_t fade_out_length = (jack_nframes_t) _fade_out.back()->when;
- jack_nframes_t fade_interval_start = max(internal_offset, _length-fade_out_length);
- jack_nframes_t fade_interval_end = min(internal_offset + to_read, _length);
+ nframes_t fade_out_length = (nframes_t) _fade_out.back()->when;
+ nframes_t fade_interval_start = max(internal_offset, _length-fade_out_length);
+ nframes_t fade_interval_end = min(internal_offset + to_read, _length);
if (fade_interval_end > fade_interval_start) {
/* (part of the) the fade out is in this buffer */
- jack_nframes_t limit = fade_interval_end - fade_interval_start;
- jack_nframes_t curve_offset = fade_interval_start - (_length-fade_out_length);
- jack_nframes_t fade_offset = fade_interval_start - internal_offset;
+ nframes_t limit = fade_interval_end - fade_interval_start;
+ nframes_t curve_offset = fade_interval_start - (_length-fade_out_length);
+ nframes_t fade_offset = fade_interval_start - internal_offset;
_fade_out.get_vector (curve_offset,curve_offset+limit, gain_buffer, limit);
- for (jack_nframes_t n = 0, m = fade_offset; n < limit; ++n, ++m) {
+ for (nframes_t n = 0, m = fade_offset; n < limit; ++n, ++m) {
mixdown_buffer[m] *= gain_buffer[n];
}
}
@@ -497,11 +496,11 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
_envelope.get_vector (internal_offset, internal_offset + to_read, gain_buffer, to_read);
if (_scale_amplitude != 1.0f) {
- for (jack_nframes_t n = 0; n < to_read; ++n) {
+ for (nframes_t n = 0; n < to_read; ++n) {
mixdown_buffer[n] *= gain_buffer[n] * _scale_amplitude;
}
} else {
- for (jack_nframes_t n = 0; n < to_read; ++n) {
+ for (nframes_t n = 0; n < to_read; ++n) {
mixdown_buffer[n] *= gain_buffer[n];
}
}
@@ -516,7 +515,7 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
buf += buf_offset;
- for (jack_nframes_t n = 0; n < to_read; ++n) {
+ for (nframes_t n = 0; n < to_read; ++n) {
buf[n] += mixdown_buffer[n];
}
}
@@ -540,7 +539,7 @@ AudioRegion::state (bool full)
for (uint32_t n=0; n < _sources.size(); ++n) {
snprintf (buf2, sizeof(buf2), "source-%d", n);
- _sources[n]->id().print (buf);
+ _sources[n]->id().print (buf, sizeof (buf));
node.add_property (buf2, buf);
}
@@ -670,17 +669,17 @@ AudioRegion::set_state (const XMLNode& node)
void
AudioRegion::set_fade_in_shape (FadeShape shape)
{
- set_fade_in (shape, (jack_nframes_t) _fade_in.back()->when);
+ set_fade_in (shape, (nframes_t) _fade_in.back()->when);
}
void
AudioRegion::set_fade_out_shape (FadeShape shape)
{
- set_fade_out (shape, (jack_nframes_t) _fade_out.back()->when);
+ set_fade_out (shape, (nframes_t) _fade_out.back()->when);
}
void
-AudioRegion::set_fade_in (FadeShape shape, jack_nframes_t len)
+AudioRegion::set_fade_in (FadeShape shape, nframes_t len)
{
_fade_in.freeze ();
_fade_in.clear ();
@@ -744,7 +743,7 @@ AudioRegion::set_fade_in (FadeShape shape, jack_nframes_t len)
}
void
-AudioRegion::set_fade_out (FadeShape shape, jack_nframes_t len)
+AudioRegion::set_fade_out (FadeShape shape, nframes_t len)
{
_fade_out.freeze ();
_fade_out.clear ();
@@ -806,7 +805,7 @@ AudioRegion::set_fade_out (FadeShape shape, jack_nframes_t len)
}
void
-AudioRegion::set_fade_in_length (jack_nframes_t len)
+AudioRegion::set_fade_in_length (nframes_t len)
{
bool changed = _fade_in.extend_to (len);
@@ -824,7 +823,7 @@ AudioRegion::set_fade_in_length (jack_nframes_t len)
}
void
-AudioRegion::set_fade_out_length (jack_nframes_t len)
+AudioRegion::set_fade_out_length (nframes_t len)
{
bool changed = _fade_out.extend_to (len);
@@ -977,8 +976,8 @@ AudioRegion::apply (AudioFilter& filter)
int
AudioRegion::exportme (Session& session, AudioExportSpecification& spec)
{
- const jack_nframes_t blocksize = 4096;
- jack_nframes_t to_read;
+ const nframes_t blocksize = 4096;
+ nframes_t to_read;
int status = -1;
spec.channels = _sources.size();
@@ -1013,7 +1012,7 @@ AudioRegion::exportme (Session& session, AudioExportSpecification& spec)
goto out;
}
- for (jack_nframes_t x = 0; x < to_read; ++x) {
+ for (nframes_t x = 0; x < to_read; ++x) {
spec.dataF[chan+(x*spec.channels)] = buf[x];
}
}
@@ -1057,11 +1056,11 @@ AudioRegion::set_scale_amplitude (gain_t g)
void
AudioRegion::normalize_to (float target_dB)
{
- const jack_nframes_t blocksize = 64 * 1024;
+ const nframes_t blocksize = 64 * 1024;
Sample buf[blocksize];
- jack_nframes_t fpos;
- jack_nframes_t fend;
- jack_nframes_t to_read;
+ nframes_t fpos;
+ nframes_t fend;
+ nframes_t to_read;
double maxamp = 0;
gain_t target = dB_to_coefficient (target_dB);
@@ -1183,7 +1182,10 @@ AudioRegion::speed_mismatch (float sr) const
void
AudioRegion::source_offset_changed ()
{
- set_position (source()->natural_position() + start(), this);
+ if (boost::dynamic_pointer_cast<DestructiveFileSource>(_sources.front())) {
+ set_start (source()->natural_position(), this);
+ set_position (source()->natural_position(), this);
+ }
}
boost::shared_ptr<AudioSource>
@@ -1197,7 +1199,7 @@ extern "C" {
int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t cnt, intptr_t data, uint32_t n_chan, double samples_per_unit)
{
- return ((AudioRegion *) arg)->read_peaks ((PeakData *) data, (jack_nframes_t) npeaks, (jack_nframes_t) start, (jack_nframes_t) cnt, n_chan,samples_per_unit);
+ return ((AudioRegion *) arg)->read_peaks ((PeakData *) data, (nframes_t) npeaks, (nframes_t) start, (nframes_t) cnt, n_chan,samples_per_unit);
}
uint32_t region_length_from_c (void *arg)
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index a8fe2a7c73..419fe9240c 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -23,6 +23,7 @@
#include <fcntl.h>
#include <poll.h>
#include <float.h>
+#include <utime.h>
#include <cerrno>
#include <ctime>
#include <cmath>
@@ -43,7 +44,7 @@ using namespace PBD;
pthread_t AudioSource::peak_thread;
bool AudioSource::have_peak_thread = false;
-vector<AudioSource*> AudioSource::pending_peak_sources;
+vector<boost::shared_ptr<AudioSource> > AudioSource::pending_peak_sources;
Glib::Mutex* AudioSource::pending_peak_sources_lock = 0;
int AudioSource::peak_request_pipe[2];
@@ -190,7 +191,7 @@ AudioSource::peak_thread_work (void* arg)
while (!pending_peak_sources.empty()) {
- AudioSource* s = pending_peak_sources.front();
+ boost::shared_ptr<AudioSource> s = pending_peak_sources.front();
pending_peak_sources.erase (pending_peak_sources.begin());
pending_peak_sources_lock->unlock ();
@@ -250,7 +251,7 @@ AudioSource::stop_peak_thread ()
}
void
-AudioSource::queue_for_peaks (AudioSource* source)
+AudioSource::queue_for_peaks (boost::shared_ptr<AudioSource> source)
{
if (have_peak_thread) {
@@ -296,6 +297,23 @@ AudioSource::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) con
return ret;
}
+void
+AudioSource::touch_peakfile ()
+{
+ struct stat statbuf;
+
+ if (stat (peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) {
+ return;
+ }
+
+ struct utimbuf tbuf;
+
+ tbuf.actime = statbuf.st_atime;
+ tbuf.modtime = time ((time_t) 0);
+
+ utime (peakpath.c_str(), &tbuf);
+}
+
int
AudioSource::rename_peakfile (string newpath)
{
@@ -350,7 +368,6 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
error << string_compose(_("AudioSource: cannot stat peakfile \"%1\""), peakpath) << endmsg;
return -1;
}
-
} else {
/* we found it in the peaks dir */
@@ -370,30 +387,30 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
}
}
}
-
+
if (!newfile && !_peaks_built && _build_missing_peakfiles && _build_peakfiles) {
build_peaks_from_scratch ();
}
-
+
return 0;
}
-jack_nframes_t
-AudioSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const
+nframes_t
+AudioSource::read (Sample *dst, nframes_t start, nframes_t cnt) const
{
Glib::Mutex::Lock lm (_lock);
return read_unlocked (dst, start, cnt);
}
-jack_nframes_t
-AudioSource::write (Sample *dst, jack_nframes_t cnt)
+nframes_t
+AudioSource::write (Sample *dst, nframes_t cnt)
{
Glib::Mutex::Lock lm (_lock);
return write_unlocked (dst, cnt);
}
int
-AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t start, jack_nframes_t cnt, double samples_per_visual_peak) const
+AudioSource::read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_visual_peak) const
{
Glib::Mutex::Lock lm (_lock);
double scale;
@@ -402,7 +419,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
PeakData::PeakDatum xmin;
int32_t to_read;
uint32_t nread;
- jack_nframes_t zero_fill = 0;
+ nframes_t zero_fill = 0;
int ret = -1;
PeakData* staging = 0;
Sample* raw_staging = 0;
@@ -428,8 +445,8 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
if (cnt > _length - start) {
// cerr << "too close to end @ " << _length << " given " << start << " + " << cnt << endl;
cnt = _length - start;
- jack_nframes_t old = npeaks;
- npeaks = min ((jack_nframes_t) floor (cnt / samples_per_visual_peak), npeaks);
+ nframes_t old = npeaks;
+ npeaks = min ((nframes_t) floor (cnt / samples_per_visual_peak), npeaks);
zero_fill = old - npeaks;
}
@@ -437,7 +454,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
if (npeaks == cnt) {
- // cerr << "RAW DATA\n";
+ cerr << "RAW DATA\n";
/* no scaling at all, just get the sample data and duplicate it for
both max and min peak values.
@@ -450,7 +467,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
return -1;
}
- for (jack_nframes_t i = 0; i < npeaks; ++i) {
+ for (nframes_t i = 0; i < npeaks; ++i) {
peaks[i].max = raw_staging[i];
peaks[i].min = raw_staging[i];
}
@@ -499,7 +516,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
}
- jack_nframes_t tnp;
+ nframes_t tnp;
if (scale < 1.0) {
@@ -521,11 +538,11 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
/* compute the rounded up frame position */
- jack_nframes_t current_frame = start;
- jack_nframes_t current_stored_peak = (jack_nframes_t) ceil (current_frame / (double) frames_per_peak);
+ nframes_t current_frame = start;
+ nframes_t current_stored_peak = (nframes_t) ceil (current_frame / (double) frames_per_peak);
uint32_t next_visual_peak = (uint32_t) ceil (current_frame / samples_per_visual_peak);
double next_visual_peak_frame = next_visual_peak * samples_per_visual_peak;
- uint32_t stored_peak_before_next_visual_peak = (jack_nframes_t) next_visual_peak_frame / frames_per_peak;
+ uint32_t stored_peak_before_next_visual_peak = (nframes_t) next_visual_peak_frame / frames_per_peak;
uint32_t nvisual_peaks = 0;
uint32_t stored_peaks_read = 0;
uint32_t i = 0;
@@ -546,7 +563,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
if (i == stored_peaks_read) {
uint32_t start_byte = current_stored_peak * sizeof(PeakData);
- tnp = min ((_length/frames_per_peak - current_stored_peak), (jack_nframes_t) expected_peaks);
+ tnp = min ((_length/frames_per_peak - current_stored_peak), (nframes_t) expected_peaks);
to_read = min (chunksize, tnp);
off_t fend = lseek (peakfile, 0, SEEK_END);
@@ -615,14 +632,14 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
data on the fly.
*/
- jack_nframes_t frames_read = 0;
- jack_nframes_t current_frame = start;
- jack_nframes_t i = 0;
- jack_nframes_t nvisual_peaks = 0;
- jack_nframes_t chunksize = (jack_nframes_t) min (cnt, (jack_nframes_t) 4096);
+ nframes_t frames_read = 0;
+ nframes_t current_frame = start;
+ nframes_t i = 0;
+ nframes_t nvisual_peaks = 0;
+ nframes_t chunksize = (nframes_t) min (cnt, (nframes_t) 4096);
raw_staging = new Sample[chunksize];
- jack_nframes_t frame_pos = start;
+ nframes_t frame_pos = start;
double pixel_pos = floor (frame_pos / samples_per_visual_peak);
double next_pixel_pos = ceil (frame_pos / samples_per_visual_peak);
double pixels_per_frame = 1.0 / samples_per_visual_peak;
@@ -635,7 +652,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t
if (i == frames_read) {
to_read = min (chunksize, (_length - current_frame));
-
+
if ((frames_read = read_unlocked (raw_staging, current_frame, to_read)) == 0) {
error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3")
, _name, to_read, current_frame)
@@ -745,15 +762,15 @@ AudioSource::build_peaks ()
}
int
-AudioSource::do_build_peak (jack_nframes_t first_frame, jack_nframes_t cnt)
+AudioSource::do_build_peak (nframes_t first_frame, nframes_t cnt)
{
- jack_nframes_t current_frame;
+ nframes_t current_frame;
Sample buf[frames_per_peak];
Sample xmin, xmax;
uint32_t peaki;
PeakData* peakbuf;
- jack_nframes_t frames_read;
- jack_nframes_t frames_to_read;
+ nframes_t frames_read;
+ nframes_t frames_to_read;
off_t first_peak_byte;
int peakfile = -1;
int ret = -1;
@@ -791,7 +808,7 @@ AudioSource::do_build_peak (jack_nframes_t first_frame, jack_nframes_t cnt)
xmin = buf[0];
xmax = buf[0];
- for (jack_nframes_t n = 1; n < frames_read; ++n) {
+ for (nframes_t n = 1; n < frames_read; ++n) {
xmax = max (xmax, buf[n]);
xmin = min (xmin, buf[n]);
@@ -830,7 +847,7 @@ AudioSource::build_peaks_from_scratch ()
next_peak_clear_should_notify = true;
pending_peak_builds.push_back (new PeakBuildRecord (0, _length));
- queue_for_peaks (this);
+ queue_for_peaks (shared_from_this());
}
bool
@@ -849,7 +866,7 @@ AudioSource::file_changed (string path)
}
}
-jack_nframes_t
+nframes_t
AudioSource::available_peaks (double zoom_factor) const
{
int peakfile;
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc
index 29ae3b4d2b..3887e5ecc7 100644
--- a/libs/ardour/auditioner.cc
+++ b/libs/ardour/auditioner.cc
@@ -150,10 +150,10 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
}
int
-Auditioner::play_audition (jack_nframes_t nframes)
+Auditioner::play_audition (nframes_t nframes)
{
bool need_butler;
- jack_nframes_t this_nframes;
+ nframes_t this_nframes;
int ret;
if (g_atomic_int_get (&_active) == 0) {
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index afdeecbbfe..f286b11607 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -1217,7 +1217,7 @@ AutomationList::store_state (XMLNode& node) const
XMLNode *pointnode = new XMLNode ("point");
- snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*i)->when));
+ snprintf (buf, sizeof (buf), "%" PRIu32, (nframes_t) floor ((*i)->when));
pointnode->add_property ("x", buf);
snprintf (buf, sizeof (buf), "%.12g", (*i)->value);
pointnode->add_property ("y", buf);
@@ -1232,7 +1232,7 @@ AutomationList::load_state (const XMLNode& node)
const XMLNodeList& elist = node.children();
XMLNodeConstIterator i;
XMLProperty* prop;
- jack_nframes_t x;
+ nframes_t x;
double y;
clear ();
diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc
index 84c3e3a834..e84e92fa26 100644
--- a/libs/ardour/configuration.cc
+++ b/libs/ardour/configuration.cc
@@ -56,7 +56,7 @@ Configuration::Configuration ()
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
- user_configuration (false)
+ current_owner (ConfigVariableBase::Default)
{
_control_protocol_state = 0;
}
@@ -65,6 +65,12 @@ Configuration::~Configuration ()
{
}
+void
+Configuration::set_current_owner (ConfigVariableBase::Owner owner)
+{
+ current_owner = owner;
+}
+
int
Configuration::load_state ()
{
@@ -85,15 +91,14 @@ Configuration::load_state ()
return -1;
}
+ current_owner = ConfigVariableBase::System;
+
if (set_state (*tree.root())) {
error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
}
- /* from this point on, all configuration changes are user driven */
-
- user_configuration = true;
/* now load configuration file for user */
@@ -110,6 +115,8 @@ Configuration::load_state ()
return -1;
}
+ current_owner = ConfigVariableBase::Config;
+
if (set_state (*tree.root())) {
error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
@@ -125,15 +132,11 @@ Configuration::save_state()
XMLTree tree;
string rcfile;
- /* Note: this only writes the per-user file, and therefore
- only saves variables marked as user-set or modified
- */
-
rcfile = get_user_ardour_path ();
rcfile += "ardour.rc";
if (rcfile.length()) {
- tree.set_root (&state (true));
+ tree.set_root (&get_state());
if (!tree.write (rcfile.c_str())){
error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg;
return -1;
@@ -143,45 +146,56 @@ Configuration::save_state()
return 0;
}
-XMLNode&
-Configuration::get_state ()
+bool
+Configuration::save_config_options_predicate (ConfigVariableBase::Owner owner)
{
- return state (false);
+ /* only save things that were in the config file to start with */
+ return owner & ConfigVariableBase::Config;
}
XMLNode&
-Configuration::state (bool user_only)
+Configuration::get_state ()
{
- XMLNode* root = new XMLNode("Ardour");
+ XMLNode* root;
LocaleGuard lg (X_("POSIX"));
+ root = new XMLNode("Ardour");
typedef map<string, MidiPortDescriptor*>::const_iterator CI;
for(CI m = midi_ports.begin(); m != midi_ports.end(); ++m){
root->add_child_nocopy(m->second->get_state());
}
-
- XMLNode* node = new XMLNode("Config");
+ root->add_child_nocopy (get_variables (sigc::mem_fun (*this, &Configuration::save_config_options_predicate)));
+
+ if (_extra_xml) {
+ root->add_child_copy (*_extra_xml);
+ }
+
+ root->add_child_nocopy (ControlProtocolManager::instance().get_state());
+ root->add_child_nocopy (Library->get_state());
+
+ return *root;
+}
+
+XMLNode&
+Configuration::get_variables (sigc::slot<bool,ConfigVariableBase::Owner> predicate)
+{
+ XMLNode* node;
+ LocaleGuard lg (X_("POSIX"));
+
+ node = new XMLNode("Config");
+
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
#define CONFIG_VARIABLE(type,var,name,value) \
- if (!user_only || var.is_user()) var.add_to_node (*node);
+ if (predicate (var.owner())) { var.add_to_node (*node); }
#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
- if (!user_only || var.is_user()) var.add_to_node (*node);
+ if (predicate (var.owner())) { var.add_to_node (*node); }
#include "ardour/configuration_vars.h"
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
-
- root->add_child_nocopy (*node);
-
- if (_extra_xml) {
- root->add_child_copy (*_extra_xml);
- }
-
- root->add_child_nocopy (ControlProtocolManager::instance().get_state());
- root->add_child_nocopy (Library->get_state());
-
- return *root;
+
+ return *node;
}
int
@@ -213,18 +227,8 @@ Configuration::set_state (const XMLNode& root)
}
} else if (node->name() == "Config") {
-
-#undef CONFIG_VARIABLE
-#undef CONFIG_VARIABLE_SPECIAL
-#define CONFIG_VARIABLE(type,var,name,value) \
- var.set_from_node (*node); \
- var.set_is_user (user_configuration);
-#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
- var.set_from_node (*node); \
- var.set_is_user (user_configuration);
-#include "ardour/configuration_vars.h"
-#undef CONFIG_VARIABLE
-#undef CONFIG_VARIABLE_SPECIAL
+
+ set_variables (*node, ConfigVariableBase::Config);
} else if (node->name() == "extra") {
_extra_xml = new XMLNode (*node);
@@ -241,6 +245,25 @@ Configuration::set_state (const XMLNode& root)
return 0;
}
+void
+Configuration::set_variables (const XMLNode& node, ConfigVariableBase::Owner owner)
+{
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,name,value) \
+ if (var.set_from_node (node, owner)) { \
+ ParameterChanged (name); \
+ }
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
+ if (var.set_from_node (node, owner)) { \
+ ParameterChanged (name); \
+ }
+#include "ardour/configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+}
+
Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node)
{
const XMLProperty *prop;
@@ -287,3 +310,14 @@ Configuration::MidiPortDescriptor::get_state()
return *root;
}
+void
+Configuration::map_parameters (sigc::slot<void,const char*> theSlot)
+{
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,name,value) theSlot (name);
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name);
+#include "ardour/configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+}
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index 5c02936ba0..1ff6c28ef3 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -50,7 +50,7 @@ ControlProtocolManager::set_session (Session& s)
instantiate (**i);
(*i)->requested = false;
- if ((*i)->state) {
+ if ((*i)->protocol && (*i)->state) {
(*i)->protocol->set_state (*(*i)->state);
}
}
@@ -93,6 +93,10 @@ ControlProtocolManager::instantiate (ControlProtocolInfo& cpi)
Glib::Mutex::Lock lm (protocols_lock);
control_protocols.push_back (cpi.protocol);
+ if (cpi.state) {
+ cpi.protocol->set_state (*cpi.state);
+ }
+
return cpi.protocol;
}
@@ -154,7 +158,7 @@ ControlProtocolManager::discover_control_protocols (string path)
vector<string *> *found;
PathScanner scanner;
- cerr << "looking for control protocols in " << path << endl;
+ info << string_compose (_("looking for control protocols in %1"), path) << endmsg;
found = scanner (path, protocol_filter, 0, false, true);
@@ -185,6 +189,7 @@ ControlProtocolManager::control_protocol_discover (string path)
cpi->protocol = 0;
cpi->requested = false;
cpi->mandatory = descriptor->mandatory;
+ cpi->supports_feedback = descriptor->supports_feedback;
cpi->state = 0;
control_protocol_info.push_back (cpi);
@@ -261,11 +266,20 @@ ControlProtocolManager::set_state (const XMLNode& node)
for (citer = clist.begin(); citer != clist.end(); ++citer) {
if ((*citer)->name() == X_("Protocol")) {
+
prop = (*citer)->property (X_("active"));
+
if (prop && prop->value() == X_("yes")) {
if ((prop = (*citer)->property (X_("name"))) != 0) {
ControlProtocolInfo* cpi = cpi_by_name (prop->value());
if (cpi) {
+
+ if (!(*citer)->children().empty()) {
+ cpi->state = (*citer)->children().front ();
+ } else {
+ cpi->state = 0;
+ }
+
if (_session) {
instantiate (*cpi);
} else {
@@ -294,3 +308,34 @@ ControlProtocolManager::get_state (void)
return *root;
}
+
+void
+ControlProtocolManager::set_protocol_states (const XMLNode& node)
+{
+ XMLNodeList nlist;
+ XMLNodeConstIterator niter;
+ XMLProperty* prop;
+
+ nlist = node.children();
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+
+ XMLNode* child = (*niter);
+
+ if ((prop = child->property ("name")) == 0) {
+ error << _("control protocol XML node has no name property. Ignored.") << endmsg;
+ continue;
+ }
+
+ ControlProtocolInfo* cpi = cpi_by_name (prop->value());
+
+ if (!cpi) {
+ warning << string_compose (_("control protocol \"%1\" is not known. Ignored"), prop->value()) << endmsg;
+ continue;
+ }
+
+ /* copy the node so that ownership is clear */
+
+ cpi->state = new XMLNode (*child);
+ }
+}
diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc
index 049b5aabbe..c8cbb7a40d 100644
--- a/libs/ardour/coreaudiosource.cc
+++ b/libs/ardour/coreaudiosource.cc
@@ -86,10 +86,7 @@ CoreAudioSource::init (const string& idstr)
}
if (_build_peakfiles) {
- if (initialize_peakfile (false, _path)) {
- error << string_compose("CoreAudioSource: initialize peakfile failed (%1)", name()) << endmsg;
- throw failed_constructor ();
- }
+ _need_peakfile = true;
}
}
@@ -105,8 +102,8 @@ CoreAudioSource::~CoreAudioSource ()
cerr << "deletion done" << endl;
}
-jack_nframes_t
-CoreAudioSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const
+nframes_t
+CoreAudioSource::read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const
{
try {
af.Seek (start);
@@ -188,7 +185,7 @@ CoreAudioSource::sample_rate() const
}
int
-CoreAudioSource::update_header (jack_nframes_t when, struct tm&, time_t)
+CoreAudioSource::update_header (nframes_t when, struct tm&, time_t)
{
return 0;
}
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index fcd2158fd8..32a9e2b533 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -35,7 +35,7 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-jack_nframes_t Crossfade::_short_xfade_length = 0;
+nframes_t Crossfade::_short_xfade_length = 0;
Change Crossfade::ActiveChanged = new_change();
/* XXX if and when we ever implement parallel processing of the process()
@@ -46,7 +46,7 @@ Sample* Crossfade::crossfade_buffer_out = 0;
Sample* Crossfade::crossfade_buffer_in = 0;
void
-Crossfade::set_buffer_size (jack_nframes_t sz)
+Crossfade::set_buffer_size (nframes_t sz)
{
if (crossfade_buffer_out) {
delete [] crossfade_buffer_out;
@@ -71,8 +71,8 @@ Crossfade::operator== (const Crossfade& other)
}
Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<AudioRegion> out,
- jack_nframes_t length,
- jack_nframes_t position,
+ nframes_t length,
+ nframes_t position,
AnchorPoint ap)
: _fade_in (0.0, 2.0, 1.0), // linear (gain coefficient) => -inf..+6dB
_fade_out (0.0, 2.0, 1.0) // linear (gain coefficient) => -inf..+6dB
@@ -240,7 +240,7 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
{
boost::shared_ptr<AudioRegion> top;
boost::shared_ptr<AudioRegion> bottom;
- jack_nframes_t short_xfade_length;
+ nframes_t short_xfade_length;
short_xfade_length = _short_xfade_length;
@@ -400,13 +400,13 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
return 0;
}
-jack_nframes_t
+nframes_t
Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
- float *gain_buffer, jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n,
- jack_nframes_t read_frames, jack_nframes_t skip_frames)
+ float *gain_buffer, nframes_t start, nframes_t cnt, uint32_t chan_n,
+ nframes_t read_frames, nframes_t skip_frames)
{
- jack_nframes_t offset;
- jack_nframes_t to_write;
+ nframes_t offset;
+ nframes_t to_write;
if (!_active) {
return 0;
@@ -453,7 +453,7 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
position and length, and so we know precisely how much data they could return.
*/
- for (jack_nframes_t n = 0; n < to_write; ++n) {
+ for (nframes_t n = 0; n < to_write; ++n) {
buf[n] = (crossfade_buffer_out[n] * fov[n]) + (crossfade_buffer_in[n] * fiv[n]);
}
@@ -464,9 +464,9 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
}
OverlapType
-Crossfade::coverage (jack_nframes_t start, jack_nframes_t end) const
+Crossfade::coverage (nframes_t start, nframes_t end) const
{
- jack_nframes_t my_end = _position + _length;
+ nframes_t my_end = _position + _length;
if ((start >= _position) && (end <= my_end)) {
return OverlapInternal;
@@ -534,7 +534,7 @@ Crossfade::refresh ()
bool
Crossfade::update (bool force)
{
- jack_nframes_t newlen;
+ nframes_t newlen;
bool save = false;
if (_follow_overlap) {
@@ -679,9 +679,9 @@ Crossfade::get_state ()
char buf[64];
LocaleGuard lg (X_("POSIX"));
- _out->id().print (buf);
+ _out->id().print (buf, sizeof (buf));
node->add_property ("out", buf);
- _in->id().print (buf);
+ _in->id().print (buf, sizeof (buf));
node->add_property ("in", buf);
node->add_property ("active", (_active ? "yes" : "no"));
node->add_property ("follow-overlap", (_follow_overlap ? "yes" : "no"));
@@ -700,7 +700,7 @@ Crossfade::get_state ()
pnode = new XMLNode ("point");
- snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*ii)->when));
+ snprintf (buf, sizeof (buf), "%" PRIu32, (nframes_t) floor ((*ii)->when));
pnode->add_property ("x", buf);
snprintf (buf, sizeof (buf), "%.12g", (*ii)->value);
pnode->add_property ("y", buf);
@@ -714,7 +714,7 @@ Crossfade::get_state ()
pnode = new XMLNode ("point");
- snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*ii)->when));
+ snprintf (buf, sizeof (buf), "%" PRIu32, (nframes_t) floor ((*ii)->when));
pnode->add_property ("x", buf);
snprintf (buf, sizeof (buf), "%.12g", (*ii)->value);
pnode->add_property ("y", buf);
@@ -796,7 +796,7 @@ Crossfade::set_state (const XMLNode& node)
for (i = children.begin(); i != children.end(); ++i) {
if ((*i)->name() == "point") {
- jack_nframes_t x;
+ nframes_t x;
float y;
prop = (*i)->property ("x");
@@ -817,7 +817,7 @@ Crossfade::set_state (const XMLNode& node)
for (i = children.begin(); i != children.end(); ++i) {
if ((*i)->name() == "point") {
- jack_nframes_t x;
+ nframes_t x;
float y;
XMLProperty* prop;
@@ -856,10 +856,10 @@ Crossfade::set_follow_overlap (bool yn)
}
}
-jack_nframes_t
-Crossfade::set_length (jack_nframes_t len)
+nframes_t
+Crossfade::set_length (nframes_t len)
{
- jack_nframes_t limit;
+ nframes_t limit;
switch (_anchor_point) {
case StartOfIn:
@@ -894,7 +894,7 @@ Crossfade::set_length (jack_nframes_t len)
return len;
}
-jack_nframes_t
+nframes_t
Crossfade::overlap_length () const
{
if (_fixed) {
@@ -904,7 +904,7 @@ Crossfade::overlap_length () const
}
void
-Crossfade::set_short_xfade_length (jack_nframes_t n)
+Crossfade::set_short_xfade_length (nframes_t n)
{
_short_xfade_length = n;
}
diff --git a/libs/ardour/default_click.cc b/libs/ardour/default_click.cc
index d692af83ec..b4067a2051 100644
--- a/libs/ardour/default_click.cc
+++ b/libs/ardour/default_click.cc
@@ -556,7 +556,7 @@ const Sample Session::default_click_emphasis[] = {
0, 0,
};
-const jack_nframes_t Session::default_click_emphasis_length = sizeof (default_click_emphasis) / sizeof (default_click_emphasis[0]);
+const nframes_t Session::default_click_emphasis_length = sizeof (default_click_emphasis) / sizeof (default_click_emphasis[0]);
const Sample Session::default_click[] = {
0, -0.014312744, -0.03338623, 0.019165039, 0.042541504,
@@ -1172,4 +1172,4 @@ const Sample Session::default_click[] = {
0, 0, 0, 0, 0, 0, 0, 0,
};
-const jack_nframes_t Session::default_click_length = sizeof (default_click) / sizeof (default_click[0]);
+const nframes_t Session::default_click_length = sizeof (default_click) / sizeof (default_click[0]);
diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc
index 1e57d88d70..e160ffd608 100644
--- a/libs/ardour/destructive_filesource.cc
+++ b/libs/ardour/destructive_filesource.cc
@@ -66,9 +66,9 @@ using namespace PBD;
gain_t* DestructiveFileSource::out_coefficient = 0;
gain_t* DestructiveFileSource::in_coefficient = 0;
-jack_nframes_t DestructiveFileSource::xfade_frames = 64;
+nframes_t DestructiveFileSource::xfade_frames = 64;
-DestructiveFileSource::DestructiveFileSource (Session& s, string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, Flag flags)
+DestructiveFileSource::DestructiveFileSource (Session& s, string path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags)
: SndFileSource (s, path, samp_format, hdr_format, rate, flags)
{
init ();
@@ -106,13 +106,13 @@ DestructiveFileSource::~DestructiveFileSource()
}
void
-DestructiveFileSource::setup_standard_crossfades (jack_nframes_t rate)
+DestructiveFileSource::setup_standard_crossfades (nframes_t rate)
{
/* This static method is assumed to have been called by the Session
before any DFS's are created.
*/
- xfade_frames = (jack_nframes_t) floor ((Config->get_destructive_xfade_msecs () / 1000.0) * rate);
+ xfade_frames = (nframes_t) floor ((Config->get_destructive_xfade_msecs () / 1000.0) * rate);
if (out_coefficient) {
delete [] out_coefficient;
@@ -129,7 +129,7 @@ DestructiveFileSource::setup_standard_crossfades (jack_nframes_t rate)
}
void
-DestructiveFileSource::mark_capture_start (jack_nframes_t pos)
+DestructiveFileSource::mark_capture_start (nframes_t pos)
{
if (pos < timeline_position) {
_capture_start = false;
@@ -152,15 +152,15 @@ DestructiveFileSource::clear_capture_marks ()
_capture_end = false;
}
-jack_nframes_t
-DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in)
+nframes_t
+DestructiveFileSource::crossfade (Sample* data, nframes_t cnt, int fade_in)
{
- jack_nframes_t xfade = min (xfade_frames, cnt);
- jack_nframes_t nofade = cnt - xfade;
+ nframes_t xfade = min (xfade_frames, cnt);
+ nframes_t nofade = cnt - xfade;
Sample* fade_data = 0;
- jack_nframes_t fade_position = 0; // in frames
+ nframes_t fade_position = 0; // in frames
ssize_t retval;
- jack_nframes_t file_cnt;
+ nframes_t file_cnt;
if (fade_in) {
fade_position = file_pos;
@@ -190,6 +190,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in)
}
if (file_cnt) {
+
if ((retval = read_unlocked (xfade_buf, fade_position, file_cnt)) != (ssize_t) file_cnt) {
if (retval >= 0 && errno == EAGAIN) {
/* XXX - can we really trust that errno is meaningful here? yes POSIX, i'm talking to you.
@@ -203,12 +204,12 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in)
}
if (file_cnt != xfade) {
- jack_nframes_t delta = xfade - file_cnt;
+ nframes_t delta = xfade - file_cnt;
memset (xfade_buf+file_cnt, 0, sizeof (Sample) * delta);
}
if (nofade && !fade_in) {
- if (write_float (data, file_pos - timeline_position, nofade) != nofade) {
+ if (write_float (data, file_pos, nofade) != nofade) {
error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
return 0;
}
@@ -216,7 +217,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in)
if (xfade == xfade_frames) {
- jack_nframes_t n;
+ nframes_t n;
/* use the standard xfade curve */
@@ -247,20 +248,20 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in)
compute_equal_power_fades (xfade, in, out);
- for (jack_nframes_t n = 0; n < xfade; ++n) {
+ for (nframes_t n = 0; n < xfade; ++n) {
xfade_buf[n] = (xfade_buf[n] * out[n]) + (fade_data[n] * in[n]);
}
}
if (xfade) {
- if (write_float (xfade_buf, fade_position - timeline_position, xfade) != xfade) {
+ if (write_float (xfade_buf, fade_position, xfade) != xfade) {
error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
return 0;
}
}
if (fade_in && nofade) {
- if (write_float (data + xfade, file_pos + xfade - timeline_position, nofade) != nofade) {
+ if (write_float (data + xfade, file_pos + xfade, nofade) != nofade) {
error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
return 0;
}
@@ -269,10 +270,10 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in)
return cnt;
}
-jack_nframes_t
-DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt)
+nframes_t
+DestructiveFileSource::write_unlocked (Sample* data, nframes_t cnt)
{
- jack_nframes_t old_file_pos;
+ nframes_t old_file_pos;
if (!writable()) {
return 0;
@@ -291,8 +292,8 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt)
file_pos = capture_start_frame;
// split cnt in half
- jack_nframes_t subcnt = cnt / 2;
- jack_nframes_t ofilepos = file_pos;
+ nframes_t subcnt = cnt / 2;
+ nframes_t ofilepos = file_pos;
// fade in
if (crossfade (data, subcnt, 1) != subcnt) {
@@ -320,8 +321,8 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt)
_capture_end = false;
/* move to the correct location place */
- file_pos = capture_start_frame;
-
+ file_pos = capture_start_frame - timeline_position;
+
if (crossfade (data, cnt, 1) != cnt) {
return 0;
}
@@ -343,7 +344,8 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt)
/* in the middle of recording */
- if (write_float (data, file_pos - timeline_position, cnt) != cnt) {
+
+ if (write_float (data, file_pos, cnt) != cnt) {
return 0;
}
}
@@ -374,13 +376,13 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt)
}
if (_build_peakfiles) {
- queue_for_peaks (this);
+ queue_for_peaks (shared_from_this ());
}
return cnt;
}
-jack_nframes_t
+nframes_t
DestructiveFileSource::last_capture_start_frame () const
{
return capture_start_frame;
@@ -407,7 +409,7 @@ DestructiveFileSource::handle_header_position_change ()
}
void
-DestructiveFileSource::set_timeline_position (jack_nframes_t pos)
+DestructiveFileSource::set_timeline_position (nframes_t pos)
{
//destructive track timeline postion does not change except at instantion or when header_position_offset (session start) changes
}
diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc
index a5c4d769b1..da9c5c3588 100644
--- a/libs/ardour/diskstream.cc
+++ b/libs/ardour/diskstream.cc
@@ -63,9 +63,8 @@ using namespace PBD;
* default from configuration_vars.h). 0 is not a good value for
* allocating buffer sizes..
*/
-jack_nframes_t Diskstream::disk_io_chunk_frames = 1024 * 256;
+ARDOUR::nframes_t Diskstream::disk_io_chunk_frames = 1024 * 256;
-sigc::signal<void,list<boost::shared_ptr<Source> >*> Diskstream::DeleteSources;
sigc::signal<void> Diskstream::DiskOverrun;
sigc::signal<void> Diskstream::DiskUnderrun;
@@ -166,7 +165,7 @@ Diskstream::non_realtime_set_speed ()
if (_seek_required) {
if (speed() != 1.0f || speed() != -1.0f) {
- seek ((jack_nframes_t) (_session.transport_frame() * (double) speed()), true);
+ seek ((nframes_t) (_session.transport_frame() * (double) speed()), true);
}
else {
seek (_session.transport_frame(), true);
@@ -189,7 +188,7 @@ Diskstream::realtime_set_speed (double sp, bool global)
if (new_speed != _actual_speed) {
- jack_nframes_t required_wrap_size = (jack_nframes_t) floor (_session.get_block_size() *
+ nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() *
fabs (new_speed)) + 1;
if (required_wrap_size > wrap_buffer_size) {
@@ -264,7 +263,7 @@ Diskstream::set_loop (Location *location)
return 0;
}
-jack_nframes_t
+ARDOUR::nframes_t
Diskstream::get_capture_start_frame (uint32_t n)
{
Glib::Mutex::Lock lm (capture_info_lock);
@@ -277,7 +276,7 @@ Diskstream::get_capture_start_frame (uint32_t n)
}
}
-jack_nframes_t
+ARDOUR::nframes_t
Diskstream::get_captured_frames (uint32_t n)
{
Glib::Mutex::Lock lm (capture_info_lock);
@@ -291,7 +290,7 @@ Diskstream::get_captured_frames (uint32_t n)
}
void
-Diskstream::set_roll_delay (jack_nframes_t nframes)
+Diskstream::set_roll_delay (ARDOUR::nframes_t nframes)
{
_roll_delay = nframes;
}
diff --git a/libs/ardour/gain.cc b/libs/ardour/gain.cc
index d6fd464208..0b77bea279 100644
--- a/libs/ardour/gain.cc
+++ b/libs/ardour/gain.cc
@@ -42,21 +42,21 @@ Gain::operator= (const Gain& other)
}
void
-Gain::fill_linear_volume_fade_in (Gain& gain, jack_nframes_t frames)
+Gain::fill_linear_volume_fade_in (Gain& gain, nframes_t frames)
{
}
void
-Gain::fill_linear_volume_fade_out (Gain& gain, jack_nframes_t frames)
+Gain::fill_linear_volume_fade_out (Gain& gain, nframes_t frames)
{
}
void
-Gain::fill_linear_fade_in (Gain& gain, jack_nframes_t frames)
+Gain::fill_linear_fade_in (Gain& gain, nframes_t frames)
{
}
void
-Gain::fill_linear_fade_out (Gain& gain, jack_nframes_t frames)
+Gain::fill_linear_fade_out (Gain& gain, nframes_t frames)
{
}
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index cc92529d88..9b5bea9d3a 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -14,8 +14,6 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id$
*/
#include <cstdio> // Needed so that libraptor (included in lrdf) won't complain
@@ -361,6 +359,12 @@ ARDOUR::new_change ()
}
string
+ARDOUR::get_ardour_revision ()
+{
+ return "$Rev$";
+}
+
+string
ARDOUR::get_user_ardour_path ()
{
string path;
@@ -497,8 +501,8 @@ ARDOUR::LocaleGuard::~LocaleGuard ()
}
ARDOUR::OverlapType
-ARDOUR::coverage (jack_nframes_t sa, jack_nframes_t ea,
- jack_nframes_t sb, jack_nframes_t eb)
+ARDOUR::coverage (nframes_t sa, nframes_t ea,
+ nframes_t sb, nframes_t eb)
{
/* OverlapType returned reflects how the second (B)
range overlaps the first (A).
@@ -577,16 +581,23 @@ ARDOUR::coverage (jack_nframes_t sa, jack_nframes_t ea,
/* not sure where to put these */
-std::istream& operator>>(std::istream& o, HeaderFormat& hf) {
+template<class T>
+std::istream& int_to_type (std::istream& o, T& hf) {
int val;
o >> val;
- hf = (HeaderFormat) val;
+ hf = (T) val;
return o;
}
-std::istream& operator>>(std::istream& o, SampleFormat& sf) {
- int val;
- o >> val;
- sf = (SampleFormat) val;
- return o;
-}
+std::istream& operator>>(std::istream& o, HeaderFormat& var) { return int_to_type<HeaderFormat> (o, var); }
+std::istream& operator>>(std::istream& o, SampleFormat& var) { return int_to_type<SampleFormat> (o, var); }
+std::istream& operator>>(std::istream& o, AutoConnectOption& var) { return int_to_type<AutoConnectOption> (o, var); }
+std::istream& operator>>(std::istream& o, MonitorModel& var) { return int_to_type<MonitorModel> (o, var); }
+std::istream& operator>>(std::istream& o, EditMode& var) { return int_to_type<EditMode> (o, var); }
+std::istream& operator>>(std::istream& o, SoloModel& var) { return int_to_type<SoloModel> (o, var); }
+std::istream& operator>>(std::istream& o, LayerModel& var) { return int_to_type<LayerModel> (o, var); }
+std::istream& operator>>(std::istream& o, CrossfadeModel& var) { return int_to_type<CrossfadeModel> (o, var); }
+std::istream& operator>>(std::istream& o, SlaveSource& var) { return int_to_type<SlaveSource> (o, var); }
+std::istream& operator>>(std::istream& o, ShuttleBehaviour& var) { return int_to_type<ShuttleBehaviour> (o, var); }
+std::istream& operator>>(std::istream& o, ShuttleUnits& var) { return int_to_type<ShuttleUnits> (o, var); }
+
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index b10f76424b..f16a6e7d8c 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -65,7 +65,7 @@ Session::import_audiofile (import_status& status)
long n;
string basepath;
string sounds_dir;
- jack_nframes_t so_far;
+ nframes_t so_far;
char buf[PATH_MAX+1];
int ret = -1;
vector<string> new_paths;
diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc
index e72c1d535a..b557017ec7 100644
--- a/libs/ardour/insert.cc
+++ b/libs/ardour/insert.cc
@@ -261,7 +261,7 @@ PluginInsert::parameter_changed (uint32_t which, float val)
}
void
-PluginInsert::set_block_size (jack_nframes_t nframes)
+PluginInsert::set_block_size (nframes_t nframes)
{
for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->set_block_size (nframes);
@@ -285,7 +285,7 @@ PluginInsert::deactivate ()
}
void
-PluginInsert::connect_and_run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset, bool with_auto, jack_nframes_t now)
+PluginInsert::connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now)
{
uint32_t in_index = 0;
uint32_t out_index = 0;
@@ -325,24 +325,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, jack_nframes_t nframes, jack_nfr
}
void
-PluginInsert::automation_snapshot (jack_nframes_t now)
-{
- map<uint32_t,AutomationList*>::iterator li;
-
- for (li = parameter_automation.begin(); li != parameter_automation.end(); ++li) {
-
- AutomationList *alist = ((*li).second);
- if (alist != 0 && alist->automation_write ()) {
-
- float val = _plugins[0]->get_parameter ((*li).first);
- alist->rt_add (now, val);
- last_automation_snapshot = now;
- }
- }
-}
-
-void
-PluginInsert::transport_stopped (jack_nframes_t now)
+PluginInsert::transport_stopped (nframes_t now)
{
map<uint32_t,AutomationList*>::iterator li;
@@ -357,7 +340,7 @@ PluginInsert::transport_stopped (jack_nframes_t now)
}
void
-PluginInsert::silence (jack_nframes_t nframes, jack_nframes_t offset)
+PluginInsert::silence (nframes_t nframes, nframes_t offset)
{
uint32_t in_index = 0;
uint32_t out_index = 0;
@@ -373,7 +356,7 @@ PluginInsert::silence (jack_nframes_t nframes, jack_nframes_t offset)
}
void
-PluginInsert::run (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset)
+PluginInsert::run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
{
if (active()) {
@@ -414,11 +397,11 @@ PluginInsert::set_parameter (uint32_t port, float val)
}
void
-PluginInsert::automation_run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset)
+PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes, nframes_t offset)
{
ControlEvent next_event (0, 0.0f);
- jack_nframes_t now = _session.transport_frame ();
- jack_nframes_t end = now + nframes;
+ nframes_t now = _session.transport_frame ();
+ nframes_t end = now + nframes;
Glib::Mutex::Lock lm (_automation_lock, Glib::TRY_LOCK);
@@ -437,7 +420,7 @@ PluginInsert::automation_run (BufferSet& bufs, jack_nframes_t nframes, jack_nfra
while (nframes) {
- jack_nframes_t cnt = min (((jack_nframes_t) floor (next_event.when) - now), nframes);
+ nframes_t cnt = min (((nframes_t) floor (next_event.when) - now), nframes);
connect_and_run (bufs, cnt, offset, true, now);
@@ -478,7 +461,6 @@ PluginInsert::set_port_automation_state (uint32_t port, AutoState s)
if (s != al.automation_state()) {
al.set_automation_state (s);
- last_automation_snapshot = 0;
_session.set_dirty ();
}
}
@@ -797,7 +779,7 @@ PluginInsert::describe_parameter (uint32_t what)
return _plugins[0]->describe_parameter (what);
}
-jack_nframes_t
+ARDOUR::nframes_t
PluginInsert::latency()
{
return _plugins[0]->latency ();
@@ -911,7 +893,7 @@ PortInsert::~PortInsert ()
}
void
-PortInsert::run (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset)
+PortInsert::run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
{
if (n_outputs().get(_default_type) == 0) {
return;
@@ -978,7 +960,7 @@ PortInsert::set_state(const XMLNode& node)
return 0;
}
-jack_nframes_t
+ARDOUR::nframes_t
PortInsert::latency()
{
/* because we deliver and collect within the same cycle,
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 57a89b2310..af5473368b 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -60,10 +60,8 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-
static float current_automation_version_number = 1.0;
-jack_nframes_t IO::_automation_interval = 0;
const string IO::state_node_name = "IO";
bool IO::connecting_legal = false;
bool IO::ports_legal = false;
@@ -105,7 +103,7 @@ IO::IO (Session& s, string name,
_output_buffers(new BufferSet()),
_name (name),
_default_type(default_type),
- _gain_control (*this),
+ _gain_control (X_("gaincontrol"), *this),
_gain_automation_curve (0.0, 2.0, 1.0),
_input_minimum (ChanCount::ZERO),
_input_maximum (ChanCount::INFINITE),
@@ -138,9 +136,7 @@ IO::IO (Session& s, string name,
deferred_state = 0;
apply_gain_automation = false;
-
- last_automation_snapshot = 0;
-
+
_gain_automation_state = Off;
_gain_automation_style = Absolute;
@@ -177,7 +173,7 @@ IO::~IO ()
}
void
-IO::silence (jack_nframes_t nframes, jack_nframes_t offset)
+IO::silence (nframes_t nframes, nframes_t offset)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
@@ -192,10 +188,9 @@ IO::silence (jack_nframes_t nframes, jack_nframes_t offset)
* to the outputs, eg applying gain or pan or whatever else needs to be done.
*/
void
-IO::deliver_output (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset)
+IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
{
// FIXME: type specific code doesn't actually need to be here, it will go away in time
-
/* ********** AUDIO ********** */
@@ -210,6 +205,7 @@ IO::deliver_output (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t
if (dm.locked()) {
dg = _desired_gain;
}
+
}
Amp::run(bufs, nframes, _gain, dg, _phase_invert);
@@ -248,7 +244,7 @@ IO::deliver_output (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t
}
void
-IO::collect_input (BufferSet& outs, jack_nframes_t nframes, jack_nframes_t offset)
+IO::collect_input (BufferSet& outs, nframes_t nframes, nframes_t offset)
{
assert(outs.available() >= n_inputs());
@@ -268,8 +264,8 @@ IO::collect_input (BufferSet& outs, jack_nframes_t nframes, jack_nframes_t offse
}
void
-IO::just_meter_input (jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t nframes, jack_nframes_t offset)
+IO::just_meter_input (nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, nframes_t offset)
{
BufferSet& bufs = _session.get_scratch_buffers (n_inputs());
@@ -1138,7 +1134,7 @@ IO::state (bool full_state)
Glib::Mutex::Lock lm (io_lock);
node->add_property("name", _name);
- id().print (buf);
+ id().print (buf, sizeof (buf));
node->add_property("id", buf);
str = "";
@@ -1220,6 +1216,7 @@ IO::state (bool full_state)
}
node->add_child_nocopy (_panner->state (full_state));
+ node->add_child_nocopy (_gain_control.get_state ());
snprintf (buf, sizeof(buf), "%2.12f", gain());
node->add_property ("gain", buf);
@@ -1342,9 +1339,15 @@ IO::set_state (const XMLNode& node)
}
for (iter = node.children().begin(); iter != node.children().end(); ++iter) {
+
if ((*iter)->name() == "Panner") {
_panner->set_state (**iter);
}
+
+ if ((*iter)->name() == X_("gaincontrol")) {
+ _gain_control.set_state (**iter);
+ _session.add_controllable (&_gain_control);
+ }
}
if ((prop = node.property ("automation-state")) != 0) {
@@ -1759,7 +1762,7 @@ IO::set_output_maximum (ChanCount n)
}
void
-IO::set_port_latency (jack_nframes_t nframes)
+IO::set_port_latency (nframes_t nframes)
{
Glib::Mutex::Lock lm (io_lock);
@@ -1768,11 +1771,11 @@ IO::set_port_latency (jack_nframes_t nframes)
}
}
-jack_nframes_t
+nframes_t
IO::output_latency () const
{
- jack_nframes_t max_latency;
- jack_nframes_t latency;
+ nframes_t max_latency;
+ nframes_t latency;
max_latency = 0;
@@ -1787,11 +1790,11 @@ IO::output_latency () const
return max_latency;
}
-jack_nframes_t
+nframes_t
IO::input_latency () const
{
- jack_nframes_t max_latency;
- jack_nframes_t latency;
+ nframes_t max_latency;
+ nframes_t latency;
max_latency = 0;
@@ -2087,7 +2090,7 @@ IO::update_meters()
void
IO::meter ()
{
- // FIXME: Remove this function and just connect signal directly to PeakMeter::meter
+ // FIXME: Ugly. Meter should manage the lock, if it's necessary
Glib::Mutex::Lock lm (io_lock); // READER: meter thread.
_meter->meter();
@@ -2114,7 +2117,7 @@ IO::save_automation (const string& path)
/* XXX use apply_to_points to get thread safety */
for (AutomationList::iterator i = _gain_automation_curve.begin(); i != _gain_automation_curve.end(); ++i) {
- out << "g " << (jack_nframes_t) floor ((*i)->when) << ' ' << (*i)->value << endl;
+ out << "g " << (nframes_t) floor ((*i)->when) << ' ' << (*i)->value << endl;
}
_panner->save ();
@@ -2153,7 +2156,7 @@ IO::load_automation (const string& path)
while (in.getline (line, sizeof(line), '\n')) {
char type;
- jack_nframes_t when;
+ nframes_t when;
double value;
if (++linecnt == 1) {
@@ -2223,7 +2226,6 @@ IO::set_gain_automation_state (AutoState state)
if (state != _gain_automation_curve.automation_state()) {
changed = true;
- last_automation_snapshot = 0;
_gain_automation_curve.set_automation_state (state);
if (state != Off) {
@@ -2322,22 +2324,7 @@ IO::end_pan_touch (uint32_t which)
}
void
-IO::automation_snapshot (jack_nframes_t now)
-{
- if (last_automation_snapshot > now || (now - last_automation_snapshot) > _automation_interval) {
-
- if (gain_automation_recording()) {
- _gain_automation_curve.rt_add (now, gain());
- }
-
- _panner->snapshot (now);
-
- last_automation_snapshot = now;
- }
-}
-
-void
-IO::transport_stopped (jack_nframes_t frame)
+IO::transport_stopped (nframes_t frame)
{
_gain_automation_curve.reposition_for_rt_add (frame);
diff --git a/libs/ardour/jack_slave.cc b/libs/ardour/jack_slave.cc
index 352bcaeee5..2e03b2f45d 100644
--- a/libs/ardour/jack_slave.cc
+++ b/libs/ardour/jack_slave.cc
@@ -36,7 +36,7 @@ JACK_Slave::JACK_Slave (jack_client_t* j)
: jack (j)
{
float x;
- jack_nframes_t p;
+ nframes_t p;
/* call this to initialize things */
speed_and_position (x, p);
}
@@ -58,7 +58,7 @@ JACK_Slave::ok() const
}
bool
-JACK_Slave::speed_and_position (float& sp, jack_nframes_t& position)
+JACK_Slave::speed_and_position (float& sp, nframes_t& position)
{
jack_position_t pos;
jack_transport_state_t state;
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 82cc4e6202..c21d09e01b 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -18,6 +18,9 @@
$Id$
*/
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h>
+
#include <vector>
#include <string>
@@ -52,7 +55,7 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-LadspaPlugin::LadspaPlugin (void *mod, AudioEngine& e, Session& session, uint32_t index, jack_nframes_t rate)
+LadspaPlugin::LadspaPlugin (void *mod, AudioEngine& e, Session& session, uint32_t index, nframes_t rate)
: Plugin (e, session)
{
init (mod, index, rate);
@@ -70,7 +73,7 @@ LadspaPlugin::LadspaPlugin (const LadspaPlugin &other)
}
void
-LadspaPlugin::init (void *mod, uint32_t index, jack_nframes_t rate)
+LadspaPlugin::init (void *mod, uint32_t index, nframes_t rate)
{
LADSPA_Descriptor_Function dfunc;
uint32_t i, port_cnt;
@@ -490,11 +493,11 @@ LadspaPlugin::describe_parameter (uint32_t which)
}
}
-jack_nframes_t
+ARDOUR::nframes_t
LadspaPlugin::latency () const
{
if (latency_control_port) {
- return (jack_nframes_t) floor (*latency_control_port);
+ return (nframes_t) floor (*latency_control_port);
} else {
return 0;
}
@@ -517,7 +520,7 @@ LadspaPlugin::automatable () const
}
int
-LadspaPlugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& out_index, jack_nframes_t nframes, jack_nframes_t offset)
+LadspaPlugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& out_index, nframes_t nframes, nframes_t offset)
{
uint32_t port_index = 0;
cycles_t then, now;
@@ -591,7 +594,7 @@ LadspaPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const
}
void
-LadspaPlugin::run (jack_nframes_t nframes)
+LadspaPlugin::run (nframes_t nframes)
{
for (uint32_t i = 0; i < parameter_count(); ++i) {
if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && LADSPA_IS_PORT_CONTROL(port_descriptor (i))) {
@@ -617,7 +620,7 @@ LadspaPlugin::latency_compute_run ()
uint32_t port_index = 0;
uint32_t in_index = 0;
uint32_t out_index = 0;
- const jack_nframes_t bufsize = 1024;
+ const nframes_t bufsize = 1024;
LADSPA_Data buffer[bufsize];
memset(buffer,0,sizeof(LADSPA_Data)*bufsize);
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 6b3ea6f220..39331cfda6 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -77,7 +77,7 @@ Location::operator= (const Location& other)
}
int
-Location::set_start (jack_nframes_t s)
+Location::set_start (nframes_t s)
{
if (is_mark()) {
if (_start != s) {
@@ -113,7 +113,7 @@ Location::set_start (jack_nframes_t s)
}
int
-Location::set_end (jack_nframes_t e)
+Location::set_end (nframes_t e)
{
if (is_mark()) {
if (_start != e) {
@@ -136,7 +136,7 @@ Location::set_end (jack_nframes_t e)
}
int
-Location::set (jack_nframes_t start, jack_nframes_t end)
+Location::set (nframes_t start, nframes_t end)
{
if (is_mark() && start != end) {
return -1;
@@ -266,7 +266,7 @@ Location::get_state (void)
node->add_child_nocopy(cd_info_node(m->first, m->second));
}
- id().print (buf);
+ id().print (buf, sizeof (buf));
node->add_property("id", buf);
node->add_property ("name", name());
snprintf (buf, sizeof (buf), "%u", start());
@@ -644,7 +644,7 @@ struct LocationStartLaterComparison
};
Location *
-Locations::first_location_before (jack_nframes_t frame)
+Locations::first_location_before (nframes_t frame)
{
LocationList locs;
@@ -668,7 +668,7 @@ Locations::first_location_before (jack_nframes_t frame)
}
Location *
-Locations::first_location_after (jack_nframes_t frame)
+Locations::first_location_after (nframes_t frame)
{
LocationList locs;
@@ -691,8 +691,8 @@ Locations::first_location_after (jack_nframes_t frame)
return 0;
}
-jack_nframes_t
-Locations::first_mark_before (jack_nframes_t frame)
+nframes_t
+Locations::first_mark_before (nframes_t frame)
{
LocationList locs;
@@ -728,8 +728,8 @@ Locations::first_mark_before (jack_nframes_t frame)
return 0;
}
-jack_nframes_t
-Locations::first_mark_after (jack_nframes_t frame)
+nframes_t
+Locations::first_mark_after (nframes_t frame)
{
LocationList locs;
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index c685b03943..1ce610d13c 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -102,11 +102,11 @@ PeakMeter::meter ()
new_peak = minus_infinity();
}
- if (_session.meter_falloff() == 0.0f || new_peak > _visible_peak_power[n]) {
+ if (Config->get_meter_falloff() == 0.0f || new_peak > _visible_peak_power[n]) {
_visible_peak_power[n] = new_peak;
} else {
// do falloff
- new_peak = _visible_peak_power[n] - _session.meter_falloff();
+ new_peak = _visible_peak_power[n] - Config->get_meter_falloff();
_visible_peak_power[n] = std::max (new_peak, -INFINITY);
}
}
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 6435655689..8247aac217 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -356,7 +356,7 @@ MidiDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nframe
if (_alignment_style == ExistingMaterial) {
- if (!_session.get_punch_in()) {
+ if (!Config->get_punch_in()) {
/* manual punch in happens at the correct transport frame
because the user hit a button. but to get alignment correct
@@ -385,7 +385,7 @@ MidiDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nframe
} else {
- if (_session.get_punch_in()) {
+ if (Config->get_punch_in()) {
first_recordable_frame += _roll_delay;
} else {
capture_start_frame -= _roll_delay;
@@ -472,7 +472,7 @@ MidiDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes,
adjust_capture_position = 0;
- if (nominally_recording || (_session.get_record_enabled() && _session.get_punch_in())) {
+ if (nominally_recording || (_session.get_record_enabled() && Config->get_punch_in())) {
OverlapType ot;
ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
@@ -1006,25 +1006,15 @@ MidiDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_cap
if (abort_capture) {
- list<boost::shared_ptr<Source> >* deletion_list = new list<boost::shared_ptr<Source> >;
-
if (_write_source) {
_write_source->mark_for_remove ();
-
- deletion_list->push_back (_write_source);
-
+ _write_source->drop_references ();
_write_source.reset();
}
/* new source set up in "out" below */
- if (!deletion_list->empty()) {
- DeleteSources (deletion_list);
- } else {
- delete deletion_list;
- }
-
} else {
assert(_write_source);
@@ -1193,8 +1183,8 @@ MidiDiskstream::engage_record_enable ()
g_atomic_int_set (&_record_enabled, 1);
- if (Config->get_use_hardware_monitoring() && _source_port) {
- _source_port->request_monitor_input (!(_session.get_auto_input() && rolling));
+ if (_source_port && Config->get_monitoring_model() == HardwareMonitoring) {
+ _source_port->request_monitor_input (!(Config->get_auto_input() && rolling));
}
RecordEnableChanged (); /* EMIT SIGNAL */
@@ -1204,7 +1194,7 @@ void
MidiDiskstream::disengage_record_enable ()
{
g_atomic_int_set (&_record_enabled, 0);
- if (Config->get_use_hardware_monitoring()) {
+ if (_source_port && Config->get_monitoring_model() == HardwareMonitoring) {
if (_source_port) {
_source_port->request_monitor_input (false);
}
@@ -1229,7 +1219,7 @@ MidiDiskstream::get_state ()
node->add_property ("speed", buf);
node->add_property("name", _name);
- id().print(buf);
+ id().print(buf, sizeof(buf));
node->add_property("id", buf);
if (_write_source && _session.get_record_enabled()) {
@@ -1245,7 +1235,7 @@ MidiDiskstream::get_state ()
Location* pi;
- if (_session.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
+ if (Config->get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
snprintf (buf, sizeof (buf), "%" PRIu32, pi->start());
} else {
snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame());
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc
index 4e39436ae3..c0d63cc2ba 100644
--- a/libs/ardour/midi_region.cc
+++ b/libs/ardour/midi_region.cc
@@ -263,7 +263,7 @@ MidiRegion::state (bool full)
for (uint32_t n=0; n < _sources.size(); ++n) {
snprintf (buf2, sizeof(buf2), "source-%d", n);
- _sources[n]->id().print (buf);
+ _sources[n]->id().print (buf, sizeof(buf));
node.add_property (buf2, buf);
}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 900a4f3191..f6d0a22019 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -226,7 +226,7 @@ MidiTrack::state(bool full_state)
for (vector<FreezeRecordInsertInfo*>::iterator i = _freeze_record.insert_info.begin(); i != _freeze_record.insert_info.end(); ++i) {
inode = new XMLNode (X_("insert"));
- (*i)->id.print (buf);
+ (*i)->id.print (buf, sizeof(buf));
inode->add_property (X_("id"), buf);
inode->add_child_copy ((*i)->state);
@@ -270,7 +270,7 @@ MidiTrack::state(bool full_state)
diskstream.
*/
- _diskstream->id().print (buf);
+ _diskstream->id().print (buf, sizeof(buf));
root.add_property ("diskstream-id", buf);
return root;
@@ -385,15 +385,15 @@ MidiTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfr
send_silence = true;
} else {
- if (_session.get_auto_input()) {
- if (Config->get_use_sw_monitoring()) {
+ if (Config->get_auto_input()) {
+ if (Config->get_monitoring_model() == SoftwareMonitoring) {
send_silence = false;
} else {
send_silence = true;
}
} else {
if (_diskstream->record_enabled()) {
- if (Config->get_use_sw_monitoring()) {
+ if (Config->get_monitoring_model() == SoftwareMonitoring) {
send_silence = false;
} else {
send_silence = true;
@@ -439,15 +439,6 @@ MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframe
int dret;
boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream();
- {
- Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
- if (lm.locked()) {
- // automation snapshot can also be called from the non-rt context
- // and it uses the redirect list, so we take the lock out here
- automation_snapshot (start_frame);
- }
- }
-
if (n_outputs().get_total() == 0 && _redirects.empty()) {
return 0;
}
@@ -482,7 +473,7 @@ MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframe
just_meter_input (start_frame, end_frame, nframes, offset);
}
- if (diskstream->record_enabled() && !can_record && !_session.get_auto_input()) {
+ if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) {
/* not actually recording, but we want to hear the input material anyway,
at least potentially (depending on monitoring options)
@@ -508,7 +499,7 @@ MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframe
diskstream->get_playback(bufs.get_midi(0), start_frame, end_frame);
process_output_buffers (bufs, start_frame, end_frame, nframes, offset,
- (!_session.get_record_enabled() || !_session.get_do_not_record_plugins()), declick, (_meter_point != MeterInput));
+ (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, (_meter_point != MeterInput));
}
diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc
index c6e234d87b..6b7755e498 100644
--- a/libs/ardour/mix.cc
+++ b/libs/ardour/mix.cc
@@ -29,7 +29,7 @@
// Debug wrappers
float
-debug_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current)
+debug_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current)
{
if ( ((intptr_t)buf % 16) != 0) {
cerr << "compute_peak(): buffer unaligned!" << endl;
@@ -39,7 +39,7 @@ debug_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current)
}
void
-debug_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain)
+debug_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain)
{
if ( ((intptr_t)buf % 16) != 0) {
cerr << "apply_gain_to_buffer(): buffer unaligned!" << endl;
@@ -49,7 +49,7 @@ debug_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float g
}
void
-debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain)
+debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain)
{
if ( ((intptr_t)dst & 15) != 0) {
cerr << "mix_buffers_with_gain(): dst unaligned!" << endl;
@@ -64,7 +64,7 @@ debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nfra
}
void
-debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes)
+debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes)
{
if ( ((intptr_t)dst & 15) != 0) {
cerr << "mix_buffers_no_gain(): dst unaligned!" << endl;
@@ -82,9 +82,9 @@ debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframe
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]));
}
@@ -92,24 +92,24 @@ compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current)
}
void
-apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain)
+apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain)
{
- for (jack_nframes_t i=0; i<nframes; i++)
+ for (nframes_t i=0; i<nframes; i++)
buf[i] *= gain;
}
void
-mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain)
+mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain)
{
- for (jack_nframes_t i = 0; i < nframes; i++) {
+ for (nframes_t i = 0; i < nframes; i++) {
dst[i] += src[i] * gain;
}
}
void
-mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes)
+mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes)
{
- for (jack_nframes_t i=0; i < nframes; i++) {
+ for (nframes_t i=0; i < nframes; i++) {
dst[i] += src[i];
}
}
@@ -118,7 +118,7 @@ mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nf
#include <Accelerate/Accelerate.h>
float
-veclib_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current)
+veclib_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current)
{
float tmpmax = 0.0f;
vDSP_maxmgv(buf, 1, &tmpmax, nsamples);
@@ -126,19 +126,19 @@ veclib_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current
}
void
-veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain)
+veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain)
{
vDSP_vsmul(buf, 1, &gain, buf, 1, nframes);
}
void
-veclib_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain)
+veclib_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain)
{
vDSP_vsma(src, 1, &gain, dst, 1, dst, 1, nframes);
}
void
-veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes)
+veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes)
{
// It seems that a vector mult only operation does not exist...
float gain = 1.0f;
diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc
index 32642d570d..2b4b2ae5bf 100644
--- a/libs/ardour/mtc_slave.cc
+++ b/libs/ardour/mtc_slave.cc
@@ -68,8 +68,8 @@ void
MTC_Slave::update_mtc_qtr (Parser& p)
{
cycles_t cnow = get_cycles ();
- jack_nframes_t now = session.engine().frame_time();
- jack_nframes_t qtr;
+ nframes_t now = session.engine().frame_time();
+ nframes_t qtr;
static cycles_t last_qtr = 0;
qtr = (long) (session.frames_per_smpte_frame() / 4);
@@ -87,7 +87,7 @@ MTC_Slave::update_mtc_qtr (Parser& p)
void
MTC_Slave::update_mtc_time (const byte *msg, bool was_full)
{
- jack_nframes_t now = session.engine().frame_time();
+ nframes_t now = session.engine().frame_time();
SMPTE::Time smpte;
smpte.hours = msg[3];
@@ -217,12 +217,12 @@ MTC_Slave::ok() const
}
bool
-MTC_Slave::speed_and_position (float& speed, jack_nframes_t& pos)
+MTC_Slave::speed_and_position (float& speed, nframes_t& pos)
{
- jack_nframes_t now = session.engine().frame_time();
+ nframes_t now = session.engine().frame_time();
SafeTime last;
- jack_nframes_t frame_rate;
- jack_nframes_t elapsed;
+ nframes_t frame_rate;
+ nframes_t elapsed;
float speed_now;
read_current (&last);
@@ -279,7 +279,7 @@ MTC_Slave::speed_and_position (float& speed, jack_nframes_t& pos)
/* scale elapsed time by the current MTC speed */
if (last.timestamp && (now > last.timestamp)) {
- elapsed = (jack_nframes_t) floor (mtc_speed * (now - last.timestamp));
+ elapsed = (nframes_t) floor (mtc_speed * (now - last.timestamp));
} else {
elapsed = 0; /* XXX is this right? */
}
@@ -293,10 +293,10 @@ MTC_Slave::speed_and_position (float& speed, jack_nframes_t& pos)
return true;
}
-jack_nframes_t
+ARDOUR::nframes_t
MTC_Slave::resolution() const
{
- return (jack_nframes_t) session.frames_per_smpte_frame();
+ return (nframes_t) session.frames_per_smpte_frame();
}
void
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 0c3b0a291f..0f6e78f84b 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -18,6 +18,9 @@
$Id$
*/
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h>
+
#include <cmath>
#include <cerrno>
#include <fstream>
@@ -68,7 +71,7 @@ static double direct_pan_to_control (pan_t val) {
StreamPanner::StreamPanner (Panner& p)
: parent (p),
- _control (*this)
+ _control (X_("panner"), *this)
{
_muted = false;
@@ -194,7 +197,7 @@ BaseStereoPanner::~BaseStereoPanner ()
}
void
-BaseStereoPanner::snapshot (jack_nframes_t now)
+BaseStereoPanner::snapshot (nframes_t now)
{
if (_automation.automation_state() == Write || _automation.automation_state() == Touch) {
_automation.rt_add (now, x);
@@ -202,7 +205,7 @@ BaseStereoPanner::snapshot (jack_nframes_t now)
}
void
-BaseStereoPanner::transport_stopped (jack_nframes_t frame)
+BaseStereoPanner::transport_stopped (nframes_t frame)
{
_automation.reposition_for_rt_add (frame);
@@ -247,7 +250,7 @@ BaseStereoPanner::save (ostream& out) const
out << "begin" << endl;
for (AutomationList::const_iterator i = _automation.const_begin(); i != _automation.const_end(); ++i) {
- out << '\t' << (jack_nframes_t) floor ((*i)->when) << ' ' << (*i)->value << endl;
+ out << '\t' << (nframes_t) floor ((*i)->when) << ' ' << (*i)->value << endl;
if (!out) {
error << string_compose (_("error writing pan automation file (%s)"), strerror (errno)) << endmsg;
return -1;
@@ -267,7 +270,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt)
_automation.clear ();
while (in.getline (line, sizeof (line), '\n')) {
- jack_nframes_t when;
+ nframes_t when;
double value;
++linecnt;
@@ -293,7 +296,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt)
}
void
-BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coeff, jack_nframes_t nframes)
+BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes)
{
assert(obufs.count().get(DataType::AUDIO) == 2);
@@ -315,8 +318,8 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain
/* interpolate over 64 frames or nframes, whichever is smaller */
- jack_nframes_t limit = min ((jack_nframes_t)64, nframes);
- jack_nframes_t n;
+ nframes_t limit = min ((nframes_t)64, nframes);
+ nframes_t n;
delta = -(delta / (float) (limit));
@@ -365,8 +368,8 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain
/* interpolate over 64 frames or nframes, whichever is smaller */
- jack_nframes_t limit = min ((jack_nframes_t)64, nframes);
- jack_nframes_t n;
+ nframes_t limit = min ((nframes_t)64, nframes);
+ nframes_t n;
delta = -(delta / (float) (limit));
@@ -451,7 +454,7 @@ EqualPowerStereoPanner::update ()
void
EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& obufs,
- jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes,
+ nframes_t start, nframes_t end, nframes_t nframes,
pan_t** buffers)
{
assert(obufs.count().get(DataType::AUDIO) == 2);
@@ -486,7 +489,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob
const float pan_law_attenuation = -3.0f;
const float scale = 2.0f - 4.0f * powf (10.0f,pan_law_attenuation/20.0f);
- for (jack_nframes_t n = 0; n < nframes; ++n) {
+ for (nframes_t n = 0; n < nframes; ++n) {
float panR = buffers[0][n];
float panL = 1 - panR;
@@ -500,7 +503,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob
dst = obufs.get_audio(0).data(nframes);
pbuf = buffers[0];
- for (jack_nframes_t n = 0; n < nframes; ++n) {
+ for (nframes_t n = 0; n < nframes; ++n) {
dst[n] += src[n] * pbuf[n];
}
@@ -511,7 +514,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob
dst = obufs.get_audio(1).data(nframes);
pbuf = buffers[1];
- for (jack_nframes_t n = 0; n < nframes; ++n) {
+ for (nframes_t n = 0; n < nframes; ++n) {
dst[n] += src[n] * pbuf[n];
}
@@ -551,6 +554,7 @@ EqualPowerStereoPanner::state (bool full_state)
root->add_property (X_("automation-style"), buf);
StreamPanner::add_state (*root);
+ root->add_child_nocopy (_control.get_state ());
return *root;
}
@@ -583,6 +587,13 @@ EqualPowerStereoPanner::set_state (const XMLNode& node)
}
StreamPanner::set_state (node);
+
+ for (XMLNodeConstIterator iter = node.children().begin(); iter != node.children().end(); ++iter) {
+ if ((*iter)->name() == X_("panner")) {
+ _control.set_state (**iter);
+ parent.session().add_controllable (&_control);
+ }
+ }
return 0;
}
@@ -600,13 +611,13 @@ Multi2dPanner::~Multi2dPanner ()
}
void
-Multi2dPanner::snapshot (jack_nframes_t now)
+Multi2dPanner::snapshot (nframes_t now)
{
// how?
}
void
-Multi2dPanner::transport_stopped (jack_nframes_t frame)
+Multi2dPanner::transport_stopped (nframes_t frame)
{
//what?
}
@@ -656,7 +667,7 @@ Multi2dPanner::update ()
}
void
-Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coeff, jack_nframes_t nframes)
+Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes)
{
Sample* dst;
pan_t pan;
@@ -679,8 +690,8 @@ Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co
/* interpolate over 64 frames or nframes, whichever is smaller */
- jack_nframes_t limit = min ((jack_nframes_t)64, nframes);
- jack_nframes_t n;
+ nframes_t limit = min ((nframes_t)64, nframes);
+ nframes_t n;
delta = -(delta / (float) (limit));
@@ -705,7 +716,7 @@ Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co
if (pan != 0.0f) {
- for (jack_nframes_t n = 0; n < nframes; ++n) {
+ for (nframes_t n = 0; n < nframes; ++n) {
dst[n] += src[n] * pan;
}
@@ -714,7 +725,7 @@ Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co
} else {
- for (jack_nframes_t n = 0; n < nframes; ++n) {
+ for (nframes_t n = 0; n < nframes; ++n) {
dst[n] += src[n];
}
@@ -730,7 +741,7 @@ Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co
void
Multi2dPanner::distribute_automated (AudioBuffer& src, BufferSet& obufs,
- jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes,
+ nframes_t start, nframes_t end, nframes_t nframes,
pan_t** buffers)
{
if (_muted) {
@@ -1060,7 +1071,7 @@ Panner::automation_style () const
}
void
-Panner::transport_stopped (jack_nframes_t frame)
+Panner::transport_stopped (nframes_t frame)
{
for (vector<StreamPanner*>::iterator i = begin(); i != end(); ++i) {
(*i)->transport_stopped (frame);
@@ -1068,7 +1079,7 @@ Panner::transport_stopped (jack_nframes_t frame)
}
void
-Panner::snapshot (jack_nframes_t now)
+Panner::snapshot (nframes_t now)
{
for (vector<StreamPanner*>::iterator i = begin(); i != end(); ++i) {
(*i)->snapshot (now);
@@ -1489,7 +1500,7 @@ Panner::set_position (float xpos, float ypos, float zpos, StreamPanner& orig)
}
void
-Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, jack_nframes_t nframes, jack_nframes_t offset, gain_t gain_coeff)
+Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes_t nframes, nframes_t offset, gain_t gain_coeff)
{
if (outbufs.count().get(DataType::AUDIO) == 0) {
// Don't want to lose audio...
@@ -1558,7 +1569,7 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, jack_nf
}
void
-Panner::distribute (BufferSet& inbufs, BufferSet& outbufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset)
+Panner::distribute (BufferSet& inbufs, BufferSet& outbufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
{
if (outbufs.count().get(DataType::AUDIO) == 0) {
// Failing to deliver audio we were asked to deliver is a bug
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index f778175e9e..56fed3d7a3 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -129,12 +129,12 @@ Playlist::Playlist (const Playlist& other, string namestr, bool hide)
}
-Playlist::Playlist (const Playlist& other, jack_nframes_t start, jack_nframes_t cnt, string str, bool hide)
+Playlist::Playlist (const Playlist& other, nframes_t start, nframes_t cnt, string str, bool hide)
: _name (str), _session (other._session), _type(other._type), _orig_diskstream_id(other._orig_diskstream_id)
{
RegionLock rlock2 (&((Playlist&)other));
- jack_nframes_t end = start + cnt - 1;
+ nframes_t end = start + cnt - 1;
init (hide);
@@ -142,9 +142,9 @@ Playlist::Playlist (const Playlist& other, jack_nframes_t start, jack_nframes_t
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> new_region;
- jack_nframes_t offset = 0;
- jack_nframes_t position = 0;
- jack_nframes_t len = 0;
+ nframes_t offset = 0;
+ nframes_t position = 0;
+ nframes_t len = 0;
string new_name;
OverlapType overlap;
@@ -237,7 +237,7 @@ Playlist::init (bool hide)
_splicing = false;
_nudging = false;
in_set_state = false;
- _edit_mode = _session.get_edit_mode();
+ _edit_mode = Config->get_edit_mode();
in_flush = false;
in_partition = false;
subcnt = 0;
@@ -401,7 +401,7 @@ Playlist::flush_notifications ()
// pending_bounds.sort (cmp);
for (RegionList::iterator r = pending_bounds.begin(); r != pending_bounds.end(); ++r) {
- if (_session.get_layer_model() == Session::MoveAddHigher) {
+ if (Config->get_layer_model() == MoveAddHigher) {
timestamp_layer_op (*r);
}
pending_length = true;
@@ -461,7 +461,7 @@ Playlist::flush_notifications ()
*************************************************************/
void
-Playlist::add_region (boost::shared_ptr<Region> region, jack_nframes_t position, float times, bool with_save)
+Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, float times, bool with_save)
{
RegionLock rlock (this);
@@ -469,7 +469,7 @@ Playlist::add_region (boost::shared_ptr<Region> region, jack_nframes_t position,
int itimes = (int) floor (times);
- jack_nframes_t pos = position;
+ nframes_t pos = position;
if (itimes >= 1) {
add_region_internal (region, pos, true);
@@ -494,7 +494,7 @@ Playlist::add_region (boost::shared_ptr<Region> region, jack_nframes_t position,
}
if (floor (times) != times) {
- jack_nframes_t length = (jack_nframes_t) floor (region->length() * (times - floor (times)));
+ nframes_t length = (nframes_t) floor (region->length() * (times - floor (times)));
string name;
_session.region_name (name, region->name(), false);
boost::shared_ptr<Region> sub = RegionFactory::create (region, 0, length, name, region->layer(), region->flags());
@@ -507,10 +507,10 @@ Playlist::add_region (boost::shared_ptr<Region> region, jack_nframes_t position,
}
void
-Playlist::add_region_internal (boost::shared_ptr<Region> region, jack_nframes_t position, bool delay_sort)
+Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t position, bool delay_sort)
{
RegionSortByPosition cmp;
- jack_nframes_t old_length = 0;
+ nframes_t old_length = 0;
if (!holding_state()) {
old_length = _get_maximum_extent();
@@ -539,11 +539,12 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, jack_nframes_t
}
}
- region->StateChanged.connect (sigc::bind (mem_fun (this, &Playlist::region_changed_proxy), region));
+ region->StateChanged.connect (sigc::bind (mem_fun (this, &Playlist::region_changed_proxy),
+ boost::weak_ptr<Region> (region)));
}
void
-Playlist::replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, jack_nframes_t pos)
+Playlist::replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, nframes_t pos)
{
RegionLock rlock (this);
@@ -574,7 +575,7 @@ int
Playlist::remove_region_internal (boost::shared_ptr<Region>region, bool delay_sort)
{
RegionList::iterator i;
- jack_nframes_t old_length = 0;
+ nframes_t old_length = 0;
// cerr << "removing region " << region->name() << endl;
@@ -629,7 +630,7 @@ Playlist::get_region_list_equivalent_regions (boost::shared_ptr<Region> other, v
}
void
-Playlist::partition (jack_nframes_t start, jack_nframes_t end, bool just_top_level)
+Playlist::partition (nframes_t start, nframes_t end, bool just_top_level)
{
RegionList thawlist;
@@ -643,7 +644,7 @@ Playlist::partition (jack_nframes_t start, jack_nframes_t end, bool just_top_lev
}
void
-Playlist::partition_internal (jack_nframes_t start, jack_nframes_t end, bool cutting, RegionList& thawlist)
+Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist)
{
RegionLock rlock (this);
boost::shared_ptr<Region> region;
@@ -651,7 +652,7 @@ Playlist::partition_internal (jack_nframes_t start, jack_nframes_t end, bool cut
string new_name;
RegionList::iterator tmp;
OverlapType overlap;
- jack_nframes_t pos1, pos2, pos3, pos4;
+ nframes_t pos1, pos2, pos3, pos4;
RegionList new_regions;
in_partition = true;
@@ -825,11 +826,11 @@ Playlist::partition_internal (jack_nframes_t start, jack_nframes_t end, bool cut
}
Playlist*
-Playlist::cut_copy (Playlist* (Playlist::*pmf)(jack_nframes_t, jack_nframes_t,bool), list<AudioRange>& ranges, bool result_is_hidden)
+Playlist::cut_copy (Playlist* (Playlist::*pmf)(nframes_t, nframes_t,bool), list<AudioRange>& ranges, bool result_is_hidden)
{
Playlist* ret;
Playlist* pl;
- jack_nframes_t start;
+ nframes_t start;
if (ranges.empty()) {
return 0;
@@ -869,19 +870,19 @@ Playlist::cut_copy (Playlist* (Playlist::*pmf)(jack_nframes_t, jack_nframes_t,bo
Playlist*
Playlist::cut (list<AudioRange>& ranges, bool result_is_hidden)
{
- Playlist* (Playlist::*pmf)(jack_nframes_t,jack_nframes_t,bool) = &Playlist::cut;
+ Playlist* (Playlist::*pmf)(nframes_t,nframes_t,bool) = &Playlist::cut;
return cut_copy (pmf, ranges, result_is_hidden);
}
Playlist*
Playlist::copy (list<AudioRange>& ranges, bool result_is_hidden)
{
- Playlist* (Playlist::*pmf)(jack_nframes_t,jack_nframes_t,bool) = &Playlist::copy;
+ Playlist* (Playlist::*pmf)(nframes_t,nframes_t,bool) = &Playlist::copy;
return cut_copy (pmf, ranges, result_is_hidden);
}
Playlist *
-Playlist::cut (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 *the_copy;
RegionList thawlist;
@@ -909,7 +910,7 @@ Playlist::cut (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden)
}
Playlist *
-Playlist::copy (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden)
+Playlist::copy (nframes_t start, nframes_t cnt, bool result_is_hidden)
{
char buf[32];
@@ -923,10 +924,10 @@ Playlist::copy (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden)
}
int
-Playlist::paste (Playlist& other, jack_nframes_t position, float times)
+Playlist::paste (Playlist& other, nframes_t position, float times)
{
times = fabs (times);
- jack_nframes_t old_length;
+ nframes_t old_length;
{
RegionLock rl1 (this);
@@ -935,8 +936,8 @@ Playlist::paste (Playlist& other, jack_nframes_t position, float times)
old_length = _get_maximum_extent();
int itimes = (int) floor (times);
- jack_nframes_t pos = position;
- jack_nframes_t shift = other._get_maximum_extent();
+ nframes_t pos = position;
+ nframes_t shift = other._get_maximum_extent();
layer_t top_layer = regions.size();
while (itimes--) {
@@ -971,13 +972,13 @@ Playlist::paste (Playlist& other, jack_nframes_t position, float times)
void
-Playlist::duplicate (boost::shared_ptr<Region> region, jack_nframes_t position, float times)
+Playlist::duplicate (boost::shared_ptr<Region> region, nframes_t position, float times)
{
times = fabs (times);
RegionLock rl (this);
int itimes = (int) floor (times);
- jack_nframes_t pos = position;
+ nframes_t pos = position;
while (itimes--) {
boost::shared_ptr<Region> copy = RegionFactory::create (region);
@@ -986,7 +987,7 @@ Playlist::duplicate (boost::shared_ptr<Region> region, jack_nframes_t position,
}
if (floor (times) != times) {
- jack_nframes_t length = (jack_nframes_t) floor (region->length() * (times - floor (times)));
+ nframes_t length = (nframes_t) floor (region->length() * (times - floor (times)));
string name;
_session.region_name (name, region->name(), false);
boost::shared_ptr<Region> sub = RegionFactory::create (region, 0, length, name, region->layer(), region->flags());
@@ -997,7 +998,7 @@ Playlist::duplicate (boost::shared_ptr<Region> region, jack_nframes_t position,
}
void
-Playlist::split_region (boost::shared_ptr<Region> region, jack_nframes_t playlist_position)
+Playlist::split_region (boost::shared_ptr<Region> region, nframes_t playlist_position)
{
RegionLock rl (this);
@@ -1012,8 +1013,8 @@ Playlist::split_region (boost::shared_ptr<Region> region, jack_nframes_t playlis
boost::shared_ptr<Region> left;
boost::shared_ptr<Region> right;
- jack_nframes_t before;
- jack_nframes_t after;
+ nframes_t before;
+ nframes_t after;
string before_name;
string after_name;
@@ -1141,7 +1142,7 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr<Region>
if (holding_state ()) {
pending_bounds.push_back (region);
} else {
- if (_session.get_layer_model() == Session::MoveAddHigher) {
+ if (Config->get_layer_model() == MoveAddHigher) {
/* it moved or changed length, so change the timestamp */
timestamp_layer_op (region);
}
@@ -1155,8 +1156,14 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr<Region>
}
void
-Playlist::region_changed_proxy (Change what_changed, boost::shared_ptr<Region> region)
+Playlist::region_changed_proxy (Change what_changed, boost::weak_ptr<Region> weak_region)
{
+ boost::shared_ptr<Region> region (weak_region.lock());
+
+ if (!region) {
+ return;
+ }
+
/* this makes a virtual call to the right kind of playlist ... */
region_changed (what_changed, region);
@@ -1217,7 +1224,7 @@ Playlist::clear (bool with_save)
**********************************************************************/
Playlist::RegionList *
-Playlist::regions_at (jack_nframes_t frame)
+Playlist::regions_at (nframes_t frame)
{
RegionLock rlock (this);
@@ -1225,7 +1232,7 @@ Playlist::regions_at (jack_nframes_t frame)
}
boost::shared_ptr<Region>
-Playlist::top_region_at (jack_nframes_t frame)
+Playlist::top_region_at (nframes_t frame)
{
RegionLock rlock (this);
@@ -1243,7 +1250,7 @@ Playlist::top_region_at (jack_nframes_t frame)
}
Playlist::RegionList *
-Playlist::find_regions_at (jack_nframes_t frame)
+Playlist::find_regions_at (nframes_t frame)
{
RegionList *rlist = new RegionList;
@@ -1257,7 +1264,7 @@ Playlist::find_regions_at (jack_nframes_t frame)
}
Playlist::RegionList *
-Playlist::regions_touched (jack_nframes_t start, jack_nframes_t end)
+Playlist::regions_touched (nframes_t start, nframes_t end)
{
RegionLock rlock (this);
RegionList *rlist = new RegionList;
@@ -1273,17 +1280,17 @@ Playlist::regions_touched (jack_nframes_t start, jack_nframes_t end)
boost::shared_ptr<Region>
-Playlist::find_next_region (jack_nframes_t frame, RegionPoint point, int dir)
+Playlist::find_next_region (nframes_t frame, RegionPoint point, int dir)
{
RegionLock rlock (this);
boost::shared_ptr<Region> ret;
- jack_nframes_t closest = max_frames;
+ nframes_t closest = max_frames;
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
- jack_nframes_t distance;
+ nframes_t distance;
boost::shared_ptr<Region> r = (*i);
- jack_nframes_t pos = 0;
+ nframes_t pos = 0;
switch (point) {
case Start:
@@ -1380,6 +1387,11 @@ Playlist::set_state (const XMLNode& node)
if (child->name() == "Region") {
+ if ((prop = child->property ("id")) == 0) {
+ error << _("region state node has no ID, ignored") << endmsg;
+ continue;
+ }
+
if ((region = RegionFactory::create (_session, *child, true)) == 0) {
error << _("Playlist: cannot create region from state file") << endmsg;
continue;
@@ -1428,7 +1440,7 @@ Playlist::state (bool full_state)
node->add_property (X_("name"), _name);
node->add_property (X_("type"), _type.to_string());
- _orig_diskstream_id.print (buf);
+ _orig_diskstream_id.print (buf, sizeof (buf));
node->add_property (X_("orig_diskstream_id"), buf);
node->add_property (X_("frozen"), _frozen ? "yes" : "no");
@@ -1453,19 +1465,19 @@ Playlist::empty() const
return regions.empty();
}
-jack_nframes_t
+ARDOUR::nframes_t
Playlist::get_maximum_extent () const
{
RegionLock rlock (const_cast<Playlist *>(this));
return _get_maximum_extent ();
}
-jack_nframes_t
+ARDOUR::nframes_t
Playlist::_get_maximum_extent () const
{
RegionList::const_iterator i;
- jack_nframes_t max_extent = 0;
- jack_nframes_t end = 0;
+ nframes_t max_extent = 0;
+ nframes_t end = 0;
for (i = regions.begin(); i != regions.end(); ++i) {
if ((end = (*i)->position() + (*i)->length()) > max_extent) {
@@ -1545,8 +1557,8 @@ Playlist::relayer ()
freeze ();
- if (_session.get_layer_model() == Session::MoveAddHigher ||
- _session.get_layer_model() == Session::AddHigher) {
+ if (Config->get_layer_model() == MoveAddHigher ||
+ Config->get_layer_model() == AddHigher) {
RegionSortByLastLayerOp cmp;
RegionList copy = regions;
@@ -1612,8 +1624,8 @@ void
Playlist::raise_region_to_top (boost::shared_ptr<Region> region)
{
/* does nothing useful if layering mode is later=higher */
- if ((_session.get_layer_model() == Session::MoveAddHigher) ||
- (_session.get_layer_model() == Session::AddHigher)) {
+ if ((Config->get_layer_model() == MoveAddHigher) ||
+ (Config->get_layer_model() == AddHigher)) {
timestamp_layer_op (region);
relayer ();
}
@@ -1623,8 +1635,8 @@ void
Playlist::lower_region_to_bottom (boost::shared_ptr<Region> region)
{
/* does nothing useful if layering mode is later=higher */
- if ((_session.get_layer_model() == Session::MoveAddHigher) ||
- (_session.get_layer_model() == Session::AddHigher)) {
+ if ((Config->get_layer_model() == MoveAddHigher) ||
+ (Config->get_layer_model() == AddHigher)) {
region->set_last_layer_op (0);
relayer ();
}
@@ -1702,10 +1714,10 @@ Playlist::move_region_to_layer (layer_t target_layer, boost::shared_ptr<Region>
}
void
-Playlist::nudge_after (jack_nframes_t start, jack_nframes_t distance, bool forwards)
+Playlist::nudge_after (nframes_t start, nframes_t distance, bool forwards)
{
RegionList::iterator i;
- jack_nframes_t new_pos;
+ nframes_t new_pos;
bool moved = false;
_nudging = true;
diff --git a/libs/ardour/playlist_factory.cc b/libs/ardour/playlist_factory.cc
index 05d9c76f7a..4461783874 100644
--- a/libs/ardour/playlist_factory.cc
+++ b/libs/ardour/playlist_factory.cc
@@ -29,7 +29,7 @@ using namespace ARDOUR;
using namespace PBD;
Playlist*
-Playlist::copyPlaylist (const Playlist& playlist, jack_nframes_t start, jack_nframes_t length,
+Playlist::copyPlaylist (const Playlist& playlist, nframes_t start, nframes_t length,
string name, bool result_is_hidden)
{
const AudioPlaylist* apl;
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index 9a82c3bbab..3b471014eb 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -95,15 +95,17 @@ Plugin::get_nth_control (uint32_t n)
Plugin::ParameterDescriptor desc;
get_parameter_descriptor (n, desc);
-
- controls[n] = new PortControllable (*this, n, desc.lower, desc.upper, desc.toggled, desc.logarithmic);
+
+ controls[n] = new PortControllable (describe_parameter (n), *this, n,
+ desc.lower, desc.upper, desc.toggled, desc.logarithmic);
}
return controls[n];
}
-Plugin::PortControllable::PortControllable (Plugin& p, uint32_t port_id, float low, float up, bool t, bool loga)
- : plugin (p), absolute_port (port_id)
+Plugin::PortControllable::PortControllable (string name, Plugin& p, uint32_t port_id,
+ float low, float up, bool t, bool loga)
+ : Controllable (name), plugin (p), absolute_port (port_id)
{
toggled = t;
logarithmic = loga;
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc
index 5b3a4658a8..bdd4d0ada6 100644
--- a/libs/ardour/plugin_manager.cc
+++ b/libs/ardour/plugin_manager.cc
@@ -18,6 +18,9 @@
$Id$
*/
+#define __STDC_FORMAT_MACROS 1
+#include <stdint.h>
+
#include <sys/types.h>
#include <cstdio>
#include <lrdf.h>
diff --git a/libs/ardour/redirect.cc b/libs/ardour/redirect.cc
index 05c07accb7..09d650b069 100644
--- a/libs/ardour/redirect.cc
+++ b/libs/ardour/redirect.cc
@@ -233,7 +233,7 @@ Redirect::state (bool full_state)
path = _session.snap_name();
path += "-redirect-";
- id().print (buf);
+ id().print (buf, sizeof (buf));
path += buf;
path += ".automation";
@@ -406,7 +406,7 @@ Redirect::mark_automation_visible (uint32_t what, bool yn)
}
bool
-Redirect::find_next_event (jack_nframes_t now, jack_nframes_t end, ControlEvent& next_event) const
+Redirect::find_next_event (nframes_t now, nframes_t end, ControlEvent& next_event) const
{
map<uint32_t,AutomationList*>::const_iterator li;
AutomationList::TimeComparator cmp;
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index c420649ef2..d55a8aea1a 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -113,7 +113,7 @@ Region::Region (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, c
}
/** Create a new Region from part of an existing one */
-Region::Region (boost::shared_ptr<const Region> other, jack_nframes_t offset, jack_nframes_t length, const string& name, layer_t layer, Flag flags)
+Region::Region (boost::shared_ptr<const Region> other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags)
: _name(name)
, _type(other->data_type())
, _flags(Flag(flags & ~(Locked|WholeFile|Hidden)))
@@ -273,9 +273,7 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node)
Region::~Region ()
{
- notify_callbacks ();
-
- /* derived classes must emit GoingAway */
+ /* derived classes must call notify_callbacks() and then emit GoingAway */
}
void
@@ -356,7 +354,7 @@ Region::set_name (string str)
}
void
-Region::set_length (jack_nframes_t len, void *src)
+Region::set_length (nframes_t len, void *src)
{
if (_flags & Locked) {
return;
@@ -364,6 +362,14 @@ Region::set_length (jack_nframes_t len, void *src)
if (_length != len && len != 0) {
+ /* check that the current _position wouldn't make the new
+ length impossible.
+ */
+
+ if (max_frames - len < _position) {
+ return;
+ }
+
if (!verify_length (len)) {
return;
}
@@ -411,7 +417,7 @@ Region::move_to_natural_position (void *src)
if (!_playlist) {
return;
}
-
+
boost::shared_ptr<Region> whole_file_region = get_parent();
if (whole_file_region) {
@@ -420,7 +426,7 @@ Region::move_to_natural_position (void *src)
}
void
-Region::special_set_position (jack_nframes_t pos)
+Region::special_set_position (nframes_t pos)
{
/* this is used when creating a whole file region as
a way to store its "natural" or "captured" position.
@@ -430,7 +436,7 @@ Region::special_set_position (jack_nframes_t pos)
}
void
-Region::set_position (jack_nframes_t pos, void *src)
+Region::set_position (nframes_t pos, void *src)
{
if (_flags & Locked) {
return;
@@ -439,6 +445,16 @@ Region::set_position (jack_nframes_t pos, void *src)
if (_position != pos) {
_position = pos;
+ /* check that the new _position wouldn't make the current
+ length impossible - if so, change the length.
+
+ XXX is this the right thing to do?
+ */
+
+ if (max_frames - _length < _position) {
+ _length = max_frames - _position;
+ }
+
if (!_frozen) {
char buf[64];
snprintf (buf, sizeof (buf), "position set to %u", pos);
@@ -454,7 +470,7 @@ Region::set_position (jack_nframes_t pos, void *src)
}
void
-Region::set_position_on_top (jack_nframes_t pos, void *src)
+Region::set_position_on_top (nframes_t pos, void *src)
{
if (_flags & Locked) {
return;
@@ -497,7 +513,7 @@ Region::nudge_position (long n, void *src)
_position += n;
}
} else {
- if (_position < (jack_nframes_t) -n) {
+ if (_position < (nframes_t) -n) {
_position = 0;
} else {
_position += n;
@@ -514,7 +530,7 @@ Region::nudge_position (long n, void *src)
}
void
-Region::set_start (jack_nframes_t pos, void *src)
+Region::set_start (nframes_t pos, void *src)
{
if (_flags & Locked) {
return;
@@ -545,12 +561,12 @@ Region::set_start (jack_nframes_t pos, void *src)
}
void
-Region::trim_start (jack_nframes_t new_position, void *src)
+Region::trim_start (nframes_t new_position, void *src)
{
if (_flags & Locked) {
return;
}
- jack_nframes_t new_start;
+ nframes_t new_start;
int32_t start_shift;
if (new_position > _position) {
@@ -573,7 +589,7 @@ Region::trim_start (jack_nframes_t new_position, void *src)
} else if (start_shift < 0) {
- if (_start < (jack_nframes_t) -start_shift) {
+ if (_start < (nframes_t) -start_shift) {
new_start = 0;
} else {
new_start = _start + start_shift;
@@ -600,14 +616,14 @@ Region::trim_start (jack_nframes_t new_position, void *src)
}
void
-Region::trim_front (jack_nframes_t new_position, void *src)
+Region::trim_front (nframes_t new_position, void *src)
{
if (_flags & Locked) {
return;
}
- jack_nframes_t end = _position + _length - 1;
- jack_nframes_t source_zero;
+ nframes_t end = last_frame();
+ nframes_t source_zero;
if (_position > _start) {
source_zero = _position - _start;
@@ -617,7 +633,7 @@ Region::trim_front (jack_nframes_t new_position, void *src)
if (new_position < end) { /* can't trim it zero or negative length */
- jack_nframes_t newlen;
+ nframes_t newlen;
/* can't trim it back passed where source position zero is located */
@@ -638,7 +654,7 @@ Region::trim_front (jack_nframes_t new_position, void *src)
}
void
-Region::trim_end (jack_nframes_t new_endpoint, void *src)
+Region::trim_end (nframes_t new_endpoint, void *src)
{
if (_flags & Locked) {
return;
@@ -653,7 +669,7 @@ Region::trim_end (jack_nframes_t new_endpoint, void *src)
}
void
-Region::trim_to (jack_nframes_t position, jack_nframes_t length, void *src)
+Region::trim_to (nframes_t position, nframes_t length, void *src)
{
if (_flags & Locked) {
return;
@@ -668,10 +684,10 @@ Region::trim_to (jack_nframes_t position, jack_nframes_t length, void *src)
}
void
-Region::trim_to_internal (jack_nframes_t position, jack_nframes_t length, void *src)
+Region::trim_to_internal (nframes_t position, nframes_t length, void *src)
{
int32_t start_shift;
- jack_nframes_t new_start;
+ nframes_t new_start;
if (_flags & Locked) {
return;
@@ -694,7 +710,7 @@ Region::trim_to_internal (jack_nframes_t position, jack_nframes_t length, void *
} else if (start_shift < 0) {
- if (_start < (jack_nframes_t) -start_shift) {
+ if (_start < (nframes_t) -start_shift) {
new_start = 0;
} else {
new_start = _start + start_shift;
@@ -819,9 +835,9 @@ Region::set_locked (bool yn)
}
void
-Region::set_sync_position (jack_nframes_t absolute_pos)
+Region::set_sync_position (nframes_t absolute_pos)
{
- jack_nframes_t file_pos;
+ nframes_t file_pos;
file_pos = _start + (absolute_pos - _position);
@@ -854,7 +870,7 @@ Region::clear_sync_position ()
}
}
-jack_nframes_t
+nframes_t
Region::sync_offset (int& dir) const
{
/* returns the sync point relative the first frame of the region */
@@ -873,11 +889,11 @@ Region::sync_offset (int& dir) const
}
}
-jack_nframes_t
-Region::adjust_to_sync (jack_nframes_t pos)
+nframes_t
+Region::adjust_to_sync (nframes_t pos)
{
int sync_dir;
- jack_nframes_t offset = sync_offset (sync_dir);
+ nframes_t offset = sync_offset (sync_dir);
if (sync_dir > 0) {
if (max_frames - pos > offset) {
@@ -894,7 +910,7 @@ Region::adjust_to_sync (jack_nframes_t pos)
return pos;
}
-jack_nframes_t
+nframes_t
Region::sync_position() const
{
if (_flags & SyncMarked) {
@@ -968,7 +984,7 @@ Region::state (bool full_state)
XMLNode *node = new XMLNode ("Region");
char buf[64];
- _id.print (buf);
+ _id.print (buf, sizeof (buf));
node->add_property ("id", buf);
node->add_property ("name", _name);
node->add_property ("type", _type.to_string());
@@ -1027,15 +1043,15 @@ Region::set_state (const XMLNode& node)
}
if ((prop = node.property ("start")) != 0) {
- _start = (jack_nframes_t) atoi (prop->value().c_str());
+ sscanf (prop->value().c_str(), "%" PRIu32, &_start);
}
if ((prop = node.property ("length")) != 0) {
- _length = (jack_nframes_t) atoi (prop->value().c_str());
+ sscanf (prop->value().c_str(), "%" PRIu32, &_length);
}
if ((prop = node.property ("position")) != 0) {
- _position = (jack_nframes_t) atoi (prop->value().c_str());
+ sscanf (prop->value().c_str(), "%" PRIu32, &_position);
}
if ((prop = node.property ("layer")) != 0) {
@@ -1045,7 +1061,7 @@ Region::set_state (const XMLNode& node)
/* note: derived classes set flags */
if ((prop = node.property ("sync-position")) != 0) {
- _sync_position = (jack_nframes_t) atoi (prop->value().c_str());
+ sscanf (prop->value().c_str(), "%" PRIu32, &_sync_position);
} else {
_sync_position = _start;
}
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc
index 492a25a08f..4041852f4e 100644
--- a/libs/ardour/region_factory.cc
+++ b/libs/ardour/region_factory.cc
@@ -37,8 +37,8 @@ using namespace PBD;
sigc::signal<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
boost::shared_ptr<Region>
-RegionFactory::create (boost::shared_ptr<Region> region, jack_nframes_t start,
- jack_nframes_t length, std::string name,
+RegionFactory::create (boost::shared_ptr<Region> region, nframes_t start,
+ nframes_t length, std::string name,
layer_t layer, Region::Flag flags, bool announce)
{
boost::shared_ptr<const AudioRegion> other_a;
@@ -91,8 +91,8 @@ RegionFactory::create (boost::shared_ptr<Region> region)
}
boost::shared_ptr<Region>
-RegionFactory::create (boost::shared_ptr<AudioRegion> region, jack_nframes_t start,
- jack_nframes_t length, std::string name,
+RegionFactory::create (boost::shared_ptr<AudioRegion> region, nframes_t start,
+ nframes_t length, std::string name,
layer_t layer, Region::Flag flags, bool announce)
{
return create (boost::static_pointer_cast<Region> (region), start, length, name, layer, flags, announce);
@@ -107,7 +107,7 @@ RegionFactory::create (Session& session, XMLNode& node, bool yn)
}
boost::shared_ptr<Region>
-RegionFactory::create (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce)
+RegionFactory::create (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce)
{
if (srcs.empty()) {
return boost::shared_ptr<Region>();
@@ -159,7 +159,7 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
}
boost::shared_ptr<Region>
-RegionFactory::create (boost::shared_ptr<Source> src, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce)
+RegionFactory::create (boost::shared_ptr<Source> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce)
{
boost::shared_ptr<AudioSource> as;
boost::shared_ptr<MidiSource> ms;
diff --git a/libs/ardour/reverse.cc b/libs/ardour/reverse.cc
index 15f90fec45..2279331701 100644
--- a/libs/ardour/reverse.cc
+++ b/libs/ardour/reverse.cc
@@ -47,12 +47,12 @@ Reverse::run (boost::shared_ptr<AudioRegion> region)
{
SourceList nsrcs;
SourceList::iterator si;
- const jack_nframes_t blocksize = 256 * 1048;
+ const nframes_t blocksize = 256 * 1048;
Sample buf[blocksize];
- jack_nframes_t fpos;
- jack_nframes_t fend;
- jack_nframes_t fstart;
- jack_nframes_t to_read;
+ nframes_t fpos;
+ nframes_t fend;
+ nframes_t fstart;
+ nframes_t to_read;
int ret = -1;
/* create new sources */
@@ -88,7 +88,7 @@ Reverse::run (boost::shared_ptr<AudioRegion> region)
/* swap memory order */
- for (jack_nframes_t i = 0; i < to_read/2; ++i) {
+ for (nframes_t i = 0; i < to_read/2; ++i) {
swap (buf[i],buf[to_read-1-i]);
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 398df02179..308dbb57cb 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -51,23 +51,22 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-
uint32_t Route::order_key_cnt = 0;
Route::Route (Session& sess, string name, int input_min, int input_max, int output_min, int output_max, Flag flg, DataType default_type)
: IO (sess, name, input_min, input_max, output_min, output_max, default_type),
_flags (flg),
- _solo_control (*this, ToggleControllable::SoloControl),
- _mute_control (*this, ToggleControllable::MuteControl)
+ _solo_control (X_("solo"), *this, ToggleControllable::SoloControl),
+ _mute_control (X_("mute"), *this, ToggleControllable::MuteControl)
{
init ();
}
Route::Route (Session& sess, const XMLNode& node)
: IO (sess, "route"),
- _solo_control (*this, ToggleControllable::SoloControl),
- _mute_control (*this, ToggleControllable::MuteControl)
+ _solo_control (X_("solo"), *this, ToggleControllable::SoloControl),
+ _mute_control (X_("mute"), *this, ToggleControllable::MuteControl)
{
init ();
set_state (node);
@@ -92,7 +91,7 @@ Route::init ()
_declickable = false;
_pending_declick = true;
_remote_control_id = 0;
-
+
_edit_group = 0;
_mix_group = 0;
@@ -229,8 +228,8 @@ Route::set_gain (gain_t val, void *src)
*/
void
Route::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)
{
// This is definitely very audio-only for now
@@ -243,9 +242,18 @@ Route::process_output_buffers (BufferSet& bufs,
IO *co;
bool mute_audible;
bool solo_audible;
- bool no_monitor = (Config->get_use_hardware_monitoring() || !Config->get_use_sw_monitoring ());
+ bool no_monitor;
gain_t* gab = _session.gain_automation_buffer();
+ switch (Config->get_monitoring_model()) {
+ case HardwareMonitoring:
+ case ExternalMonitoring:
+ no_monitor = true;
+ break;
+ default:
+ no_monitor = false;
+ }
+
declick = _pending_declick;
{
@@ -324,7 +332,7 @@ Route::process_output_buffers (BufferSet& bufs,
// TODO: this is probably wrong
- (no_monitor && record_enabled() && (!_session.get_auto_input() || _session.actively_recording()))
+ (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording()))
) {
@@ -408,7 +416,7 @@ Route::process_output_buffers (BufferSet& bufs,
// rec-enabled but not s/w monitoring
- (no_monitor && record_enabled() && (!_session.get_auto_input() || _session.actively_recording()))
+ (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording()))
) {
@@ -435,11 +443,11 @@ Route::process_output_buffers (BufferSet& bufs,
// h/w monitoring not in use
- (!Config->get_use_hardware_monitoring() &&
+ (!Config->get_monitoring_model() == HardwareMonitoring &&
// AND software monitoring required
- Config->get_use_sw_monitoring())) {
+ Config->get_monitoring_model() == SoftwareMonitoring)) {
if (apply_gain_automation) {
@@ -447,7 +455,7 @@ Route::process_output_buffers (BufferSet& bufs,
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
Sample* const sp = i->data(nframes);
- for (jack_nframes_t nx = 0; nx < nframes; ++nx) {
+ for (nframes_t nx = 0; nx < nframes; ++nx) {
sp[nx] *= -gab[nx];
}
}
@@ -455,7 +463,7 @@ Route::process_output_buffers (BufferSet& bufs,
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
Sample* const sp = i->data(nframes);
- for (jack_nframes_t nx = 0; nx < nframes; ++nx) {
+ for (nframes_t nx = 0; nx < nframes; ++nx) {
sp[nx] *= gab[nx];
}
}
@@ -492,7 +500,7 @@ Route::process_output_buffers (BufferSet& bufs,
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
Sample* const sp = i->data(nframes);
- apply_gain_to_buffer(sp,nframes,this_gain);
+ Session::apply_gain_to_buffer(sp,nframes,this_gain);
}
} else if (_gain == 0) {
@@ -571,7 +579,7 @@ Route::process_output_buffers (BufferSet& bufs,
// recording but not s/w monitoring
- (no_monitor && record_enabled() && (!_session.get_auto_input() || _session.actively_recording()))
+ (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording()))
) {
@@ -604,7 +612,7 @@ Route::process_output_buffers (BufferSet& bufs,
/* relax */
- } else if (no_monitor && record_enabled() && (!_session.get_auto_input() || _session.actively_recording())) {
+ } else if (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording())) {
IO::silence (nframes, offset);
@@ -616,7 +624,7 @@ Route::process_output_buffers (BufferSet& bufs,
// muted by solo of another track, but not using control outs for solo
- (!solo_audible && (_session.solo_model() != Session::SoloBus)) ||
+ (!solo_audible && (Config->get_solo_model() != SoloBus)) ||
// muted by mute of this track
@@ -662,7 +670,7 @@ Route::n_process_buffers ()
}
void
-Route::passthru (jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter_first)
+Route::passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter_first)
{
BufferSet& bufs = _session.get_scratch_buffers(n_process_buffers());
@@ -996,7 +1004,7 @@ Route::_reset_plugin_counts (uint32_t* err_streams)
uint32_t i_cnt;
uint32_t s_cnt;
map<Placement,list<InsertCount> > insert_map;
- jack_nframes_t initial_streams;
+ nframes_t initial_streams;
redirect_max_outs.reset();
i_cnt = 0;
@@ -1352,6 +1360,8 @@ Route::state(bool full_state)
node->add_property ("order-keys", order_string);
node->add_child_nocopy (IO::state (full_state));
+ node->add_child_nocopy (_solo_control.get_state ());
+ node->add_child_nocopy (_mute_control.get_state ());
if (_control_outs) {
XMLNode* cnode = new XMLNode (X_("ControlOuts"));
@@ -1657,6 +1667,12 @@ Route::set_state (const XMLNode& node)
} else if (child->name() == "extra") {
_extra_xml = new XMLNode (*child);
+ } else if (child->name() == "solo") {
+ _solo_control.set_state (*child);
+ _session.add_controllable (&_solo_control);
+ } else if (child->name() == "mute") {
+ _mute_control.set_state (*child);
+ _session.add_controllable (&_mute_control);
}
}
@@ -1680,7 +1696,7 @@ Route::curve_reallocate ()
}
void
-Route::silence (jack_nframes_t nframes, jack_nframes_t offset)
+Route::silence (nframes_t nframes, nframes_t offset)
{
if (!_silent) {
@@ -1915,15 +1931,11 @@ Route::set_active (bool yn)
void
Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_redirects)
{
- jack_nframes_t now = _session.transport_frame();
+ nframes_t now = _session.transport_frame();
{
Glib::RWLock::ReaderLock lm (redirect_lock);
- if (!did_locate) {
- automation_snapshot (now);
- }
-
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
if (Config->get_plugins_stop_with_transport() && can_flush_redirects) {
@@ -1984,7 +1996,7 @@ Route::pans_required () const
}
int
-Route::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset,
+Route::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool session_state_changing, bool can_record, bool rec_monitors_input)
{
if (n_outputs().get_total() == 0) {
@@ -2007,8 +2019,8 @@ Route::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes
return 0;
}
-jack_nframes_t
-Route::check_initial_delay (jack_nframes_t nframes, jack_nframes_t& offset, jack_nframes_t& transport_frame)
+nframes_t
+Route::check_initial_delay (nframes_t nframes, nframes_t& offset, nframes_t& transport_frame)
{
if (_roll_delay > nframes) {
@@ -2033,24 +2045,15 @@ Route::check_initial_delay (jack_nframes_t nframes, jack_nframes_t& offset, jack
}
int
-Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, int declick,
+Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick,
bool can_record, bool rec_monitors_input)
{
- {
- Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
- if (lm.locked()) {
- // automation snapshot can also be called from the non-rt context
- // and it uses the redirect list, so we take the lock out here
- automation_snapshot (_session.transport_frame());
- }
- }
-
if ((n_outputs().get_total() == 0 && _redirects.empty()) || n_inputs().get_total() == 0 || !_active) {
silence (nframes, offset);
return 0;
}
- jack_nframes_t unused = 0;
+ nframes_t unused = 0;
if ((nframes = check_initial_delay (nframes, offset, unused)) == 0) {
return 0;
@@ -2077,7 +2080,7 @@ Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t
}
int
-Route::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset,
+Route::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool can_record, bool rec_monitors_input)
{
silence (nframes, offset);
@@ -2143,7 +2146,7 @@ Route::set_meter_point (MeterPoint p, void *src)
}
}
-jack_nframes_t
+nframes_t
Route::update_total_latency ()
{
_own_latency = 0;
@@ -2169,7 +2172,7 @@ Route::update_total_latency ()
}
void
-Route::set_latency_delay (jack_nframes_t longest_session_latency)
+Route::set_latency_delay (nframes_t longest_session_latency)
{
_initial_delay = longest_session_latency - _own_latency;
@@ -2178,18 +2181,8 @@ Route::set_latency_delay (jack_nframes_t longest_session_latency)
}
}
-void
-Route::automation_snapshot (jack_nframes_t now)
-{
- IO::automation_snapshot (now);
-
- for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
- (*i)->automation_snapshot (now);
- }
-}
-
-Route::ToggleControllable::ToggleControllable (Route& s, ToggleType tp)
- : route (s), type(tp)
+Route::ToggleControllable::ToggleControllable (std::string name, Route& s, ToggleType tp)
+ : Controllable (name), route (s), type(tp)
{
}
@@ -2231,7 +2224,7 @@ Route::ToggleControllable::get_value (void) const
}
void
-Route::set_block_size (jack_nframes_t nframes)
+Route::set_block_size (nframes_t nframes)
{
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
(*i)->set_block_size (nframes);
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index 6654f3c75b..2c2a152416 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -103,7 +103,7 @@ Send::set_state(const XMLNode& node)
}
void
-Send::run (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset)
+Send::run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
{
if (active()) {
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index b670afb1ba..ae5466dda8 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -72,6 +72,7 @@
#include <ardour/data_type.h>
#include <ardour/buffer_set.h>
#include <ardour/source_factory.h>
+#include <ardour/region_factory.h>
#ifdef HAVE_LIBLO
#include <ardour/osc.h>
@@ -102,8 +103,6 @@ sigc::signal<int> Session::AskAboutPendingState;
sigc::signal<void> Session::SendFeedback;
sigc::signal<void> Session::SMPTEOffsetChanged;
-sigc::signal<void> Session::SMPTETypeChanged;
-sigc::signal<void> Session::PullupChanged;
sigc::signal<void> Session::StartTimeChanged;
sigc::signal<void> Session::EndTimeChanged;
@@ -287,9 +286,12 @@ Session::Session (AudioEngine &eng,
first_stage_init (fullpath, snapshot_name);
- if (create (new_session, mix_template, _engine.frame_rate() * 60 * 5)) {
- cerr << "create failed\n";
- throw failed_constructor ();
+ new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
+ if (new_session) {
+ if (create (new_session, mix_template, _engine.frame_rate() * 60 * 5)) {
+ cerr << "create failed\n";
+ throw failed_constructor ();
+ }
}
if (second_stage_init (new_session)) {
@@ -303,7 +305,7 @@ Session::Session (AudioEngine &eng,
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
- Config->ParameterChanged.connect (mem_fun (*this, &Session::handle_configuration_change));
+ Config->ParameterChanged.connect (mem_fun (*this, &Session::config_changed));
if (was_dirty) {
DirtyChanged (); /* EMIT SIGNAL */
@@ -319,7 +321,7 @@ Session::Session (AudioEngine &eng,
uint32_t master_out_channels,
uint32_t requested_physical_in,
uint32_t requested_physical_out,
- jack_nframes_t initial_length)
+ nframes_t initial_length)
: _engine (eng),
_scratch_buffers(new BufferSet()),
@@ -344,9 +346,12 @@ Session::Session (AudioEngine &eng,
n_physical_inputs = max (requested_physical_in, _engine.n_physical_inputs());
first_stage_init (fullpath, snapshot_name);
-
- if (create (new_session, 0, initial_length)) {
- throw failed_constructor ();
+
+ new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
+ if (new_session) {
+ if (create (new_session, 0, initial_length)) {
+ throw failed_constructor ();
+ }
}
if (control_out_channels) {
@@ -368,8 +373,8 @@ Session::Session (AudioEngine &eng,
output_ac = AutoConnectOption (output_ac & ~AutoConnectMaster);
}
- input_auto_connect = input_ac;
- output_auto_connect = output_ac;
+ Config->set_input_auto_connect (input_ac);
+ Config->set_output_auto_connect (output_ac);
if (second_stage_init (new_session)) {
throw failed_constructor ();
@@ -601,6 +606,8 @@ Session::when_engine_running ()
set_block_size (_engine.frames_per_cycle());
set_frame_rate (_engine.frame_rate());
+ Config->map_parameters (mem_fun (*this, &Session::config_changed));
+
/* every time we reconnect, recompute worst case output latencies */
_engine.Running.connect (mem_fun (*this, &Session::set_worst_io_latencies));
@@ -626,7 +633,7 @@ Session::when_engine_running ()
if (_click_io->set_state (*child->children().front()) == 0) {
- _clicking = click_requested;
+ _clicking = Config->get_clicking ();
} else {
@@ -644,7 +651,7 @@ Session::when_engine_running ()
if (_click_io->add_output_port (first_physical_output, this)) {
// relax, even though its an error
} else {
- _clicking = click_requested;
+ _clicking = Config->get_clicking ();
}
}
}
@@ -657,7 +664,7 @@ Session::when_engine_running ()
set_worst_io_latencies ();
if (_clicking) {
- ControlChanged (Clicking); /* EMIT SIGNAL */
+ // XXX HOW TO ALERT UI TO THIS ? DO WE NEED TO?
}
if (auditioner == 0) {
@@ -925,77 +932,13 @@ Session::record_enabling_legal () const
// return false;
// }
- if (all_safe) {
+ if (Config->get_all_safe()) {
return false;
}
return true;
}
void
-Session::set_auto_play (bool yn)
-{
- if (auto_play != yn) {
- auto_play = yn;
- set_dirty ();
- ControlChanged (AutoPlay);
- }
-}
-
-void
-Session::set_auto_return (bool yn)
-{
- if (auto_return != yn) {
- auto_return = yn;
- set_dirty ();
- ControlChanged (AutoReturn);
- }
-}
-
-void
-Session::set_crossfades_active (bool yn)
-{
- if (crossfades_active != yn) {
- crossfades_active = yn;
- set_dirty ();
- ControlChanged (CrossFadesActive);
- }
-}
-
-void
-Session::set_do_not_record_plugins (bool yn)
-{
- if (do_not_record_plugins != yn) {
- do_not_record_plugins = yn;
- set_dirty ();
- ControlChanged (RecordingPlugins);
- }
-}
-
-void
-Session::set_auto_input (bool yn)
-{
- if (auto_input != yn) {
- auto_input = yn;
-
- if (Config->get_use_hardware_monitoring() && transport_rolling()) {
- /* auto-input only makes a difference if we're rolling */
-
- boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
- for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
- if ((*i)->record_enabled ()) {
- //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
- (*i)->monitor_input (!auto_input);
- }
- }
- }
-
- set_dirty();
- ControlChanged (AutoInput);
- }
-}
-
-void
Session::reset_input_monitor_state ()
{
if (transport_rolling()) {
@@ -1005,7 +948,7 @@ Session::reset_input_monitor_state ()
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
- (*i)->monitor_input (Config->get_use_hardware_monitoring() && !auto_input);
+ (*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !Config->get_auto_input());
}
}
} else {
@@ -1013,44 +956,19 @@ Session::reset_input_monitor_state ()
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->record_enabled ()) {
- //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
- (*i)->monitor_input (Config->get_use_hardware_monitoring());
+ //cerr << "switching to input = " << !Config->get_auto_input() << __FILE__ << __LINE__ << endl << endl;
+ (*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring);
}
}
}
}
-
-void
-Session::set_input_auto_connect (bool yn)
-{
- if (yn) {
- input_auto_connect = AutoConnectOption (input_auto_connect|AutoConnectPhysical);
- } else {
- input_auto_connect = AutoConnectOption (input_auto_connect|~AutoConnectPhysical);
- }
- set_dirty ();
-}
-
-bool
-Session::get_input_auto_connect () const
-{
- return (input_auto_connect & AutoConnectPhysical);
-}
-
-void
-Session::set_output_auto_connect (AutoConnectOption aco)
-{
- output_auto_connect = aco;
- set_dirty ();
-}
-
void
Session::auto_punch_start_changed (Location* location)
{
replace_event (Event::PunchIn, location->start());
- if (get_record_enabled() && get_punch_in()) {
+ if (get_record_enabled() && Config->get_punch_in()) {
/* capture start has been changed, so save new pending state */
save_state ("", true);
}
@@ -1059,7 +977,7 @@ Session::auto_punch_start_changed (Location* location)
void
Session::auto_punch_end_changed (Location* location)
{
- jack_nframes_t when_to_stop = location->end();
+ nframes_t when_to_stop = location->end();
// when_to_stop += _worst_output_latency + _worst_input_latency;
replace_event (Event::PunchOut, when_to_stop);
}
@@ -1067,7 +985,7 @@ Session::auto_punch_end_changed (Location* location)
void
Session::auto_punch_changed (Location* location)
{
- jack_nframes_t when_to_stop = location->end();
+ nframes_t when_to_stop = location->end();
replace_event (Event::PunchIn, location->start());
//when_to_stop += _worst_output_latency + _worst_input_latency;
@@ -1079,7 +997,7 @@ Session::auto_loop_changed (Location* location)
{
replace_event (Event::AutoLoop, location->end(), location->start());
- if (transport_rolling() && get_auto_loop()) {
+ if (transport_rolling() && play_loop) {
//if (_transport_frame < location->start() || _transport_frame > location->end()) {
@@ -1090,7 +1008,7 @@ Session::auto_loop_changed (Location* location)
request_locate (location->start(), true);
}
- else if (seamless_loop && !loop_changing) {
+ else if (Config->get_seamless_loop() && !loop_changing) {
// schedule a locate-roll to refill the diskstreams at the
// previous loop end
@@ -1148,48 +1066,6 @@ Session::set_auto_punch_location (Location* location)
}
void
-Session::set_punch_in (bool yn)
-{
- if (punch_in == yn) {
- return;
- }
-
- Location* location;
-
- if ((location = _locations.auto_punch_location()) != 0) {
- if ((punch_in = yn) == true) {
- replace_event (Event::PunchIn, location->start());
- } else {
- remove_event (location->start(), Event::PunchIn);
- }
- }
-
- set_dirty();
- ControlChanged (PunchIn); /* EMIT SIGNAL */
-}
-
-void
-Session::set_punch_out (bool yn)
-{
- if (punch_out == yn) {
- return;
- }
-
- Location* location;
-
- if ((location = _locations.auto_punch_location()) != 0) {
- if ((punch_out = yn) == true) {
- replace_event (Event::PunchOut, location->end());
- } else {
- clear_events (Event::PunchOut);
- }
- }
-
- set_dirty();
- ControlChanged (PunchOut); /* EMIT SIGNAL */
-}
-
-void
Session::set_auto_loop_location (Location* location)
{
Location* existing;
@@ -1282,7 +1158,7 @@ Session::enable_record ()
_last_record_location = _transport_frame;
deliver_mmc(MIDI::MachineControl::cmdRecordStrobe, _last_record_location);
- if (Config->get_use_hardware_monitoring() && auto_input) {
+ if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->record_enabled ()) {
@@ -1316,7 +1192,7 @@ Session::disable_record (bool rt_context, bool force)
if (rt_context)
deliver_mmc (MIDI::MachineControl::cmdRecordExit, _transport_frame);
- if (Config->get_use_hardware_monitoring() && auto_input) {
+ if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
@@ -1339,11 +1215,11 @@ Session::step_back_from_record ()
{
g_atomic_int_set (&_record_status, Enabled);
- if (Config->get_use_hardware_monitoring()) {
+ if (Config->get_monitoring_model() == HardwareMonitoring) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
- if (auto_input && (*i)->record_enabled ()) {
+ if (Config->get_auto_input() && (*i)->record_enabled ()) {
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
(*i)->monitor_input (false);
}
@@ -1356,14 +1232,14 @@ Session::maybe_enable_record ()
{
g_atomic_int_set (&_record_status, Enabled);
- /* XXX this save should really happen in another thread. its needed so that
- pending capture state can be recovered if we crash.
+ /* this function is currently called from somewhere other than an RT thread.
+ this save_state() call therefore doesn't impact anything.
*/
save_state ("", true);
if (_transport_speed) {
- if (!punch_in) {
+ if (!Config->get_punch_in()) {
enable_record ();
}
} else {
@@ -1374,12 +1250,12 @@ Session::maybe_enable_record ()
set_dirty();
}
-jack_nframes_t
+nframes_t
Session::audible_frame () const
{
- jack_nframes_t ret;
- jack_nframes_t offset;
- jack_nframes_t tf;
+ nframes_t ret;
+ nframes_t offset;
+ nframes_t tf;
/* the first of these two possible settings for "offset"
mean that the audible frame is stationary until
@@ -1433,9 +1309,9 @@ Session::audible_frame () const
}
void
-Session::set_frame_rate (jack_nframes_t frames_per_second)
+Session::set_frame_rate (nframes_t frames_per_second)
{
- /** \fn void Session::set_frame_size(jack_nframes_t)
+ /** \fn void Session::set_frame_size(nframes_t)
the AudioEngine object that calls this guarantees
that it will not be called while we are also in
::process(). Its fine to do things that block
@@ -1446,8 +1322,6 @@ Session::set_frame_rate (jack_nframes_t frames_per_second)
sync_time_vars();
- Route::set_automation_interval ((jack_nframes_t) ceil ((double) frames_per_second * 0.25));
-
// XXX we need some equivalent to this, somehow
// DestructiveFileSource::setup_standard_crossfades (frames_per_second);
@@ -1457,7 +1331,7 @@ Session::set_frame_rate (jack_nframes_t frames_per_second)
}
void
-Session::set_block_size (jack_nframes_t nframes)
+Session::set_block_size (nframes_t nframes)
{
/* the AudioEngine guarantees
that it will not be called while we are also in
@@ -1497,7 +1371,7 @@ void
Session::set_default_fade (float steepness, float fade_msecs)
{
#if 0
- jack_nframes_t fade_frames;
+ nframes_t fade_frames;
/* Don't allow fade of less 1 frame */
@@ -1508,7 +1382,7 @@ Session::set_default_fade (float steepness, float fade_msecs)
} else {
- fade_frames = (jack_nframes_t) floor (fade_msecs * _current_frame_rate * 0.001);
+ fade_frames = (nframes_t) floor (fade_msecs * _current_frame_rate * 0.001);
}
@@ -1799,13 +1673,13 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
} while (track_id < (UINT_MAX-1));
- if (input_auto_connect & AutoConnectPhysical) {
+ if (Config->get_input_auto_connect() & AutoConnectPhysical) {
nphysical_in = min (n_physical_inputs, (uint32_t) physinputs.size());
} else {
nphysical_in = 0;
}
- if (output_auto_connect & AutoConnectPhysical) {
+ if (Config->get_output_auto_connect() & AutoConnectPhysical) {
nphysical_out = min (n_physical_outputs, (uint32_t) physinputs.size());
} else {
nphysical_out = 0;
@@ -1825,7 +1699,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
port = "";
- if (input_auto_connect & AutoConnectPhysical) {
+ if (Config->get_input_auto_connect() & AutoConnectPhysical) {
port = physinputs[(channels_used+x)%nphysical_in];
}
@@ -1839,9 +1713,9 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
port = "";
- if (nphysical_out && (output_auto_connect & AutoConnectPhysical)) {
+ if (nphysical_out && (Config->get_output_auto_connect() & AutoConnectPhysical)) {
port = physoutputs[(channels_used+x)%nphysical_out];
- } else if (output_auto_connect & AutoConnectMaster) {
+ } else if (Config->get_output_auto_connect() & AutoConnectMaster) {
if (_master_out) {
port = _master_out->input (x%_master_out->n_inputs().get(DataType::AUDIO))->name();
}
@@ -1945,7 +1819,7 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
port = "";
- if (input_auto_connect & AutoConnectPhysical) {
+ if (Config->get_input_auto_connect() & AutoConnectPhysical) {
port = physinputs[((n+x)%n_physical_inputs)];
}
@@ -1958,9 +1832,9 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
port = "";
- if (output_auto_connect & AutoConnectPhysical) {
+ if (Config->get_output_auto_connect() & AutoConnectPhysical) {
port = physoutputs[((n+x)%n_physical_outputs)];
- } else if (output_auto_connect & AutoConnectMaster) {
+ } else if (Config->get_output_auto_connect() & AutoConnectMaster) {
if (_master_out) {
port = _master_out->input (x%_master_out->n_inputs().get(DataType::AUDIO))->name();
}
@@ -2014,7 +1888,10 @@ Session::add_routes (RouteList& new_routes, bool save)
}
for (RouteList::iterator x = new_routes.begin(); x != new_routes.end(); ++x) {
- (*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), (*x)));
+
+ boost::weak_ptr<Route> wpr (*x);
+
+ (*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), wpr));
(*x)->mute_changed.connect (mem_fun (*this, &Session::route_mute_changed));
(*x)->output_changed.connect (mem_fun (*this, &Session::set_worst_io_latencies_x));
(*x)->redirects_changed.connect (mem_fun (*this, &Session::update_latency_compensation_proxy));
@@ -2072,11 +1949,11 @@ Session::remove_route (shared_ptr<Route> route)
*/
if (route == _master_out) {
- _master_out = shared_ptr<Route> ((Route*) 0);
+ _master_out = shared_ptr<Route> ();
}
if (route == _control_out) {
- _control_out = shared_ptr<Route> ((Route*) 0);
+ _control_out = shared_ptr<Route> ();
/* cancel control outs for all routes */
@@ -2112,14 +1989,26 @@ Session::remove_route (shared_ptr<Route> route)
update_latency_compensation (false, false);
set_dirty();
+
+ // We need to disconnect the routes inputs and outputs
+ route->disconnect_inputs(NULL);
+ route->disconnect_outputs(NULL);
- /* XXX should we disconnect from the Route's signals ? */
+ /* get rid of it from the dead wood collection in the route list manager */
+
+ /* XXX i think this is unsafe as it currently stands, but i am not sure. (pd, october 2nd, 2006) */
- save_state (_current_snapshot_name);
+ routes.flush ();
/* try to cause everyone to drop their references */
route->drop_references ();
+
+ /* save the new state of the world */
+
+ if (save_state (_current_snapshot_name)) {
+ save_history (_current_snapshot_name);
+ }
}
void
@@ -2129,7 +2018,7 @@ Session::route_mute_changed (void* src)
}
void
-Session::route_solo_changed (void* src, shared_ptr<Route> route)
+Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr)
{
if (solo_update_disabled) {
// We know already
@@ -2137,8 +2026,15 @@ Session::route_solo_changed (void* src, shared_ptr<Route> route)
}
bool is_track;
-
- is_track = (dynamic_cast<Track*>(route.get()) != 0);
+ boost::shared_ptr<Route> route = wpr.lock ();
+
+ if (!route) {
+ /* should not happen */
+ error << string_compose (_("programming error: %1"), X_("invalid route weak ptr passed to route_solo_changed")) << endmsg;
+ return;
+ }
+
+ is_track = (boost::dynamic_pointer_cast<AudioTrack>(route) != 0);
shared_ptr<RouteList> r = routes.reader ();
@@ -2174,7 +2070,7 @@ Session::route_solo_changed (void* src, shared_ptr<Route> route)
then leave it as it is.
*/
- if (_solo_latched) {
+ if (Config->get_solo_latched()) {
continue;
}
}
@@ -2224,16 +2120,6 @@ Session::route_solo_changed (void* src, shared_ptr<Route> route)
}
void
-Session::set_solo_latched (bool yn)
-{
- if (yn != _solo_latched) {
- _solo_latched = yn;
- set_dirty ();
- ControlChanged (SoloLatch);
- }
-}
-
-void
Session::update_route_solo_state ()
{
bool mute = false;
@@ -2392,7 +2278,7 @@ Session::find_current_end ()
return;
}
- jack_nframes_t max = get_maximum_extent ();
+ nframes_t max = get_maximum_extent ();
if (max > end_location->end()) {
end_location->set_end (max);
@@ -2401,11 +2287,11 @@ Session::find_current_end ()
}
}
-jack_nframes_t
+nframes_t
Session::get_maximum_extent () const
{
- jack_nframes_t max = 0;
- jack_nframes_t me;
+ nframes_t max = 0;
+ nframes_t me;
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
@@ -2615,15 +2501,21 @@ Session::add_region (boost::shared_ptr<Region> region)
set_dirty();
if (added) {
- region->GoingAway.connect (sigc::bind (mem_fun (*this, &Session::remove_region), region));
- region->StateChanged.connect (sigc::bind (mem_fun (*this, &Session::region_changed), region));
+ region->GoingAway.connect (sigc::bind (mem_fun (*this, &Session::remove_region), boost::weak_ptr<Region>(region)));
+ region->StateChanged.connect (sigc::bind (mem_fun (*this, &Session::region_changed), boost::weak_ptr<Region>(region)));
RegionAdded (region); /* EMIT SIGNAL */
}
}
void
-Session::region_changed (Change what_changed, boost::shared_ptr<Region> region)
+Session::region_changed (Change what_changed, boost::weak_ptr<Region> weak_region)
{
+ boost::shared_ptr<Region> region (weak_region.lock ());
+
+ if (!region) {
+ return;
+ }
+
if (what_changed & Region::HiddenChanged) {
/* relay hidden changes */
RegionHiddenChange (region);
@@ -2631,17 +2523,17 @@ Session::region_changed (Change what_changed, boost::shared_ptr<Region> region)
}
void
-Session::region_renamed (boost::shared_ptr<Region> region)
-{
- add_region (region);
-}
-
-void
-Session::remove_region (boost::shared_ptr<Region> region)
+Session::remove_region (boost::weak_ptr<Region> weak_region)
{
RegionList::iterator i;
+ boost::shared_ptr<Region> region (weak_region.lock ());
+
+ if (!region) {
+ return;
+ }
+
bool removed = false;
-
+
{
Glib::Mutex::Lock lm (region_lock);
@@ -2682,7 +2574,7 @@ Session::find_whole_file_parent (Region& child)
}
}
- return boost::shared_ptr<AudioRegion> ((AudioRegion*) 0);
+ return boost::shared_ptr<AudioRegion> ();
}
void
@@ -2795,9 +2687,11 @@ Session::remove_source (boost::weak_ptr<Source> src)
boost::shared_ptr<Source> source = src.lock();
if (!source) {
- cerr << "removing a source DEAD\n";
- } else {
- cerr << "removing a source " << source->name () << endl;
+ return;
+ }
+
+ {
+ Glib::Mutex::Lock lm (source_lock);
{
Glib::Mutex::Lock lm (source_lock);
@@ -2806,18 +2700,18 @@ Session::remove_source (boost::weak_ptr<Source> src)
sources.erase (i);
}
}
+ }
+
+ if (!_state_of_the_state & InCleanup) {
- if (!_state_of_the_state & InCleanup) {
-
- /* save state so we don't end up with a session file
- referring to non-existent sources.
- */
-
- save_state (_current_snapshot_name);
- }
+ /* save state so we don't end up with a session file
+ referring to non-existent sources.
+ */
- SourceRemoved(source); /* EMIT SIGNAL */
+ save_state (_current_snapshot_name);
}
+
+ SourceRemoved(source); /* EMIT SIGNAL */
}
boost::shared_ptr<Source>
@@ -3613,16 +3507,28 @@ Session::remove_redirect (Redirect* redirect)
set_dirty();
}
-jack_nframes_t
+nframes_t
Session::available_capture_duration ()
{
- const double scale = 4096.0 / sizeof (Sample);
+ float sample_bytes_on_disk;
+
+ switch (Config->get_native_file_data_format()) {
+ case FormatFloat:
+ sample_bytes_on_disk = 4;
+ break;
+
+ case FormatInt24:
+ sample_bytes_on_disk = 3;
+ break;
+ }
+
+ double scale = 4096.0 / sample_bytes_on_disk;
if (_total_free_4k_blocks * scale > (double) max_frames) {
return max_frames;
}
- return (jack_nframes_t) floor (_total_free_4k_blocks * scale);
+ return (nframes_t) floor (_total_free_4k_blocks * scale);
}
void
@@ -3675,23 +3581,6 @@ Session::connection_by_name (string name) const
}
void
-Session::set_edit_mode (EditMode mode)
-{
- _edit_mode = mode;
-
- {
- Glib::Mutex::Lock lm (playlist_lock);
-
- for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
- (*i)->set_edit_mode (mode);
- }
- }
-
- set_dirty ();
- ControlChanged (EditingMode); /* EMIT SIGNAL */
-}
-
-void
Session::tempo_map_changed (Change ignored)
{
clear_clicks ();
@@ -3816,17 +3705,7 @@ Session::n_playlists () const
}
void
-Session::set_solo_model (SoloModel sm)
-{
- if (sm != _solo_model) {
- _solo_model = sm;
- ControlChanged (SoloingModel);
- set_dirty ();
- }
-}
-
-void
-Session::allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howmany, bool force)
+Session::allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, bool force)
{
if (!force && howmany <= _npan_buffers) {
return;
@@ -3871,7 +3750,7 @@ Session::freeze (InterThreadInfo& itt)
}
int
-Session::write_one_audio_track (AudioTrack& track, jack_nframes_t start, jack_nframes_t len,
+Session::write_one_audio_track (AudioTrack& track, nframes_t start, nframes_t len,
bool overwrite, vector<boost::shared_ptr<Source> >& srcs, InterThreadInfo& itt)
{
boost::shared_ptr<AudioFileSource> fsource;
@@ -3888,7 +3767,7 @@ Session::write_one_audio_track (AudioTrack& track, jack_nframes_t start, jack_nf
BufferSet buffers;
// any bigger than this seems to cause stack overflows in called functions
- const jack_nframes_t chunk_size = (128 * 1024)/4;
+ const nframes_t chunk_size = (128 * 1024)/4;
g_atomic_int_set (&processing_prohibited, 1);
@@ -3939,7 +3818,7 @@ Session::write_one_audio_track (AudioTrack& track, jack_nframes_t start, jack_nf
to_do = len;
/* create a set of reasonably-sized buffers */
-buffers.ensure_buffers(nchans, chunk_size);
+ buffers.ensure_buffers(nchans, chunk_size);
buffers.set_count(nchans);
while (to_do && !itt.cancel) {
@@ -3991,7 +3870,12 @@ buffers.ensure_buffers(nchans, chunk_size);
afs->build_peaks ();
}
}
-
+
+ /* construct a region to represent the bounced material */
+
+ boost::shared_ptr<Region> aregion = RegionFactory::create (srcs, 0, srcs.front()->length(),
+ region_name_from_path (srcs.front()->name()));
+
ret = 0;
}
@@ -4077,36 +3961,6 @@ Session::nbusses () const
}
void
-Session::set_layer_model (LayerModel lm)
-{
- if (lm != layer_model) {
- layer_model = lm;
- set_dirty ();
- ControlChanged (LayeringModel);
- }
-}
-
-void
-Session::set_xfade_model (CrossfadeModel xm)
-{
- if (xm != xfade_model) {
- xfade_model = xm;
- set_dirty ();
- ControlChanged (CrossfadingModel);
- }
-}
-
-void
-Session::handle_configuration_change (const char* parameter)
-{
- if (!strcmp (parameter, "use-video-sync")) {
- if (_transport_speed == 0.0f) {
- waiting_for_sync_offset = true;
- }
- }
-}
-
-void
Session::add_curve(Curve *curve)
{
curves[curve->id()] = curve;
diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc
index e04bb61c30..5fd6d70983 100644
--- a/libs/ardour/session_click.cc
+++ b/libs/ardour/session_click.cc
@@ -38,7 +38,7 @@ using namespace PBD;
Pool Session::Click::pool ("click", sizeof (Click), 128);
void
-Session::click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t offset)
+Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
{
TempoMap::BBTPointList *points;
Sample *buf;
@@ -90,8 +90,8 @@ Session::click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t off
for (list<Click*>::iterator i = clicks.begin(); i != clicks.end(); ) {
- jack_nframes_t copy;
- jack_nframes_t internal_offset;
+ nframes_t copy;
+ nframes_t internal_offset;
Click *clk;
list<Click*>::iterator next;
@@ -145,17 +145,19 @@ Session::setup_click_sounds (int which)
click_data = 0;
}
- if (click_sound.length() == 0) {
+ string path = Config->get_click_emphasis_sound();
+
+ if (path.empty()) {
click_data = const_cast<Sample*> (default_click);
click_length = default_click_length;
} else {
- if ((sndfile = sf_open (click_sound.c_str(), SFM_READ, &info)) == 0) {
+ if ((sndfile = sf_open (path.c_str(), SFM_READ, &info)) == 0) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
- warning << string_compose (_("cannot open click soundfile %1 (%2)"), click_sound, errbuf) << endmsg;
+ warning << string_compose (_("cannot open click soundfile %1 (%2)"), path, errbuf) << endmsg;
_clicking = false;
return;
}
@@ -182,14 +184,16 @@ Session::setup_click_sounds (int which)
click_emphasis_data = 0;
}
- if (click_emphasis_sound.length() == 0) {
+ string path = Config->get_click_emphasis_sound();
+
+ if (path.empty()) {
click_emphasis_data = const_cast<Sample*> (default_click_emphasis);
click_emphasis_length = default_click_emphasis_length;
} else {
- if ((sndfile = sf_open (click_emphasis_sound.c_str(), SFM_READ, &info)) == 0) {
+ if ((sndfile = sf_open (path.c_str(), SFM_READ, &info)) == 0) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
- warning << string_compose (_("cannot open click emphasis soundfile %1 (%2)"), click_emphasis_sound, errbuf) << endmsg;
+ warning << string_compose (_("cannot open click emphasis soundfile %1 (%2)"), path, errbuf) << endmsg;
return;
}
@@ -218,46 +222,3 @@ Session::clear_clicks ()
clicks.clear ();
}
-
-void
-Session::set_click_sound (string path)
-{
- if (path != click_sound) {
- click_sound = path;
- setup_click_sounds (1);
- }
-}
-
-void
-Session::set_click_emphasis_sound (string path)
-{
- if (path != click_emphasis_sound) {
- click_emphasis_sound = path;
- setup_click_sounds (-1);
- }
-}
-
-void
-Session::set_clicking (bool yn)
-{
- if (click_requested != yn) {
- click_requested = yn;
-
- if (yn) {
- if (_click_io && click_data) {
- _clicking = true;
- }
- } else {
- _clicking = false;
- }
-
- ControlChanged (Clicking); /* EMIT SIGNAL */
- }
-}
-
-bool
-Session::get_clicking () const
-{
- return click_requested;
-}
-
diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc
index 9b6313fff3..dc7eabf40f 100644
--- a/libs/ardour/session_events.cc
+++ b/libs/ardour/session_events.cc
@@ -59,21 +59,21 @@ static const char* event_names[] = {
};
void
-Session::add_event (jack_nframes_t frame, Event::Type type, jack_nframes_t target_frame)
+Session::add_event (nframes_t frame, Event::Type type, nframes_t target_frame)
{
Event* ev = new Event (type, Event::Add, frame, target_frame, 0);
queue_event (ev);
}
void
-Session::remove_event (jack_nframes_t frame, Event::Type type)
+Session::remove_event (nframes_t frame, Event::Type type)
{
Event* ev = new Event (type, Event::Remove, frame, 0, 0);
queue_event (ev);
}
void
-Session::replace_event (Event::Type type, jack_nframes_t frame, jack_nframes_t target)
+Session::replace_event (Event::Type type, nframes_t frame, nframes_t target)
{
Event* ev = new Event (type, Event::Replace, frame, target, 0);
queue_event (ev);
@@ -314,7 +314,15 @@ Session::process_event (Event* ev)
switch (ev->type) {
case Event::SetLoop:
- set_auto_loop (ev->yes_or_no);
+ set_play_loop (ev->yes_or_no);
+ break;
+
+ case Event::AutoLoop:
+ if (play_loop) {
+ start_locate (ev->target_frame, true, false, Config->get_seamless_loop());
+ }
+ remove = false;
+ del = false;
break;
case Event::Locate:
@@ -345,7 +353,7 @@ Session::process_event (Event* ev)
case Event::PunchIn:
// cerr << "PunchIN at " << transport_frame() << endl;
- if (punch_in && record_status() == Enabled) {
+ if (Config->get_punch_in() && record_status() == Enabled) {
enable_record ();
}
remove = false;
@@ -354,7 +362,7 @@ Session::process_event (Event* ev)
case Event::PunchOut:
// cerr << "PunchOUT at " << transport_frame() << endl;
- if (punch_out) {
+ if (Config->get_punch_out()) {
step_back_from_record ();
}
remove = false;
@@ -384,14 +392,6 @@ Session::process_event (Event* ev)
del = false;
break;
- case Event::AutoLoop:
- if (auto_loop) {
- start_locate (ev->target_frame, true, false, seamless_loop);
- }
- remove = false;
- del = false;
- break;
-
case Event::Overwrite:
overwrite_some_buffers (static_cast<AudioDiskstream*>(ev->ptr));
break;
@@ -401,7 +401,7 @@ Session::process_event (Event* ev)
break;
case Event::SetSlaveSource:
- set_slave_source (ev->slave, ev->target_frame);
+ set_slave_source (ev->slave);
break;
case Event::Audition:
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index 946d825c1c..6902a426c3 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -154,7 +154,7 @@ AudioExportSpecification::clear ()
}
int
-AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frate)
+AudioExportSpecification::prepare (nframes_t blocksize, nframes_t frate)
{
char errbuf[256];
GDitherSize dither_size;
@@ -217,7 +217,7 @@ AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frat
}
src_data.src_ratio = sample_rate / (double) frame_rate;
- out_samples_max = (jack_nframes_t) ceil (blocksize * src_data.src_ratio * channels);
+ out_samples_max = (nframes_t) ceil (blocksize * src_data.src_ratio * channels);
dataF2 = new float[out_samples_max];
max_leftover_frames = 4 * blocksize;
@@ -259,7 +259,7 @@ AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frat
}
int
-AudioExportSpecification::process (jack_nframes_t nframes)
+AudioExportSpecification::process (nframes_t nframes)
{
float* float_buffer = 0;
uint32_t chn;
@@ -267,7 +267,7 @@ AudioExportSpecification::process (jack_nframes_t nframes)
uint32_t i;
sf_count_t written;
char errbuf[256];
- jack_nframes_t to_write = 0;
+ nframes_t to_write = 0;
int cnt = 0;
do {
@@ -414,7 +414,7 @@ AudioExportSpecification::process (jack_nframes_t nframes)
break;
}
- if ((jack_nframes_t) written != to_write) {
+ if ((nframes_t) written != to_write) {
sf_error_str (out, errbuf, sizeof (errbuf) - 1);
error << string_compose(_("Export: could not write data to output file (%1)"), errbuf) << endmsg;
return -1;
@@ -463,7 +463,7 @@ Session::stop_audio_export (AudioExportSpecification& spec)
/* restart slaving */
if (post_export_slave != None) {
- set_slave_source (post_export_slave, post_export_position);
+ Config->set_slave_source (post_export_slave);
} else {
locate (post_export_position, false, false, false);
}
@@ -518,10 +518,10 @@ Session::prepare_to_export (AudioExportSpecification& spec)
/* no slaving */
- post_export_slave = _slave_type;
+ post_export_slave = Config->get_slave_source ();
post_export_position = _transport_frame;
- set_slave_source (None, 0);
+ Config->set_slave_source (None);
/* get transport ready */
@@ -539,12 +539,12 @@ Session::prepare_to_export (AudioExportSpecification& spec)
}
int
-Session::process_export (jack_nframes_t nframes, AudioExportSpecification* spec)
+Session::process_export (nframes_t nframes, AudioExportSpecification* spec)
{
uint32_t chn;
uint32_t x;
int ret = -1;
- jack_nframes_t this_nframes;
+ nframes_t this_nframes;
/* This is not required to be RT-safe because we are running while freewheeling */
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index d7cdd94b2b..b3a5ec6e01 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -86,114 +86,10 @@ Session::use_config_midi_ports ()
MTC, MMC, etc.
**********************************************************************/
-void
-Session::set_mmc_control (bool yn)
-{
-#if 0
- if (mmc_control == yn) {
- return;
- }
-
- mmc_control = yn;
- set_dirty();
- poke_midi_thread ();
-#endif
- ControlChanged (MMCControl); /* EMIT SIGNAL */
-}
-
-void
-Session::set_midi_control (bool yn)
-{
-#if 0
- if (midi_control == yn) {
- return;
- }
-
- midi_control = yn;
- set_dirty();
- poke_midi_thread ();
-#endif
- ControlChanged (MidiControl); /* EMIT SIGNAL */
-}
-
-void
-Session::set_send_mtc (bool yn)
-{
- /* set the persistent option value regardless */
-
- send_midi_timecode = yn;
- set_dirty();
-
- /* only set the internal flag if we have
- a port.
- */
-
- if (_mtc_port == 0 || send_mtc == yn) {
- return;
- }
-
- send_mtc = yn;
- ControlChanged (SendMTC); /* EMIT SIGNAL */
-}
-
-void
-Session::set_send_mmc (bool yn)
-{
- cerr << "set send mmc " << yn << endl;
-
- if (_mmc_port == 0) {
- cerr << "\tno 1\n";
- return;
- }
-
- if (send_midi_machine_control == yn) {
- cerr << "\tno 2\n";
- return;
- }
-
- /* only set the internal flag if we have
- a port.
- */
-
- if (_mmc_port) {
- cerr << "\tyes\n";
- send_mmc = yn;
- }
-
- /* set the persistent option value regardless */
-
- send_midi_machine_control = yn;
- set_dirty();
-
- ControlChanged (SendMMC); /* EMIT SIGNAL */
-}
-
-void
-Session::set_midi_feedback (bool yn)
-{
-}
-
-bool
-Session::get_midi_feedback () const
-{
- return false;
-}
-
-bool
-Session::get_send_mtc () const
-{
- return send_mtc;
-}
-
-bool
-Session::get_send_mmc () const
-{
- return send_mmc;
-}
-
int
Session::set_mtc_port (string port_tag)
{
+#if 0
MTC_Slave *ms;
if (port_tag.length() == 0) {
@@ -227,6 +123,7 @@ Session::set_mtc_port (string port_tag)
Config->set_mtc_port_name (port_tag);
out:
+ #endif
MTC_PortChanged(); /* EMIT SIGNAL */
change_midi_ports ();
set_dirty();
@@ -236,6 +133,7 @@ Session::set_mtc_port (string port_tag)
int
Session::set_mmc_port (string port_tag)
{
+#if 0
if (port_tag.length() == 0) {
if (_mmc_port == 0) {
return 0;
@@ -295,8 +193,8 @@ Session::set_mmc_port (string port_tag)
_mmc_port->input()->stop.connect (mem_fun (*this, &Session::spp_stop));
Config->set_mmc_port_name (port_tag);
-
out:
+#endif
MMC_PortChanged(); /* EMIT SIGNAL */
change_midi_ports ();
set_dirty();
@@ -306,6 +204,7 @@ Session::set_mmc_port (string port_tag)
int
Session::set_midi_port (string port_tag)
{
+#if 0
if (port_tag.length() == 0) {
if (_midi_port == 0) {
return 0;
@@ -329,6 +228,7 @@ Session::set_midi_port (string port_tag)
Config->set_midi_port_name (port_tag);
out:
+#endif
MIDI_PortChanged(); /* EMIT SIGNAL */
change_midi_ports ();
set_dirty();
@@ -338,6 +238,7 @@ Session::set_midi_port (string port_tag)
void
Session::set_trace_midi_input (bool yn, MIDI::Port* port)
{
+#if 0
MIDI::Parser* input_parser;
if (port) {
@@ -364,6 +265,7 @@ Session::set_trace_midi_input (bool yn, MIDI::Port* port)
}
}
}
+#endif
Config->set_trace_midi_input (yn);
}
@@ -371,6 +273,7 @@ Session::set_trace_midi_input (bool yn, MIDI::Port* port)
void
Session::set_trace_midi_output (bool yn, MIDI::Port* port)
{
+#if 0
MIDI::Parser* output_parser;
if (port) {
@@ -397,6 +300,7 @@ Session::set_trace_midi_output (bool yn, MIDI::Port* port)
}
}
+#endif
Config->set_trace_midi_output (yn);
}
@@ -404,6 +308,7 @@ Session::set_trace_midi_output (bool yn, MIDI::Port* port)
bool
Session::get_trace_midi_input(MIDI::Port *port)
{
+#if 0
MIDI::Parser* input_parser;
if (port) {
if ((input_parser = port->input()) != 0) {
@@ -429,6 +334,7 @@ Session::get_trace_midi_input(MIDI::Port *port)
}
}
}
+#endif
return false;
}
@@ -436,6 +342,7 @@ Session::get_trace_midi_input(MIDI::Port *port)
bool
Session::get_trace_midi_output(MIDI::Port *port)
{
+#if 0
MIDI::Parser* output_parser;
if (port) {
if ((output_parser = port->output()) != 0) {
@@ -461,6 +368,7 @@ Session::get_trace_midi_output(MIDI::Port *port)
}
}
}
+#endif
return false;
@@ -492,21 +400,20 @@ Session::setup_midi_control ()
if (_mmc_port != 0) {
- send_mmc = send_midi_machine_control;
+ Config->set_send_mmc (session_send_mmc);
} else {
mmc = 0;
- send_mmc = false;
+ session_send_mmc = false;
}
if (_mtc_port != 0) {
- send_mtc = send_midi_timecode;
+ Config->set_send_mtc (session_send_mtc);
} else {
-
- send_mtc = false;
+ session_send_mtc = false;
}
}
@@ -553,7 +460,7 @@ Session::midi_read (MIDI::Port* port)
void
Session::spp_start (Parser& ignored)
{
- if (mmc_control && (_slave_type != MTC)) {
+ if (Config->get_mmc_control() && (Config->get_slave_source() != MTC)) {
request_transport_speed (1.0);
}
}
@@ -567,7 +474,7 @@ Session::spp_continue (Parser& ignored)
void
Session::spp_stop (Parser& ignored)
{
- if (mmc_control) {
+ if (Config->get_mmc_control()) {
request_stop ();
}
}
@@ -575,7 +482,7 @@ Session::spp_stop (Parser& ignored)
void
Session::mmc_deferred_play (MIDI::MachineControl &mmc)
{
- if (mmc_control && (_slave_type != MTC)) {
+ if (Config->get_mmc_control() && (Config->get_slave_source() != MTC)) {
request_transport_speed (1.0);
}
}
@@ -583,7 +490,7 @@ Session::mmc_deferred_play (MIDI::MachineControl &mmc)
void
Session::mmc_record_pause (MIDI::MachineControl &mmc)
{
- if (mmc_control) {
+ if (Config->get_mmc_control()) {
maybe_enable_record();
}
}
@@ -591,7 +498,7 @@ Session::mmc_record_pause (MIDI::MachineControl &mmc)
void
Session::mmc_record_strobe (MIDI::MachineControl &mmc)
{
- if (!mmc_control)
+ if (!Config->get_mmc_control())
return;
/* record strobe does an implicit "Play" command */
@@ -619,7 +526,7 @@ Session::mmc_record_strobe (MIDI::MachineControl &mmc)
void
Session::mmc_record_exit (MIDI::MachineControl &mmc)
{
- if (mmc_control) {
+ if (Config->get_mmc_control()) {
disable_record (false);
}
}
@@ -627,7 +534,7 @@ Session::mmc_record_exit (MIDI::MachineControl &mmc)
void
Session::mmc_stop (MIDI::MachineControl &mmc)
{
- if (mmc_control) {
+ if (Config->get_mmc_control()) {
request_stop ();
}
}
@@ -635,7 +542,7 @@ Session::mmc_stop (MIDI::MachineControl &mmc)
void
Session::mmc_pause (MIDI::MachineControl &mmc)
{
- if (mmc_control) {
+ if (Config->get_mmc_control()) {
/* We support RECORD_PAUSE, so the spec says that
we must interpret PAUSE like RECORD_PAUSE if
@@ -655,7 +562,7 @@ static bool step_queued = false;
void
Session::mmc_step (MIDI::MachineControl &mmc, int steps)
{
- if (!mmc_control) {
+ if (!Config->get_mmc_control()) {
return;
}
@@ -674,7 +581,7 @@ Session::mmc_step (MIDI::MachineControl &mmc, int steps)
}
double diff_secs = diff.tv_sec + (diff.tv_usec / 1000000.0);
- double cur_speed = (((steps * 0.5) * smpte_frames_per_second) / diff_secs) / smpte_frames_per_second;
+ double cur_speed = (((steps * 0.5) * Config->get_smpte_frames_per_second()) / diff_secs) / Config->get_smpte_frames_per_second();
if (_transport_speed == 0 || cur_speed * _transport_speed < 0) {
/* change direction */
@@ -706,7 +613,7 @@ Session::mmc_step (MIDI::MachineControl &mmc, int steps)
void
Session::mmc_rewind (MIDI::MachineControl &mmc)
{
- if (mmc_control) {
+ if (Config->get_mmc_control()) {
request_transport_speed(-8.0f);
}
}
@@ -714,7 +621,7 @@ Session::mmc_rewind (MIDI::MachineControl &mmc)
void
Session::mmc_fast_forward (MIDI::MachineControl &mmc)
{
- if (mmc_control) {
+ if (Config->get_mmc_control()) {
request_transport_speed(8.0f);
}
}
@@ -722,11 +629,11 @@ Session::mmc_fast_forward (MIDI::MachineControl &mmc)
void
Session::mmc_locate (MIDI::MachineControl &mmc, const MIDI::byte* mmc_tc)
{
- if (!mmc_control) {
+ if (!Config->get_mmc_control()) {
return;
}
- jack_nframes_t target_frame;
+ nframes_t target_frame;
SMPTE::Time smpte;
smpte.hours = mmc_tc[0] & 0xf;
@@ -761,18 +668,14 @@ Session::mmc_locate (MIDI::MachineControl &mmc, const MIDI::byte* mmc_tc)
void
Session::mmc_shuttle (MIDI::MachineControl &mmc, float speed, bool forw)
{
- cerr << "MMC shuttle, speed = " << speed << endl;
-
- if (!mmc_control) {
+ if (!Config->get_mmc_control()) {
return;
}
- if (shuttle_speed_threshold >= 0 && speed > shuttle_speed_threshold) {
- speed *= shuttle_speed_factor;
+ if (Config->get_shuttle_speed_threshold() >= 0 && speed > Config->get_shuttle_speed_threshold()) {
+ speed *= Config->get_shuttle_speed_factor();
}
- cerr << "requested MMC control speed = " << speed << endl;
-
if (forw) {
request_transport_speed (speed);
} else {
@@ -783,7 +686,7 @@ Session::mmc_shuttle (MIDI::MachineControl &mmc, float speed, bool forw)
void
Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
{
- if (mmc_control) {
+ if (Config->get_mmc_control()) {
RouteList::iterator i;
boost::shared_ptr<RouteList> r = routes.reader();
@@ -832,7 +735,7 @@ Session::send_full_time_code(jack_nframes_t nframes)
_send_smpte_update = false;
- if (_mtc_port == 0 || !send_mtc) {
+ if (_mtc_port == 0 || !session_send_mtc) {
return 0;
}
@@ -897,7 +800,7 @@ Session::send_midi_time_code_for_cycle(jack_nframes_t nframes)
printf("Negative????\n");
}
- if (_mtc_port == 0 || !send_mtc || transmitting_smpte_time.negative
+ if (_mtc_port == 0 || !session_send_mtc || transmitting_smpte_time.negative
/*|| (next_quarter_frame_to_send < 0)*/ ) {
//printf("(MTC) Not sending MTC\n");
return 0;
@@ -996,11 +899,11 @@ Session::send_midi_time_code_for_cycle(jack_nframes_t nframes)
**********************************************************************/
/*
void
-Session::send_mmc_in_another_thread (MIDI::MachineControl::Command cmd, jack_nframes_t target_frame)
+Session::send_mmc_in_another_thread (MIDI::MachineControl::Command cmd, nframes_t target_frame)
{
MIDIRequest* request;
- if (_mtc_port == 0 || !send_mmc) {
+ if (_mtc_port == 0 || !session_send_mmc) {
return;
}
@@ -1020,13 +923,13 @@ Session::send_mmc_in_another_thread (MIDI::MachineControl::Command cmd, jack_nfr
* this process cycle or horrible things will happen.
*/
void
-Session::deliver_mmc (MIDI::MachineControl::Command cmd, jack_nframes_t where)
+Session::deliver_mmc (MIDI::MachineControl::Command cmd, nframes_t where)
{
using namespace MIDI;
int nbytes = 4;
SMPTE::Time smpte;
- if (_mmc_port == 0 || !send_mmc) {
+ if (_mmc_port == 0 || !session_send_mmc) {
//cerr << "Not delivering MMC " << _mmc_port << " - " << send_mmc << endl;
return;
}
@@ -1236,7 +1139,7 @@ Session::terminate_midi_thread ()
void
Session::poke_midi_thread ()
{
- char c;
+ static char c = 0;
if (write (midi_request_pipe[1], &c, 1) != 1) {
error << string_compose(_("cannot send signal to midi thread! (%1)"), strerror (errno)) << endmsg;
@@ -1294,7 +1197,7 @@ Session::midi_thread_work ()
on the appropriate port.
*/
- if (mmc_control && _mmc_port && _mmc_port->selectable() >= 0) {
+ if (Config->get_mmc_control() && _mmc_port && _mmc_port->selectable() >= 0) {
pfd[nfds].fd = _mmc_port->selectable();
pfd[nfds].events = POLLIN|POLLHUP|POLLERR;
ports[nfds] = _mmc_port;
@@ -1306,14 +1209,14 @@ Session::midi_thread_work ()
the relevant port.
*/
- if (_mtc_port && (_mtc_port != _mmc_port || !mmc_control) && _mtc_port->selectable() >= 0) {
+ if (_mtc_port && (_mtc_port != _mmc_port || !Config->get_mmc_control()) && _mtc_port->selectable() >= 0) {
pfd[nfds].fd = _mtc_port->selectable();
pfd[nfds].events = POLLIN|POLLHUP|POLLERR;
ports[nfds] = _mtc_port;
nfds++;
}
- if (_midi_port && (_midi_port != _mmc_port || !mmc_control) && (_midi_port != _mtc_port) && _midi_port->selectable() >= 0) {
+ if (_midi_port && (_midi_port != _mmc_port || !Config->get_mmc_control()) && (_midi_port != _mtc_port) && _midi_port->selectable() >= 0) {
pfd[nfds].fd = _midi_port->selectable();
pfd[nfds].events = POLLIN|POLLHUP|POLLERR;
ports[nfds] = _midi_port;
@@ -1473,14 +1376,3 @@ Session::midi_thread_work ()
}
#endif
-bool
-Session::get_mmc_control () const
-{
- return mmc_control;
-}
-
-bool
-Session::get_midi_control () const
-{
- return midi_control;
-}
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 8379b93e83..c877abdca4 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -46,7 +46,7 @@ using namespace PBD;
using namespace std;
void
-Session::process (jack_nframes_t nframes)
+Session::process (nframes_t nframes)
{
MIDI::Manager::instance()->cycle_start(nframes);
@@ -79,9 +79,9 @@ Session::prepare_diskstreams ()
}
int
-Session::no_roll (jack_nframes_t nframes, jack_nframes_t offset)
+Session::no_roll (nframes_t nframes, nframes_t offset)
{
- jack_nframes_t end_frame = _transport_frame + nframes; // FIXME: varispeed + no_roll ??
+ nframes_t end_frame = _transport_frame + nframes; // FIXME: varispeed + no_roll ??
int ret = 0;
bool declick = get_transport_declick_required();
boost::shared_ptr<RouteList> r = routes.reader ();
@@ -117,7 +117,7 @@ Session::no_roll (jack_nframes_t nframes, jack_nframes_t offset)
}
int
-Session::process_routes (jack_nframes_t nframes, jack_nframes_t offset)
+Session::process_routes (nframes_t nframes, nframes_t offset)
{
bool record_active;
int declick = get_transport_declick_required();
@@ -165,7 +165,7 @@ Session::process_routes (jack_nframes_t nframes, jack_nframes_t offset)
}
int
-Session::silent_process_routes (jack_nframes_t nframes, jack_nframes_t offset)
+Session::silent_process_routes (nframes_t nframes, nframes_t offset)
{
bool record_active = actively_recording();
int declick = get_transport_declick_required();
@@ -209,7 +209,7 @@ Session::silent_process_routes (jack_nframes_t nframes, jack_nframes_t offset)
}
void
-Session::commit_diskstreams (jack_nframes_t nframes, bool &needs_butler)
+Session::commit_diskstreams (nframes_t nframes, bool &needs_butler)
{
int dret;
float pworst = 1.0f;
@@ -255,13 +255,13 @@ Session::commit_diskstreams (jack_nframes_t nframes, bool &needs_butler)
void
-Session::process_with_events (jack_nframes_t nframes)
+Session::process_with_events (nframes_t nframes)
{
Event* ev;
- jack_nframes_t this_nframes;
- jack_nframes_t end_frame;
- jack_nframes_t offset;
- jack_nframes_t stop_limit;
+ nframes_t this_nframes;
+ nframes_t end_frame;
+ nframes_t offset;
+ nframes_t stop_limit;
long frames_moved;
bool session_needs_butler = false;
@@ -386,7 +386,7 @@ Session::process_with_events (jack_nframes_t nframes)
nframes -= this_nframes;
offset += this_nframes;
- frames_moved = (jack_nframes_t) floor (_transport_speed * this_nframes);
+ frames_moved = (nframes_t) floor (_transport_speed * this_nframes);
if (frames_moved < 0) {
decrement_transport_position (-frames_moved);
@@ -446,7 +446,7 @@ Session::transport_locked () const
{
Slave* sl = _slave;
- if (!locate_pending() && ((_slave_type == None) || (sl && sl->ok() && sl->locked()))) {
+ if (!locate_pending() && ((Config->get_slave_source() == None) || (sl && sl->ok() && sl->locked()))) {
return true;
}
@@ -454,17 +454,17 @@ Session::transport_locked () const
}
bool
-Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
+Session::follow_slave (nframes_t nframes, nframes_t offset)
{
float slave_speed;
- jack_nframes_t slave_transport_frame;
- jack_nframes_t this_delta;
+ nframes_t slave_transport_frame;
+ nframes_t this_delta;
int dir;
bool starting;
if (!_slave->ok()) {
stop_transport ();
- set_slave_source (None, 0);
+ Config->set_slave_source (None);
goto noroll;
}
@@ -555,9 +555,9 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
Location* al = _locations.auto_loop_location();
- if (al && auto_loop && (slave_transport_frame < al->start() || slave_transport_frame > al->end())) {
+ if (al && play_loop && (slave_transport_frame < al->start() || slave_transport_frame > al->end())) {
// cancel looping
- request_auto_loop(false);
+ request_play_loop(false);
}
if (slave_transport_frame != _transport_frame) {
@@ -583,7 +583,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
slave_state = Running;
bool ok = true;
- jack_nframes_t frame_delta = slave_transport_frame - _transport_frame;
+ nframes_t frame_delta = slave_transport_frame - _transport_frame;
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
@@ -605,7 +605,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
/* XXX what? */
}
- memset (delta_accumulator, 0, sizeof (jack_nframes_t) * delta_accumulator_size);
+ memset (delta_accumulator, 0, sizeof (nframes_t) * delta_accumulator_size);
average_slave_delta = 0;
this_delta = 0;
}
@@ -628,7 +628,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
// << " tf = " << _transport_frame
// << endl;
- if (_slave_type == JACK) {
+ if (Config->get_slave_source() == JACK) {
last_stop_frame = _transport_frame;
}
@@ -676,7 +676,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
request_transport_speed (adjusted_speed);
#if 1
- if ((jack_nframes_t) average_slave_delta > _slave->resolution()) {
+ if ((nframes_t) average_slave_delta > _slave->resolution()) {
// cerr << "not locked\n";
goto silent_motion;
}
@@ -715,7 +715,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
increment_transport_position (frames_moved);
}
- jack_nframes_t stop_limit;
+ nframes_t stop_limit;
if (actively_recording()) {
stop_limit = max_frames;
@@ -737,12 +737,12 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
}
void
-Session::process_without_events (jack_nframes_t nframes)
+Session::process_without_events (nframes_t nframes)
{
bool session_needs_butler = false;
- jack_nframes_t stop_limit;
+ nframes_t stop_limit;
long frames_moved;
- jack_nframes_t offset = 0;
+ nframes_t offset = 0;
{
if (post_transport_work & (PostTransportLocate|PostTransportStop)) {
@@ -800,7 +800,7 @@ Session::process_without_events (jack_nframes_t nframes)
} else {
increment_transport_position (frames_moved);
}
-
+
maybe_stop (stop_limit);
check_declick_out ();
@@ -811,7 +811,7 @@ Session::process_without_events (jack_nframes_t nframes)
}
void
-Session::process_audition (jack_nframes_t nframes)
+Session::process_audition (nframes_t nframes)
{
Event* ev;
boost::shared_ptr<RouteList> r = routes.reader ();
@@ -851,9 +851,9 @@ Session::process_audition (jack_nframes_t nframes)
}
bool
-Session::maybe_sync_start (jack_nframes_t& nframes, jack_nframes_t& offset)
+Session::maybe_sync_start (nframes_t& nframes, nframes_t& offset)
{
- jack_nframes_t sync_offset;
+ nframes_t sync_offset;
if (!waiting_for_sync_offset) {
return false;
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index a8b2804ff0..cd78a9c362 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -18,6 +18,9 @@
$Id$
*/
+#define __STDC_FORMAT_MACROS 1
+#include <stdint.h>
+
#include <algorithm>
#include <fstream>
#include <string>
@@ -91,6 +94,8 @@
#include <ardour/region_factory.h>
#include <ardour/source_factory.h>
+#include <control_protocol/control_protocol.h>
+
#include "i18n.h"
#include <locale.h>
@@ -106,10 +111,11 @@ Session::first_stage_init (string fullpath, string snapshot_name)
}
char buf[PATH_MAX+1];
- if (!realpath(fullpath.c_str(), buf) && (errno != ENOENT)) {
+ if (!realpath (fullpath.c_str(), buf) && (errno != ENOENT)) {
error << string_compose(_("Could not use path %1 (%s)"), buf, strerror(errno)) << endmsg;
throw failed_constructor();
}
+
_path = string(buf);
if (_path[_path.length()-1] != '/') {
@@ -121,7 +127,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
*/
_name = _current_snapshot_name = snapshot_name;
- setup_raid_path (_path);
_current_frame_rate = _engine.frame_rate ();
_tempo_map = new TempoMap (_current_frame_rate);
@@ -139,16 +144,8 @@ Session::first_stage_init (string fullpath, string snapshot_name)
start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
_end_location_is_free = true;
g_atomic_int_set (&_record_status, Disabled);
- auto_play = false;
- punch_in = false;
- punch_out = false;
- auto_loop = false;
- seamless_loop = false;
loop_changing = false;
- auto_input = true;
- crossfades_active = false;
- all_safe = false;
- auto_return = false;
+ play_loop = false;
_last_roll_location = 0;
_last_record_location = 0;
pending_locate_frame = 0;
@@ -161,8 +158,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
outbound_mtc_smpte_frame = 0;
next_quarter_frame_to_send = -1;
current_block_size = 0;
- _solo_latched = true;
- _solo_model = InverseMute;
solo_update_disabled = false;
currently_soloing = false;
_have_captured = false;
@@ -171,12 +166,11 @@ Session::first_stage_init (string fullpath, string snapshot_name)
_worst_track_latency = 0;
_state_of_the_state = StateOfTheState(CannotSave|InitialConnecting|Loading);
_slave = 0;
- _slave_type = None;
butler_mixdown_buffer = 0;
butler_gain_buffer = 0;
- mmc_control = false;
- midi_control = true;
mmc = 0;
+ session_send_mmc = false;
+ session_send_mtc = false;
post_transport_work = PostTransportWork (0);
g_atomic_int_set (&butler_should_do_transport_work, 0);
g_atomic_int_set (&butler_active, 0);
@@ -184,48 +178,38 @@ Session::first_stage_init (string fullpath, string snapshot_name)
g_atomic_int_set (&_capture_load, 100);
g_atomic_int_set (&_playback_load_min, 100);
g_atomic_int_set (&_capture_load_min, 100);
- _edit_mode = Slide;
- pending_edit_mode = _edit_mode;
_play_range = false;
- input_auto_connect = AutoConnectOption (0);
- output_auto_connect = AutoConnectOption (0);
waiting_to_start = false;
_exporting = false;
_gain_automation_buffer = 0;
_pan_automation_buffer = 0;
_npan_buffers = 0;
pending_abort = false;
- layer_model = MoveAddHigher;
- xfade_model = ShortCrossfade;
destructive_index = 0;
current_trans = 0;
+ first_file_data_format_reset = true;
+ first_file_header_format_reset = true;
AudioDiskstream::allocate_working_buffers();
/* default short fade = 15ms */
- Crossfade::set_short_xfade_length ((jack_nframes_t) floor ((15.0 * frame_rate()) / 1000.0));
+ Crossfade::set_short_xfade_length ((nframes_t) floor (Config->get_short_xfade_seconds() * frame_rate()));
DestructiveFileSource::setup_standard_crossfades (frame_rate());
last_mmc_step.tv_sec = 0;
last_mmc_step.tv_usec = 0;
step_speed = 0.0;
- preroll.type = AnyTime::Frames;
- preroll.frames = 0;
- postroll.type = AnyTime::Frames;
- postroll.frames = 0;
-
/* click sounds are unset by default, which causes us to internal
waveforms for clicks.
*/
- _clicking = false;
- click_requested = false;
click_data = 0;
click_emphasis_data = 0;
click_length = 0;
click_emphasis_length = 0;
+ _clicking = false;
process_function = &Session::process_with_events;
@@ -238,34 +222,18 @@ Session::first_stage_init (string fullpath, string snapshot_name)
_current_frame_rate = 48000;
_base_frame_rate = 48000;
- smpte_frames_per_second = 30;
- video_pullup = 0.0;
- smpte_drop_frames = false;
last_smpte_when = 0;
_smpte_offset = 0;
_smpte_offset_negative = true;
last_smpte_valid = false;
+ sync_time_vars ();
+
last_rr_session_dir = session_dirs.begin();
refresh_disk_space ();
// set_default_fade (0.2, 5.0); /* steepness, millisecs */
- /* default configuration */
-
- do_not_record_plugins = false;
- over_length_short = 2;
- over_length_long = 10;
- send_midi_timecode = false;
- send_midi_machine_control = false;
- shuttle_speed_factor = 1.0;
- shuttle_speed_threshold = 5;
- rf_speed = 2.0;
- _meter_hold = 100; // XXX unknown units: number of calls to meter::set()
- _meter_falloff = 0.375f; // XXX unknown units: refresh_rate
- max_level = 0;
- min_level = 0;
-
/* slave stuff */
average_slave_delta = 1800;
@@ -273,11 +241,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
delta_accumulator_cnt = 0;
slave_state = Stopped;
- /* default SMPTE type is 30 FPS, non-drop */
-
- set_smpte_type (30.0, false);
- set_video_pullup (0.0);
-
_engine.GraphReordered.connect (mem_fun (*this, &Session::graph_reordered));
/* These are all static "per-class" signals */
@@ -290,7 +253,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
Curve::CurveCreated.connect (mem_fun (*this, &Session::add_curve));
AutomationList::AutomationListCreated.connect (mem_fun (*this, &Session::add_automation_list));
- Controllable::Created.connect (mem_fun (*this, &Session::add_controllable));
Controllable::GoingAway.connect (mem_fun (*this, &Session::remove_controllable));
IO::MoreChannels.connect (mem_fun (*this, &Session::ensure_buffers));
@@ -322,10 +284,14 @@ Session::second_stage_init (bool new_session)
return -1;
}*/
+ // set_state() will call setup_raid_path(), but if it's a new session we need
+ // to call setup_raid_path() here.
if (state_tree) {
if (set_state (*state_tree->root())) {
return -1;
}
+ } else {
+ setup_raid_path(_path);
}
/* we can't save till after ::when_engine_running() is called,
@@ -387,14 +353,6 @@ Session::raid_path () const
}
void
-Session::set_raid_path (string path)
-{
- /* public-access to setup_raid_path() */
-
- setup_raid_path (path);
-}
-
-void
Session::setup_raid_path (string path)
{
string::size_type colon;
@@ -489,12 +447,10 @@ Session::setup_raid_path (string path)
}
int
-Session::create (bool& new_session, string* mix_template, jack_nframes_t initial_length)
+Session::create (bool& new_session, string* mix_template, nframes_t initial_length)
{
string dir;
- new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
-
if (g_mkdir_with_parents (_path.c_str(), 0755) < 0) {
error << string_compose(_("Session: cannot create session dir \"%1\" (%2)"), _path, strerror (errno)) << endmsg;
return -1;
@@ -528,66 +484,57 @@ Session::create (bool& new_session, string* mix_template, jack_nframes_t initial
return -1;
}
-
+
/* check new_session so we don't overwrite an existing one */
-
+
if (mix_template) {
- if (new_session){
- std::string in_path = *mix_template;
+ std::string in_path = *mix_template;
+
+ ifstream in(in_path.c_str());
+
+ if (in){
+ string out_path = _path;
+ out_path += _name;
+ out_path += _statefile_suffix;
+
+ ofstream out(out_path.c_str());
+
+ if (out){
+ out << in.rdbuf();
+
+ // okay, session is set up. Treat like normal saved
+ // session from now on.
+
+ new_session = false;
+ return 0;
- ifstream in(in_path.c_str());
-
- if (in){
- string out_path = _path;
- out_path += _name;
- out_path += _statefile_suffix;
-
- ofstream out(out_path.c_str());
-
- if (out){
- out << in.rdbuf();
-
- // okay, session is set up. Treat like normal saved
- // session from now on.
-
- new_session = false;
- return 0;
-
- } else {
- error << string_compose (_("Could not open %1 for writing mix template"), out_path)
- << endmsg;
- return -1;
- }
-
} else {
- error << string_compose (_("Could not open mix template %1 for reading"), in_path)
- << endmsg;
+ error << string_compose (_("Could not open %1 for writing mix template"), out_path)
+ << endmsg;
return -1;
}
-
-
+
} else {
- warning << _("Session already exists. Not overwriting") << endmsg;
+ error << string_compose (_("Could not open mix template %1 for reading"), in_path)
+ << endmsg;
return -1;
}
+
}
- if (new_session) {
+ /* set initial start + end point */
- /* set initial start + end point */
+ start_location->set_end (0);
+ _locations.add (start_location);
- start_location->set_end (0);
- _locations.add (start_location);
+ end_location->set_end (initial_length);
+ _locations.add (end_location);
- end_location->set_end (initial_length);
- _locations.add (end_location);
-
- _state_of_the_state = Clean;
+ _state_of_the_state = Clean;
- if (save_state (_current_snapshot_name)) {
- save_history (_current_snapshot_name);
- return -1;
- }
+ if (save_state (_current_snapshot_name)) {
+ save_history (_current_snapshot_name);
+ return -1;
}
return 0;
@@ -786,232 +733,9 @@ Session::load_options (const XMLNode& node)
{
XMLNode* child;
XMLProperty* prop;
- bool have_fade_msecs = false;
- bool have_fade_steepness = false;
- float fade_msecs = 0;
- float fade_steepness = 0;
- SlaveSource slave_src = None;
- int x;
LocaleGuard lg (X_("POSIX"));
-
- if ((child = find_named_node (node, "input-auto-connect")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- sscanf (prop->value().c_str(), "%x", &x);
- input_auto_connect = AutoConnectOption (x);
- }
- }
- if ((child = find_named_node (node, "output-auto-connect")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- sscanf (prop->value().c_str(), "%x", &x);
- output_auto_connect = AutoConnectOption (x);
- }
- }
-
- if ((child = find_named_node (node, "slave")) != 0) {
- if ((prop = child->property ("type")) != 0) {
- if (prop->value() == "none") {
- slave_src = None;
- } else if (prop->value() == "mtc") {
- slave_src = MTC;
- } else if (prop->value() == "jack") {
- slave_src = JACK;
- }
- set_slave_source (slave_src, 0);
- }
- }
-
- /* we cannot set edit mode if we are loading a session,
- because it might destroy the playlist's positioning
- */
-
- if ((child = find_named_node (node, "edit-mode")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- if (prop->value() == "slide") {
- pending_edit_mode = Slide;
- } else if (prop->value() == "splice") {
- pending_edit_mode = Splice;
- }
- }
- }
-
- if ((child = find_named_node (node, "send-midi-timecode")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- bool x = (prop->value() == "yes");
- send_mtc = !x; /* force change in value */
- set_send_mtc (x);
- }
- }
- if ((child = find_named_node (node, "send-midi-machine-control")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- bool x = (prop->value() == "yes");
- send_mmc = !x; /* force change in value */
- set_send_mmc (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "max-level")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- max_level = atoi (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "min-level")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- min_level = atoi (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "meter-hold")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- _meter_hold = atof (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "meter-falloff")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- _meter_falloff = atof (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "long-over-length")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- over_length_long = atoi (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "short-over-length")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- over_length_short = atoi (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "shuttle-speed-factor")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- shuttle_speed_factor = atof (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "shuttle-speed-threshold")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- shuttle_speed_threshold = atof (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "rf-speed")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- rf_speed = atof (prop->value().c_str());
- }
- }
- if ((child = find_named_node (node, "video-pullup")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_video_pullup( atof (prop->value().c_str()) );
- }
- }
- if ((child = find_named_node (node, "smpte-frames-per-second")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_smpte_type( atof (prop->value().c_str()), smpte_drop_frames );
- }
- }
- if ((child = find_named_node (node, "smpte-drop-frames")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_smpte_type( smpte_frames_per_second, (prop->value() == "yes") );
- }
- }
- if ((child = find_named_node (node, "smpte-offset")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_smpte_offset( atoi (prop->value().c_str()) );
- }
- }
- if ((child = find_named_node (node, "smpte-offset-negative")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_smpte_offset_negative( (prop->value() == "yes") );
- }
- }
- if ((child = find_named_node (node, "click-sound")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- click_sound = prop->value();
- }
- }
- if ((child = find_named_node (node, "click-emphasis-sound")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- click_emphasis_sound = prop->value();
- }
- }
-
- if ((child = find_named_node (node, "solo-model")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- if (prop->value() == "SoloBus")
- _solo_model = SoloBus;
- else
- _solo_model = InverseMute;
- }
- }
-
- /* BOOLEAN OPTIONS */
-
- if ((child = find_named_node (node, "auto-play")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_auto_play (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "auto-input")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_auto_input (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "seamless-loop")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_seamless_loop (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "punch-in")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_punch_in (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "punch-out")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_punch_out (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "auto-return")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_auto_return (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "send-mtc")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_send_mtc (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "mmc-control")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_mmc_control (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "midi-control")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_midi_control (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "midi-feedback")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_midi_feedback (prop->value() == "yes");
- }
- }
- // Legacy support for <recording-plugins>
- if ((child = find_named_node (node, "recording-plugins")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_do_not_record_plugins (prop->value() == "no");
- }
- }
- if ((child = find_named_node (node, "do-not-record-plugins")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_do_not_record_plugins (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "crossfades-active")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_crossfades_active (prop->value() == "yes");
- }
- }
- if ((child = find_named_node (node, "audible-click")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- set_clicking (prop->value() == "yes");
- }
- }
+ Config->set_variables (node, ConfigVariableBase::Session);
if ((child = find_named_node (node, "end-marker-is-free")) != 0) {
if ((prop = child->property ("val")) != 0) {
@@ -1019,243 +743,30 @@ Session::load_options (const XMLNode& node)
}
}
- if ((child = find_named_node (node, "layer-model")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- if (prop->value() == X_("LaterHigher")) {
- set_layer_model (LaterHigher);
- } else if (prop->value() == X_("AddHigher")) {
- set_layer_model (AddHigher);
- } else {
- set_layer_model (MoveAddHigher);
- }
- }
- }
-
- if ((child = find_named_node (node, "xfade-model")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- if (prop->value() == X_("Short")) {
- set_xfade_model (ShortCrossfade);
- } else {
- set_xfade_model (FullCrossfade);
- }
- }
- }
-
- if ((child = find_named_node (node, "short-xfade-length")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- /* value is stored as a fractional seconds */
- float secs = atof (prop->value().c_str());
- Crossfade::set_short_xfade_length ((jack_nframes_t) floor (secs * frame_rate()));
- }
- }
-
- if ((child = find_named_node (node, "full-xfades-unmuted")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- crossfades_active = (prop->value() == "yes");
- }
- }
-
- /* TIED OPTIONS */
-
- if ((child = find_named_node (node, "default-fade-steepness")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- fade_steepness = atof (prop->value().c_str());
- have_fade_steepness = true;
- }
- }
- if ((child = find_named_node (node, "default-fade-msec")) != 0) {
- if ((prop = child->property ("val")) != 0) {
- fade_msecs = atof (prop->value().c_str());
- have_fade_msecs = true;
- }
- }
+ return 0;
+}
- if (have_fade_steepness || have_fade_msecs) {
- // set_default_fade (fade_steepness, fade_msecs);
- }
+bool
+Session::save_config_options_predicate (ConfigVariableBase::Owner owner) const
+{
+ const ConfigVariableBase::Owner modified_by_session_or_user = (ConfigVariableBase::Owner)
+ (ConfigVariableBase::Session|ConfigVariableBase::Interface);
- return 0;
+ return owner & modified_by_session_or_user;
}
XMLNode&
Session::get_options () const
{
- XMLNode* opthead;
XMLNode* child;
- char buf[32];
LocaleGuard lg (X_("POSIX"));
- opthead = new XMLNode ("Options");
+ XMLNode& option_root = Config->get_variables (mem_fun (*this, &Session::save_config_options_predicate));
- SlaveSource src = slave_source ();
- string src_string;
- switch (src) {
- case None:
- src_string = "none";
- break;
- case MTC:
- src_string = "mtc";
- break;
- case JACK:
- src_string = "jack";
- break;
- }
- child = opthead->add_child ("slave");
- child->add_property ("type", src_string);
-
- child = opthead->add_child ("send-midi-timecode");
- child->add_property ("val", send_midi_timecode?"yes":"no");
-
- child = opthead->add_child ("send-midi-machine-control");
- child->add_property ("val", send_midi_machine_control?"yes":"no");
-
- snprintf (buf, sizeof(buf)-1, "%x", (int) input_auto_connect);
- child = opthead->add_child ("input-auto-connect");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%x", (int) output_auto_connect);
- child = opthead->add_child ("output-auto-connect");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%d", max_level);
- child = opthead->add_child ("max-level");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%d", min_level);
- child = opthead->add_child ("min-level");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%f", _meter_hold);
- child = opthead->add_child ("meter-hold");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%f", _meter_falloff);
- child = opthead->add_child ("meter-falloff");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%u", over_length_long);
- child = opthead->add_child ("long-over-length");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%u", over_length_short);
- child = opthead->add_child ("short-over-length");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%f", shuttle_speed_factor);
- child = opthead->add_child ("shuttle-speed-factor");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%f", shuttle_speed_threshold);
- child = opthead->add_child ("shuttle-speed-threshold");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%f", rf_speed);
- child = opthead->add_child ("rf-speed");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%.4f", video_pullup);
- child = opthead->add_child ("video-pullup");
- child->add_property ("val", buf);
-
- snprintf (buf, sizeof(buf)-1, "%.2f", smpte_frames_per_second);
- child = opthead->add_child ("smpte-frames-per-second");
- child->add_property ("val", buf);
-
- child = opthead->add_child ("smpte-drop-frames");
- child->add_property ("val", smpte_drop_frames ? "yes" : "no");
-
- snprintf (buf, sizeof(buf)-1, "%u", smpte_offset ());
- child = opthead->add_child ("smpte-offset");
- child->add_property ("val", buf);
-
- child = opthead->add_child ("smpte-offset-negative");
- child->add_property ("val", smpte_offset_negative () ? "yes" : "no");
-
- child = opthead->add_child ("edit-mode");
- switch (_edit_mode) {
- case Splice:
- child->add_property ("val", "splice");
- break;
-
- case Slide:
- child->add_property ("val", "slide");
- break;
- }
-
- child = opthead->add_child ("auto-play");
- child->add_property ("val", get_auto_play () ? "yes" : "no");
- child = opthead->add_child ("auto-input");
- child->add_property ("val", get_auto_input () ? "yes" : "no");
- child = opthead->add_child ("seamless-loop");
- child->add_property ("val", get_seamless_loop () ? "yes" : "no");
- child = opthead->add_child ("punch-in");
- child->add_property ("val", get_punch_in () ? "yes" : "no");
- child = opthead->add_child ("punch-out");
- child->add_property ("val", get_punch_out () ? "yes" : "no");
- child = opthead->add_child ("all-safe");
- child->add_property ("val", get_all_safe () ? "yes" : "no");
- child = opthead->add_child ("auto-return");
- child->add_property ("val", get_auto_return () ? "yes" : "no");
- child = opthead->add_child ("mmc-control");
- child->add_property ("val", get_mmc_control () ? "yes" : "no");
- child = opthead->add_child ("midi-control");
- child->add_property ("val", get_midi_control () ? "yes" : "no");
- child = opthead->add_child ("midi-feedback");
- child->add_property ("val", get_midi_feedback () ? "yes" : "no");
- child = opthead->add_child ("do-not-record-plugins");
- child->add_property ("val", get_do_not_record_plugins () ? "yes" : "no");
- child = opthead->add_child ("auto-crossfade");
- child->add_property ("val", get_crossfades_active () ? "yes" : "no");
- child = opthead->add_child ("audible-click");
- child->add_property ("val", get_clicking () ? "yes" : "no");
- child = opthead->add_child ("end-marker-is-free");
+ child = option_root.add_child ("end-marker-is-free");
child->add_property ("val", _end_location_is_free ? "yes" : "no");
- if (click_sound.length()) {
- child = opthead->add_child ("click-sound");
- child->add_property ("val", click_sound);
- }
-
- if (click_emphasis_sound.length()) {
- child = opthead->add_child ("click-emphasis-sound");
- child->add_property ("val", click_emphasis_sound);
- }
-
- child = opthead->add_child ("solo-model");
- child->add_property ("val", _solo_model == SoloBus ? "SoloBus" : "InverseMute");
-
- child = opthead->add_child ("layer-model");
- switch (layer_model) {
- case LaterHigher:
- child->add_property ("val", X_("LaterHigher"));
- break;
- case MoveAddHigher:
- child->add_property ("val", X_("MoveAddHigher"));
- break;
- case AddHigher:
- child->add_property ("val", X_("AddHigher"));
- break;
- }
-
- child = opthead->add_child ("xfade-model");
- switch (xfade_model) {
- case FullCrossfade:
- child->add_property ("val", X_("Full"));
- break;
- case ShortCrossfade:
- child->add_property ("val", X_("Short"));
- }
-
- child = opthead->add_child ("short-xfade-length");
- /* store as fractions of a second */
- snprintf (buf, sizeof(buf)-1, "%f",
- (float) Crossfade::short_xfade_length() / frame_rate());
- child->add_property ("val", buf);
-
- child = opthead->add_child ("full-xfades-unmuted");
- child->add_property ("val", crossfades_active ? "yes" : "no");
-
- return *opthead;
+ return option_root;
}
XMLNode&
@@ -1472,6 +983,8 @@ Session::state(bool full_state)
node->add_child_nocopy (_tempo_map->get_state());
+ node->add_child_nocopy (get_control_protocol_state());
+
if (_extra_xml) {
node->add_child_copy (*_extra_xml);
}
@@ -1479,6 +992,25 @@ Session::state(bool full_state)
return *node;
}
+XMLNode&
+Session::get_control_protocol_state ()
+{
+ ControlProtocolManager& cpm (ControlProtocolManager::instance());
+ XMLNode* node = new XMLNode (X_("ControlProtocols"));
+
+ cpm.foreach_known_protocol (bind (mem_fun (*this, &Session::add_control_protocol), node));
+
+ return *node;
+}
+
+void
+Session::add_control_protocol (const ControlProtocolInfo* const cpi, XMLNode* node)
+{
+ if (cpi->protocol) {
+ node->add_child_nocopy (cpi->protocol->get_state());
+ }
+}
+
int
Session::set_state (const XMLNode& node)
{
@@ -1500,6 +1032,8 @@ Session::set_state (const XMLNode& node)
_name = prop->value ();
}
+ setup_raid_path(_path);
+
if ((prop = node.property (X_("id-counter"))) != 0) {
uint64_t x;
sscanf (prop->value().c_str(), "%" PRIu64, &x);
@@ -1523,7 +1057,7 @@ Session::set_state (const XMLNode& node)
MIDI
Path
extra
- Options
+ Options/Config
Sources
AudioRegions
AudioDiskstreams
@@ -1533,26 +1067,22 @@ Session::set_state (const XMLNode& node)
EditGroups
MixGroups
Click
+ ControlProtocols
*/
if (use_config_midi_ports ()) {
}
- if ((child = find_named_node (node, "Path")) != 0) {
- /* XXX this XML content stuff horrible API design */
- string raid_path = _path + ':' + child->children().front()->content();
- setup_raid_path (raid_path);
- } else {
- /* the path is already set */
- }
-
if ((child = find_named_node (node, "extra")) != 0) {
_extra_xml = new XMLNode (*child);
}
- if ((child = find_named_node (node, "Options")) == 0) {
+ if (((child = find_named_node (node, "Options")) != 0)) { /* old style */
+ load_options (*child);
+ } else if ((child = find_named_node (node, "Config")) != 0) { /* new style */
+ load_options (*child);
+ } else {
error << _("Session: XML state has no options section") << endmsg;
- } else if (load_options (*child)) {
}
if ((child = find_named_node (node, "Sources")) == 0) {
@@ -1669,9 +1199,9 @@ Session::set_state (const XMLNode& node)
_click_io->set_state (*child);
}
- /* OK, now we can set edit mode */
-
- set_edit_mode (pending_edit_mode);
+ if ((child = find_named_node (node, "ControlProtocols")) != 0) {
+ ControlProtocolManager::instance().set_protocol_states (*child);
+ }
/* here beginneth the second phase ... */
@@ -1815,6 +1345,11 @@ Session::XMLAudioRegionFactory (const XMLNode& node, bool full)
nchans = atoi (prop->value().c_str());
}
+
+ if ((prop = node.property ("name")) == 0) {
+ cerr << "no name for this region\n";
+ abort ();
+ }
if ((prop = node.property (X_("source-0"))) == 0) {
if ((prop = node.property ("source")) == 0) {
@@ -2363,17 +1898,21 @@ Session::sound_dir (bool with_path) const
/* support old session structure */
struct stat statbuf;
- string old;
-
- if (with_path) {
- old = _path;
- }
+ string old_nopath;
+ string old_withpath;
- old += sound_dir_name;
- old += '/';
+ old_nopath += old_sound_dir_name;
+ old_nopath += '/';
+
+ old_withpath = _path;
+ old_withpath += old_sound_dir_name;
+ old_withpath += '/';
- if (stat (old.c_str(), &statbuf) == 0) {
- return old;
+ if (stat (old_withpath.c_str(), &statbuf) == 0) {
+ if (with_path)
+ return old_withpath;
+
+ return old_nopath;
}
string res;
@@ -2653,21 +2192,6 @@ Session::edit_group_by_name (string name)
}
void
-Session::set_meter_hold (float val)
-{
- _meter_hold = val;
- MeterHoldChanged(); // emit
-}
-
-void
-Session::set_meter_falloff (float val)
-{
- _meter_falloff = val;
- MeterFalloffChanged(); // emit
-}
-
-
-void
Session::begin_reversible_command (string name)
{
current_trans = new UndoTransaction;
@@ -3342,7 +2866,7 @@ void
Session::add_controllable (Controllable* c)
{
Glib::Mutex::Lock lm (controllables_lock);
- controllables.push_back (c);
+ controllables.insert (c);
}
void
@@ -3353,7 +2877,12 @@ Session::remove_controllable (Controllable* c)
}
Glib::Mutex::Lock lm (controllables_lock);
- controllables.remove (c);
+
+ Controllables::iterator x = controllables.find (c);
+
+ if (x != controllables.end()) {
+ controllables.erase (x);
+ }
}
Controllable*
@@ -3489,3 +3018,178 @@ Session::restore_history (string snapshot_name)
return 0;
}
+
+void
+Session::config_changed (const char* parameter_name)
+{
+#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
+
+ if (PARAM_IS ("seamless-loop")) {
+
+ } else if (PARAM_IS ("rf-speed")) {
+
+ } else if (PARAM_IS ("auto-loop")) {
+
+ } else if (PARAM_IS ("auto-input")) {
+
+ if (Config->get_monitoring_model() == HardwareMonitoring && transport_rolling()) {
+ /* auto-input only makes a difference if we're rolling */
+
+ boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
+
+ for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
+ if ((*i)->record_enabled ()) {
+ //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
+ (*i)->monitor_input (!Config->get_auto_input());
+ }
+ }
+ }
+
+ } else if (PARAM_IS ("punch-in")) {
+
+ Location* location;
+
+ if ((location = _locations.auto_punch_location()) != 0) {
+
+ if (Config->get_punch_in ()) {
+ replace_event (Event::PunchIn, location->start());
+ } else {
+ remove_event (location->start(), Event::PunchIn);
+ }
+ }
+
+ } else if (PARAM_IS ("punch-out")) {
+
+ Location* location;
+
+ if ((location = _locations.auto_punch_location()) != 0) {
+
+ if (Config->get_punch_out()) {
+ replace_event (Event::PunchOut, location->end());
+ } else {
+ clear_events (Event::PunchOut);
+ }
+ }
+
+ } else if (PARAM_IS ("edit-mode")) {
+
+ Glib::Mutex::Lock lm (playlist_lock);
+
+ for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
+ (*i)->set_edit_mode (Config->get_edit_mode ());
+ }
+
+ } else if (PARAM_IS ("use-video-sync")) {
+
+ if (transport_stopped()) {
+ if (Config->get_use_video_sync()) {
+ waiting_for_sync_offset = true;
+ }
+ }
+
+ } else if (PARAM_IS ("mmc-control")) {
+
+ //poke_midi_thread ();
+
+ } else if (PARAM_IS ("midi-control")) {
+
+ //poke_midi_thread ();
+
+ } else if (PARAM_IS ("raid-path")) {
+
+ setup_raid_path (Config->get_raid_path());
+
+ } else if (PARAM_IS ("smpte-frames-per-second") || PARAM_IS ("smpte-drop-frames")) {
+
+ sync_time_vars ();
+
+ } else if (PARAM_IS ("video-pullup")) {
+
+ sync_time_vars ();
+
+ } else if (PARAM_IS ("seamless-loop")) {
+
+ if (play_loop && transport_rolling()) {
+ // to reset diskstreams etc
+ request_play_loop (true);
+ }
+
+ } else if (PARAM_IS ("rf-speed")) {
+
+ cumulative_rf_motion = 0;
+ reset_rf_scale (0);
+
+ } else if (PARAM_IS ("click-sound")) {
+
+ setup_click_sounds (1);
+
+ } else if (PARAM_IS ("click-emphasis-sound")) {
+
+ setup_click_sounds (-1);
+
+ } else if (PARAM_IS ("clicking")) {
+
+ if (Config->get_clicking()) {
+ if (_click_io && click_data) { // don't require emphasis data
+ _clicking = true;
+ }
+ } else {
+ _clicking = false;
+ }
+
+ } else if (PARAM_IS ("send-mtc")) {
+
+ /* only set the internal flag if we have
+ a port.
+ */
+
+ if (_mtc_port != 0) {
+ session_send_mtc = Config->get_send_mtc();
+ }
+
+ } else if (PARAM_IS ("send-mmc")) {
+
+ /* only set the internal flag if we have
+ a port.
+ */
+
+ if (_mmc_port != 0) {
+ session_send_mmc = Config->get_send_mmc();
+ }
+
+ } else if (PARAM_IS ("midi-feedback")) {
+
+ /* only set the internal flag if we have
+ a port.
+ */
+
+ if (_mtc_port != 0) {
+ session_midi_feedback = Config->get_midi_feedback();
+ }
+
+ } else if (PARAM_IS ("jack-time-master")) {
+
+ engine().reset_timebase ();
+
+ } else if (PARAM_IS ("native-file-header-format")) {
+
+ if (!first_file_header_format_reset) {
+ reset_native_file_format ();
+ }
+
+ first_file_header_format_reset = false;
+
+ } else if (PARAM_IS ("native-file-data-format")) {
+
+ if (!first_file_data_format_reset) {
+ reset_native_file_format ();
+ }
+
+ first_file_data_format_reset = false;
+ }
+
+ set_dirty ();
+
+#undef PARAM_IS
+
+}
diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc
index 887a9fa6c4..d24bab5ff8 100644
--- a/libs/ardour/session_time.cc
+++ b/libs/ardour/session_time.cc
@@ -26,6 +26,7 @@
#include <ardour/timestamps.h>
#include <pbd/error.h>
+#include <pbd/stacktrace.h>
#include <ardour/ardour.h>
#include <ardour/configuration.h>
@@ -41,7 +42,7 @@ using namespace PBD;
/* BBT TIME*/
void
-Session::bbt_time (jack_nframes_t when, BBT_Time& bbt)
+Session::bbt_time (nframes_t when, BBT_Time& bbt)
{
_tempo_map->bbt_time (when, bbt);
}
@@ -51,17 +52,17 @@ Session::bbt_time (jack_nframes_t when, BBT_Time& bbt)
void
Session::sync_time_vars ()
{
- _current_frame_rate = (jack_nframes_t) round (_base_frame_rate * (1.0 + (video_pullup/100.0)));
+ _current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (Config->get_video_pullup()/100.0)));
_frames_per_hour = _current_frame_rate * 3600;
- _frames_per_smpte_frame = (double) _current_frame_rate / (double) smpte_frames_per_second;
- _smpte_frames_per_hour = (unsigned long) (smpte_frames_per_second * 3600.0);
+ _frames_per_smpte_frame = (double) _current_frame_rate / (double) Config->get_smpte_frames_per_second();
+ _smpte_frames_per_hour = (unsigned long) (Config->get_smpte_frames_per_second() * 3600.0);
}
int
Session::set_smpte_type (float fps, bool drop_frames)
{
- smpte_frames_per_second = fps;
- smpte_drop_frames = drop_frames;
+ Config->set_smpte_frames_per_second (fps);
+ Config->set_smpte_drop_frames (drop_frames);
last_smpte_valid = false;
// smpte type bits are the middle two in the upper nibble
@@ -88,31 +89,11 @@ Session::set_smpte_type (float fps, bool drop_frames)
break;
};
- sync_time_vars();
-
- SMPTETypeChanged (); /* EMIT SIGNAL */
-
- set_dirty();
-
- return 0;
-}
-
-int
-Session::set_video_pullup (float pull)
-{
- video_pullup = pull;
-
- sync_time_vars();
-
- PullupChanged (); /* EMIT SIGNAL */
-
- set_dirty();
-
return 0;
}
void
-Session::set_smpte_offset (jack_nframes_t off)
+Session::set_smpte_offset (nframes_t off)
{
_smpte_offset = off;
last_smpte_valid = false;
@@ -130,9 +111,9 @@ Session::set_smpte_offset_negative (bool neg)
}
void
-Session::smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes ) const
+Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes ) const
{
- if (smpte_drop_frames) {
+ if (Config->get_smpte_drop_frames()) {
// The drop frame format was created to better approximate the 30000/1001 = 29.97002997002997....
// framerate of NTSC color TV. The used frame rate of drop frame is 29.97, which drifts by about
// 0.108 frame per hour, or about 1.3 frames per 12 hours. This is not perfect, but a lot better
@@ -173,16 +154,16 @@ Session::smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_o
// Per Sigmond <per@sigmond.no>
// Samples inside time dividable by 10 minutes (real time accurate)
- jack_nframes_t base_samples = ((smpte.hours * 60 * 60) + ((smpte.minutes / 10) * 10 * 60)) * frame_rate();
+ nframes_t base_samples = ((smpte.hours * 60 * 60) + ((smpte.minutes / 10) * 10 * 60)) * frame_rate();
// Samples inside time exceeding the nearest 10 minutes (always offset, see above)
long exceeding_df_minutes = smpte.minutes % 10;
long exceeding_df_seconds = (exceeding_df_minutes * 60) + smpte.seconds;
long exceeding_df_frames = (30 * exceeding_df_seconds) + smpte.frames - (2 * exceeding_df_minutes);
- jack_nframes_t exceeding_samples = (jack_nframes_t) rint(exceeding_df_frames * _frames_per_smpte_frame);
+ nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_smpte_frame);
sample = base_samples + exceeding_samples;
} else {
// Non drop is easy:
- sample = (((smpte.hours * 60 * 60) + (smpte.minutes * 60) + smpte.seconds) * frame_rate()) + (jack_nframes_t)rint(smpte.frames * _frames_per_smpte_frame);
+ sample = (((smpte.hours * 60 * 60) + (smpte.minutes * 60) + smpte.seconds) * frame_rate()) + (nframes_t)rint(smpte.frames * _frames_per_smpte_frame);
}
if (use_subframes) {
@@ -213,9 +194,9 @@ Session::smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_o
void
-Session::sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const
+Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const
{
- jack_nframes_t offset_sample;
+ nframes_t offset_sample;
if (!use_offset) {
offset_sample = sample;
@@ -259,7 +240,7 @@ Session::sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_of
// Extract hour-exceeding frames for minute, second and frame calculations
smpte_frames_left = ((long) floor( smpte_frames_left_exact ));
- if (smpte_drop_frames) {
+ if (Config->get_smpte_drop_frames()) {
// See long explanation in smpte_to_sample()...
// Number of 10 minute chunks
@@ -295,10 +276,10 @@ Session::sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_of
}
} else {
// Non drop is easy
- smpte.minutes = smpte_frames_left / ((long) smpte_frames_per_second * 60);
- smpte_frames_left = smpte_frames_left % ((long) smpte_frames_per_second * 60);
- smpte.seconds = smpte_frames_left / (long) smpte_frames_per_second;
- smpte.frames = smpte_frames_left % (long) smpte_frames_per_second;
+ smpte.minutes = smpte_frames_left / ((long) Config->get_smpte_frames_per_second () * 60);
+ smpte_frames_left = smpte_frames_left % ((long) Config->get_smpte_frames_per_second () * 60);
+ smpte.seconds = smpte_frames_left / (long) Config->get_smpte_frames_per_second ();
+ smpte.frames = smpte_frames_left % (long) Config->get_smpte_frames_per_second ();
}
if (!use_subframes) {
@@ -307,7 +288,7 @@ Session::sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_of
}
void
-Session::smpte_time (jack_nframes_t when, SMPTE::Time& smpte)
+Session::smpte_time (nframes_t when, SMPTE::Time& smpte)
{
if (last_smpte_valid && when == last_smpte_when) {
smpte = last_smpte;
@@ -322,7 +303,7 @@ Session::smpte_time (jack_nframes_t when, SMPTE::Time& smpte)
}
void
-Session::smpte_time_subframes (jack_nframes_t when, SMPTE::Time& smpte)
+Session::smpte_time_subframes (nframes_t when, SMPTE::Time& smpte)
{
if (last_smpte_valid && when == last_smpte_when) {
smpte = last_smpte;
@@ -337,13 +318,13 @@ Session::smpte_time_subframes (jack_nframes_t when, SMPTE::Time& smpte)
}
void
-Session::smpte_duration (jack_nframes_t when, SMPTE::Time& smpte) const
+Session::smpte_duration (nframes_t when, SMPTE::Time& smpte) const
{
sample_to_smpte( when, smpte, false /* use_offset */, true /* use_subframes */ );
}
void
-Session::smpte_duration_string (char* buf, jack_nframes_t when) const
+Session::smpte_duration_string (char* buf, nframes_t when) const
{
SMPTE::Time smpte;
@@ -400,7 +381,7 @@ Session::jack_sync_callback (jack_transport_state_t state,
void
Session::jack_timebase_callback (jack_transport_state_t state,
- jack_nframes_t nframes,
+ nframes_t nframes,
jack_position_t* pos,
int new_position)
{
@@ -434,7 +415,7 @@ Session::jack_timebase_callback (jack_transport_state_t state,
#ifdef HAVE_JACK_VIDEO_SUPPORT
//poke audio video ratio so Ardour can track Video Sync
- pos->audio_frames_per_video_frame = frame_rate() / smpte_frames_per_second;
+ pos->audio_frames_per_video_frame = frame_rate() / Config->get_smpte_frames_per_second ();
pos->valid = jack_position_bits_t (pos->valid | JackAudioVideoRatio);
#endif
@@ -442,11 +423,11 @@ Session::jack_timebase_callback (jack_transport_state_t state,
/* SMPTE info */
t.smpte_offset = _smpte_offset;
- t.smpte_frame_rate = smpte_frames_per_second;
+ t.smpte_frame_rate = Config->get_smpte_frames_per_second ();
if (_transport_speed) {
- if (auto_loop) {
+ if (play_loop) {
Location* location = _locations.auto_loop_location();
@@ -478,8 +459,8 @@ Session::jack_timebase_callback (jack_transport_state_t state,
#endif
}
-jack_nframes_t
-Session::convert_to_frames_at (jack_nframes_t position, AnyTime& any)
+ARDOUR::nframes_t
+Session::convert_to_frames_at (nframes_t position, AnyTime& any)
{
double secs;
@@ -493,19 +474,19 @@ Session::convert_to_frames_at (jack_nframes_t position, AnyTime& any)
secs = any.smpte.hours * 60 * 60;
secs += any.smpte.minutes * 60;
secs += any.smpte.seconds;
- secs += any.smpte.frames / smpte_frames_per_second;
+ secs += any.smpte.frames / Config->get_smpte_frames_per_second ();
if (_smpte_offset_negative)
{
- return (jack_nframes_t) floor (secs * frame_rate()) - _smpte_offset;
+ return (nframes_t) floor (secs * frame_rate()) - _smpte_offset;
}
else
{
- return (jack_nframes_t) floor (secs * frame_rate()) + _smpte_offset;
+ return (nframes_t) floor (secs * frame_rate()) + _smpte_offset;
}
break;
case AnyTime::Seconds:
- return (jack_nframes_t) floor (any.seconds * frame_rate());
+ return (nframes_t) floor (any.seconds * frame_rate());
break;
case AnyTime::Frames:
diff --git a/libs/ardour/session_timefx.cc b/libs/ardour/session_timefx.cc
index b5b143514c..69a42ec8b8 100644
--- a/libs/ardour/session_timefx.cc
+++ b/libs/ardour/session_timefx.cc
@@ -48,8 +48,8 @@ Session::tempoize_region (TimeStretchRequest& tsr)
string region_name;
string ident = X_("-TIMEFX-");
float percentage;
- jack_nframes_t total_frames;
- jack_nframes_t done;
+ nframes_t total_frames;
+ nframes_t done;
/* the soundtouch code wants a *tempo* change percentage, which is
of opposite sign to the length change.
@@ -91,13 +91,13 @@ Session::tempoize_region (TimeStretchRequest& tsr)
}
try {
- const jack_nframes_t bufsize = 16384;
+ const nframes_t bufsize = 16384;
for (uint32_t i = 0; i < sources.size(); ++i) {
gain_t gain_buffer[bufsize];
Sample buffer[bufsize];
- jack_nframes_t pos = 0;
- jack_nframes_t this_read = 0;
+ nframes_t pos = 0;
+ nframes_t this_read = 0;
boost::shared_ptr<AudioSource> asrc = boost::dynamic_pointer_cast<AudioSource>(sources[i]);
if (!asrc) {
@@ -107,7 +107,7 @@ Session::tempoize_region (TimeStretchRequest& tsr)
st.clear();
while (tsr.running && pos < tsr.region->length()) {
- jack_nframes_t this_time;
+ nframes_t this_time;
this_time = min (bufsize, tsr.region->length() - pos);
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 561d63fe78..004261fe8e 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -57,16 +57,15 @@ Session::request_input_change_handling ()
}
void
-Session::request_slave_source (SlaveSource src, jack_nframes_t pos)
+Session::request_slave_source (SlaveSource src)
{
- Event* ev = new Event (Event::SetSlaveSource, Event::Add, Event::Immediate, pos, 0.0);
+ Event* ev = new Event (Event::SetSlaveSource, Event::Add, Event::Immediate, 0, 0.0);
- if (src == Session::JACK) {
- /* could set_seamless_loop() be disposed of entirely?*/
- set_seamless_loop (false);
+ if (src == JACK) {
+ /* could set_seamless_loop() be disposed of entirely?*/
+ Config->set_seamless_loop (false);
} else {
-
- set_seamless_loop (true);
+ Config->set_seamless_loop (true);
}
ev->slave = src;
queue_event (ev);
@@ -95,21 +94,21 @@ Session::request_stop (bool abort)
}
void
-Session::request_locate (jack_nframes_t target_frame, bool with_roll)
+Session::request_locate (nframes_t target_frame, bool with_roll)
{
Event *ev = new Event (with_roll ? Event::LocateRoll : Event::Locate, Event::Add, Event::Immediate, target_frame, 0, false);
queue_event (ev);
}
void
-Session::force_locate (jack_nframes_t target_frame, bool with_roll)
+Session::force_locate (nframes_t target_frame, bool with_roll)
{
Event *ev = new Event (with_roll ? Event::LocateRoll : Event::Locate, Event::Add, Event::Immediate, target_frame, 0, true);
queue_event (ev);
}
void
-Session::request_auto_loop (bool yn)
+Session::request_play_loop (bool yn)
{
Event* ev;
Location *location = _locations.auto_loop_location();
@@ -123,7 +122,7 @@ Session::request_auto_loop (bool yn)
ev = new Event (Event::SetLoop, Event::Add, Event::Immediate, 0, 0.0, yn);
queue_event (ev);
- if (!yn && seamless_loop && transport_rolling()) {
+ if (!yn && Config->get_seamless_loop() && transport_rolling()) {
// request an immediate locate to refresh the diskstreams
// after disabling looping
request_locate (_transport_frame-1, true);
@@ -131,21 +130,6 @@ Session::request_auto_loop (bool yn)
}
void
-Session::set_seamless_loop (bool yn)
-{
- if (seamless_loop != yn) {
- seamless_loop = yn;
-
- if (auto_loop && transport_rolling()) {
- // to reset diskstreams etc
- request_auto_loop (true);
- }
-
- ControlChanged (SeamlessLoop); /* EMIT */
- }
-}
-
-void
Session::realtime_stop (bool abort)
{
/* assume that when we start, we'll be moving forwards */
@@ -195,7 +179,7 @@ Session::realtime_stop (bool abort)
waiting_for_sync_offset = true;
}
- transport_sub_state = (auto_return ? AutoReturning : 0);
+ transport_sub_state = (Config->get_auto_return() ? AutoReturning : 0);
}
void
@@ -230,7 +214,7 @@ Session::butler_transport_work ()
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if (!(*i)->hidden()) {
if ((*i)->speed() != 1.0f || (*i)->speed() != -1.0f) {
- (*i)->seek ((jack_nframes_t) (_transport_frame * (double) (*i)->speed()));
+ (*i)->seek ((nframes_t) (_transport_frame * (double) (*i)->speed()));
}
else {
(*i)->seek (_transport_frame);
@@ -282,11 +266,13 @@ Session::non_realtime_stop (bool abort)
struct tm* now;
time_t xnow;
bool did_record;
-
+ bool saved;
+
did_record = false;
-
- boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
+ saved = false;
+ boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
+
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->get_captured_frames () != 0) {
did_record = true;
@@ -312,7 +298,7 @@ Session::non_realtime_stop (bool abort)
Location* loc = _locations.end_location();
bool change_end = false;
-
+
if (_transport_frame < loc->end()) {
/* stopped recording before current end */
@@ -353,22 +339,22 @@ Session::non_realtime_stop (bool abort)
(*i)->set_pending_declick (0);
}
}
-
+
if (did_record) {
commit_reversible_command ();
}
-
+
if (_engine.running()) {
update_latency_compensation (true, abort);
}
- if (auto_return || (post_transport_work & PostTransportLocate) || synced_to_jack()) {
-
+ if (Config->get_auto_return() || (post_transport_work & PostTransportLocate) || synced_to_jack()) {
+
if (pending_locate_flush) {
flush_all_redirects ();
}
- if ((auto_return || synced_to_jack()) && !(post_transport_work & PostTransportLocate)) {
+ if ((Config->get_auto_return() || synced_to_jack()) && !(post_transport_work & PostTransportLocate)) {
_transport_frame = last_stop_frame;
@@ -384,14 +370,14 @@ Session::non_realtime_stop (bool abort)
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if (!(*i)->hidden()) {
if ((*i)->speed() != 1.0f || (*i)->speed() != -1.0f) {
- (*i)->seek ((jack_nframes_t) (_transport_frame * (double) (*i)->speed()));
+ (*i)->seek ((nframes_t) (_transport_frame * (double) (*i)->speed()));
}
else {
(*i)->seek (_transport_frame);
}
}
}
-
+
//FIXME
//deliver_mmc (MIDI::MachineControl::cmdLocate, _transport_frame);
@@ -407,7 +393,7 @@ Session::non_realtime_stop (bool abort)
when realtime_stop(), which has already executed,
will have done this.
*/
-
+
if (!Config->get_latched_record_enable()) {
g_atomic_int_set (&_record_status, Disabled);
} else {
@@ -419,6 +405,7 @@ Session::non_realtime_stop (bool abort)
if ((post_transport_work & PostTransportLocate) && get_record_enabled()) {
/* capture start has been changed, so save pending state */
save_state ("", true);
+ saved = true;
}
/* always try to get rid of this */
@@ -427,7 +414,7 @@ Session::non_realtime_stop (bool abort)
/* save the current state of things if appropriate */
- if (did_record) {
+ if (did_record && !saved) {
save_state (_current_snapshot_name);
}
@@ -439,7 +426,7 @@ Session::non_realtime_stop (bool abort)
_play_range = false;
/* do not turn off autoloop on stop */
-
+
}
PositionChanged (_transport_frame); /* EMIT SIGNAL */
@@ -447,7 +434,7 @@ Session::non_realtime_stop (bool abort)
/* and start it up again if relevant */
- if ((post_transport_work & PostTransportLocate) && _slave_type == None && pending_locate_roll) {
+ if ((post_transport_work & PostTransportLocate) && Config->get_slave_source() == None && pending_locate_roll) {
request_transport_speed (1.0);
pending_locate_roll = false;
}
@@ -478,7 +465,7 @@ Session::check_declick_out ()
}
void
-Session::set_auto_loop (bool yn)
+Session::set_play_loop (bool yn)
{
/* Called from event-handling context */
@@ -488,7 +475,7 @@ Session::set_auto_loop (bool yn)
set_dirty();
- if (yn && seamless_loop && synced_to_jack()) {
+ if (yn && Config->get_seamless_loop() && synced_to_jack()) {
warning << _("Seamless looping cannot be supported while Ardour is using JACK transport.\n"
"Recommend changing the configured options")
<< endmsg;
@@ -496,14 +483,14 @@ Session::set_auto_loop (bool yn)
}
- if ((auto_loop = yn)) {
+ if ((play_loop = yn)) {
Location *loc;
if ((loc = _locations.auto_loop_location()) != 0) {
- if (seamless_loop) {
+ if (Config->get_seamless_loop()) {
// set all diskstreams to use internal looping
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
@@ -553,8 +540,6 @@ Session::set_auto_loop (bool yn)
}
}
-
- ControlChanged (AutoLoop); /* EMIT SIGNAL */
}
void
@@ -568,12 +553,12 @@ Session::flush_all_redirects ()
}
void
-Session::start_locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, bool with_loop)
+Session::start_locate (nframes_t target_frame, bool with_roll, bool with_flush, bool with_loop)
{
if (synced_to_jack()) {
float sp;
- jack_nframes_t pos;
+ nframes_t pos;
_slave->speed_and_position (sp, pos);
@@ -598,7 +583,7 @@ Session::start_locate (jack_nframes_t target_frame, bool with_roll, bool with_fl
}
void
-Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, bool with_loop)
+Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool with_loop)
{
if (actively_recording()) {
return;
@@ -631,7 +616,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
}
}
- if (transport_rolling() && !auto_play && !with_roll && !(synced_to_jack() && auto_loop)) {
+ if (transport_rolling() && !Config->get_auto_play() && !with_roll && !(synced_to_jack() && play_loop)) {
realtime_stop (false);
}
@@ -663,20 +648,20 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
if (with_roll) {
/* switch from input if we're going to roll */
- if (Config->get_use_hardware_monitoring()) {
+ if (Config->get_monitoring_model() == HardwareMonitoring) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
- (*i)->monitor_input (!auto_input);
+ (*i)->monitor_input (!Config->get_auto_input());
}
}
}
} else {
/* otherwise we're going to stop, so do the opposite */
- if (Config->get_use_hardware_monitoring()) {
+ if (Config->get_monitoring_model() == HardwareMonitoring) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
@@ -688,13 +673,13 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
}
}
- /* cancel autoloop if transport pos outside of loop range */
- if (auto_loop) {
+ /* cancel looped playback if transport pos outside of loop range */
+ if (play_loop) {
Location* al = _locations.auto_loop_location();
if (al && (_transport_frame < al->start() || _transport_frame > al->end())) {
// cancel looping directly, this is called from event handling context
- set_auto_loop(false);
+ set_play_loop (false);
}
}
@@ -718,7 +703,7 @@ Session::set_transport_speed (float speed, bool abort)
if (transport_rolling() && speed == 0.0) {
- if (Config->get_use_hardware_monitoring())
+ if (Config->get_monitoring_model() == HardwareMonitoring)
{
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
@@ -735,19 +720,19 @@ Session::set_transport_speed (float speed, bool abort)
} else {
stop_transport (abort);
}
-
+
} else if (transport_stopped() && speed == 1.0) {
if (!get_record_enabled() && Config->get_stop_at_session_end() && _transport_frame >= current_end_frame()) {
return;
}
- if (Config->get_use_hardware_monitoring()) {
+ if (Config->get_monitoring_model() == HardwareMonitoring) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
- if (auto_input && (*i)->record_enabled ()) {
+ if (Config->get_auto_input() && (*i)->record_enabled ()) {
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
(*i)->monitor_input (false);
}
@@ -816,7 +801,7 @@ Session::stop_transport (bool abort)
if (_transport_speed == 0.0f) {
return;
}
-
+
if (actively_recording() && !(transport_sub_state & StopPendingCapture) &&
_worst_output_latency > current_block_size)
{
@@ -839,9 +824,11 @@ Session::stop_transport (bool abort)
return;
}
+
if ((transport_sub_state & PendingDeclickOut) == 0) {
transport_sub_state |= PendingDeclickOut;
/* we'll be called again after the declick */
+ pending_abort = abort;
return;
}
@@ -860,7 +847,7 @@ Session::start_transport ()
switch (record_status()) {
case Enabled:
- if (!punch_in) {
+ if (!Config->get_punch_in()) {
enable_record ();
}
break;
@@ -919,7 +906,7 @@ Session::post_transport ()
if (post_transport_work & PostTransportLocate) {
- if ((auto_play && !_exporting) || (post_transport_work & PostTransportRoll)) {
+ if ((Config->get_auto_play() && !_exporting) || (post_transport_work & PostTransportRoll)) {
start_transport ();
@@ -934,15 +921,7 @@ Session::post_transport ()
}
void
-Session::set_rf_speed (float speed)
-{
- rf_speed = speed;
- cumulative_rf_motion = 0;
- reset_rf_scale (0);
-}
-
-void
-Session::reset_rf_scale (jack_nframes_t motion)
+Session::reset_rf_scale (nframes_t motion)
{
cumulative_rf_motion += motion;
@@ -961,31 +940,24 @@ Session::reset_rf_scale (jack_nframes_t motion)
}
}
-int
-Session::set_slave_source (SlaveSource src, jack_nframes_t frame)
+void
+Session::set_slave_source (SlaveSource src)
{
bool reverse = false;
bool non_rt_required = false;
- if (src == _slave_type) {
- return 0;
- }
-
if (_transport_speed) {
error << _("please stop the transport before adjusting slave settings") << endmsg;
- /* help out non-MVC friendly UI's by telling them the slave type changed */
- ControlChanged (SlaveType); /* EMIT SIGNAL */
- return 0;
+ return;
}
// if (src == JACK && Config->get_jack_time_master()) {
-// return -1;
+// return;
// }
if (_slave) {
delete _slave;
_slave = 0;
- _slave_type = None;
}
if (_transport_speed < 0.0) {
@@ -996,7 +968,7 @@ Session::set_slave_source (SlaveSource src, jack_nframes_t frame)
case None:
stop_transport ();
break;
-
+
case MTC:
if (_mtc_port) {
try {
@@ -1004,12 +976,12 @@ Session::set_slave_source (SlaveSource src, jack_nframes_t frame)
}
catch (failed_constructor& err) {
- return -1;
+ return;
}
} else {
error << _("No MTC port defined: MTC slaving is impossible.") << endmsg;
- return -1;
+ return;
}
_desired_transport_speed = _transport_speed;
break;
@@ -1019,9 +991,9 @@ Session::set_slave_source (SlaveSource src, jack_nframes_t frame)
_desired_transport_speed = _transport_speed;
break;
};
-
- _slave_type = src;
+ Config->set_slave_source (src);
+
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if (!(*i)->hidden()) {
@@ -1042,9 +1014,6 @@ Session::set_slave_source (SlaveSource src, jack_nframes_t frame)
}
set_dirty();
- ControlChanged (SlaveType); /* EMIT SIGNAL */
-
- return 0;
}
void
@@ -1093,8 +1062,6 @@ Session::set_play_range (bool yn)
Event* ev = new Event (Event::SetTransportSpeed, Event::Add, Event::Immediate, 0, 0.0f, false);
merge_event (ev);
}
-
- ControlChanged (PlayRange); /* EMIT SIGNAL */
}
}
@@ -1127,7 +1094,7 @@ Session::setup_auto_play ()
/* locating/stopping is subject to delays for declicking.
*/
- jack_nframes_t requested_frame = (*i).end;
+ nframes_t requested_frame = (*i).end;
if (requested_frame > current_block_size) {
requested_frame -= current_block_size;
@@ -1160,7 +1127,7 @@ Session::setup_auto_play ()
}
void
-Session::request_bounded_roll (jack_nframes_t start, jack_nframes_t end)
+Session::request_bounded_roll (nframes_t start, nframes_t end)
{
request_stop ();
Event *ev = new Event (Event::StopOnce, Event::Replace, Event::Immediate, end, 0.0);
@@ -1224,8 +1191,8 @@ Session::update_latency_compensation (bool with_stop, bool abort)
(!(post_transport_work & PostTransportLocate) || pending_locate_flush));
}
- jack_nframes_t old_latency = (*i)->signal_latency ();
- jack_nframes_t track_latency = (*i)->update_total_latency ();
+ nframes_t old_latency = (*i)->signal_latency ();
+ nframes_t track_latency = (*i)->update_total_latency ();
if (old_latency != track_latency) {
update_jack = true;
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 0e80dee714..dcc0b82c0e 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -23,6 +23,7 @@
#include <pwd.h>
#include <sys/utsname.h>
+#include <sys/stat.h>
#include <glibmm/miscutils.h>
@@ -42,14 +43,6 @@ SndFileSource::SndFileSource (Session& s, const XMLNode& node)
if (open()) {
throw failed_constructor ();
}
-
- if (_build_peakfiles) {
- if (initialize_peakfile (false, _path)) {
- sf_close (sf);
- sf = 0;
- throw failed_constructor ();
- }
- }
}
SndFileSource::SndFileSource (Session& s, string idstr, Flag flags)
@@ -61,23 +54,21 @@ SndFileSource::SndFileSource (Session& s, string idstr, Flag flags)
if (open()) {
throw failed_constructor ();
}
-
- if (!(_flags & NoPeakFile) && _build_peakfiles) {
- if (initialize_peakfile (false, _path)) {
- sf_close (sf);
- sf = 0;
- throw failed_constructor ();
- }
- }
}
-SndFileSource::SndFileSource (Session& s, string idstr, SampleFormat sfmt, HeaderFormat hf, jack_nframes_t rate, Flag flags)
+SndFileSource::SndFileSource (Session& s, string idstr, SampleFormat sfmt, HeaderFormat hf, nframes_t rate, Flag flags)
: AudioFileSource (s, idstr, flags, sfmt, hf)
{
int fmt = 0;
init (idstr);
+ /* this constructor is used to construct new files, not open
+ existing ones.
+ */
+
+ file_is_new = true;
+
switch (hf) {
case CAF:
fmt = SF_FORMAT_CAF;
@@ -170,14 +161,6 @@ SndFileSource::SndFileSource (Session& s, string idstr, SampleFormat sfmt, Heade
}
}
-
- if (!(_flags & NoPeakFile) && _build_peakfiles) {
- if (initialize_peakfile (true, _path)) {
- sf_close (sf);
- sf = 0;
- throw failed_constructor ();
- }
- }
}
void
@@ -266,6 +249,14 @@ SndFileSource::~SndFileSource ()
if (sf) {
sf_close (sf);
sf = 0;
+
+ /* stupid libsndfile updated the headers on close,
+ so touch the peakfile if it exists and has data
+ to make sure its time is as new as the audio
+ file.
+ */
+
+ touch_peakfile ();
}
if (interleave_buf) {
@@ -283,18 +274,13 @@ SndFileSource::sample_rate () const
return _info.samplerate;
}
-jack_nframes_t
-SndFileSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const
+nframes_t
+SndFileSource::read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const
{
int32_t nread;
float *ptr;
uint32_t real_cnt;
- jack_nframes_t file_cnt;
-
- //destructive (tape) tracks need to offset reads and writes by the timeline position
- if (_flags && ARDOUR::Destructive == ARDOUR::Destructive) {
- start -= timeline_position;
- }
+ nframes_t file_cnt;
if (start > _length) {
@@ -325,14 +311,14 @@ SndFileSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t
}
if (_info.channels == 1) {
- jack_nframes_t ret = sf_read_float (sf, dst, file_cnt);
+ nframes_t ret = sf_read_float (sf, dst, file_cnt);
_read_data_count = cnt * sizeof(float);
return ret;
}
}
if (file_cnt != cnt) {
- jack_nframes_t delta = cnt - file_cnt;
+ nframes_t delta = cnt - file_cnt;
memset (dst+file_cnt, 0, sizeof (Sample) * delta);
}
@@ -363,8 +349,8 @@ SndFileSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t
return nread;
}
-jack_nframes_t
-SndFileSource::write_unlocked (Sample *data, jack_nframes_t cnt)
+nframes_t
+SndFileSource::write_unlocked (Sample *data, nframes_t cnt)
{
if (!writable()) {
return 0;
@@ -376,7 +362,7 @@ SndFileSource::write_unlocked (Sample *data, jack_nframes_t cnt)
return 0;
}
- jack_nframes_t oldlen;
+ nframes_t oldlen;
int32_t frame_pos = _length;
if (write_float (data, frame_pos, cnt) != cnt) {
@@ -409,7 +395,7 @@ SndFileSource::write_unlocked (Sample *data, jack_nframes_t cnt)
if (_build_peakfiles) {
- queue_for_peaks (this);
+ queue_for_peaks (shared_from_this ());
}
_write_data_count = cnt;
@@ -418,7 +404,7 @@ SndFileSource::write_unlocked (Sample *data, jack_nframes_t cnt)
}
int
-SndFileSource::update_header (jack_nframes_t when, struct tm& now, time_t tnow)
+SndFileSource::update_header (nframes_t when, struct tm& now, time_t tnow)
{
set_timeline_position (when);
@@ -437,12 +423,11 @@ SndFileSource::flush_header ()
if (!writable() || (sf == 0)) {
return -1;
}
-
return (sf_command (sf, SFC_UPDATE_HEADER_NOW, 0, 0) != SF_TRUE);
}
int
-SndFileSource::setup_broadcast_info (jack_nframes_t when, struct tm& now, time_t tnow)
+SndFileSource::setup_broadcast_info (nframes_t when, struct tm& now, time_t tnow)
{
if (!writable()) {
return -1;
@@ -511,8 +496,8 @@ SndFileSource::set_header_timeline_position ()
}
-jack_nframes_t
-SndFileSource::write_float (Sample* data, jack_nframes_t frame_pos, jack_nframes_t cnt)
+nframes_t
+SndFileSource::write_float (Sample* data, nframes_t frame_pos, nframes_t cnt)
{
if (sf_seek (sf, frame_pos, SEEK_SET|SFM_WRITE) != frame_pos) {
error << string_compose (_("%1: cannot seek to %2"), _path, frame_pos) << endmsg;
@@ -526,7 +511,7 @@ SndFileSource::write_float (Sample* data, jack_nframes_t frame_pos, jack_nframes
return cnt;
}
-jack_nframes_t
+nframes_t
SndFileSource::natural_position() const
{
return timeline_position;
diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc
index 977aea6efd..86ca0c55f2 100644
--- a/libs/ardour/source.cc
+++ b/libs/ardour/source.cc
@@ -79,7 +79,7 @@ Source::get_state ()
node->add_property ("name", _name);
node->add_property ("type", _type.to_string());
- _id.print (buf);
+ _id.print (buf, sizeof (buf));
node->add_property ("id", buf);
if (_timestamp != 0) {
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index 29cd5166ff..e9564a6193 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -18,6 +18,8 @@
$Id$
*/
+#include <pbd/error.h>
+
#include <ardour/source_factory.h>
#include <ardour/sndfilesource.h>
#include <ardour/smf_source.h>
@@ -32,9 +34,24 @@
using namespace ARDOUR;
using namespace std;
+using namespace PBD;
sigc::signal<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated;
+int
+SourceFactory::setup_peakfile (boost::shared_ptr<Source> s)
+{
+ boost::shared_ptr<AudioSource> as (boost::dynamic_pointer_cast<AudioSource> (s));
+ if (as) {
+ if (as->setup_peakfile ()) {
+ error << string_compose("SourceFactory: could not set up peakfile for %1", as->name()) << endmsg;
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
#ifdef HAVE_COREAUDIO
boost::shared_ptr<Source>
SourceFactory::create (Session& s, const XMLNode& node)
@@ -46,17 +63,23 @@ SourceFactory::create (Session& s, const XMLNode& node)
}
if (type == DataType::AUDIO) {
-
+
if (node.property (X_("destructive")) != 0) {
-
+
boost::shared_ptr<Source> ret (new DestructiveFileSource (s, node));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
SourceCreated (ret);
return ret;
-
+
} else {
try {
boost::shared_ptr<Source> ret (new CoreAudioSource (s, node));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
SourceCreated (ret);
return ret;
@@ -70,7 +93,11 @@ SourceFactory::create (Session& s, const XMLNode& node)
catch (failed_constructor& err) {
- boost::shared_ptr<Source> ret (new SndFileSource (node));
+
+ boost::shared_ptr<Source> ret (new SndFileSource (s, node));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
SourceCreated (ret);
return ret;
}
@@ -101,20 +128,26 @@ SourceFactory::create (Session& s, const XMLNode& node)
if (type == DataType::AUDIO) {
if (node.property (X_("destructive")) != 0) {
-
+
boost::shared_ptr<Source> ret (new DestructiveFileSource (s, node));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
SourceCreated (ret);
return ret;
} else {
-
+
boost::shared_ptr<Source> ret (new SndFileSource (s, node));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
SourceCreated (ret);
return ret;
}
} else if (type == DataType::MIDI) {
-
+
boost::shared_ptr<Source> ret (new SMFSource (s, node));
SourceCreated (ret);
return ret;
@@ -130,9 +163,13 @@ SourceFactory::create (Session& s, const XMLNode& node)
boost::shared_ptr<Source>
SourceFactory::createReadable (DataType type, Session& s, string idstr, AudioFileSource::Flag flags, bool announce)
{
+<<<<<<< .working
if (type == DataType::AUDIO) {
if (flags & Destructive) {
boost::shared_ptr<Source> ret (new DestructiveFileSource (s, idstr, flags));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
if (announce) {
SourceCreated (ret);
}
@@ -172,6 +209,9 @@ SourceFactory::createReadable (DataType type, Session& s, string idstr, AudioFil
if (type == DataType::AUDIO) {
boost::shared_ptr<Source> ret (new SndFileSource (s, idstr, flags));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
if (announce) {
SourceCreated (ret);
}
@@ -180,6 +220,9 @@ SourceFactory::createReadable (DataType type, Session& s, string idstr, AudioFil
} else if (type == DataType::MIDI) {
boost::shared_ptr<Source> ret (new SMFSource (s, idstr, SMFSource::Flag(0))); // FIXME: flags?
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
if (announce) {
SourceCreated (ret);
}
@@ -193,35 +236,37 @@ SourceFactory::createReadable (DataType type, Session& s, string idstr, AudioFil
#endif // HAVE_COREAUDIO
boost::shared_ptr<Source>
-SourceFactory::createWritable (DataType type, Session& s, std::string path, bool destructive, jack_nframes_t rate, bool announce)
+SourceFactory::createWritable (DataType type, Session& s, std::string path, bool destructive, nframes_t rate, bool announce)
{
/* this might throw failed_constructor(), which is OK */
if (type == DataType::AUDIO) {
+
if (destructive) {
-
boost::shared_ptr<Source> ret (new DestructiveFileSource (s, path,
Config->get_native_file_data_format(),
Config->get_native_file_header_format(),
rate));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
if (announce) {
SourceCreated (ret);
}
- return ret;
-
} else {
-
boost::shared_ptr<Source> ret (new SndFileSource (s, path,
Config->get_native_file_data_format(),
Config->get_native_file_header_format(),
rate));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
if (announce) {
SourceCreated (ret);
}
return ret;
-
}
-
+
} else if (type == DataType::MIDI) {
boost::shared_ptr<Source> ret (new SMFSource (s, path));
diff --git a/libs/ardour/sse_functions.s b/libs/ardour/sse_functions.s
index 7df689188c..934ce6887a 100644
--- a/libs/ardour/sse_functions.s
+++ b/libs/ardour/sse_functions.s
@@ -524,6 +524,8 @@ x86_sse_compute_peak:
.size x86_sse_compute_peak, .-x86_sse_compute_peak
#; end proc
-
+#ifdef __ELF__
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index c2ff4f9a3a..3cc5420c67 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -47,7 +47,7 @@ const double Meter::ticks_per_beat = 1920.0;
/***********************************************************************/
double
-Meter::frames_per_bar (const Tempo& tempo, jack_nframes_t sr) const
+Meter::frames_per_bar (const Tempo& tempo, nframes_t sr) const
{
return ((60.0 * sr * _beats_per_bar) / tempo.beats_per_minute());
}
@@ -200,7 +200,7 @@ struct MetricSectionSorter {
}
};
-TempoMap::TempoMap (jack_nframes_t fr)
+TempoMap::TempoMap (nframes_t fr)
{
metrics = new Metrics;
_frame_rate = fr;
@@ -509,8 +509,8 @@ TempoMap::timestamp_metrics ()
const Tempo* tempo;
Meter *m;
Tempo *t;
- jack_nframes_t current;
- jack_nframes_t section_frames;
+ nframes_t current;
+ nframes_t section_frames;
BBT_Time start;
BBT_Time end;
@@ -542,7 +542,7 @@ TempoMap::timestamp_metrics ()
}
TempoMap::Metric
-TempoMap::metric_at (jack_nframes_t frame) const
+TempoMap::metric_at (nframes_t frame) const
{
Metric m (first_meter(), first_tempo());
const Meter* meter;
@@ -610,7 +610,7 @@ TempoMap::metric_at (BBT_Time bbt) const
}
void
-TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const
+TempoMap::bbt_time (nframes_t frame, BBT_Time& bbt) const
{
{
Glib::RWLock::ReaderLock lm (lock);
@@ -619,15 +619,15 @@ TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const
}
void
-TempoMap::bbt_time_unlocked (jack_nframes_t frame, BBT_Time& bbt) const
+TempoMap::bbt_time_unlocked (nframes_t frame, BBT_Time& bbt) const
{
bbt_time_with_metric (frame, bbt, metric_at (frame));
}
void
-TempoMap::bbt_time_with_metric (jack_nframes_t frame, BBT_Time& bbt, const Metric& metric) const
+TempoMap::bbt_time_with_metric (nframes_t frame, BBT_Time& bbt, const Metric& metric) const
{
- jack_nframes_t frame_diff;
+ nframes_t frame_diff;
uint32_t xtra_bars = 0;
double xtra_beats = 0;
@@ -667,7 +667,7 @@ TempoMap::bbt_time_with_metric (jack_nframes_t frame, BBT_Time& bbt, const Metri
}
-jack_nframes_t
+nframes_t
TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) const
{
@@ -676,9 +676,9 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con
*/
- jack_nframes_t frames = 0;
- jack_nframes_t start_frame = 0;
- jack_nframes_t end_frame = 0;
+ nframes_t frames = 0;
+ nframes_t start_frame = 0;
+ nframes_t end_frame = 0;
Metric m = metric_at(start);
@@ -688,7 +688,7 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con
+ start.ticks/Meter::ticks_per_beat;
- start_frame = m.frame() + (jack_nframes_t) rint( beat_offset * m.tempo().frames_per_beat(_frame_rate));
+ start_frame = m.frame() + (nframes_t) rint( beat_offset * m.tempo().frames_per_beat(_frame_rate));
m = metric_at(end);
@@ -697,7 +697,7 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con
beat_offset = bar_offset * m.meter().beats_per_bar() - (m.start().beats -1) + (end.beats - 1)
+ end.ticks/Meter::ticks_per_beat;
- end_frame = m.frame() + (jack_nframes_t) rint(beat_offset * m.tempo().frames_per_beat(_frame_rate));
+ end_frame = m.frame() + (nframes_t) rint(beat_offset * m.tempo().frames_per_beat(_frame_rate));
frames = end_frame - start_frame;
@@ -705,12 +705,12 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con
}
-jack_nframes_t
+nframes_t
TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo, const BBT_Time& start, const BBT_Time& end) const
{
/*this is used in timestamping the metrics by actually counting the beats */
- jack_nframes_t frames = 0;
+ nframes_t frames = 0;
uint32_t bar = start.bars;
double beat = (double) start.beats;
double beats_counted = 0;
@@ -739,13 +739,13 @@ TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo,
}
}
- frames = (jack_nframes_t) floor (beats_counted * beat_frames);
+ frames = (nframes_t) floor (beats_counted * beat_frames);
return frames;
}
-jack_nframes_t
+nframes_t
TempoMap::frame_time (const BBT_Time& bbt) const
{
BBT_Time start ; /* 1|1|0 */
@@ -753,10 +753,10 @@ TempoMap::frame_time (const BBT_Time& bbt) const
return count_frames_between ( start, bbt);
}
-jack_nframes_t
-TempoMap::bbt_duration_at (jack_nframes_t pos, const BBT_Time& bbt, int dir) const
+nframes_t
+TempoMap::bbt_duration_at (nframes_t pos, const BBT_Time& bbt, int dir) const
{
- jack_nframes_t frames = 0;
+ nframes_t frames = 0;
BBT_Time when;
bbt_time(pos,when);
@@ -769,11 +769,11 @@ TempoMap::bbt_duration_at (jack_nframes_t pos, const BBT_Time& bbt, int dir) con
return frames;
}
-jack_nframes_t
+nframes_t
TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const
{
- jack_nframes_t frames = 0;
+ nframes_t frames = 0;
double beats_per_bar;
BBT_Time result;
@@ -896,8 +896,8 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i
-jack_nframes_t
-TempoMap::round_to_bar (jack_nframes_t fr, int dir)
+nframes_t
+TempoMap::round_to_bar (nframes_t fr, int dir)
{
{
Glib::RWLock::ReaderLock lm (lock);
@@ -906,8 +906,8 @@ TempoMap::round_to_bar (jack_nframes_t fr, int dir)
}
-jack_nframes_t
-TempoMap::round_to_beat (jack_nframes_t fr, int dir)
+nframes_t
+TempoMap::round_to_beat (nframes_t fr, int dir)
{
{
Glib::RWLock::ReaderLock lm (lock);
@@ -915,9 +915,9 @@ TempoMap::round_to_beat (jack_nframes_t fr, int dir)
}
}
-jack_nframes_t
+nframes_t
-TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
+TempoMap::round_to_beat_subdivision (nframes_t fr, int sub_num)
{
BBT_Time the_beat;
@@ -948,16 +948,16 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
TempoMap::BBTPointList::iterator i;
TempoMap::BBTPointList *more_zoomed_bbt_points;
- jack_nframes_t frame_one_beats_worth;
- jack_nframes_t pos = 0;
- jack_nframes_t next_pos = 0 ;
+ nframes_t frame_one_beats_worth;
+ nframes_t pos = 0;
+ nframes_t next_pos = 0 ;
double tempo = 1;
double frames_one_subdivisions_worth;
bool fr_has_changed = false;
int n;
- frame_one_beats_worth = (jack_nframes_t) ::floor ((double) _frame_rate * 60 / 20 ); //one beat @ 20 bpm
+ frame_one_beats_worth = (nframes_t) ::floor ((double) _frame_rate * 60 / 20 ); //one beat @ 20 bpm
{
Glib::RWLock::ReaderLock lm (lock);
more_zoomed_bbt_points = get_points((fr >= frame_one_beats_worth) ?
@@ -982,7 +982,7 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
for (n = sub_num; n > 0; n--) {
if (fr >= (pos + ((n - 0.5) * frames_one_subdivisions_worth))) {
- fr = (jack_nframes_t) round(pos + (n * frames_one_subdivisions_worth));
+ fr = (nframes_t) round(pos + (n * frames_one_subdivisions_worth));
if (fr > next_pos) {
fr = next_pos; //take care of fractional beats that don't match the subdivision asked
}
@@ -1002,9 +1002,9 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
}
-jack_nframes_t
+nframes_t
-TempoMap::round_to_type (jack_nframes_t frame, int dir, BBTPointType type)
+TempoMap::round_to_type (nframes_t frame, int dir, BBTPointType type)
{
Metric metric = metric_at (frame);
BBT_Time bbt;
@@ -1055,7 +1055,7 @@ TempoMap::round_to_type (jack_nframes_t frame, int dir, BBTPointType type)
}
TempoMap::BBTPointList *
-TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
+TempoMap::get_points (nframes_t lower, nframes_t upper) const
{
Metrics::const_iterator i;
@@ -1071,7 +1071,7 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
double beat_frame;
double beat_frames;
double frames_per_bar;
- jack_nframes_t limit;
+ nframes_t limit;
meter = &first_meter ();
tempo = &first_tempo ();
@@ -1132,7 +1132,7 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
if (beat == 1) {
if (current >= lower) {
- points->push_back (BBTPoint (*meter, *tempo,(jack_nframes_t)rint(current), Bar, bar, 1));
+ points->push_back (BBTPoint (*meter, *tempo,(nframes_t)rint(current), Bar, bar, 1));
}
}
@@ -1143,7 +1143,7 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
while (beat <= ceil( beats_per_bar) && beat_frame < limit) {
if (beat_frame >= lower) {
- points->push_back (BBTPoint (*meter, *tempo, (jack_nframes_t) rint(beat_frame), Beat, bar, beat));
+ points->push_back (BBTPoint (*meter, *tempo, (nframes_t) rint(beat_frame), Beat, bar, beat));
}
beat_frame += beat_frames;
current+= beat_frames;
@@ -1206,7 +1206,7 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
}
const Tempo&
-TempoMap::tempo_at (jack_nframes_t frame)
+TempoMap::tempo_at (nframes_t frame)
{
Metric m (metric_at (frame));
return m.tempo();
@@ -1214,7 +1214,7 @@ TempoMap::tempo_at (jack_nframes_t frame)
const Meter&
-TempoMap::meter_at (jack_nframes_t frame)
+TempoMap::meter_at (nframes_t frame)
{
Metric m (metric_at (frame));
return m.meter();
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 79229efdab..053a866256 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -88,7 +88,7 @@ Track::toggle_monitor_input ()
}
}
-jack_nframes_t
+ARDOUR::nframes_t
Track::update_total_latency ()
{
_own_latency = 0;
@@ -119,7 +119,7 @@ Track::freeze_state() const
}
Track::RecEnableControllable::RecEnableControllable (Track& s)
- : track (s)
+ : Controllable (X_("recenable")), track (s)
{
}
@@ -218,7 +218,7 @@ Track::set_name (string str, void *src)
}
void
-Track::set_latency_delay (jack_nframes_t longest_session_latency)
+Track::set_latency_delay (nframes_t longest_session_latency)
{
Route::set_latency_delay (longest_session_latency);
_diskstream->set_roll_delay (_roll_delay);
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc
index ce4f4accd3..9a841e81b4 100644
--- a/libs/ardour/utils.cc
+++ b/libs/ardour/utils.cc
@@ -18,6 +18,9 @@
$Id$
*/
+#define __STDC_FORMAT_MACROS 1
+#include <stdint.h>
+
#include <cstdio> /* for sprintf */
#include <cmath>
#include <cctype>
@@ -279,7 +282,7 @@ CFStringRefToStdString(CFStringRef stringRef)
#endif // HAVE_COREAUDIO
void
-compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out)
+compute_equal_power_fades (nframes_t nframes, float* in, float* out)
{
double step;
@@ -287,7 +290,7 @@ compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out)
in[0] = 0.0f;
- for (jack_nframes_t i = 1; i < nframes - 1; ++i) {
+ for (nframes_t i = 1; i < nframes - 1; ++i) {
in[i] = in[i-1] + step;
}
@@ -303,3 +306,104 @@ compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out)
in[n] = inVal * (scale * inVal + 1.0f - scale);
}
}
+
+EditMode
+string_to_edit_mode (string str)
+{
+ if (str == _("Splice Edit")) {
+ return Splice;
+ } else if (str == _("Slide Edit")) {
+ return Slide;
+ }
+ fatal << string_compose (_("programming error: unknown edit mode string \"%1\""), str) << endmsg;
+ /*NOTREACHED*/
+ return Slide;
+}
+
+const char*
+edit_mode_to_string (EditMode mode)
+{
+ switch (mode) {
+ case Slide:
+ return _("Slide Edit");
+
+ default:
+ case Splice:
+ return _("Splice Edit");
+ }
+}
+
+SlaveSource
+string_to_slave_source (string str)
+{
+ if (str == _("Internal")) {
+ return None;
+ }
+
+ if (str == _("MTC")) {
+ return MTC;
+ }
+
+ if (str == _("JACK")) {
+ return JACK;
+ }
+
+ fatal << string_compose (_("programming error: unknown slave source string \"%1\""), str) << endmsg;
+ /*NOTREACHED*/
+ return None;
+}
+
+const char*
+slave_source_to_string (SlaveSource src)
+{
+ switch (src) {
+ case JACK:
+ return _("JACK");
+
+ case MTC:
+ return _("MTC");
+
+ default:
+ case None:
+ return _("Internal");
+
+ }
+}
+
+float
+meter_falloff_to_float (MeterFalloff falloff)
+{
+ switch (falloff) {
+ case MeterFalloffOff:
+ return 0.0f;
+ case MeterFalloffSlowest:
+ return 1.0f;
+ case MeterFalloffSlow:
+ return 2.0f;
+ case MeterFalloffMedium:
+ return 3.0f;
+ case MeterFalloffFast:
+ return 4.0f;
+ case MeterFalloffFaster:
+ return 5.0f;
+ case MeterFalloffFastest:
+ default:
+ return 6.0f;
+ }
+}
+
+float
+meter_hold_to_float (MeterHold hold)
+{
+ switch (hold) {
+ case MeterHoldOff:
+ return 0.0f;
+ case MeterHoldShort:
+ return 40.0f;
+ case MeterHoldMedium:
+ return 100.0f;
+ case MeterHoldLong:
+ default:
+ return 200.0f;
+ }
+}
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index 5dd32f2d51..800c5a9856 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -103,7 +103,7 @@ VSTPlugin::~VSTPlugin ()
}
void
-VSTPlugin::set_block_size (jack_nframes_t nframes)
+VSTPlugin::set_block_size (nframes_t nframes)
{
deactivate ();
_plugin->dispatcher (_plugin, effSetBlockSize, 0, nframes, NULL, 0.0f);
@@ -212,7 +212,7 @@ VSTPlugin::get_state()
char index[64];
char val[32];
snprintf (index, sizeof (index), "param_%ld", n);
- snprintf (val, sizeof (val), "%f", _plugin->getParameter (_plugin, n));
+ snprintf (val, sizeof (val), "%.12g", _plugin->getParameter (_plugin, n));
parameters->add_property (index, val);
}
@@ -245,6 +245,7 @@ VSTPlugin::set_state(const XMLNode& node)
for (i = child->properties().begin(); i != child->properties().end(); ++i) {
long param;
float val;
+
sscanf ((*i)->name().c_str(), "param_%ld", &param);
sscanf ((*i)->value().c_str(), "%f", &val);
@@ -357,7 +358,7 @@ VSTPlugin::describe_parameter (uint32_t param)
return name;
}
-jack_nframes_t
+nframes_t
VSTPlugin::latency () const
{
return _plugin->initialDelay;
@@ -376,7 +377,7 @@ VSTPlugin::automatable () const
}
int
-VSTPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in_index, int32_t& out_index, jack_nframes_t nframes, jack_nframes_t offset)
+VSTPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in_index, int32_t& out_index, nframes_t nframes, nframes_t offset)
{
float *ins[_plugin->numInputs];
float *outs[_plugin->numOutputs];