13
0
livetrax/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
David Robillard 74dd5bd706 Committed filthy mess of a working copy solely for moving between machines.
Nothing to see here, move along now...


git-svn-id: svn://localhost/trunk/ardour2midi@575 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-08 23:46:42 +00:00

67 lines
1.2 KiB
C++

#include <midi++/port.h>
#include <ardour/route.h>
#include <ardour/session.h>
#include "generic_midi_control_protocol.h"
using namespace ARDOUR;
#include "i18n.h"
GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
: ControlProtocol (s, _("GenericMIDI"))
{
_port = s.midi_port();
s.MIDI_PortChanged.connect (mem_fun (*this, &GenericMidiControlProtocol::port_change));
}
GenericMidiControlProtocol::~GenericMidiControlProtocol ()
{
}
int
GenericMidiControlProtocol::set_active (bool yn)
{
/* start delivery/outbound thread */
return 0;
}
void
GenericMidiControlProtocol::port_change ()
{
_port = session->midi_port ();
}
void
GenericMidiControlProtocol::set_port (MIDI::Port* p)
{
_port = p;
}
void
GenericMidiControlProtocol::send_route_feedback (list<Route*>& routes)
{
if (_port != 0) {
const int32_t bufsize = 16 * 1024;
MIDI::byte buf[bufsize];
int32_t bsize = bufsize;
MIDI::byte* end = buf;
for (list<Route*>::iterator r = routes.begin(); r != routes.end(); ++r) {
end = (*r)->write_midi_feedback (end, bsize);
}
if (end == buf) {
return;
}
// FIXME
//_port->write (buf, (int32_t) (end - buf));
//cerr << "MIDI feedback: wrote " << (int32_t) (end - buf) << " to midi port\n";
}
}