2 Copyright (C) 2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __ardour_track_h__
20 #define __ardour_track_h__
22 #include <boost/shared_ptr.hpp>
24 #include "ardour/route.h"
34 class Track : public Route
37 Track (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO);
41 bool set_name (const std::string& str);
43 TrackMode mode () const { return _mode; }
44 virtual int set_mode (TrackMode m) { return false; }
45 virtual bool can_use_mode (TrackMode m, bool& bounce_required) { return false; }
46 sigc::signal<void> TrackModeChanged;
48 virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
49 nframes_t offset, int declick, bool can_record, bool rec_monitors_input) = 0;
51 virtual int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
52 nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input) = 0;
54 virtual int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
55 nframes_t offset, bool can_record, bool rec_monitors_input) = 0;
57 void toggle_monitor_input ();
61 boost::shared_ptr<Diskstream> diskstream() const { return _diskstream; }
63 virtual int use_diskstream (string name) = 0;
64 virtual int use_diskstream (const PBD::ID& id) = 0;
66 nframes_t update_total_latency();
67 void set_latency_delay (nframes_t);
75 FreezeState freeze_state() const;
77 virtual void freeze (InterThreadInfo&) = 0;
78 virtual void unfreeze () = 0;
80 virtual boost::shared_ptr<Region> bounce (InterThreadInfo&) = 0;
81 virtual boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&) = 0;
84 XMLNode& get_template();
85 virtual int set_state(const XMLNode& node) = 0;
87 boost::shared_ptr<PBD::Controllable> rec_enable_control() { return _rec_enable_control; }
89 bool record_enabled() const;
90 void set_record_enable (bool yn, void *src);
92 void set_meter_point (MeterPoint, void* src);
94 sigc::signal<void> DiskstreamChanged;
95 sigc::signal<void> FreezeChange;
98 Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO);
100 virtual XMLNode& state (bool full) = 0;
102 boost::shared_ptr<Diskstream> _diskstream;
103 MeterPoint _saved_meter_point;
107 struct FreezeRecordProcessorInfo {
108 FreezeRecordProcessorInfo(XMLNode& st, boost::shared_ptr<Processor> proc)
109 : state (st), processor (proc) {}
112 boost::shared_ptr<Processor> processor;
116 struct FreezeRecord {
118 : have_mementos(false)
123 boost::shared_ptr<Playlist> playlist;
124 vector<FreezeRecordProcessorInfo*> processor_info;
128 AutoState gain_automation_state;
129 AutoState pan_automation_state;
132 struct RecEnableControllable : public PBD::Controllable {
133 RecEnableControllable (Track&);
135 void set_value (float);
136 float get_value (void) const;
141 virtual void set_state_part_two () = 0;
143 FreezeRecord _freeze_record;
144 XMLNode* pending_state;
145 sigc::connection recenable_connection;
146 sigc::connection ic_connection;
149 boost::shared_ptr<RecEnableControllable> _rec_enable_control;
152 }; /* namespace ARDOUR*/
154 #endif /* __ardour_track_h__ */