diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/disk_reader.h | 47 | ||||
-rw-r--r-- | libs/ardour/ardour/rc_configuration_vars.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/track.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/transport_fsm.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/types_convert.h | 1 |
8 files changed, 58 insertions, 8 deletions
diff --git a/libs/ardour/ardour/disk_reader.h b/libs/ardour/ardour/disk_reader.h index 427a6503d2..970295b6c2 100644 --- a/libs/ardour/ardour/disk_reader.h +++ b/libs/ardour/ardour/disk_reader.h @@ -22,6 +22,8 @@ #include "pbd/i18n.h" +#include "evoral/Curve.h" + #include "ardour/disk_io.h" #include "ardour/midi_buffer.h" #include "ardour/midi_state_tracker.h" @@ -53,6 +55,7 @@ public: void realtime_locate (bool); bool overwrite_existing_buffers (); void set_pending_overwrite (); + void set_loop (Location *); int set_state (const XMLNode&, int version); @@ -96,6 +99,7 @@ public: void reset_tracker (); bool declick_in_progress () const; + void reload_loop (); static void set_midi_readahead_samples (samplecnt_t samples_ahead) { midi_readahead = samples_ahead; } @@ -110,18 +114,30 @@ public: static void inc_no_disk_output (); static void dec_no_disk_output(); static bool no_disk_output () { return g_atomic_int_get (&_no_disk_output); } + static void reset_loop_declick (Location*, samplecnt_t sample_rate); + static void alloc_loop_declick (samplecnt_t sample_rate); protected: friend class Track; friend class MidiTrack; - struct ReaderChannelInfo : public DiskIOProcessor::ChannelInfo { - ReaderChannelInfo (samplecnt_t buffer_size) + struct ReaderChannelInfo : public DiskIOProcessor::ChannelInfo + { + ReaderChannelInfo (samplecnt_t buffer_size, samplecnt_t preloop_size) : DiskIOProcessor::ChannelInfo (buffer_size) + , pre_loop_buffer (0) + , pre_loop_buffer_size (0) { resize (buffer_size); + resize_preloop (preloop_size); } + ~ReaderChannelInfo() { delete [] pre_loop_buffer; } + void resize (samplecnt_t); + void resize_preloop (samplecnt_t); + + Sample* pre_loop_buffer; + samplecnt_t pre_loop_buffer_size; }; XMLNode& state (); @@ -138,7 +154,7 @@ protected: public: DeclickAmp (samplecnt_t sample_rate); - void apply_gain (AudioBuffer& buf, samplecnt_t n_samples, const float target); + void apply_gain (AudioBuffer& buf, samplecnt_t n_samples, const float target, sampleoffset_t buffer_offset = 0); float gain () const { return _g; } void set_gain (float g) { _g = g; } @@ -149,6 +165,22 @@ protected: float _g; }; + class Declicker { + public: + Declicker (); + ~Declicker (); + + void alloc (samplecnt_t sr, bool fadein); + + void run (Sample* buf, samplepos_t start, samplepos_t end); + void reset (samplepos_t start, samplepos_t end, bool fadein, samplecnt_t sr); + + samplepos_t fade_start; + samplepos_t fade_end; + samplecnt_t fade_length; + Sample* vec; + }; + private: /** The number of samples by which this diskstream's output should be delayed with respect to the transport sample. This is used for latency compensation. @@ -170,12 +202,18 @@ private: static samplecnt_t midi_readahead; static gint _no_disk_output; + static Declicker loop_declick_in; + static Declicker loop_declick_out; + static samplecnt_t loop_fade_length; + int audio_read (PBD::PlaybackBuffer<Sample>*, Sample* sum_buffer, Sample* mixdown_buffer, float* gain_buffer, samplepos_t& start, samplecnt_t cnt, - int channel, bool reversed); + ReaderChannelInfo* rci, + int channel, + bool reversed); static Sample* _sum_buffer; static Sample* _mixdown_buffer; @@ -189,6 +227,7 @@ private: RTMidiBuffer* rt_midibuffer(); void get_midi_playback (MidiBuffer& dst, samplepos_t start_sample, samplepos_t end_sample, MonitorState, BufferSet&, double speed, samplecnt_t distance); + void maybe_xfade_loop (Sample*, samplepos_t read_start, samplepos_t read_end, ReaderChannelInfo*); }; } // namespace diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index 6938531b5e..b572bec865 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -162,6 +162,7 @@ CONFIG_VARIABLE (bool, create_xrun_marker, "create-xrun-marker", true) CONFIG_VARIABLE (bool, stop_at_session_end, "stop-at-session-end", false) CONFIG_VARIABLE (float, preroll_seconds, "preroll-seconds", -2.0f) CONFIG_VARIABLE (bool, loop_is_mode, "loop-is-mode", false) +CONFIG_VARIABLE (LoopFadeChoice, loop_fade_choice, "loop-fade-choice", XFadeLoop) CONFIG_VARIABLE (samplecnt_t, preroll, "preroll", 0) CONFIG_VARIABLE (samplecnt_t, postroll, "postroll", 0) CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) // used for MMC shuttle diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index efc93a7ee9..5c2c4ad48d 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -360,6 +360,8 @@ public: PBD::Signal0<void> denormal_protection_changed; PBD::Signal0<void> comment_changed; + virtual void reload_loop(); + bool is_track(); /** track numbers - assigned by session diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 4e74a1dc5a..3a3f16dfdf 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1486,7 +1486,6 @@ private: PBD::ScopedConnectionList loop_connections; void auto_loop_changed (Location *); - void auto_loop_declick_range (Location *, samplepos_t &, samplepos_t &); void pre_engine_init (std::string path); int post_engine_init (); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 90d5574b65..0b6462fbc3 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -166,6 +166,7 @@ public: } void adjust_playback_buffering (); void adjust_capture_buffering (); + void reload_loop (); PBD::Signal0<void> FreezeChange; PBD::Signal0<void> PlaylistChanged; diff --git a/libs/ardour/ardour/transport_fsm.h b/libs/ardour/ardour/transport_fsm.h index 7eafccead1..26ccb78765 100644 --- a/libs/ardour/ardour/transport_fsm.h +++ b/libs/ardour/ardour/transport_fsm.h @@ -54,7 +54,7 @@ struct TransportFSM }; /* for locate */ samplepos_t target; - bool with_loop; + bool for_loop_end; bool force; Event (EventType t) @@ -62,7 +62,7 @@ struct TransportFSM , with_roll (false) , with_flush (false) , target (0) - , with_loop (false) + , for_loop_end (false) , force (false) {} Event (EventType t, bool ab, bool cl) @@ -77,7 +77,7 @@ struct TransportFSM , with_roll (r) , with_flush (fl) , target (pos) - , with_loop (lp) + , for_loop_end (lp) , force (f4c) { assert (t == Locate); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index ea96c7fd6d..7cd3759a88 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -785,6 +785,13 @@ struct CaptureInfo { samplecnt_t samples; }; +enum LoopFadeChoice { + NoLoopFade, + EndLoopFade, + BothLoopFade, + XFadeLoop, +}; + typedef std::vector<CaptureInfo*> CaptureInfos; } // namespace ARDOUR diff --git a/libs/ardour/ardour/types_convert.h b/libs/ardour/ardour/types_convert.h index ae48c7602d..9e46d51982 100644 --- a/libs/ardour/ardour/types_convert.h +++ b/libs/ardour/ardour/types_convert.h @@ -75,6 +75,7 @@ DEFINE_ENUM_CONVERT(ARDOUR::VUMeterStandard) DEFINE_ENUM_CONVERT(ARDOUR::MeterLineUp) DEFINE_ENUM_CONVERT(ARDOUR::MidiPortFlags) DEFINE_ENUM_CONVERT(ARDOUR::TransportRequestType) +DEFINE_ENUM_CONVERT(ARDOUR::LoopFadeChoice) DEFINE_ENUM_CONVERT(MusicalMode::Type) |