openshot-audio  0.1.6
juce_MidiInput.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_MIDIINPUT_H_INCLUDED
26 #define JUCE_MIDIINPUT_H_INCLUDED
27 
28 class MidiInput;
29 
30 
31 //==============================================================================
41 {
42 public:
44  virtual ~MidiInputCallback() {}
45 
46 
59  virtual void handleIncomingMidiMessage (MidiInput* source,
60  const MidiMessage& message) = 0;
61 
72  virtual void handlePartialSysexMessage (MidiInput* source,
73  const uint8* messageData,
74  int numBytesSoFar,
75  double timestamp)
76  {
77  // (this bit is just to avoid compiler warnings about unused variables)
78  (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
79  }
80 };
81 
82 //==============================================================================
92 {
93 public:
94  //==============================================================================
102  static StringArray getDevices();
103 
108  static int getDefaultDeviceIndex();
109 
122  static MidiInput* openDevice (int deviceIndex,
123  MidiInputCallback* callback);
124 
125  #if JUCE_LINUX || JUCE_MAC || JUCE_IOS || DOXYGEN
126 
136  static MidiInput* createNewDevice (const String& deviceName,
137  MidiInputCallback* callback);
138  #endif
139 
140  //==============================================================================
142  ~MidiInput();
143 
145  const String& getName() const noexcept { return name; }
146 
150  void setName (const String& newName) noexcept { name = newName; }
151 
152  //==============================================================================
161  void start();
162 
166  void stop();
167 
168 private:
169  //==============================================================================
170  String name;
171  void* internal;
172 
173  // The input objects are created with the openDevice() method.
174  explicit MidiInput (const String&);
175 
177 };
178 
179 
180 #endif // JUCE_MIDIINPUT_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
virtual ~MidiInputCallback()
Definition: juce_MidiInput.h:44
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
void setName(const String &newName) noexcept
Definition: juce_MidiInput.h:150
#define const
Definition: juce_MidiInput.h:91
virtual void handlePartialSysexMessage(MidiInput *source, const uint8 *messageData, int numBytesSoFar, double timestamp)
Definition: juce_MidiInput.h:72
Definition: juce_MidiInput.h:40
Definition: juce_StringArray.h:39
void
Definition: juce_PNGLoader.cpp:1173
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
const String & getName() const noexcept
Definition: juce_MidiInput.h:145
unsigned char uint8
Definition: juce_MathsFunctions.h:43
Definition: juce_MidiMessage.h:35