CFugue
MidiDevice.cpp
1 /*
2  This is part of CFugue, a C++ Runtime for MIDI Score Programming
3  Copyright (C) 2009 Gopalakrishna Palem
4 
5  For links to further information, or to contact the author,
6  see <http://cfugue.sourceforge.net/>.
7 */
8 
9 #include "MidiDevice.h"
10 #include "rtmidi/RtMidi.h"
11 
12 namespace CFugue
13 {
14  unsigned int GetMidiOutPortCount()
15  {
16  static RtMidiOut midiOutObj;
17  return midiOutObj.getPortCount();
18  }
19 
20  unsigned int GetMidiInPortCount()
21  {
22  static RtMidiIn midiInObj;
23  return midiInObj.getPortCount();
24  }
25 
26  std::string GetMidiInPortName(unsigned int nPortIndex)
27  {
28  static RtMidiIn midiInObj;
29  return midiInObj.getPortName(nPortIndex);
30  }
31 
32  std::string GetMidiOutPortName(unsigned int nPortIndex)
33  {
34  static RtMidiOut midiOutObj;
35  return midiOutObj.getPortName(nPortIndex);
36  }
37 
38  StringList GetMidiInPortNames()
39  {
40  StringList strRetList;
41 
42  for(int i=0, nMax = GetMidiInPortCount(); i < nMax; ++i)
43  strRetList.push_back(GetMidiInPortName(i));
44 
45  return strRetList;
46  }
47 
48  StringList GetMidiOutPortNames()
49  {
50  StringList strRetList;
51 
52  for(int i=0, nMax = GetMidiOutPortCount(); i < nMax; ++i)
53  strRetList.push_back(GetMidiOutPortName(i));
54 
55  return strRetList;
56  }
57 
58 } // namespace CFugue
unsigned int GetMidiInPortCount()
Returns the number of Input Midi Ports.
Definition: MidiDevice.cpp:20
StringList GetMidiInPortNames()
Returns the names of all Midi Input Ports available.
Definition: MidiDevice.cpp:38
std::string GetMidiOutPortName(unsigned int nPortIndex)
Returns the name of the given Midi Output Port.
Definition: MidiDevice.cpp:32
StringList GetMidiOutPortNames()
Returns the names of all Midi Output Ports available.
Definition: MidiDevice.cpp:48
std::string GetMidiInPortName(unsigned int nPortIndex)
Returns the name of the given Midi Input Port.
Definition: MidiDevice.cpp:26
unsigned int GetMidiOutPortCount()
Returns the number of Output Midi Ports.
Definition: MidiDevice.cpp:14

CFugue, the C++ Music Programming Library © Copyright 2009 Cenacle Research India Private Limited Gopalakrishna Palem