Skip to content

Commit

Permalink
Updated RtMidi and RtAudio files after new releases.
Browse files Browse the repository at this point in the history
  • Loading branch information
garyscavone committed Feb 23, 2016
1 parent 83b75ed commit 126ff9d
Show file tree
Hide file tree
Showing 4 changed files with 325 additions and 229 deletions.
7 changes: 4 additions & 3 deletions include/RtAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
RtAudio: realtime audio i/o C++ classes
Copyright (c) 2001-2014 Gary P. Scavone
Copyright (c) 2001-2016 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
Expand Down Expand Up @@ -45,7 +45,7 @@
#ifndef __RTAUDIO_H
#define __RTAUDIO_H

#define RTAUDIO_VERSION "4.1.1"
#define RTAUDIO_VERSION "4.1.2"

#include <string>
#include <vector>
Expand Down Expand Up @@ -286,12 +286,13 @@ class RtAudio
bool isDefaultOutput; /*!< true if this is the default output device. */
bool isDefaultInput; /*!< true if this is the default input device. */
std::vector<unsigned int> sampleRates; /*!< Supported sample rates (queried from list of standard rates). */
unsigned int preferredSampleRate; /*!< Preferred sample rate, eg. for WASAPI the system sample rate. */
RtAudioFormat nativeFormats; /*!< Bit mask of supported data formats. */

// Default constructor.
DeviceInfo()
:probed(false), outputChannels(0), inputChannels(0), duplexChannels(0),
isDefaultOutput(false), isDefaultInput(false), nativeFormats(0) {}
isDefaultOutput(false), isDefaultInput(false), preferredSampleRate(0), nativeFormats(0) {}
};

//! The structure for specifying input or ouput stream parameters.
Expand Down
20 changes: 11 additions & 9 deletions include/RtMidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
RtMidi: realtime MIDI i/o C++ classes
Copyright (c) 2003-2014 Gary P. Scavone
Copyright (c) 2003-2016 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
Expand Down Expand Up @@ -43,7 +43,7 @@
#ifndef RTMIDI_H
#define RTMIDI_H

#define RTMIDI_VERSION "2.1.0"
#define RTMIDI_VERSION "2.1.1"

#include <exception>
#include <iostream>
Expand Down Expand Up @@ -109,7 +109,7 @@ class RtMidiError : public std::exception
Note that class behaviour is undefined after a critical error (not
a warning) is reported.
*/
typedef void (*RtMidiErrorCallback)( RtMidiError::Type type, const std::string &errorText );
typedef void (*RtMidiErrorCallback)( RtMidiError::Type type, const std::string &errorText, void *userData );

class MidiApi;

Expand Down Expand Up @@ -161,7 +161,7 @@ class RtMidi
The callback function will be called whenever an error has occured. It is best
to set the error callback function before opening a port.
*/
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL ) = 0;
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 ) = 0;

protected:

Expand Down Expand Up @@ -322,7 +322,7 @@ class RtMidiIn : public RtMidi
The callback function will be called whenever an error has occured. It is best
to set the error callback function before opening a port.
*/
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL );
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );

protected:
void openMidiApi( RtMidi::Api api, const std::string clientName, unsigned int queueSizeLimit );
Expand Down Expand Up @@ -413,7 +413,7 @@ class RtMidiOut : public RtMidi
The callback function will be called whenever an error has occured. It is best
to set the error callback function before opening a port.
*/
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL );
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );

protected:
void openMidiApi( RtMidi::Api api, const std::string clientName );
Expand Down Expand Up @@ -448,7 +448,7 @@ class MidiApi
virtual std::string getPortName( unsigned int portNumber ) = 0;

inline bool isPortOpen() const { return connected_; }
void setErrorCallback( RtMidiErrorCallback errorCallback );
void setErrorCallback( RtMidiErrorCallback errorCallback, void *userData );

//! A basic error reporting function for RtMidi classes.
void error( RtMidiError::Type type, std::string errorString );
Expand All @@ -460,6 +460,8 @@ class MidiApi
bool connected_;
std::string errorString_;
RtMidiErrorCallback errorCallback_;
bool firstErrorOccurred_;
void *errorCallbackUserData_;
};

class MidiInApi : public MidiApi
Expand Down Expand Up @@ -547,7 +549,7 @@ inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCou
inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { ((MidiInApi *)rtapi_)->ignoreTypes( midiSysex, midiTime, midiSense ); }
inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return ((MidiInApi *)rtapi_)->getMessage( message ); }
inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback ) { rtapi_->setErrorCallback(errorCallback); }
inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }

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 ); }
Expand All @@ -557,7 +559,7 @@ inline bool RtMidiOut :: isPortOpen() const { return rtapi_->isPortOpen(); }
inline unsigned int RtMidiOut :: getPortCount( void ) { return rtapi_->getPortCount(); }
inline std::string RtMidiOut :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
inline void RtMidiOut :: sendMessage( std::vector<unsigned char> *message ) { ((MidiOutApi *)rtapi_)->sendMessage( message ); }
inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback ) { rtapi_->setErrorCallback(errorCallback); }
inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }

// **************************************************************** //
//
Expand Down
Loading

0 comments on commit 126ff9d

Please sign in to comment.