/*
- Copyright (C) 2002-2006 Paul Davis
+ Copyright (C) 2002-2006 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#ifndef __ardour_audio_track_h__
#define __ardour_audio_track_h__
-#include <ardour/route.h>
+#include "ardour/interthread_info.h"
+#include "ardour/track.h"
namespace ARDOUR {
class AudioDiskstream;
class AudioPlaylist;
class RouteGroup;
+class AudioFileSource;
-class AudioTrack : public Route
+class LIBARDOUR_API AudioTrack : public Track
{
public:
- AudioTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
- AudioTrack (Session&, const XMLNode&);
+ AudioTrack (Session&, std::string name, TrackMode m = Normal);
~AudioTrack ();
-
- int set_name (string str, void *src);
- int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame,
+ int set_mode (TrackMode m);
+ bool can_use_mode (TrackMode m, bool& bounce_required);
- jack_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 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 roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ int declick, bool& need_butler);
- void toggle_monitor_input ();
+ boost::shared_ptr<Diskstream> create_diskstream ();
+ void set_diskstream (boost::shared_ptr<Diskstream>);
- bool can_record() const { return true; }
- void set_record_enable (bool yn, void *src);
-
- AudioDiskstream& disk_stream() const { return *diskstream; }
- int set_diskstream (AudioDiskstream&, void *);
- int use_diskstream (string name);
- int use_diskstream (const PBD::ID& id);
-
- TrackMode mode() const { return _mode; }
- void set_mode (TrackMode m);
- sigc::signal<void> ModeChanged;
-
- jack_nframes_t update_total_latency();
- void set_latency_delay (jack_nframes_t);
-
- int export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t end_frame);
-
- sigc::signal<void,void*> diskstream_changed;
-
- enum FreezeState {
- NoFreeze,
- Frozen,
- UnFrozen
- };
-
- FreezeState freeze_state() const;
+ DataType data_type () const {
+ return DataType::AUDIO;
+ }
- sigc::signal<void> FreezeChange;
-
- void freeze (InterThreadInfo&);
+ void freeze_me (InterThreadInfo&);
void unfreeze ();
- void bounce (InterThreadInfo&);
- void bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo&);
-
- XMLNode& get_state();
- XMLNode& get_template();
- int set_state(const XMLNode& node);
+ bool bounceable (boost::shared_ptr<Processor>, bool include_endpoint) const;
+ boost::shared_ptr<Region> bounce (InterThreadInfo&);
+ boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&,
+ boost::shared_ptr<Processor> endpoint, bool include_endpoint);
+ int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes,
+ boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze);
- PBD::Controllable& rec_enable_control() {
- return _rec_enable_control;
- }
+ int set_state (const XMLNode&, int version);
- bool record_enabled() const;
- void set_meter_point (MeterPoint, void* src);
+ boost::shared_ptr<AudioFileSource> write_source (uint32_t n = 0);
protected:
- AudioDiskstream *diskstream;
- MeterPoint _saved_meter_point;
- TrackMode _mode;
-
+ boost::shared_ptr<AudioDiskstream> audio_diskstream () const;
XMLNode& state (bool full);
- void passthru_silence (jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t nframes, jack_nframes_t offset, int declick,
- bool meter);
-
- uint32_t n_process_buffers ();
-
private:
- struct FreezeRecordInsertInfo {
- FreezeRecordInsertInfo(XMLNode& st, boost::shared_ptr<Insert> ins)
- : state (st), insert (ins) {}
- XMLNode state;
- boost::shared_ptr<Insert> insert;
- PBD::ID id;
- UndoAction memento;
- };
+ boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &);
- struct FreezeRecord {
- FreezeRecord() {
- playlist = 0;
- have_mementos = false;
- }
-
- ~FreezeRecord();
-
- AudioPlaylist* playlist;
- vector<FreezeRecordInsertInfo*> insert_info;
- bool have_mementos;
- FreezeState state;
- };
-
- FreezeRecord _freeze_record;
- XMLNode* pending_state;
-
- void diskstream_record_enable_changed (void *src);
- void diskstream_input_channel_changed (void *src);
-
- void input_change_handler (void *src);
-
- sigc::connection recenable_connection;
- sigc::connection ic_connection;
-
- int deprecated_use_diskstream_connections ();
+ int deprecated_use_diskstream_connections ();
void set_state_part_two ();
void set_state_part_three ();
-
- struct RecEnableControllable : public PBD::Controllable {
- RecEnableControllable (AudioTrack&);
-
- void set_value (float);
- float get_value (void) const;
-
- AudioTrack& track;
- };
-
- RecEnableControllable _rec_enable_control;
-
- bool _destructive;
};
} // namespace ARDOUR