3
Copyright (C) 2000 Jeff Tranter
6
(C) 1998 Stefan Westerfeld
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2 of the License, or
12
(at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
#include "artsmodules.h"
28
#include "stdsynthmodule.h"
32
class Synth_MIDI_DEBUG_impl : virtual public Synth_MIDI_DEBUG_skel,
33
virtual public StdSynthModule
35
SystemMidiTimer timer;
38
Synth_MIDI_DEBUG self() { return Synth_MIDI_DEBUG::_from_base(_copy()); }
42
printf("MIDI_DEBUG: streamInit\n");
43
MidiManager manager = Reference("global:Arts_MidiManager");
46
client = manager.addClient(mcdRecord,mctDestination,"midi debug",
47
"Arts::Synth_MIDI_DEBUG");
48
client.addInputPort(self());
51
arts_warning("Synth_MIDI_DEBUG: no midi manager found "
55
void processEvent(const MidiEvent& event)
57
printf("MIDI_DEBUG: scheduling event at %ld.%ld\n",
58
event.time.sec, event.time.usec);
59
timer.queueEvent(self(),event);
61
void processCommand(const MidiCommand& command)
63
mcopbyte channel = command.status & mcsChannelMask;
64
switch(command.status & mcsCommandMask)
66
case mcsNoteOn: printf("MIDI_DEBUG: note on channel %d, "
67
"note %d, velocity %d\n", channel,
68
command.data1, command.data2);
70
case mcsNoteOff: printf("MIDI_DEBUG: note off channel %d, "
71
"note %d, velocity %d\n", channel,
72
command.data1, command.data2);
81
return TimeStamp(tv.tv_sec, tv.tv_usec);
86
REGISTER_IMPLEMENTATION(Synth_MIDI_DEBUG_impl);