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.
22 #include <ardour/base_midi_port.h>
23 #include <ardour/data_type.h>
25 using namespace ARDOUR;
28 BaseMidiPort::BaseMidiPort (const std::string& name, Flags flags)
33 _type = DataType::MIDI;
34 _mixdown = default_mixdown;
37 BaseMidiPort::~BaseMidiPort()
39 if (_own_buffer && _buffer) {
45 BaseMidiPort::default_mixdown (const set<Port*>& ports, MidiBuffer* dest, nframes_t cnt, nframes_t offset, bool first_overwrite)
47 set<Port*>::const_iterator p = ports.begin();
49 if (first_overwrite) {
50 cout << "first overwrite" << endl;
51 dest->read_from ((dynamic_cast<BaseMidiPort*>(*p))->get_midi_buffer(), cnt, offset);
55 // XXX DAVE: this is just a guess
57 for (; p != ports.end(); ++p) {
58 cout << "merge" << endl;
59 dest->merge (*dest, (dynamic_cast<BaseMidiPort*>(*p))->get_midi_buffer());
64 BaseMidiPort::set_mixdown_function (void (*func)(const set<Port*>&, MidiBuffer*, nframes_t, nframes_t, bool))
66 g_atomic_pointer_set(&_mixdown, func);