use -r argument with JACK if realtime is not requested in engine dialog (also applied...
[ArdourMidi.git] / libs / midi++2 / miditrace.cc
blobb5a66cafa9a1d471fd9b478ea95cd7ceb8f4fd16
1 #include <cstdio>
2 #include <fcntl.h>
4 #include "pbd/error.h"
5 #include "pbd/textreceiver.h"
7 Transmitter error (Transmitter::Error);
8 Transmitter info (Transmitter::Info);
9 Transmitter warning (Transmitter::Warning);
10 Transmitter fatal (Transmitter::Fatal);
11 TextReceiver text_receiver ("mmctest");
13 #include "midi++/port.h"
14 #include "midi++/manager.h"
16 using namespace MIDI;
18 Port *port;
19 PortRequest midi_device;
21 int
22 setup_midi ()
25 midi_device.devname = "/dev/snd/midiC0D0";
26 midi_device.tagname = "trident";
27 midi_device.mode = O_RDWR;
28 midi_device.type = Port::ALSA_RawMidi;
30 if ((port = MIDI::Manager::instance()->add_port (midi_device)) == 0) {
31 info << "MIDI port is not valid" << endmsg;
32 return -1;
35 return 0;
38 main (int argc, char *argv[])
41 byte buf[1];
43 text_receiver.listen_to (error);
44 text_receiver.listen_to (info);
45 text_receiver.listen_to (fatal);
46 text_receiver.listen_to (warning);
48 if (setup_midi ()) {
49 exit (1);
52 port->input()->trace (true, &cout);
54 while (1) {
55 if (port->read (buf, 1) < 0) {
56 error << "cannot read byte"
57 << endmsg;
58 break;