26class MidiDeviceListConnectionBroadcaster;
60 : broadcaster (std::exchange (other.broadcaster,
nullptr)),
61 key (std::exchange (other.key, Key{}))
72 ~MidiDeviceListConnection() noexcept;
94 : broadcaster (b), key (k) {}
98 std::swap (other.broadcaster, broadcaster);
99 std::swap (other.key, key);
102 MidiDeviceListConnectionBroadcaster* broadcaster =
nullptr;
119 MidiDeviceInfo() =
default;
121 MidiDeviceInfo (
const String& deviceName,
const String& deviceIdentifier)
146 bool operator== (
const MidiDeviceInfo& other)
const noexcept {
return tie() == other.tie(); }
147 bool operator!= (
const MidiDeviceInfo& other)
const noexcept {
return tie() != other.tie(); }
163class JUCE_API MidiInput final
193 #if JUCE_LINUX || JUCE_BSD || JUCE_MAC || JUCE_IOS || DOXYGEN
239 void setName (
const String& newName)
noexcept { deviceInfo.name = newName; }
243 [[deprecated (
"Use getAvailableDevices instead.")]]
245 [[deprecated (
"Use getDefaultDevice instead.")]]
246 static int getDefaultDeviceIndex();
247 [[deprecated (
"Use openDevice that takes a device identifier instead.")]]
260 std::unique_ptr<Pimpl> internal;
262 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (
MidiInput)
308 const uint8* messageData,
324class JUCE_API MidiOutput final :
private Thread
352 #if JUCE_LINUX || JUCE_BSD || JUCE_MAC || JUCE_IOS || DOXYGEN
365 static std::unique_ptr<MidiOutput> createNewDevice (
const String& deviceName);
382 void setName (
const String& newName)
noexcept { deviceInfo.name = newName; }
409 double millisecondCounterToStartAt,
410 double samplesPerSecondForBuffer);
432 [[deprecated (
"Use getAvailableDevices instead.")]]
434 [[deprecated (
"Use getDefaultDevice instead.")]]
435 static int getDefaultDeviceIndex();
436 [[deprecated (
"Use openDevice that takes a device identifier instead.")]]
437 static std::unique_ptr<MidiOutput> openDevice (
int);
445 struct PendingMessage
447 PendingMessage (
const void* data,
int len,
double timeStamp)
448 : message (data, len, timeStamp)
453 PendingMessage* next;
457 explicit MidiOutput (
const String&,
const String&);
460 MidiDeviceInfo deviceInfo;
462 std::unique_ptr<Pimpl> internal;
464 CriticalSection lock;
465 PendingMessage* firstMessage =
nullptr;
467 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiOutput)
static MidiDeviceListConnection make(std::function< void()>)
MidiDeviceListConnection()=default
static MidiDeviceInfo getDefaultDevice()
void sendBlockOfMessagesNow(const MidiBuffer &buffer)
void stopBackgroundThread()
String getName() const noexcept
void setName(const String &newName) noexcept
String getIdentifier() const noexcept
void clearAllPendingMessages()
static std::unique_ptr< MidiOutput > openDevice(const String &deviceIdentifier)
MidiDeviceInfo getDeviceInfo() const noexcept
void startBackgroundThread()
bool isBackgroundThreadRunning() const noexcept
void sendMessageNow(const MidiMessage &message)
void sendBlockOfMessages(const MidiBuffer &buffer, double millisecondCounterToStartAt, double samplesPerSecondForBuffer)
static Array< MidiDeviceInfo > getAvailableDevices()
Thread(const String &threadName, size_t threadStackSize=osDefaultStackSize)
bool isThreadRunning() const