Use a MIDI device to control transport in Ardour.
This code is an example how to convert arbitrary MIDI event sequences to one specific Open Sound Control command. If you know Bison or understand BNF grammar this small piece of software could be easily adapted to your needs.
- A MIDI device
- ALSA libasound.so
- liblo (for interfacing Ardour via Open Sound Control)
- Bison parser generator
$ mkdir build && cd build
$ cmake ..
$ make
$ ./midi2osc-ardour "osc.udp://daw.example.org:3819/"
Exit with Ctrl^C
.
There is no usable default configuration, yet.
You might want to change the configuration in the code. See the Bison
grammar file src/parser.y
. Follow these steps:
-
Find the
yylex()
function and check out, which hexcode your button produces. -
Make sure, you define a token with the same code. Add e.g.:
%token TOKEN_MY_BUTTON_PRESS 0x0abcde;
%token TOKEN_MY_BUTTON_RELEASE 0x0abcdf;
- Add a grammar rule with your C++ code. E.g.:
event_rule: [...]
| [...]
| TOKEN_MY_BUTTON_PRESS TOKEN_MY_BUTTON_RELEASE {
std::cout << "My button was pressed and released." << std::endl;
}
;