Fix some unused parameter warnings.
[ardour.git] / libs / ardour / ardour / track.h
1 /*
2     Copyright (C) 2006 Paul Davis 
3
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.
8
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.
13
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.
17 */
18
19 #ifndef __ardour_track_h__
20 #define __ardour_track_h__
21
22 #include <boost/shared_ptr.hpp>
23
24 #include "ardour/route.h"
25
26 namespace ARDOUR {
27
28 class Session;
29 class Diskstream;
30 class Playlist;
31 class RouteGroup;
32 class Region;
33
34 class Track : public Route
35 {
36   public:
37         Track (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO);
38
39         virtual ~Track ();
40         
41         bool set_name (const std::string& str);
42
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;
47         
48         int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, 
49                      bool state_changing, bool can_record, bool rec_monitors_input);
50         
51         int silent_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, 
52                         bool can_record, bool rec_monitors_input);
53
54         virtual int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, 
55                           int declick, bool can_record, bool rec_monitors_input) = 0;
56         
57         void toggle_monitor_input ();
58
59         bool can_record();
60
61         boost::shared_ptr<Diskstream> diskstream() const { return _diskstream; }
62
63         virtual int use_diskstream (std::string name) = 0;
64         virtual int use_diskstream (const PBD::ID& id) = 0;
65
66         nframes_t update_total_latency();
67         void           set_latency_delay (nframes_t);
68
69         enum FreezeState {
70                 NoFreeze,
71                 Frozen,
72                 UnFrozen
73         };
74
75         FreezeState freeze_state() const;
76  
77         virtual void freeze (InterThreadInfo&) = 0;
78         virtual void unfreeze () = 0;
79
80         virtual boost::shared_ptr<Region> bounce (InterThreadInfo&) = 0;
81         virtual boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&, bool enable_processing = true) = 0;
82
83         XMLNode&    get_state();
84         XMLNode&    get_template();
85         virtual int set_state(const XMLNode& node) = 0;
86         static void zero_diskstream_id_in_xml (XMLNode&);
87
88         boost::shared_ptr<PBD::Controllable> rec_enable_control() { return _rec_enable_control; }
89
90         bool record_enabled() const;
91         void set_record_enable (bool yn, void *src);
92         
93         void set_meter_point (MeterPoint, void* src);
94         
95         sigc::signal<void> DiskstreamChanged;
96         sigc::signal<void> FreezeChange;
97
98   protected:
99         Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO);
100
101         virtual XMLNode& state (bool full) = 0;
102
103         boost::shared_ptr<Diskstream> _diskstream;
104         MeterPoint  _saved_meter_point;
105         TrackMode   _mode;
106
107         //private: (FIXME)
108         struct FreezeRecordProcessorInfo {
109             FreezeRecordProcessorInfo(XMLNode& st, boost::shared_ptr<Processor> proc) 
110                     : state (st), processor (proc) {}
111
112             XMLNode                      state;
113             boost::shared_ptr<Processor> processor;
114             PBD::ID                      id;
115         };
116
117         struct FreezeRecord {
118             FreezeRecord()
119                 : have_mementos(false)
120             {}
121
122             ~FreezeRecord();
123
124             boost::shared_ptr<Playlist>        playlist;
125             std::vector<FreezeRecordProcessorInfo*> processor_info;
126             bool                               have_mementos;
127             FreezeState                        state;
128             gain_t                          gain;
129             AutoState                       gain_automation_state;
130             AutoState                       pan_automation_state;
131         };
132
133         struct RecEnableControllable : public PBD::Controllable {
134             RecEnableControllable (Track&);
135             
136             void set_value (float);
137             float get_value (void) const;
138
139             Track& track;
140         };
141
142         virtual void set_state_part_two () = 0;
143
144         FreezeRecord          _freeze_record;
145         XMLNode*              pending_state;
146         sigc::connection      recenable_connection;
147         sigc::connection      ic_connection;
148         bool                  _destructive;
149         
150         boost::shared_ptr<RecEnableControllable> _rec_enable_control;
151 };
152
153 }; /* namespace ARDOUR*/
154
155 #endif /* __ardour_track_h__ */