Date: Monday, November 4, 2019 @ 19:39:01 Author: dvzrv Revision: 524121
archrelease: copy trunk to community-x86_64 Added: din/repos/community-x86_64/PKGBUILD (from rev 524120, din/trunk/PKGBUILD) din/repos/community-x86_64/din-43-devendor-rtaudio_rtmidi.patch (from rev 524120, din/trunk/din-43-devendor-rtaudio_rtmidi.patch) Deleted: din/repos/community-x86_64/PKGBUILD --------------------------------------+ PKGBUILD | 101 - din-43-devendor-rtaudio_rtmidi.patch | 1955 +++++++++++++++++++++++++++++++++ 2 files changed, 1997 insertions(+), 59 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2019-11-04 19:38:47 UTC (rev 524120) +++ PKGBUILD 2019-11-04 19:39:01 UTC (rev 524121) @@ -1,59 +0,0 @@ -# Maintainer: David Runge <d...@sleepmap.de> -# Contributor: muzhed <chusto...@126.com> - -pkgname=din -pkgver=43 -pkgrel=1 -pkgdesc="A sound synthesizer and musical instrument." -arch=('x86_64') -url="https://dinisnoise.org/" -license=('GPL2') -groups=('pro-audio') -depends=('glibc' 'hicolor-icon-theme' 'jack' 'libgl' 'rtaudio' 'rtmidi' 'sdl' 'tcl') -makedepends=('boost' 'glu') -source=("https://archive.org/download/dinisnoise_source_code/${pkgname}-${pkgver}.tar.gz") -sha512sums=('cd371b9762e136853ac7cb879b3648841a5741c3ee3718b6684e33df49519b26eccf0bcf7119729c0ca1ff898f9828eb75cd2b4bb0aac374bc11f0da95f62a79') - -prepare() { - cd "${pkgname}-${pkgver}" -# # use system rtaudio/rtmidi, instead of vendored versions - sed -e 's/RtAudio.h//' \ - -e 's/RtMidi.h//' \ - -e '/RtMidi.Po/d' \ - -e '/RtAudio.Po/d' \ - -i include/Makefile.{am,in} - sed -e 's/RtAudio.cpp//' \ - -e 's/RtMidi.cpp//' \ - -e '/RtMidi.Po/d' \ - -e '/RtAudio.Po/d' \ - -e '/RtMidi.$(OBJECT)/d' \ - -e '/RtAudio.$(OBJECT)/d' \ - -i src/Makefile.{am,in} - sed -e 's/\"RtAudio.h\"/<RtAudio.h>/' \ - -i include/audio.h - sed -e 's/\"RtMidi.h\"/<RtMidi.h>/' \ - -i include/midi_in.h - sed -e '19i#include <RtAudio.h>' \ - -i src/audio.cc - sed -e '13i#include <RtMidi.h>' \ - -i src/midi_in.cc - rm -v include/Rt{Audio,Midi}.h src/Rt{Audio,Midi}.cpp - autoreconf -vfi -} - -build() { - cd "${pkgname}-${pkgver}" - export CXXFLAGS="${CXXFLAGS} $(pkg-config --cflags jack rtaudio rtmidi)" - export CFLAGS="${CFLAGS} $(pkg-config --cflags jack rtaudio rtmidi)" - export LIBS="${LIBS} $(pkg-config --libs jack rtaudio rtmidi)" - ./configure --prefix='/usr' - make -} - -package() { - cd "${pkgname}-${pkgver}" - make install DESTDIR="${pkgdir}" - # docs - install -t "${pkgdir}/usr/share/doc/${pkgname}/" \ - -vDm 644 {AUTHORS,BUGS,CHANGELOG,NEWS,README,TODO} -} Copied: din/repos/community-x86_64/PKGBUILD (from rev 524120, din/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2019-11-04 19:39:01 UTC (rev 524121) @@ -0,0 +1,42 @@ +# Maintainer: David Runge <dv...@archlinux.org> +# Contributor: muzhed <chusto...@126.com> + +pkgname=din +pkgver=43.0.1 +pkgrel=1 +pkgdesc="A sound synthesizer and musical instrument." +arch=('x86_64') +url="https://dinisnoise.org/" +license=('GPL2') +groups=('pro-audio') +depends=('glibc' 'hicolor-icon-theme' 'jack' 'libgl' 'rtaudio' 'rtmidi' 'sdl' 'tcl') +makedepends=('boost' 'glu') +source=("https://archive.org/download/dinisnoise_source_code/${pkgname}-${pkgver}.tar.gz" + "din-43-devendor-rtaudio_rtmidi.patch" +) +sha512sums=('14df7f52a80801f062ed1a81c5625d8730e7bcc21cfa5256ecce9b478494828a3d0877c37434f30883aa519f767a70ba1cee4d203ec57c5bc72de1c47d2d848d' + 'eab5e6bc55a81ede0b415706f9a6805d0a78a2d5dc58c2bb23ca3a3c0a7de6ddd3f2c4c99771a3068907864f5898c135d32d0de6d85b10933824b9f22d1e329e') + +prepare() { + cd "${pkgname}-${pkgver}" + # use system rtaudio/rtmidi, instead of vendored versions + patch -Np1 -i ../din-43-devendor-rtaudio_rtmidi.patch + autoreconf -vfi +} + +build() { + cd "${pkgname}-${pkgver}" + export CXXFLAGS="${CXXFLAGS} $(pkg-config --cflags jack rtaudio rtmidi)" + export CFLAGS="${CFLAGS} $(pkg-config --cflags jack rtaudio rtmidi)" + export LIBS="${LIBS} $(pkg-config --libs jack rtaudio rtmidi)" + ./configure --prefix='/usr' + make +} + +package() { + cd "${pkgname}-${pkgver}" + make install DESTDIR="${pkgdir}" + # docs + install -t "${pkgdir}/usr/share/doc/${pkgname}/" \ + -vDm 644 {AUTHORS,BUGS,CHANGELOG,NEWS,README,TODO} +} Copied: din/repos/community-x86_64/din-43-devendor-rtaudio_rtmidi.patch (from rev 524120, din/trunk/din-43-devendor-rtaudio_rtmidi.patch) =================================================================== --- din-43-devendor-rtaudio_rtmidi.patch (rev 0) +++ din-43-devendor-rtaudio_rtmidi.patch 2019-11-04 19:39:01 UTC (rev 524121) @@ -0,0 +1,1955 @@ +diff -ruN a/include/Makefile.am b/include/Makefile.am +--- a/include/Makefile.am 2019-05-01 08:51:10.000000000 +0200 ++++ b/include/Makefile.am 2019-11-04 19:54:31.943153592 +0100 +@@ -2,6 +2,6 @@ + + #dinincludedir = $(pkgincludedir) + +-dist_include = alarm.h arrow_button.h audio.h authors_note.h ball.h ball_ops.h basic_editor.h beat2value.h binaural_drone.h binaural_drones.h bit_display.h box.h box_selector.h button.h capturer.h checkbutton.h chrono.h circler.h color.h command.h compressor.h console.h console_iterator.h constant_radius.h container.h cosine.h countries.h cross_button.h crvpt.h curve.h curve_display.h curve_editor.h curve_library.h curve_listener.h curve_mixer.h curve_picker.h custom_periodic.h delay.h din.h dingl.h drone.h fader.h fft.h field.h file-utils.h filled_button.h font.h font_editor.h fractaliser.h funktion.h globals.h glyph.h gravity.h help.h hit.h input.h instrument.h item_list.h keyboard_keyboard.h kiss_fft.h label.h label_field.h label_field_slider.h levels.h line.h lissajous.h listeners.h log.h main.h menu.h mesh.h midi_in.h minus_button.h mocap.h modulator.h mondrian.h morpher.h morse_code.h mouse_slider.h multi_curve.h note.h number.h octave_shift_data.h options_list.h osc.h oscill oscope.h phrasor.h play.h plugin.h plugin_browser.h plus_button.h point.h point_modulator.h random.h range.h recorder.h rect.h rose_milker.h scale_info.h scale_notes.h scalelist.h separator.h settings.h sine.h sine_mixer.h slider.h slit.h solver.h spinner.h spiraler.h starrer.h strength_editor.h superformula.h tap_bpm.h tcl_interp.h textboard.h tick.h tokenizer.h trail.h triggered_note.h ui.h ui_list.h ui_sin_cos_radius.h utils.h vector2d.h viewwin.h warper.h wav.h widget.h RtAudio.h RtError.h RtMidi.h _kiss_fft_guts.h ++dist_include = alarm.h arrow_button.h audio.h authors_note.h ball.h ball_ops.h basic_editor.h beat2value.h binaural_drone.h binaural_drones.h bit_display.h box.h box_selector.h button.h capturer.h checkbutton.h chrono.h circler.h color.h command.h compressor.h console.h console_iterator.h constant_radius.h container.h cosine.h countries.h cross_button.h crvpt.h curve.h curve_display.h curve_editor.h curve_library.h curve_listener.h curve_mixer.h curve_picker.h custom_periodic.h delay.h din.h dingl.h drone.h fader.h fft.h field.h file-utils.h filled_button.h font.h font_editor.h fractaliser.h funktion.h globals.h glyph.h gravity.h help.h hit.h input.h instrument.h item_list.h keyboard_keyboard.h kiss_fft.h label.h label_field.h label_field_slider.h levels.h line.h lissajous.h listeners.h log.h main.h menu.h mesh.h midi_in.h minus_button.h mocap.h modulator.h mondrian.h morpher.h morse_code.h mouse_slider.h multi_curve.h note.h number.h octave_shift_data.h options_list.h osc.h oscill oscope.h phrasor.h play.h plugin.h plugin_browser.h plus_button.h point.h point_modulator.h random.h range.h recorder.h rect.h rose_milker.h scale_info.h scale_notes.h scalelist.h separator.h settings.h sine.h sine_mixer.h slider.h slit.h solver.h spinner.h spiraler.h starrer.h strength_editor.h superformula.h tap_bpm.h tcl_interp.h textboard.h tick.h tokenizer.h trail.h triggered_note.h ui.h ui_list.h ui_sin_cos_radius.h utils.h vector2d.h viewwin.h warper.h wav.h widget.h RtError.h _kiss_fft_guts.h + + EXTRA_DIST = $(dist_include) +diff -ruN a/include/Makefile.in b/include/Makefile.in +--- a/include/Makefile.in 2019-11-04 12:25:43.000000000 +0100 ++++ b/include/Makefile.in 2019-11-04 19:54:52.042962639 +0100 +@@ -237,7 +237,7 @@ + strength_editor.h superformula.h tap_bpm.h tcl_interp.h \ + textboard.h tick.h tokenizer.h trail.h triggered_note.h ui.h \ + ui_list.h ui_sin_cos_radius.h utils.h vector2d.h viewwin.h \ +- warper.h wav.h widget.h RtAudio.h RtError.h RtMidi.h \ ++ warper.h wav.h widget.h RtError.h \ + _kiss_fft_guts.h + EXTRA_DIST = $(dist_include) + all: all-am +diff -ruN a/include/RtAudio.h b/include/RtAudio.h +--- a/include/RtAudio.h 2019-01-27 12:22:36.000000000 +0100 ++++ b/include/RtAudio.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,1162 +0,0 @@ +-/************************************************************************/ +-/*! \class RtAudio +- \brief Realtime audio i/o C++ classes. +- +- RtAudio provides a common API (Application Programming Interface) +- for realtime audio input/output across Linux (native ALSA, Jack, +- and OSS), Macintosh OS X (CoreAudio and Jack), and Windows +- (DirectSound, ASIO and WASAPI) operating systems. +- +- RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/ +- +- RtAudio: realtime audio i/o C++ classes +- Copyright (c) 2001-2014 Gary P. Scavone +- +- Permission is hereby granted, free of charge, to any person +- obtaining a copy of this software and associated documentation files +- (the "Software"), to deal in the Software without restriction, +- including without limitation the rights to use, copy, modify, merge, +- publish, distribute, sublicense, and/or sell copies of the Software, +- and to permit persons to whom the Software is furnished to do so, +- subject to the following conditions: +- +- The above copyright notice and this permission notice shall be +- included in all copies or substantial portions of the Software. +- +- Any person wishing to distribute modifications to the Software is +- asked to send the modifications to the original developer so that +- they can be incorporated into the canonical version. This is, +- however, not a binding provision of this license. +- +- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +- ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +- CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-*/ +-/************************************************************************/ +- +-/*! +- \file RtAudio.h +- */ +- +-#ifndef __RTAUDIO_H +-#define __RTAUDIO_H +- +-#define RTAUDIO_VERSION "4.1.1" +- +-#include <string> +-#include <vector> +-#include <exception> +-#include <iostream> +- +-/*! \typedef typedef unsigned long RtAudioFormat; +- \brief RtAudio data format type. +- +- Support for signed integers and floats. Audio data fed to/from an +- RtAudio stream is assumed to ALWAYS be in host byte order. The +- internal routines will automatically take care of any necessary +- byte-swapping between the host format and the soundcard. Thus, +- endian-ness is not a concern in the following format definitions. +- +- - \e RTAUDIO_SINT8: 8-bit signed integer. +- - \e RTAUDIO_SINT16: 16-bit signed integer. +- - \e RTAUDIO_SINT24: 24-bit signed integer. +- - \e RTAUDIO_SINT32: 32-bit signed integer. +- - \e RTAUDIO_FLOAT32: Normalized between plus/minus 1.0. +- - \e RTAUDIO_FLOAT64: Normalized between plus/minus 1.0. +-*/ +-typedef unsigned long RtAudioFormat; +-static const RtAudioFormat RTAUDIO_SINT8 = 0x1; // 8-bit signed integer. +-static const RtAudioFormat RTAUDIO_SINT16 = 0x2; // 16-bit signed integer. +-static const RtAudioFormat RTAUDIO_SINT24 = 0x4; // 24-bit signed integer. +-static const RtAudioFormat RTAUDIO_SINT32 = 0x8; // 32-bit signed integer. +-static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10; // Normalized between plus/minus 1.0. +-static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/minus 1.0. +- +-/*! \typedef typedef unsigned long RtAudioStreamFlags; +- \brief RtAudio stream option flags. +- +- The following flags can be OR'ed together to allow a client to +- make changes to the default stream behavior: +- +- - \e RTAUDIO_NONINTERLEAVED: Use non-interleaved buffers (default = interleaved). +- - \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency. +- - \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use. +- - \e RTAUDIO_ALSA_USE_DEFAULT: Use the "default" PCM device (ALSA only). +- +- By default, RtAudio streams pass and receive audio data from the +- client in an interleaved format. By passing the +- RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio +- data will instead be presented in non-interleaved buffers. In +- this case, each buffer argument in the RtAudioCallback function +- will point to a single array of data, with \c nFrames samples for +- each channel concatenated back-to-back. For example, the first +- sample of data for the second channel would be located at index \c +- nFrames (assuming the \c buffer pointer was recast to the correct +- data type for the stream). +- +- Certain audio APIs offer a number of parameters that influence the +- I/O latency of a stream. By default, RtAudio will attempt to set +- these parameters internally for robust (glitch-free) performance +- (though some APIs, like Windows Direct Sound, make this difficult). +- By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream() +- function, internal stream settings will be influenced in an attempt +- to minimize stream latency, though possibly at the expense of stream +- performance. +- +- If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to +- open the input and/or output stream device(s) for exclusive use. +- Note that this is not possible with all supported audio APIs. +- +- If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt +- to select realtime scheduling (round-robin) for the callback thread. +- +- If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to +- open the "default" PCM device when using the ALSA API. Note that this +- will override any specified input or output device id. +-*/ +-typedef unsigned int RtAudioStreamFlags; +-static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved). +-static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to set stream parameters for lowest possible latency. +-static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others. +-static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread. +-static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10; // Use the "default" PCM device (ALSA only). +- +-/*! \typedef typedef unsigned long RtAudioStreamStatus; +- \brief RtAudio stream status (over- or underflow) flags. +- +- Notification of a stream over- or underflow is indicated by a +- non-zero stream \c status argument in the RtAudioCallback function. +- The stream status can be one of the following two options, +- depending on whether the stream is open for output and/or input: +- +- - \e RTAUDIO_INPUT_OVERFLOW: Input data was discarded because of an overflow condition at the driver. +- - \e RTAUDIO_OUTPUT_UNDERFLOW: The output buffer ran low, likely producing a break in the output sound. +-*/ +-typedef unsigned int RtAudioStreamStatus; +-static const RtAudioStreamStatus RTAUDIO_INPUT_OVERFLOW = 0x1; // Input data was discarded because of an overflow condition at the driver. +-static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2; // The output buffer ran low, likely causing a gap in the output sound. +- +-//! RtAudio callback function prototype. +-/*! +- All RtAudio clients must create a function of type RtAudioCallback +- to read and/or write data from/to the audio stream. When the +- underlying audio system is ready for new input or output data, this +- function will be invoked. +- +- \param outputBuffer For output (or duplex) streams, the client +- should write \c nFrames of audio sample frames into this +- buffer. This argument should be recast to the datatype +- specified when the stream was opened. For input-only +- streams, this argument will be NULL. +- +- \param inputBuffer For input (or duplex) streams, this buffer will +- hold \c nFrames of input audio sample frames. This +- argument should be recast to the datatype specified when the +- stream was opened. For output-only streams, this argument +- will be NULL. +- +- \param nFrames The number of sample frames of input or output +- data in the buffers. The actual buffer size in bytes is +- dependent on the data type and number of channels in use. +- +- \param streamTime The number of seconds that have elapsed since the +- stream was started. +- +- \param status If non-zero, this argument indicates a data overflow +- or underflow condition for the stream. The particular +- condition can be determined by comparison with the +- RtAudioStreamStatus flags. +- +- \param userData A pointer to optional data provided by the client +- when opening the stream (default = NULL). +- +- To continue normal stream operation, the RtAudioCallback function +- should return a value of zero. To stop the stream and drain the +- output buffer, the function should return a value of one. To abort +- the stream immediately, the client should return a value of two. +- */ +-typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer, +- unsigned int nFrames, +- double streamTime, +- RtAudioStreamStatus status, +- void *userData ); +- +-/************************************************************************/ +-/*! \class RtAudioError +- \brief Exception handling class for RtAudio. +- +- The RtAudioError class is quite simple but it does allow errors to be +- "caught" by RtAudioError::Type. See the RtAudio documentation to know +- which methods can throw an RtAudioError. +-*/ +-/************************************************************************/ +- +-class RtAudioError : public std::exception +-{ +- public: +- //! Defined RtAudioError types. +- enum Type { +- WARNING, /*!< A non-critical error. */ +- DEBUG_WARNING, /*!< A non-critical error which might be useful for debugging. */ +- UNSPECIFIED, /*!< The default, unspecified error type. */ +- NO_DEVICES_FOUND, /*!< No devices found on system. */ +- INVALID_DEVICE, /*!< An invalid device ID was specified. */ +- MEMORY_ERROR, /*!< An error occured during memory allocation. */ +- INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */ +- INVALID_USE, /*!< The function was called incorrectly. */ +- DRIVER_ERROR, /*!< A system driver error occured. */ +- SYSTEM_ERROR, /*!< A system error occured. */ +- THREAD_ERROR /*!< A thread error occured. */ +- }; +- +- //! The constructor. +- RtAudioError( const std::string& message, Type type = RtAudioError::UNSPECIFIED ) throw() : message_(message), type_(type) {} +- +- //! The destructor. +- virtual ~RtAudioError( void ) throw() {} +- +- //! Prints thrown error message to stderr. +- virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; } +- +- //! Returns the thrown error message type. +- virtual const Type& getType(void) const throw() { return type_; } +- +- //! Returns the thrown error message string. +- virtual const std::string& getMessage(void) const throw() { return message_; } +- +- //! Returns the thrown error message as a c-style string. +- virtual const char* what( void ) const throw() { return message_.c_str(); } +- +- protected: +- std::string message_; +- Type type_; +-}; +- +-//! RtAudio error callback function prototype. +-/*! +- \param type Type of error. +- \param errorText Error description. +- */ +-typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string &errorText ); +- +-// **************************************************************** // +-// +-// RtAudio class declaration. +-// +-// RtAudio is a "controller" used to select an available audio i/o +-// interface. It presents a common API for the user to call but all +-// functionality is implemented by the class RtApi and its +-// subclasses. RtAudio creates an instance of an RtApi subclass +-// based on the user's API choice. If no choice is made, RtAudio +-// attempts to make a "logical" API selection. +-// +-// **************************************************************** // +- +-class RtApi; +- +-class RtAudio +-{ +- public: +- +- //! Audio API specifier arguments. +- enum Api { +- UNSPECIFIED, /*!< Search for a working compiled API. */ +- LINUX_ALSA, /*!< The Advanced Linux Sound Architecture API. */ +- LINUX_PULSE, /*!< The Linux PulseAudio API. */ +- LINUX_OSS, /*!< The Linux Open Sound System API. */ +- UNIX_JACK, /*!< The Jack Low-Latency Audio Server API. */ +- MACOSX_CORE, /*!< Macintosh OS-X Core Audio API. */ +- WINDOWS_WASAPI, /*!< The Microsoft WASAPI API. */ +- WINDOWS_ASIO, /*!< The Steinberg Audio Stream I/O API. */ +- WINDOWS_DS, /*!< The Microsoft Direct Sound API. */ +- RTAUDIO_DUMMY /*!< A compilable but non-functional API. */ +- }; +- +- //! The public device information structure for returning queried values. +- struct DeviceInfo { +- bool probed; /*!< true if the device capabilities were successfully probed. */ +- std::string name; /*!< Character string device identifier. */ +- unsigned int outputChannels; /*!< Maximum output channels supported by device. */ +- unsigned int inputChannels; /*!< Maximum input channels supported by device. */ +- unsigned int duplexChannels; /*!< Maximum simultaneous input/output channels supported by device. */ +- 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). */ +- 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) {} +- }; +- +- //! The structure for specifying input or ouput stream parameters. +- struct StreamParameters { +- unsigned int deviceId; /*!< Device index (0 to getDeviceCount() - 1). */ +- unsigned int nChannels; /*!< Number of channels. */ +- unsigned int firstChannel; /*!< First channel index on device (default = 0). */ +- +- // Default constructor. +- StreamParameters() +- : deviceId(0), nChannels(0), firstChannel(0) {} +- }; +- +- //! The structure for specifying stream options. +- /*! +- The following flags can be OR'ed together to allow a client to +- make changes to the default stream behavior: +- +- - \e RTAUDIO_NONINTERLEAVED: Use non-interleaved buffers (default = interleaved). +- - \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency. +- - \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use. +- - \e RTAUDIO_SCHEDULE_REALTIME: Attempt to select realtime scheduling for callback thread. +- - \e RTAUDIO_ALSA_USE_DEFAULT: Use the "default" PCM device (ALSA only). +- +- By default, RtAudio streams pass and receive audio data from the +- client in an interleaved format. By passing the +- RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio +- data will instead be presented in non-interleaved buffers. In +- this case, each buffer argument in the RtAudioCallback function +- will point to a single array of data, with \c nFrames samples for +- each channel concatenated back-to-back. For example, the first +- sample of data for the second channel would be located at index \c +- nFrames (assuming the \c buffer pointer was recast to the correct +- data type for the stream). +- +- Certain audio APIs offer a number of parameters that influence the +- I/O latency of a stream. By default, RtAudio will attempt to set +- these parameters internally for robust (glitch-free) performance +- (though some APIs, like Windows Direct Sound, make this difficult). +- By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream() +- function, internal stream settings will be influenced in an attempt +- to minimize stream latency, though possibly at the expense of stream +- performance. +- +- If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to +- open the input and/or output stream device(s) for exclusive use. +- Note that this is not possible with all supported audio APIs. +- +- If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt +- to select realtime scheduling (round-robin) for the callback thread. +- The \c priority parameter will only be used if the RTAUDIO_SCHEDULE_REALTIME +- flag is set. It defines the thread's realtime priority. +- +- If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to +- open the "default" PCM device when using the ALSA API. Note that this +- will override any specified input or output device id. +- +- The \c numberOfBuffers parameter can be used to control stream +- latency in the Windows DirectSound, Linux OSS, and Linux Alsa APIs +- only. A value of two is usually the smallest allowed. Larger +- numbers can potentially result in more robust stream performance, +- though likely at the cost of stream latency. The value set by the +- user is replaced during execution of the RtAudio::openStream() +- function by the value actually used by the system. +- +- The \c streamName parameter can be used to set the client name +- when using the Jack API. By default, the client name is set to +- RtApiJack. However, if you wish to create multiple instances of +- RtAudio with Jack, each instance must have a unique client name. +- */ +- struct StreamOptions { +- RtAudioStreamFlags flags; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE, RTAUDIO_ALSA_USE_DEFAULT). */ +- unsigned int numberOfBuffers; /*!< Number of stream buffers. */ +- std::string streamName; /*!< A stream name (currently used only in Jack). */ +- int priority; /*!< Scheduling priority of callback thread (only used with flag RTAUDIO_SCHEDULE_REALTIME). */ +- +- // Default constructor. +- StreamOptions() +- : flags(0), numberOfBuffers(0), priority(0) {} +- }; +- +- //! A static function to determine the current RtAudio version. +- static std::string getVersion( void ) throw(); +- +- //! A static function to determine the available compiled audio APIs. +- /*! +- The values returned in the std::vector can be compared against +- the enumerated list values. Note that there can be more than one +- API compiled for certain operating systems. +- */ +- static void getCompiledApi( std::vector<RtAudio::Api> &apis ) throw(); +- +- //! The class constructor. +- /*! +- The constructor performs minor initialization tasks. An exception +- can be thrown if no API support is compiled. +- +- If no API argument is specified and multiple API support has been +- compiled, the default order of use is JACK, ALSA, OSS (Linux +- systems) and ASIO, DS (Windows systems). +- */ +- RtAudio( RtAudio::Api api=UNSPECIFIED ); +- +- //! The destructor. +- /*! +- If a stream is running or open, it will be stopped and closed +- automatically. +- */ +- ~RtAudio() throw(); +- +- //! Returns the audio API specifier for the current instance of RtAudio. +- RtAudio::Api getCurrentApi( void ) throw(); +- +- //! A public function that queries for the number of audio devices available. +- /*! +- This function performs a system query of available devices each time it +- is called, thus supporting devices connected \e after instantiation. If +- a system error occurs during processing, a warning will be issued. +- */ +- unsigned int getDeviceCount( void ) throw(); +- +- //! Return an RtAudio::DeviceInfo structure for a specified device number. +- /*! +- +- Any device integer between 0 and getDeviceCount() - 1 is valid. +- If an invalid argument is provided, an RtAudioError (type = INVALID_USE) +- will be thrown. If a device is busy or otherwise unavailable, the +- structure member "probed" will have a value of "false" and all +- other members are undefined. If the specified device is the +- current default input or output device, the corresponding +- "isDefault" member will have a value of "true". +- */ +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- +- //! A function that returns the index of the default output device. +- /*! +- If the underlying audio API does not provide a "default +- device", or if no devices are available, the return value will be +- 0. Note that this is a valid device identifier and it is the +- client's responsibility to verify that a device is available +- before attempting to open a stream. +- */ +- unsigned int getDefaultOutputDevice( void ) throw(); +- +- //! A function that returns the index of the default input device. +- /*! +- If the underlying audio API does not provide a "default +- device", or if no devices are available, the return value will be +- 0. Note that this is a valid device identifier and it is the +- client's responsibility to verify that a device is available +- before attempting to open a stream. +- */ +- unsigned int getDefaultInputDevice( void ) throw(); +- +- //! A public function for opening a stream with the specified parameters. +- /*! +- An RtAudioError (type = SYSTEM_ERROR) is thrown if a stream cannot be +- opened with the specified parameters or an error occurs during +- processing. An RtAudioError (type = INVALID_USE) is thrown if any +- invalid device ID or channel number parameters are specified. +- +- \param outputParameters Specifies output stream parameters to use +- when opening a stream, including a device ID, number of channels, +- and starting channel number. For input-only streams, this +- argument should be NULL. The device ID is an index value between +- 0 and getDeviceCount() - 1. +- \param inputParameters Specifies input stream parameters to use +- when opening a stream, including a device ID, number of channels, +- and starting channel number. For output-only streams, this +- argument should be NULL. The device ID is an index value between +- 0 and getDeviceCount() - 1. +- \param format An RtAudioFormat specifying the desired sample data format. +- \param sampleRate The desired sample rate (sample frames per second). +- \param *bufferFrames A pointer to a value indicating the desired +- internal buffer size in sample frames. The actual value +- used by the device is returned via the same pointer. A +- value of zero can be specified, in which case the lowest +- allowable value is determined. +- \param callback A client-defined function that will be invoked +- when input data is available and/or output data is needed. +- \param userData An optional pointer to data that can be accessed +- from within the callback function. +- \param options An optional pointer to a structure containing various +- global stream options, including a list of OR'ed RtAudioStreamFlags +- and a suggested number of stream buffers that can be used to +- control stream latency. More buffers typically result in more +- robust performance, though at a cost of greater latency. If a +- value of zero is specified, a system-specific median value is +- chosen. If the RTAUDIO_MINIMIZE_LATENCY flag bit is set, the +- lowest allowable value is used. The actual value used is +- returned via the structure argument. The parameter is API dependent. +- \param errorCallback A client-defined function that will be invoked +- when an error has occured. +- */ +- void openStream( RtAudio::StreamParameters *outputParameters, +- RtAudio::StreamParameters *inputParameters, +- RtAudioFormat format, unsigned int sampleRate, +- unsigned int *bufferFrames, RtAudioCallback callback, +- void *userData = NULL, RtAudio::StreamOptions *options = NULL, RtAudioErrorCallback errorCallback = NULL ); +- +- //! A function that closes a stream and frees any associated stream memory. +- /*! +- If a stream is not open, this function issues a warning and +- returns (no exception is thrown). +- */ +- void closeStream( void ) throw(); +- +- //! A function that starts a stream. +- /*! +- An RtAudioError (type = SYSTEM_ERROR) is thrown if an error occurs +- during processing. An RtAudioError (type = INVALID_USE) is thrown if a +- stream is not open. A warning is issued if the stream is already +- running. +- */ +- void startStream( void ); +- +- //! Stop a stream, allowing any samples remaining in the output queue to be played. +- /*! +- An RtAudioError (type = SYSTEM_ERROR) is thrown if an error occurs +- during processing. An RtAudioError (type = INVALID_USE) is thrown if a +- stream is not open. A warning is issued if the stream is already +- stopped. +- */ +- void stopStream( void ); +- +- //! Stop a stream, discarding any samples remaining in the input/output queue. +- /*! +- An RtAudioError (type = SYSTEM_ERROR) is thrown if an error occurs +- during processing. An RtAudioError (type = INVALID_USE) is thrown if a +- stream is not open. A warning is issued if the stream is already +- stopped. +- */ +- void abortStream( void ); +- +- //! Returns true if a stream is open and false if not. +- bool isStreamOpen( void ) const throw(); +- +- //! Returns true if the stream is running and false if it is stopped or not open. +- bool isStreamRunning( void ) const throw(); +- +- //! Returns the number of elapsed seconds since the stream was started. +- /*! +- If a stream is not open, an RtAudioError (type = INVALID_USE) will be thrown. +- */ +- double getStreamTime( void ); +- +- //! Set the stream time to a time in seconds greater than or equal to 0.0. +- /*! +- If a stream is not open, an RtAudioError (type = INVALID_USE) will be thrown. +- */ +- void setStreamTime( double time ); +- +- //! Returns the internal stream latency in sample frames. +- /*! +- The stream latency refers to delay in audio input and/or output +- caused by internal buffering by the audio system and/or hardware. +- For duplex streams, the returned value will represent the sum of +- the input and output latencies. If a stream is not open, an +- RtAudioError (type = INVALID_USE) will be thrown. If the API does not +- report latency, the return value will be zero. +- */ +- long getStreamLatency( void ); +- +- //! Returns actual sample rate in use by the stream. +- /*! +- On some systems, the sample rate used may be slightly different +- than that specified in the stream parameters. If a stream is not +- open, an RtAudioError (type = INVALID_USE) will be thrown. +- */ +- unsigned int getStreamSampleRate( void ); +- +- //! Specify whether warning messages should be printed to stderr. +- void showWarnings( bool value = true ) throw(); +- +- protected: +- +- void openRtApi( RtAudio::Api api ); +- RtApi *rtapi_; +-}; +- +-// Operating system dependent thread functionality. +-#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__) +- +- #ifndef NOMINMAX +- #define NOMINMAX +- #endif +- #include <windows.h> +- #include <process.h> +- +- typedef uintptr_t ThreadHandle; +- typedef CRITICAL_SECTION StreamMutex; +- +-#elif defined(__LINUX_ALSA__) || defined(__LINUX_PULSE__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__) +- // Using pthread library for various flavors of unix. +- #include <pthread.h> +- +- typedef pthread_t ThreadHandle; +- typedef pthread_mutex_t StreamMutex; +- +-#else // Setup for "dummy" behavior +- +- #define __RTAUDIO_DUMMY__ +- typedef int ThreadHandle; +- typedef int StreamMutex; +- +-#endif +- +-// This global structure type is used to pass callback information +-// between the private RtAudio stream structure and global callback +-// handling functions. +-struct CallbackInfo { +- void *object; // Used as a "this" pointer. +- ThreadHandle thread; +- void *callback; +- void *userData; +- void *errorCallback; +- void *apiInfo; // void pointer for API specific callback information +- bool isRunning; +- bool doRealtime; +- int priority; +- +- // Default constructor. +- CallbackInfo() +- :object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false) {} +-}; +- +-// **************************************************************** // +-// +-// RtApi class declaration. +-// +-// Subclasses of RtApi contain all API- and OS-specific code necessary +-// to fully implement the RtAudio API. +-// +-// Note that RtApi is an abstract base class and cannot be +-// explicitly instantiated. The class RtAudio will create an +-// instance of an RtApi subclass (RtApiOss, RtApiAlsa, +-// RtApiJack, RtApiCore, RtApiDs, or RtApiAsio). +-// +-// **************************************************************** // +- +-#pragma pack(push, 1) +-class S24 { +- +- protected: +- unsigned char c3[3]; +- +- public: +- S24() {} +- +- S24& operator = ( const int& i ) { +- c3[0] = (i & 0x000000ff); +- c3[1] = (i & 0x0000ff00) >> 8; +- c3[2] = (i & 0x00ff0000) >> 16; +- return *this; +- } +- +- S24( const S24& v ) { *this = v; } +- S24( const double& d ) { *this = (int) d; } +- S24( const float& f ) { *this = (int) f; } +- S24( const signed short& s ) { *this = (int) s; } +- S24( const char& c ) { *this = (int) c; } +- +- int asInt() { +- int i = c3[0] | (c3[1] << 8) | (c3[2] << 16); +- if (i & 0x800000) i |= ~0xffffff; +- return i; +- } +-}; +-#pragma pack(pop) +- +-#if defined( HAVE_GETTIMEOFDAY ) +- #include <sys/time.h> +-#endif +- +-#include <sstream> +- +-class RtApi +-{ +-public: +- +- RtApi(); +- virtual ~RtApi(); +- virtual RtAudio::Api getCurrentApi( void ) = 0; +- virtual unsigned int getDeviceCount( void ) = 0; +- virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0; +- virtual unsigned int getDefaultInputDevice( void ); +- virtual unsigned int getDefaultOutputDevice( void ); +- void openStream( RtAudio::StreamParameters *outputParameters, +- RtAudio::StreamParameters *inputParameters, +- RtAudioFormat format, unsigned int sampleRate, +- unsigned int *bufferFrames, RtAudioCallback callback, +- void *userData, RtAudio::StreamOptions *options, +- RtAudioErrorCallback errorCallback ); +- virtual void closeStream( void ); +- virtual void startStream( void ) = 0; +- virtual void stopStream( void ) = 0; +- virtual void abortStream( void ) = 0; +- long getStreamLatency( void ); +- unsigned int getStreamSampleRate( void ); +- virtual double getStreamTime( void ); +- virtual void setStreamTime( double time ); +- bool isStreamOpen( void ) const { return stream_.state != STREAM_CLOSED; } +- bool isStreamRunning( void ) const { return stream_.state == STREAM_RUNNING; } +- void showWarnings( bool value ) { showWarnings_ = value; } +- +- +-protected: +- +- static const unsigned int MAX_SAMPLE_RATES; +- static const unsigned int SAMPLE_RATES[]; +- +- enum { FAILURE, SUCCESS }; +- +- enum StreamState { +- STREAM_STOPPED, +- STREAM_STOPPING, +- STREAM_RUNNING, +- STREAM_CLOSED = -50 +- }; +- +- enum StreamMode { +- OUTPUT, +- INPUT, +- DUPLEX, +- UNINITIALIZED = -75 +- }; +- +- // A protected structure used for buffer conversion. +- struct ConvertInfo { +- int channels; +- int inJump, outJump; +- RtAudioFormat inFormat, outFormat; +- std::vector<int> inOffset; +- std::vector<int> outOffset; +- }; +- +- // A protected structure for audio streams. +- struct RtApiStream { +- unsigned int device[2]; // Playback and record, respectively. +- void *apiHandle; // void pointer for API specific stream handle information +- StreamMode mode; // OUTPUT, INPUT, or DUPLEX. +- StreamState state; // STOPPED, RUNNING, or CLOSED +- char *userBuffer[2]; // Playback and record, respectively. +- char *deviceBuffer; +- bool doConvertBuffer[2]; // Playback and record, respectively. +- bool userInterleaved; +- bool deviceInterleaved[2]; // Playback and record, respectively. +- bool doByteSwap[2]; // Playback and record, respectively. +- unsigned int sampleRate; +- unsigned int bufferSize; +- unsigned int nBuffers; +- unsigned int nUserChannels[2]; // Playback and record, respectively. +- unsigned int nDeviceChannels[2]; // Playback and record channels, respectively. +- unsigned int channelOffset[2]; // Playback and record, respectively. +- unsigned long latency[2]; // Playback and record, respectively. +- RtAudioFormat userFormat; +- RtAudioFormat deviceFormat[2]; // Playback and record, respectively. +- StreamMutex mutex; +- CallbackInfo callbackInfo; +- ConvertInfo convertInfo[2]; +- double streamTime; // Number of elapsed seconds since the stream started. +- +-#if defined(HAVE_GETTIMEOFDAY) +- struct timeval lastTickTimestamp; +-#endif +- +- RtApiStream() +- :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; } +- }; +- +- typedef S24 Int24; +- typedef signed short Int16; +- typedef signed int Int32; +- typedef float Float32; +- typedef double Float64; +- +- std::ostringstream errorStream_; +- std::string errorText_; +- bool showWarnings_; +- RtApiStream stream_; +- bool firstErrorOccurred_; +- +- /*! +- Protected, api-specific method that attempts to open a device +- with the given parameters. This function MUST be implemented by +- all subclasses. If an error is encountered during the probe, a +- "warning" message is reported and FAILURE is returned. A +- successful probe is indicated by a return value of SUCCESS. +- */ +- virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int *bufferSize, +- RtAudio::StreamOptions *options ); +- +- //! A protected function used to increment the stream time. +- void tickStreamTime( void ); +- +- //! Protected common method to clear an RtApiStream structure. +- void clearStreamInfo(); +- +- /*! +- Protected common method that throws an RtAudioError (type = +- INVALID_USE) if a stream is not open. +- */ +- void verifyStream( void ); +- +- //! Protected common error method to allow global control over error handling. +- void error( RtAudioError::Type type ); +- +- /*! +- Protected method used to perform format, channel number, and/or interleaving +- conversions between the user and device buffers. +- */ +- void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info ); +- +- //! Protected common method used to perform byte-swapping on buffers. +- void byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format ); +- +- //! Protected common method that returns the number of bytes for a given format. +- unsigned int formatBytes( RtAudioFormat format ); +- +- //! Protected common method that sets up the parameters for buffer conversion. +- void setConvertInfo( StreamMode mode, unsigned int firstChannel ); +-}; +- +-// **************************************************************** // +-// +-// Inline RtAudio definitions. +-// +-// **************************************************************** // +- +-inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); } +-inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); } +-inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); } +-inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); } +-inline unsigned int RtAudio :: getDefaultOutputDevice( void ) throw() { return rtapi_->getDefaultOutputDevice(); } +-inline void RtAudio :: closeStream( void ) throw() { return rtapi_->closeStream(); } +-inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); } +-inline void RtAudio :: stopStream( void ) { return rtapi_->stopStream(); } +-inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); } +-inline bool RtAudio :: isStreamOpen( void ) const throw() { return rtapi_->isStreamOpen(); } +-inline bool RtAudio :: isStreamRunning( void ) const throw() { return rtapi_->isStreamRunning(); } +-inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); } +-inline unsigned int RtAudio :: getStreamSampleRate( void ) { return rtapi_->getStreamSampleRate(); } +-inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); } +-inline void RtAudio :: setStreamTime( double time ) { return rtapi_->setStreamTime( time ); } +-inline void RtAudio :: showWarnings( bool value ) throw() { rtapi_->showWarnings( value ); } +- +-// RtApi Subclass prototypes. +- +-#if defined(__MACOSX_CORE__) +- +-#include <CoreAudio/AudioHardware.h> +- +-class RtApiCore: public RtApi +-{ +-public: +- +- RtApiCore(); +- ~RtApiCore(); +- RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; } +- unsigned int getDeviceCount( void ); +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- unsigned int getDefaultOutputDevice( void ); +- unsigned int getDefaultInputDevice( void ); +- void closeStream( void ); +- void startStream( void ); +- void stopStream( void ); +- void abortStream( void ); +- long getStreamLatency( void ); +- +- // This function is intended for internal use only. It must be +- // public because it is called by the internal callback handler, +- // which is not a member of RtAudio. External use of this function +- // will most likely produce highly undesireable results! +- bool callbackEvent( AudioDeviceID deviceId, +- const AudioBufferList *inBufferList, +- const AudioBufferList *outBufferList ); +- +- private: +- +- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int *bufferSize, +- RtAudio::StreamOptions *options ); +- static const char* getErrorCode( OSStatus code ); +-}; +- +-#endif +- +-#if defined(__UNIX_JACK__) +- +-class RtApiJack: public RtApi +-{ +-public: +- +- RtApiJack(); +- ~RtApiJack(); +- RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; } +- unsigned int getDeviceCount( void ); +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- void closeStream( void ); +- void startStream( void ); +- void stopStream( void ); +- void abortStream( void ); +- long getStreamLatency( void ); +- +- // This function is intended for internal use only. It must be +- // public because it is called by the internal callback handler, +- // which is not a member of RtAudio. External use of this function +- // will most likely produce highly undesireable results! +- bool callbackEvent( unsigned long nframes ); +- +- private: +- +- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int *bufferSize, +- RtAudio::StreamOptions *options ); +-}; +- +-#endif +- +-#if defined(__WINDOWS_ASIO__) +- +-class RtApiAsio: public RtApi +-{ +-public: +- +- RtApiAsio(); +- ~RtApiAsio(); +- RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; } +- unsigned int getDeviceCount( void ); +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- void closeStream( void ); +- void startStream( void ); +- void stopStream( void ); +- void abortStream( void ); +- long getStreamLatency( void ); +- +- // This function is intended for internal use only. It must be +- // public because it is called by the internal callback handler, +- // which is not a member of RtAudio. External use of this function +- // will most likely produce highly undesireable results! +- bool callbackEvent( long bufferIndex ); +- +- private: +- +- std::vector<RtAudio::DeviceInfo> devices_; +- void saveDeviceInfo( void ); +- bool coInitialized_; +- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int *bufferSize, +- RtAudio::StreamOptions *options ); +-}; +- +-#endif +- +-#if defined(__WINDOWS_DS__) +- +-class RtApiDs: public RtApi +-{ +-public: +- +- RtApiDs(); +- ~RtApiDs(); +- RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; } +- unsigned int getDeviceCount( void ); +- unsigned int getDefaultOutputDevice( void ); +- unsigned int getDefaultInputDevice( void ); +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- void closeStream( void ); +- void startStream( void ); +- void stopStream( void ); +- void abortStream( void ); +- long getStreamLatency( void ); +- +- // This function is intended for internal use only. It must be +- // public because it is called by the internal callback handler, +- // which is not a member of RtAudio. External use of this function +- // will most likely produce highly undesireable results! +- void callbackEvent( void ); +- +- private: +- +- bool coInitialized_; +- bool buffersRolling; +- long duplexPrerollBytes; +- std::vector<struct DsDevice> dsDevices; +- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int *bufferSize, +- RtAudio::StreamOptions *options ); +-}; +- +-#endif +- +-#if defined(__WINDOWS_WASAPI__) +- +-struct IMMDeviceEnumerator; +- +-class RtApiWasapi : public RtApi +-{ +-public: +- RtApiWasapi(); +- ~RtApiWasapi(); +- +- RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_WASAPI; } +- unsigned int getDeviceCount( void ); +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- unsigned int getDefaultOutputDevice( void ); +- unsigned int getDefaultInputDevice( void ); +- void closeStream( void ); +- void startStream( void ); +- void stopStream( void ); +- void abortStream( void ); +- +-private: +- bool coInitialized_; +- IMMDeviceEnumerator* deviceEnumerator_; +- +- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int* bufferSize, +- RtAudio::StreamOptions* options ); +- +- static DWORD WINAPI runWasapiThread( void* wasapiPtr ); +- static DWORD WINAPI stopWasapiThread( void* wasapiPtr ); +- static DWORD WINAPI abortWasapiThread( void* wasapiPtr ); +- void wasapiThread(); +-}; +- +-#endif +- +-#if defined(__LINUX_ALSA__) +- +-class RtApiAlsa: public RtApi +-{ +-public: +- +- RtApiAlsa(); +- ~RtApiAlsa(); +- RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; } +- unsigned int getDeviceCount( void ); +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- void closeStream( void ); +- void startStream( void ); +- void stopStream( void ); +- void abortStream( void ); +- +- // This function is intended for internal use only. It must be +- // public because it is called by the internal callback handler, +- // which is not a member of RtAudio. External use of this function +- // will most likely produce highly undesireable results! +- void callbackEvent( void ); +- +- private: +- +- std::vector<RtAudio::DeviceInfo> devices_; +- void saveDeviceInfo( void ); +- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int *bufferSize, +- RtAudio::StreamOptions *options ); +-}; +- +-#endif +- +-#if defined(__LINUX_PULSE__) +- +-class RtApiPulse: public RtApi +-{ +-public: +- ~RtApiPulse(); +- RtAudio::Api getCurrentApi() { return RtAudio::LINUX_PULSE; } +- unsigned int getDeviceCount( void ); +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- void closeStream( void ); +- void startStream( void ); +- void stopStream( void ); +- void abortStream( void ); +- +- // This function is intended for internal use only. It must be +- // public because it is called by the internal callback handler, +- // which is not a member of RtAudio. External use of this function +- // will most likely produce highly undesireable results! +- void callbackEvent( void ); +- +- private: +- +- std::vector<RtAudio::DeviceInfo> devices_; +- void saveDeviceInfo( void ); +- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int *bufferSize, +- RtAudio::StreamOptions *options ); +-}; +- +-#endif +- +-#if defined(__LINUX_OSS__) +- +-class RtApiOss: public RtApi +-{ +-public: +- +- RtApiOss(); +- ~RtApiOss(); +- RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; } +- unsigned int getDeviceCount( void ); +- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +- void closeStream( void ); +- void startStream( void ); +- void stopStream( void ); +- void abortStream( void ); +- +- // This function is intended for internal use only. It must be +- // public because it is called by the internal callback handler, +- // which is not a member of RtAudio. External use of this function +- // will most likely produce highly undesireable results! +- void callbackEvent( void ); +- +- private: +- +- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +- unsigned int firstChannel, unsigned int sampleRate, +- RtAudioFormat format, unsigned int *bufferSize, +- RtAudio::StreamOptions *options ); +-}; +- +-#endif +- +-#if defined(__RTAUDIO_DUMMY__) +- +-class RtApiDummy: public RtApi +-{ +-public: +- +- RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtAudioError::WARNING ); } +- RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; } +- unsigned int getDeviceCount( void ) { return 0; } +- RtAudio::DeviceInfo getDeviceInfo( unsigned int /*device*/ ) { RtAudio::DeviceInfo info; return info; } +- void closeStream( void ) {} +- void startStream( void ) {} +- void stopStream( void ) {} +- void abortStream( void ) {} +- +- private: +- +- bool probeDeviceOpen( unsigned int /*device*/, StreamMode /*mode*/, unsigned int /*channels*/, +- unsigned int /*firstChannel*/, unsigned int /*sampleRate*/, +- RtAudioFormat /*format*/, unsigned int * /*bufferSize*/, +- RtAudio::StreamOptions * /*options*/ ) { return false; } +-}; +- +-#endif +- +-#endif +- +-// Indentation settings for Vim and Emacs +-// +-// Local Variables: +-// c-basic-offset: 2 +-// indent-tabs-mode: nil +-// End: +-// +-// vim: et sts=2 sw=2 +diff -ruN a/include/RtMidi.h b/include/RtMidi.h +--- a/include/RtMidi.h 2019-01-27 12:22:36.000000000 +0100 ++++ b/include/RtMidi.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,676 +0,0 @@ +-/**********************************************************************/ +-/*! \class RtMidi +- \brief An abstract base class for realtime MIDI input/output. +- +- This class implements some common functionality for the realtime +- MIDI input/output subclasses RtMidiIn and RtMidiOut. +- +- RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/ +- +- RtMidi: realtime MIDI i/o C++ classes +- Copyright (c) 2003-2012 Gary P. Scavone +- +- Permission is hereby granted, free of charge, to any person +- obtaining a copy of this software and associated documentation files +- (the "Software"), to deal in the Software without restriction, +- including without limitation the rights to use, copy, modify, merge, +- publish, distribute, sublicense, and/or sell copies of the Software, +- and to permit persons to whom the Software is furnished to do so, +- subject to the following conditions: +- +- The above copyright notice and this permission notice shall be +- included in all copies or substantial portions of the Software. +- +- Any person wishing to distribute modifications to the Software is +- asked to send the modifications to the original developer so that +- they can be incorporated into the canonical version. This is, +- however, not a binding provision of this license. +- +- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +- ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +- CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-*/ +-/**********************************************************************/ +- +-/*! +- \file RtMidi.h +- */ +- +-// RtMidi: Version 2.0.1 +- +-#ifndef RTMIDI_H +-#define RTMIDI_H +- +-#include "RtError.h" +-#include <string> +-#include <vector> +- +-class RtMidi +-{ +- public: +- +- //! MIDI API specifier arguments. +- enum Api { +- UNSPECIFIED, /*!< Search for a working compiled API. */ +- MACOSX_CORE, /*!< Macintosh OS-X Core Midi API. */ +- LINUX_ALSA, /*!< The Advanced Linux Sound Architecture API. */ +- UNIX_JACK, /*!< The Jack Low-Latency MIDI Server API. */ +- WINDOWS_MM, /*!< The Microsoft Multimedia MIDI API. */ +- WINDOWS_KS, /*!< The Microsoft Kernel Streaming MIDI API. */ +- RTMIDI_DUMMY /*!< A compilable but non-functional API. */ +- }; +- +- //! A static function to determine the available compiled MIDI APIs. +- /*! +- The values returned in the std::vector can be compared against +- the enumerated list values. Note that there can be more than one +- API compiled for certain operating systems. +- */ +- static void getCompiledApi( std::vector<RtMidi::Api> &apis ) throw(); +- +- //! Pure virtual openPort() function. +- virtual void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi" ) ) = 0; +- +- //! Pure virtual openVirtualPort() function. +- virtual void openVirtualPort( const std::string portName = std::string( "RtMidi" ) ) = 0; +- +- //! Pure virtual getPortCount() function. +- virtual unsigned int getPortCount() = 0; +- +- //! Pure virtual getPortName() function. +- virtual std::string getPortName( unsigned int portNumber = 0 ) = 0; +- +- //! Pure virtual closePort() function. +- virtual void closePort( void ) = 0; +- +- //! A basic error reporting function for RtMidi classes. +- static void error( RtError::Type type, std::string errorString ); +- +- protected: +- +- RtMidi() {}; +- virtual ~RtMidi() {}; +-}; +- +-/**********************************************************************/ +-/*! \class RtMidiIn +- \brief A realtime MIDI input class. +- +- This class provides a common, platform-independent API for +- realtime MIDI input. It allows access to a single MIDI input +- port. Incoming MIDI messages are either saved to a queue for +- retrieval using the getMessage() function or immediately passed to +- a user-specified callback function. Create multiple instances of +- this class to connect to more than one MIDI device at the same +- time. With the OS-X and Linux ALSA MIDI APIs, it is also possible +- to open a virtual input port to which other MIDI software clients +- can connect. +- +- by Gary P. Scavone, 2003-2012. +-*/ +-/**********************************************************************/ +- +-// **************************************************************** // +-// +-// RtMidiIn and RtMidiOut class declarations. +-// +-// RtMidiIn / RtMidiOut are "controllers" used to select an available +-// MIDI input or output interface. They present common APIs for the +-// user to call but all functionality is implemented by the classes +-// MidiInApi, MidiOutApi and their subclasses. RtMidiIn and RtMidiOut +-// each create an instance of a MidiInApi or MidiOutApi subclass based +-// on the user's API choice. If no choice is made, they attempt to +-// make a "logical" API selection. +-// +-// **************************************************************** // +- +-class MidiInApi; +-class MidiOutApi; +- +-class RtMidiIn : public RtMidi +-{ +- public: +- +- //! User callback function type definition. +- typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData); +- +- //! Default constructor that allows an optional api, client name and queue size. +- /*! +- An exception will be thrown if a MIDI system initialization +- error occurs. The queue size defines the maximum number of +- messages that can be held in the MIDI queue (when not using a +- callback function). If the queue size limit is reached, +- incoming messages will be ignored. +- +- If no API argument is specified and multiple API support has been +- compiled, the default order of use is JACK, ALSA (Linux) and CORE, +- Jack (OS-X). +- */ +- RtMidiIn( RtMidi::Api api=UNSPECIFIED, +- const std::string clientName = std::string( "RtMidi Input Client"), +- unsigned int queueSizeLimit = 100 ); +- +- //! If a MIDI connection is still open, it will be closed by the destructor. +- ~RtMidiIn ( void ) throw(); +- +- //! Returns the MIDI API specifier for the current instance of RtMidiIn. +- RtMidi::Api getCurrentApi( void ) throw(); +- +- //! Open a MIDI input connection. +- /*! +- An optional port number greater than 0 can be specified. +- Otherwise, the default or first port found is opened. +- */ +- void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi Input" ) ); +- +- //! Create a virtual input port, with optional name, to allow software connections (OS X and ALSA only). +- /*! +- This function creates a virtual MIDI input port to which other +- software applications can connect. This type of functionality +- is currently only supported by the Macintosh OS-X and Linux ALSA +- APIs (the function does nothing for the other APIs). +- */ +- void openVirtualPort( const std::string portName = std::string( "RtMidi Input" ) ); +- +- //! Set a callback function to be invoked for incoming MIDI messages. +- /*! +- The callback function will be called whenever an incoming MIDI +- message is received. While not absolutely necessary, it is best +- to set the callback function before opening a MIDI port to avoid +- leaving some messages in the queue. +- */ +- void setCallback( RtMidiCallback callback, void *userData = 0 ); +- +- //! Cancel use of the current callback function (if one exists). +- /*! +- Subsequent incoming MIDI messages will be written to the queue +- and can be retrieved with the \e getMessage function. +- */ +- void cancelCallback(); +- +- //! Close an open MIDI connection (if one exists). +- void closePort( void ); +- +- //! Return the number of available MIDI input ports. +- unsigned int getPortCount(); +- +- //! Return a string identifier for the specified MIDI input port number. +- /*! +- An empty string is returned if an invalid port specifier is provided. +- */ +- std::string getPortName( unsigned int portNumber = 0 ); +- +- //! Specify whether certain MIDI message types should be queued or ignored during input. +- /*! +- o By default, MIDI timing and active sensing messages are ignored +- during message input because of their relative high data rates. +- MIDI sysex messages are ignored by default as well. Variable +- values of "true" imply that the respective message type will be +- ignored. +- */ +- void ignoreTypes( bool midiSysex = true, bool midiTime = true, bool midiSense = true ); +- +- //! Fill the user-provided vector with the data bytes for the next available MIDI message in the input queue and return the event delta-time in seconds. +- /*! +- This function returns immediately whether a new message is +- available or not. A valid message is indicated by a non-zero +- vector size. An exception is thrown if an error occurs during +- message retrieval or an input connection was not previously +- established. +- */ +- double getMessage( std::vector<unsigned char> *message ); +- +- protected: +- void openMidiApi( RtMidi::Api api, const std::string clientName, unsigned int queueSizeLimit ); +- MidiInApi *rtapi_; +- +-}; +- +-/**********************************************************************/ +-/*! \class RtMidiOut +- \brief A realtime MIDI output class. +- +- This class provides a common, platform-independent API for MIDI +- output. It allows one to probe available MIDI output ports, to +- connect to one such port, and to send MIDI bytes immediately over +- the connection. Create multiple instances of this class to +- connect to more than one MIDI device at the same time. With the +- OS-X and Linux ALSA MIDI APIs, it is also possible to open a +- virtual port to which other MIDI software clients can connect. +- +- by Gary P. Scavone, 2003-2012. +-*/ +-/**********************************************************************/ +- +-class RtMidiOut : public RtMidi +-{ +- public: +- +- //! Default constructor that allows an optional client name. +- /*! +- An exception will be thrown if a MIDI system initialization error occurs. +- +- If no API argument is specified and multiple API support has been +- compiled, the default order of use is JACK, ALSA (Linux) and CORE, +- Jack (OS-X). +- */ +- RtMidiOut( RtMidi::Api api=UNSPECIFIED, +- const std::string clientName = std::string( "RtMidi Output Client") ); +- +- //! The destructor closes any open MIDI connections. +- ~RtMidiOut( void ) throw(); +- +- //! Returns the MIDI API specifier for the current instance of RtMidiOut. +- RtMidi::Api getCurrentApi( void ) throw(); +- +- //! Open a MIDI output connection. +- /*! +- An optional port number greater than 0 can be specified. +- Otherwise, the default or first port found is opened. An +- exception is thrown if an error occurs while attempting to make +- the port connection. +- */ +- void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi Output" ) ); +- +- //! Close an open MIDI connection (if one exists). +- void closePort( void ); +- +- //! Create a virtual output port, with optional name, to allow software connections (OS X and ALSA only). +- /*! +- This function creates a virtual MIDI output port to which other +- software applications can connect. This type of functionality +- is currently only supported by the Macintosh OS-X and Linux ALSA +- APIs (the function does nothing with the other APIs). An +- exception is thrown if an error occurs while attempting to create +- the virtual port. +- */ +- void openVirtualPort( const std::string portName = std::string( "RtMidi Output" ) ); +- +- //! Return the number of available MIDI output ports. +- unsigned int getPortCount( void ); +- +- //! Return a string identifier for the specified MIDI port type and number. +- /*! +- An empty string is returned if an invalid port specifier is provided. +- */ +- std::string getPortName( unsigned int portNumber = 0 ); +- +- //! Immediately send a single message out an open MIDI output port. +- /*! +- An exception is thrown if an error occurs during output or an +- output connection was not previously established. +- */ +- void sendMessage( std::vector<unsigned char> *message ); +- +- protected: +- void openMidiApi( RtMidi::Api api, const std::string clientName ); +- MidiOutApi *rtapi_; +-}; +- +- +-// **************************************************************** // +-// +-// MidiInApi / MidiOutApi class declarations. +-// +-// Subclasses of MidiInApi and MidiOutApi contain all API- and +-// OS-specific code necessary to fully implement the RtMidi API. +-// +-// Note that MidiInApi and MidiOutApi are abstract base classes and +-// cannot be explicitly instantiated. RtMidiIn and RtMidiOut will +-// create instances of a MidiInApi or MidiOutApi subclass. +-// +-// **************************************************************** // +- +-class MidiInApi +-{ +- public: +- +- MidiInApi( unsigned int queueSizeLimit ); +- virtual ~MidiInApi( void ); +- virtual RtMidi::Api getCurrentApi( void ) = 0; +- virtual void openPort( unsigned int portNumber, const std::string portName ) = 0; +- virtual void openVirtualPort( const std::string portName ) = 0; +- virtual void closePort( void ) = 0; +- void setCallback( RtMidiIn::RtMidiCallback callback, void *userData ); +- void cancelCallback( void ); +- virtual unsigned int getPortCount( void ) = 0; +- virtual std::string getPortName( unsigned int portNumber ) = 0; +- virtual void ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ); +- double getMessage( std::vector<unsigned char> *message ); +- +- // A MIDI structure used internally by the class to store incoming +- // messages. Each message represents one and only one MIDI message. +- struct MidiMessage { +- std::vector<unsigned char> bytes; +- double timeStamp; +- +- // Default constructor. +- MidiMessage() +- :bytes(0), timeStamp(0.0) {} +- }; +- +- struct MidiQueue { +- unsigned int front; +- unsigned int back; +- unsigned int size; +- unsigned int ringSize; +- MidiMessage *ring; +- +- // Default constructor. +- MidiQueue() +- :front(0), back(0), size(0), ringSize(0) {} +- }; +- +- // The RtMidiInData structure is used to pass private class data to +- // the MIDI input handling function or thread. +- struct RtMidiInData { +- MidiQueue queue; +- MidiMessage message; +- unsigned char ignoreFlags; +- bool doInput; +- bool firstMessage; +- void *apiData; +- bool usingCallback; +- void *userCallback; +- void *userData; +- bool continueSysex; +- +- // Default constructor. +- RtMidiInData() +- : ignoreFlags(7), doInput(false), firstMessage(true), +- apiData(0), usingCallback(false), userCallback(0), userData(0), +- continueSysex(false) {} +- }; +- +- protected: +- virtual void initialize( const std::string& clientName ) = 0; +- RtMidiInData inputData_; +- +- void *apiData_; +- bool connected_; +- std::string errorString_; +-}; +- +-class MidiOutApi +-{ +- public: +- +- MidiOutApi( void ); +- virtual ~MidiOutApi( void ); +- virtual RtMidi::Api getCurrentApi( void ) = 0; +- virtual void openPort( unsigned int portNumber, const std::string portName ) = 0; +- virtual void openVirtualPort( const std::string portName ) = 0; +- virtual void closePort( void ) = 0; +- virtual unsigned int getPortCount( void ) = 0; +- virtual std::string getPortName( unsigned int portNumber ) = 0; +- virtual void sendMessage( std::vector<unsigned char> *message ) = 0; +- +- protected: +- virtual void initialize( const std::string& clientName ) = 0; +- +- void *apiData_; +- bool connected_; +- std::string errorString_; +-}; +- +-// **************************************************************** // +-// +-// Inline RtMidiIn and RtMidiOut definitions. +-// +-// **************************************************************** // +- +-inline RtMidi::Api RtMidiIn :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); } +-inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string portName ) { return rtapi_->openPort( portNumber, portName ); } +-inline void RtMidiIn :: openVirtualPort( const std::string portName ) { return rtapi_->openVirtualPort( portName ); } +-inline void RtMidiIn :: closePort( void ) { return rtapi_->closePort(); } +-inline void RtMidiIn :: setCallback( RtMidiCallback callback, void *userData ) { return rtapi_->setCallback( callback, userData ); } +-inline void RtMidiIn :: cancelCallback( void ) { return rtapi_->cancelCallback(); } +-inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCount(); } +-inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); } +-inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { return rtapi_->ignoreTypes( midiSysex, midiTime, midiSense ); } +-inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return rtapi_->getMessage( message ); } +- +-inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); } +-inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string portName ) { return rtapi_->openPort( portNumber, portName ); } +-inline void RtMidiOut :: openVirtualPort( const std::string portName ) { return rtapi_->openVirtualPort( portName ); } +-inline void RtMidiOut :: closePort( void ) { return rtapi_->closePort(); } +-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 ) { return rtapi_->sendMessage( message ); } +- +-// **************************************************************** // +-// +-// MidiInApi and MidiOutApi subclass prototypes. +-// +-// **************************************************************** // +- +- +-#if !defined(__LINUX_ALSA__) && !defined(__UNIX_JACK__) && !defined(__MACOSX_CORE__) && !defined(__WINDOWS_MM__) && !defined(__WINDOWS_KS__) +- #define __RTMIDI_DUMMY__ +-#endif +- +-#if defined(__MACOSX_CORE__) +- +-class MidiInCore: public MidiInApi +-{ +- public: +- MidiInCore( const std::string clientName, unsigned int queueSizeLimit ); +- ~MidiInCore( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-class MidiOutCore: public MidiOutApi +-{ +- public: +- MidiOutCore( const std::string clientName ); +- ~MidiOutCore( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- void sendMessage( std::vector<unsigned char> *message ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-#endif +- +-#if defined(__UNIX_JACK__) +- +-class MidiInJack: public MidiInApi +-{ +- public: +- MidiInJack( const std::string clientName, unsigned int queueSizeLimit ); +- ~MidiInJack( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-class MidiOutJack: public MidiOutApi +-{ +- public: +- MidiOutJack( const std::string clientName ); +- ~MidiOutJack( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- void sendMessage( std::vector<unsigned char> *message ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-#endif +- +-#if defined(__LINUX_ALSA__) +- +-class MidiInAlsa: public MidiInApi +-{ +- public: +- MidiInAlsa( const std::string clientName, unsigned int queueSizeLimit ); +- ~MidiInAlsa( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-class MidiOutAlsa: public MidiOutApi +-{ +- public: +- MidiOutAlsa( const std::string clientName ); +- ~MidiOutAlsa( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- void sendMessage( std::vector<unsigned char> *message ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-#endif +- +-#if defined(__WINDOWS_MM__) +- +-class MidiInWinMM: public MidiInApi +-{ +- public: +- MidiInWinMM( const std::string clientName, unsigned int queueSizeLimit ); +- ~MidiInWinMM( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-class MidiOutWinMM: public MidiOutApi +-{ +- public: +- MidiOutWinMM( const std::string clientName ); +- ~MidiOutWinMM( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- void sendMessage( std::vector<unsigned char> *message ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-#endif +- +-#if defined(__WINDOWS_KS__) +- +-class MidiInWinKS: public MidiInApi +-{ +- public: +- MidiInWinKS( const std::string clientName, unsigned int queueSizeLimit ); +- ~MidiInWinKS( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_KS; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-class MidiOutWinKS: public MidiOutApi +-{ +- public: +- MidiOutWinKS( const std::string clientName ); +- ~MidiOutWinKS( void ); +- RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_KS; }; +- void openPort( unsigned int portNumber, const std::string portName ); +- void openVirtualPort( const std::string portName ); +- void closePort( void ); +- unsigned int getPortCount( void ); +- std::string getPortName( unsigned int portNumber ); +- void sendMessage( std::vector<unsigned char> *message ); +- +- protected: +- void initialize( const std::string& clientName ); +-}; +- +-#endif +- +-#if defined(__RTMIDI_DUMMY__) +- +-class MidiInDummy: public MidiInApi +-{ +- public: +- MidiInDummy( const std::string clientName, unsigned int queueSizeLimit ) : MidiInApi( queueSizeLimit ) { errorString_ = "MidiInDummy: This class provides no functionality."; RtMidi::error( RtError::WARNING, errorString_ ); }; +- RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; }; +- void openPort( unsigned int portNumber, const std::string portName ) {}; +- void openVirtualPort( const std::string portName ) {}; +- void closePort( void ) {}; +- unsigned int getPortCount( void ) { return 0; }; +- std::string getPortName( unsigned int portNumber ) { return ""; }; +- +- protected: +- void initialize( const std::string& clientName ) {}; +-}; +- +-class MidiOutDummy: public MidiOutApi +-{ +- public: +- MidiOutDummy( const std::string clientName ) { errorString_ = "MidiOutDummy: This class provides no functionality."; RtMidi::error( RtError::WARNING, errorString_ ); }; +- RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; }; +- void openPort( unsigned int portNumber, const std::string portName ) {}; +- void openVirtualPort( const std::string portName ) {}; +- void closePort( void ) {}; +- unsigned int getPortCount( void ) { return 0; }; +- std::string getPortName( unsigned int portNumber ) { return ""; }; +- void sendMessage( std::vector<unsigned char> *message ) {}; +- +- protected: +- void initialize( const std::string& clientName ) {}; +-}; +- +-#endif +- +-#endif +diff -ruN a/include/audio.h b/include/audio.h +--- a/include/audio.h 2019-01-27 12:22:36.000000000 +0100 ++++ b/include/audio.h 2019-11-04 19:56:59.538418201 +0100 +@@ -8,7 +8,7 @@ + #ifndef __AUDIO + #define __AUDIO + +-#include "RtAudio.h" ++#include <RtAudio.h> + + #include <map> + #include <vector> +diff -ruN a/include/midi_in.h b/include/midi_in.h +--- a/include/midi_in.h 2019-09-12 17:12:20.000000000 +0200 ++++ b/include/midi_in.h 2019-11-04 19:57:27.431486597 +0100 +@@ -7,7 +7,7 @@ + #ifndef __midi_in + #define __midi_in + +-#include "RtMidi.h" ++#include <RtMidi.h> + #include <vector> + #include <string> + +diff -ruN a/src/Makefile.am b/src/Makefile.am +--- a/src/Makefile.am 2019-11-04 12:24:29.000000000 +0100 ++++ b/src/Makefile.am 2019-11-04 19:55:13.392759816 +0100 +@@ -3,4 +3,4 @@ + + AM_CFLAGS = -I ../include + bin_PROGRAMS = din +-din_SOURCES = alarm.cc arrow_button.cc audio.cc authors_note.cc ball.cc ball_ops.cc basic_editor.cc beat2value.cc binaural_drone.cc binaural_drones.cc bit_display.cc box_selector.cc button.cc capturer.cc checkbutton.cc chrono.cc circler.cc command.cc compressor.cc console.cc console_iterator.cc countries.cc cross_button.cc curve.cc curve_display.cc curve_editor.cc curve_library.cc curve_mixer.cc curve_picker.cc custom_periodic.cc delay.cc din.cc drone.cc fader.cc fft.cc field.cc filled_button.cc font.cc font_editor.cc fractaliser.cc globals.cc glyph.cc gravity.cc hit.cc help.cc item_list.cc keyboard_keyboard.cc label.cc levels.cc line.cc lissajous.cc listeners.cc main.cc menu.cc mesh.cc midi_in.cc minus_button.cc mocap.cc modulator.cc mondrian.cc morpher.cc morse_code.cc mouse_slider.cc multi_curve.cc note.cc number.cc oscilloscope.cc phrasor.cc play.cc plugin.cc plugin_browser.cc plus_button.cc point_modulator.cc range.cc recorder.cc rect.cc rose_milker.cc scale_info.cc scale_note s.cc scalelist.cc separator.cc settings.cc sine_mixer.cc slit.cc solver.cc spiraler.cc starrer.cc superformula.cc tap_bpm.cc tcl_interp.cc textboard.cc tokenizer.cc trail.cc triggered_note.cc ui.cc ui_sin_cos_radius.cc viewwin.cc warper.cc widget.cc kiss_fft.c RtAudio.cpp RtMidi.cpp ++din_SOURCES = alarm.cc arrow_button.cc audio.cc authors_note.cc ball.cc ball_ops.cc basic_editor.cc beat2value.cc binaural_drone.cc binaural_drones.cc bit_display.cc box_selector.cc button.cc capturer.cc checkbutton.cc chrono.cc circler.cc command.cc compressor.cc console.cc console_iterator.cc countries.cc cross_button.cc curve.cc curve_display.cc curve_editor.cc curve_library.cc curve_mixer.cc curve_picker.cc custom_periodic.cc delay.cc din.cc drone.cc fader.cc fft.cc field.cc filled_button.cc font.cc font_editor.cc fractaliser.cc globals.cc glyph.cc gravity.cc hit.cc help.cc item_list.cc keyboard_keyboard.cc label.cc levels.cc line.cc lissajous.cc listeners.cc main.cc menu.cc mesh.cc midi_in.cc minus_button.cc mocap.cc modulator.cc mondrian.cc morpher.cc morse_code.cc mouse_slider.cc multi_curve.cc note.cc number.cc oscilloscope.cc phrasor.cc play.cc plugin.cc plugin_browser.cc plus_button.cc point_modulator.cc range.cc recorder.cc rect.cc rose_milker.cc scale_info.cc scale_note s.cc scalelist.cc separator.cc settings.cc sine_mixer.cc slit.cc solver.cc spiraler.cc starrer.cc superformula.cc tap_bpm.cc tcl_interp.cc textboard.cc tokenizer.cc trail.cc triggered_note.cc ui.cc ui_sin_cos_radius.cc viewwin.cc warper.cc widget.cc kiss_fft.c +diff -ruN a/src/Makefile.in b/src/Makefile.in +--- a/src/Makefile.in 2019-11-04 12:25:43.000000000 +0100 ++++ b/src/Makefile.in 2019-11-04 19:55:59.558987930 +0100 +@@ -134,8 +134,7 @@ + textboard.$(OBJEXT) tokenizer.$(OBJEXT) trail.$(OBJEXT) \ + triggered_note.$(OBJEXT) ui.$(OBJEXT) \ + ui_sin_cos_radius.$(OBJEXT) viewwin.$(OBJEXT) warper.$(OBJEXT) \ +- widget.$(OBJEXT) kiss_fft.$(OBJEXT) RtAudio.$(OBJEXT) \ +- RtMidi.$(OBJEXT) ++ widget.$(OBJEXT) kiss_fft.$(OBJEXT) + din_OBJECTS = $(am_din_OBJECTS) + din_LDADD = $(LDADD) + AM_V_P = $(am__v_P_@AM_V@) +@@ -325,7 +324,7 @@ + spiraler.cc starrer.cc superformula.cc tap_bpm.cc \ + tcl_interp.cc textboard.cc tokenizer.cc trail.cc \ + triggered_note.cc ui.cc ui_sin_cos_radius.cc viewwin.cc \ +- warper.cc widget.cc kiss_fft.c RtAudio.cpp RtMidi.cpp ++ warper.cc widget.cc kiss_fft.c + all: all-am + + .SUFFIXES: +@@ -412,8 +411,6 @@ + distclean-compile: + -rm -f *.tab.c + +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RtAudio.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RtMidi.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alarm.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arrow_button.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio.Po@am__quote@ +diff -ruN a/src/audio.cc b/src/audio.cc +--- a/src/audio.cc 2019-09-12 17:12:21.000000000 +0200 ++++ b/src/audio.cc 2019-11-04 19:58:15.947692476 +0100 +@@ -17,6 +17,7 @@ + #include "utils.h" + #include "RtError.h" + #include "log.h" ++#include <RtAudio.h> + using namespace std; + + extern string user_data_dir; +diff -ruN a/src/midi_in.cc b/src/midi_in.cc +--- a/src/midi_in.cc 2019-09-12 17:12:21.000000000 +0200 ++++ b/src/midi_in.cc 2019-11-04 19:58:41.534116137 +0100 +@@ -11,6 +11,7 @@ + #include "chrono.h" + #include <fstream> + #include <string> ++#include <RtMidi.h> + using namespace std; + + extern tcl_interp interpreter;