namespace ARDOUR {
-class Session;
-class Route;
+class AudioFileSource;
+class AudioPlaylist;
class Location;
+class MidiPlaylist;
+class Playlist;
+class Route;
+class Route;
+class Session;
+
+template<typename T> class MidiRingBuffer;
class LIBARDOUR_API DiskIOProcessor : public Processor
{
DiskIOProcessor (Session&, const std::string& name, Flag f);
+ void set_route (boost::shared_ptr<Route>);
+ void drop_route ();
+
static void set_buffering_parameters (BufferingPreset bp);
- /** @return A number between 0 and 1, where 0 indicates that the playback buffer
+ int set_block_size (pframes_t);
+ bool configure_io (ChanCount in, ChanCount out);
+ bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
+
+ /** @return A number between 0 and 1, where 0 indicates that the playback/capture buffer
* is dry (ie the disk subsystem could not keep up) and 1 indicates that the
* buffer is full.
*/
- virtual float playback_buffer_load() const = 0;
- virtual float capture_buffer_load() const = 0;
+ virtual float buffer_load() const = 0;
void set_flag (Flag f) { _flags = Flag (_flags | f); }
void unset_flag (Flag f) { _flags = Flag (_flags & ~f); }
bool hidden() const { return _flags & Hidden; }
bool recordable() const { return _flags & Recordable; }
bool non_layered() const { return _flags & NonLayered; }
- bool reversed() const { return _actual_speed < 0.0f; }
- double speed() const { return _visible_speed; }
- ChanCount n_channels() { return _n_channels; }
+ virtual void non_realtime_locate (samplepos_t);
- void non_realtime_set_speed ();
- bool realtime_set_speed (double sp, bool global);
+ void non_realtime_speed_change ();
+ bool realtime_speed_change ();
virtual void punch_in() {}
virtual void punch_out() {}
- virtual float buffer_load() const = 0;
-
bool slaved() const { return _slaved; }
void set_slaved(bool yn) { _slaved = yn; }
int add_channel (uint32_t how_many);
int remove_channel (uint32_t how_many);
+ bool need_butler() const { return _need_butler; }
+
+ boost::shared_ptr<Playlist> get_playlist (DataType dt) const { return _playlists[dt]; }
+ boost::shared_ptr<MidiPlaylist> midi_playlist() const;
+ boost::shared_ptr<AudioPlaylist> audio_playlist() const;
+
+ virtual void playlist_modified () {}
+ virtual int use_playlist (DataType, boost::shared_ptr<Playlist>);
+
+ PBD::Signal1<void,DataType> PlaylistChanged;
+
+ virtual void adjust_buffering() = 0;
+
protected:
friend class Auditioner;
- virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0;
+ virtual int seek (samplepos_t which_sample, bool complete_refill = false) = 0;
protected:
Flag _flags;
- uint32_t i_am_the_modifier;
- ChanCount _n_channels;
- double _visible_speed;
+ uint32_t i_am_the_modifier;
double _actual_speed;
- double _speed;
double _target_speed;
/* items needed for speed change logic */
bool _buffer_reallocation_required;
bool _slaved;
Location* loop_location;
bool in_set_state;
- framecnt_t wrap_buffer_size;
- framecnt_t speed_buffer_size;
+ samplepos_t playback_sample;
+ samplecnt_t wrap_buffer_size;
+ samplecnt_t speed_buffer_size;
+ bool _need_butler;
+ boost::shared_ptr<Route> _route;
+
+ void init ();
Glib::Threads::Mutex state_lock;
static bool get_buffering_presets (BufferingPreset bp,
- framecnt_t& read_chunk_size,
- framecnt_t& read_buffer_size,
- framecnt_t& write_chunk_size,
- framecnt_t& write_buffer_size);
+ samplecnt_t& read_chunk_size,
+ samplecnt_t& read_buffer_size,
+ samplecnt_t& write_chunk_size,
+ samplecnt_t& write_buffer_size);
+
+ enum TransitionType {
+ CaptureStart = 0,
+ CaptureEnd
+ };
- virtual void allocate_temporary_buffers () = 0;
+ struct CaptureTransition {
+ TransitionType type;
+ samplepos_t capture_val; ///< The start or end file sample position
+ };
/** Information about one audio channel, playback or capture
* (depending on the derived class)
*/
struct ChannelInfo : public boost::noncopyable {
- ChannelInfo (framecnt_t buffer_size,
- framecnt_t speed_buffer_size,
- framecnt_t wrap_buffer_size);
+ ChannelInfo (samplecnt_t buffer_size);
~ChannelInfo ();
- Sample *wrap_buffer;
- Sample *speed_buffer;
- Sample *current_buffer;
-
/** A ringbuffer for data to be played back, written to in the
butler thread, read from in the process thread.
*/
Sample* scrub_forward_buffer;
Sample* scrub_reverse_buffer;
- PBD::RingBufferNPT<Sample>::rw_vector read_vector;
+ PBD::RingBufferNPT<Sample>::rw_vector rw_vector;
+
+ /* used only by capture */
+ boost::shared_ptr<AudioFileSource> write_source;
+ PBD::RingBufferNPT<CaptureTransition> * capture_transition_buf;
+ // the following are used in the butler thread only
+ samplecnt_t curr_capture_cnt;
- void resize (framecnt_t);
+ void resize (samplecnt_t);
};
typedef std::vector<ChannelInfo*> ChannelList;
CubicInterpolation interpolation;
+ boost::shared_ptr<Playlist> _playlists[DataType::num_types];
+ PBD::ScopedConnectionList playlist_connections;
+
+ virtual void playlist_changed (const PBD::PropertyChange&) {}
+ virtual void playlist_deleted (boost::weak_ptr<Playlist>);
+ virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool) {}
+
+ /* The MIDI stuff */
+
+ MidiRingBuffer<samplepos_t>* _midi_buf;
+ gint _samples_written_to_ringbuffer;
+ gint _samples_read_from_ringbuffer;
+ CubicMidiInterpolation midi_interpolation;
+
+ static void get_location_times (const Location* location, samplepos_t* start, samplepos_t* end, samplepos_t* length);
};
} // namespace ARDOUR