2 Copyright (C) 2000-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.
18 $Id: midiregion.h 733 2006-08-01 17:19:38Z drobilla $
21 #ifndef __ardour_midi_region_h__
22 #define __ardour_midi_region_h__
26 #include <pbd/fastlog.h>
29 #include <ardour/ardour.h>
30 #include <ardour/region.h>
31 #include <ardour/gain.h>
32 #include <ardour/logcurve.h>
33 #include <ardour/export.h>
45 class MidiRegion : public Region
48 MidiRegion (MidiSource&, jack_nframes_t start, jack_nframes_t length, bool announce = true);
49 MidiRegion (MidiSource&, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true);
50 MidiRegion (SourceList &, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true);
51 MidiRegion (const MidiRegion&, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true);
52 MidiRegion (const MidiRegion&);
53 MidiRegion (MidiSource&, const XMLNode&);
54 MidiRegion (SourceList &, const XMLNode&);
57 MidiSource& midi_source (uint32_t n=0) const;
59 jack_nframes_t read_at (RawMidi* out, RawMidi* mix,
60 jack_nframes_t position,
63 jack_nframes_t read_frames = 0,
64 jack_nframes_t skip_frames = 0) const;
66 jack_nframes_t master_read_at (RawMidi* buf, RawMidi* mix,
67 jack_nframes_t position,
69 uint32_t chan_n=0) const;
71 XMLNode& state (bool);
72 int set_state (const XMLNode&);
74 int separate_by_channel (ARDOUR::Session&, vector<MidiRegion*>&) const;
76 UndoAction get_memento() const;
79 friend class Playlist;
82 StateManager::State* state_factory (std::string why) const;
83 Change restore_state (StateManager::State&);
85 jack_nframes_t _read_at (const SourceList&, RawMidi *buf,
86 jack_nframes_t position,
89 jack_nframes_t read_frames = 0,
90 jack_nframes_t skip_frames = 0) const;
92 void recompute_at_start ();
93 void recompute_at_end ();
96 } /* namespace ARDOUR */
99 #endif /* __ardour_midi_region_h__ */