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"
15 #include "midi++/mmc.h"
21 PortRequest midi_device
;
24 MachineControl::CommandSignature cs
;
25 MachineControl::ResponseSignature rs
;
31 midi_device
.devname
= "/dev/snd/midiC0D0";
32 midi_device
.tagname
= "trident";
33 midi_device
.mode
= O_RDWR
;
34 midi_device
.type
= Port::ALSA_RawMidi
;
36 if ((port
= MIDI::Manager::instance()->add_port (midi_device
)) == 0) {
37 info
<< "MIDI port is not valid" << endmsg
;
41 mmc
= new MachineControl (*port
, 0.0, cs
, rs
);
47 do_deferred_play (MachineControl
&mmc
)
50 cout
<< "Deferred Play" << endl
;
54 do_stop (MachineControl
&mmc
)
57 cout
<< "Stop" << endl
;
61 do_ffwd (MachineControl
&mmc
)
64 cout
<< "Fast Forward" << endl
;
68 do_rewind (MachineControl
&mmc
)
71 cout
<< "Rewind" << endl
;
75 do_record_status (MachineControl
&mmc
, size_t track
, bool enabled
)
78 cout
<< "Track " << track
+ 1 << (enabled
? " enabled" : " disabled")
82 main (int argc
, char *argv
[])
87 text_receiver
.listen_to (error
);
88 text_receiver
.listen_to (info
);
89 text_receiver
.listen_to (fatal
);
90 text_receiver
.listen_to (warning
);
97 mmc
->DeferredPlay
.connect (mem_fun (do_deferred_play
));
98 mmc
->FastForward
.connect (mem_fun (do_ffwd
));
99 mmc
->Rewind
.connect (mem_fun (do_rewind
));
100 mmc
->Stop
.connect (mem_fun (do_stop
));
101 mmc
->TrackRecordStatusChange
.connect (mem_fun (do_record_status
));
104 if (port
->read (buf
, 1) < 0) {
105 error
<< "cannot read byte"