Update the bundled RtMidi library to 6.0.0

This commit is contained in:
Martchus 2023-08-19 15:53:18 +02:00
parent ea6e649a85
commit bc56719e3f
3 changed files with 1994 additions and 127 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
RtMidi WWW site: http://www.music.mcgill.ca/~gary/rtmidi/
RtMidi: realtime MIDI i/o C++ classes
Copyright (c) 2003-2019 Gary P. Scavone
Copyright (c) 2003-2023 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@ -58,13 +58,31 @@
#endif
#endif
#define RTMIDI_VERSION "4.0.0"
#define RTMIDI_VERSION_MAJOR 6
#define RTMIDI_VERSION_MINOR 0
#define RTMIDI_VERSION_PATCH 0
#define RTMIDI_VERSION_BETA 0
#define RTMIDI_TOSTRING2(n) #n
#define RTMIDI_TOSTRING(n) RTMIDI_TOSTRING2(n)
#if RTMIDI_VERSION_BETA > 0
#define RTMIDI_VERSION RTMIDI_TOSTRING(RTMIDI_VERSION_MAJOR) \
"." RTMIDI_TOSTRING(RTMIDI_VERSION_MINOR) \
"." RTMIDI_TOSTRING(RTMIDI_VERSION_PATCH) \
"beta" RTMIDI_TOSTRING(RTMIDI_VERSION_BETA)
#else
#define RTMIDI_VERSION RTMIDI_TOSTRING(RTMIDI_VERSION_MAJOR) \
"." RTMIDI_TOSTRING(RTMIDI_VERSION_MINOR) \
"." RTMIDI_TOSTRING(RTMIDI_VERSION_PATCH)
#endif
#include <exception>
#include <iostream>
#include <string>
#include <vector>
/************************************************************************/
/*! \class RtMidiError
\brief Exception handling class for RtMidi.
@ -132,6 +150,8 @@ class MidiApi;
class RTMIDI_DLL_PUBLIC RtMidi
{
public:
RtMidi(RtMidi&& other) noexcept;
//! MIDI API specifier arguments.
enum Api {
UNSPECIFIED, /*!< Search for a working compiled API. */
@ -140,6 +160,9 @@ class RTMIDI_DLL_PUBLIC RtMidi
UNIX_JACK, /*!< The JACK Low-Latency MIDI Server API. */
WINDOWS_MM, /*!< The Microsoft Multimedia MIDI API. */
RTMIDI_DUMMY, /*!< A compilable but non-functional API. */
WEB_MIDI_API, /*!< W3C Web MIDI API. */
WINDOWS_UWP, /*!< The Microsoft Universal Windows Platform MIDI API. */
ANDROID_AMIDI, /*!< Native Android MIDI API. */
NUM_APIS /*!< Number of values in this enum. */
};
@ -213,6 +236,10 @@ class RTMIDI_DLL_PUBLIC RtMidi
RtMidi();
virtual ~RtMidi();
MidiApi *rtapi_;
/* Make the class non-copyable */
RtMidi(RtMidi& other) = delete;
RtMidi& operator=(RtMidi& other) = delete;
};
/**********************************************************************/
@ -248,7 +275,6 @@ class RTMIDI_DLL_PUBLIC RtMidi
class RTMIDI_DLL_PUBLIC RtMidiIn : public RtMidi
{
public:
//! User callback function type definition.
typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData );
@ -274,6 +300,8 @@ class RTMIDI_DLL_PUBLIC RtMidiIn : public RtMidi
const std::string& clientName = "RtMidi Input Client",
unsigned int queueSizeLimit = 100 );
RtMidiIn(RtMidiIn&& other) noexcept : RtMidi(std::move(other)) { }
//! If a MIDI connection is still open, it will be closed by the destructor.
~RtMidiIn ( void ) throw();
@ -371,6 +399,19 @@ class RTMIDI_DLL_PUBLIC RtMidiIn : public RtMidi
*/
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
//! Set maximum expected incoming message size.
/*!
For APIs that require manual buffer management, it can be useful to set the buffer
size and buffer count when expecting to receive large SysEx messages. Note that
currently this function has no effect when called after openPort(). The default
buffer size is 1024 with a count of 4 buffers, which should be sufficient for most
cases; as mentioned, this does not affect all API backends, since most either support
dynamically scalable buffers or take care of buffer handling themselves. It is
principally intended for users of the Windows MM backend who must support receiving
especially large messages.
*/
virtual void setBufferSize( unsigned int size, unsigned int count );
protected:
void openMidiApi( RtMidi::Api api, const std::string &clientName, unsigned int queueSizeLimit );
};
@ -403,6 +444,8 @@ class RTMIDI_DLL_PUBLIC RtMidiOut : public RtMidi
RtMidiOut( RtMidi::Api api=UNSPECIFIED,
const std::string& clientName = "RtMidi Output Client" );
RtMidiOut(RtMidiOut&& other) noexcept : RtMidi(std::move(other)) { }
//! The destructor closes any open MIDI connections.
~RtMidiOut( void ) throw();
@ -523,6 +566,7 @@ protected:
RtMidiErrorCallback errorCallback_;
bool firstErrorOccurred_;
void *errorCallbackUserData_;
};
class RTMIDI_DLL_PUBLIC MidiInApi : public MidiApi
@ -534,7 +578,8 @@ class RTMIDI_DLL_PUBLIC MidiInApi : public MidiApi
void setCallback( RtMidiIn::RtMidiCallback callback, void *userData );
void cancelCallback( void );
virtual void ignoreTypes( bool midiSysex, bool midiTime, bool midiSense );
double getMessage( std::vector<unsigned char> *message );
virtual double getMessage( std::vector<unsigned char> *message );
virtual void setBufferSize( unsigned int size, unsigned int count );
// A MIDI structure used internally by the class to store incoming
// messages. Each message represents one and only one MIDI message.
@ -576,11 +621,13 @@ class RTMIDI_DLL_PUBLIC MidiInApi : public MidiApi
RtMidiIn::RtMidiCallback userCallback;
void *userData;
bool continueSysex;
unsigned int bufferSize;
unsigned int bufferCount;
// Default constructor.
RtMidiInData()
: ignoreFlags(7), doInput(false), firstMessage(true), apiData(0), usingCallback(false),
userCallback(0), userData(0), continueSysex(false) {}
userCallback(0), userData(0), continueSysex(false), bufferSize(1024), bufferCount(4) {}
};
protected:
@ -614,6 +661,7 @@ inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return r
inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { static_cast<MidiInApi *>(rtapi_)->ignoreTypes( midiSysex, midiTime, midiSense ); }
inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return static_cast<MidiInApi *>(rtapi_)->getMessage( message ); }
inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
inline void RtMidiIn :: setBufferSize( unsigned int size, unsigned int count ) { static_cast<MidiInApi *>(rtapi_)->setBufferSize(size, count); }
inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string &portName ) { rtapi_->openPort( portNumber, portName ); }

View File

@ -651,7 +651,7 @@ void QtWindow::about()
) %
#ifdef USE_BUNDLED_RTMIDI
tr("This program also contains RtMIDI: realtime MIDI i/o C++ classes<br>") %
tr("Copyright(c) Gary P. Scavone, 2003-2019; All rights reserved.") %
tr("Copyright (c) 2003-2023 Gary P. Scavone") %
QStringLiteral("<br><br>") %
#endif
tr("Fallback icons from <a href=\"https://invent.kde.org/frameworks/breeze-icons\">KDE/Breeze</a> "