mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
a) dynamically loadable control surface support
b) move tranzport and generic midi into separate dirs under "surfaces" git-svn-id: svn://localhost/trunk/ardour2@442 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
f7c82c6911
commit
9ae0f6cbee
20 changed files with 356 additions and 293 deletions
55
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
Normal file
55
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#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 = 0;
|
||||
}
|
||||
|
||||
GenericMidiControlProtocol::~GenericMidiControlProtocol ()
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
int32_t bsize = bufsize;
|
||||
MIDI::byte* buf = new MIDI::byte[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) {
|
||||
delete [] buf;
|
||||
return;
|
||||
}
|
||||
|
||||
session.deliver_midi (_port, buf, (int32_t) (end - buf));
|
||||
//cerr << "MIDI feedback: wrote " << (int32_t) (end - buf) << " to midi port\n";
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
GenericMidiControlProtocol::active() const
|
||||
{
|
||||
return _port && send();
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue