2 Copyright (C) 2006 Paul Davis
3 Written by Dave Robillard
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_midi_track_h__
21 #define __ardour_midi_track_h__
23 #include <ardour/track.h>
24 #include <ardour/midi_ring_buffer.h>
34 class MidiTrack : public Track
37 MidiTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
38 MidiTrack (Session&, const XMLNode&);
41 int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
42 nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
44 int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
45 nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
47 int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
48 nframes_t offset, bool can_record, bool rec_monitors_input);
50 void process_output_buffers (BufferSet& bufs,
51 nframes_t start_frame, nframes_t end_frame,
52 nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
55 boost::shared_ptr<MidiDiskstream> midi_diskstream() const;
57 int use_diskstream (string name);
58 int use_diskstream (const PBD::ID& id);
60 void set_latency_delay (nframes_t);
62 int export_stuff (BufferSet& bufs,
63 nframes_t nframes, nframes_t end_frame);
65 void freeze (InterThreadInfo&);
68 void bounce (InterThreadInfo&);
69 void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&);
71 int set_state(const XMLNode& node);
73 void midi_panic(void);
74 bool write_immediate_event(size_t size, const uint8_t* buf);
76 struct MidiControl : public AutomationControl {
77 MidiControl(MidiTrack* route, boost::shared_ptr<AutomationList> al)
78 : AutomationControl (route->session(), al, al->parameter().to_string())
82 void set_value (float val);
87 NoteMode note_mode() const { return _note_mode; }
88 void set_note_mode (NoteMode m);
92 XMLNode& state (bool full);
94 int _set_state (const XMLNode&, bool call_base);
98 void write_controller_messages(MidiBuffer& buf,
99 nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
101 int set_diskstream (boost::shared_ptr<MidiDiskstream> ds);
102 void set_state_part_two ();
103 void set_state_part_three ();
105 MidiRingBuffer _immediate_events;
109 } /* namespace ARDOUR*/
111 #endif /* __ardour_midi_track_h__ */