summaryrefslogtreecommitdiffstats
path: root/arts/midi/miditest_impl.cc
blob: b6ecce90c5246dfe20c4a8442890df938a2f8c7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    /*

    Copyright (C) 2000 Stefan Westerfeld
                       stefan@space.twc.de

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
  
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.
   
    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.

    */

#include "midimanager_impl.h"
#include <stdio.h>

namespace Arts {

class MidiTest_impl : virtual public MidiTest_skel {
public:
	Arts::TimeStamp time()
	{
		return TimeStamp(0,0);
	}
	Arts::TimeStamp playTime()
	{
		return time();
	}
	void processCommand(const MidiCommand& command)
	{
		if((command.status & mcsCommandMask) == mcsNoteOn)
		{
			mcopbyte ch = command.status & mcsChannelMask;

			printf("noteon ch = %d, note = %d, vel = %d\n",
							ch,command.data1,command.data2);
		}
	}
	void processEvent(const MidiEvent& event)
	{
		printf("At %ld.%06ld: ",event.time.sec,event.time.usec);
		processCommand(event.command);
	}
};

REGISTER_IMPLEMENTATION(MidiTest_impl);
}