blob: 6576e152a3f3d1eef66e758f0d13f17600a4a822 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// midiprobe.cpp
//
// Simple program to check MIDI inputs and outputs.
//
// by Gary Scavone, 2003-2012.
#include <iostream>
#include <cstdlib>
#include <map>
#include "RtMidi.h"
int main()
{
// Create an api map.
std::map<int, std::string> apiMap;
apiMap[RtMidi::MACOSX_CORE] = "OS-X CoreMidi";
apiMap[RtMidi::WINDOWS_MM] = "Windows MultiMedia";
apiMap[RtMidi::WINDOWS_KS] = "Windows Kernel Straming";
apiMap[RtMidi::UNIX_JACK] = "Jack Client";
apiMap[RtMidi::LINUX_ALSA] = "Linux ALSA";
apiMap[RtMidi::RTMIDI_DUMMY] = "RtMidi Dummy";
std::vector< RtMidi::Api > apis;
RtMidi :: getCompiledApi( apis );
std::cout << "\nCompiled APIs:\n";
for ( unsigned int i=0; i<apis.size(); i++ )
std::cout << " " << apiMap[ apis[i] ] << std::endl;
RtMidiIn *midiin = 0;
RtMidiOut *midiout = 0;
try {
// RtMidiIn constructor ... exception possible
midiin = new RtMidiIn();
std::cout << "\nCurrent input API: " << apiMap[ midiin->getCurrentApi() ] << std::endl;
// Check inputs.
unsigned int nPorts = midiin->getPortCount();
std::cout << "\nThere are " << nPorts << " MIDI input sources available.\n";
for ( unsigned i=0; i<nPorts; i++ ) {
std::string portName = midiin->getPortName(i);
std::cout << " Input Port #" << i+1 << ": " << portName << '\n';
}
// RtMidiOut constructor ... exception possible
midiout = new RtMidiOut();
std::cout << "\nCurrent output API: " << apiMap[ midiout->getCurrentApi() ] << std::endl;
// Check outputs.
nPorts = midiout->getPortCount();
std::cout << "\nThere are " << nPorts << " MIDI output ports available.\n";
for ( unsigned i=0; i<nPorts; i++ ) {
std::string portName = midiout->getPortName(i);
std::cout << " Output Port #" << i+1 << ": " << portName << std::endl;
}
std::cout << std::endl;
} catch ( RtMidiError &error ) {
error.printMessage();
}
delete midiin;
delete midiout;
return 0;
}
|