24 Commits
4.6.2 ... 5.0.1

Author SHA1 Message Date
garyscavone
1cb2c81d04 Updated configure.ac 2023-08-10 16:49:35 -04:00
garyscavone
b671638f99 Version updates for 5.0.1 release. 2023-08-10 16:46:47 -04:00
garyscavone
169b005a2d Merge pull request #135 from donarturo11/fix-msvc-flags
Fix msvc flags
2023-08-08 09:00:51 -04:00
garyscavone
73008d02a1 Merge pull request #133 from donarturo11/fix-math
Add using math definitions
2023-08-08 09:00:24 -04:00
garyscavone
e364d81c8f Merge pull request #129 from Segfault1602/alexstonge-fixdemovcxproj
Fix demo project on Windows
2023-08-08 08:59:58 -04:00
garyscavone
3675846c66 Documentation updates in preparation for 5.0.0 release. 2023-08-04 11:21:16 -04:00
garyscavone
fd5e37863d Updates to eguitar, ragamatic and examples project files for new RtAudio API. 2023-08-04 10:37:22 -04:00
garyscavone
7f97ab5f71 Updated PitShift to use a single delay line and updated effects.cpp for new RtAudio API. 2023-08-04 10:14:26 -04:00
garyscavone
8b29e0ea6d Added new versions of RtAudio and RtMidi, updated RtWvIn and RtWvOut for new API, updated demo project for new API. 2023-08-04 09:44:26 -04:00
garyscavone
2af2f1c816 Removed use of register variables. 2023-08-03 13:49:20 -04:00
donarturo11
f39c1fb06d Add MSVC flags 2023-01-28 21:06:31 +01:00
donarturo11
35ca4abcb9 Add math definitions 2023-01-26 10:30:20 +01:00
garyscavone
cc2dd22e97 Merge pull request #132 from donarturo11/cmake-install
Implement install STK
2023-01-08 10:19:10 -08:00
Artur Wrona
e0279e305b Implement install STK 2023-01-07 17:21:48 +01:00
Segfault1602
ce765cc391 Fix demo project on Windows
The demo project definition on windows was outdated, causing it to not build properly.

The fix was to add the two missing cpp file to the project definition (Iir.cpp and Recorder.cpp) as well as define `_USE_MATH_DEFINES` to allow the compiler to use `M_SQRT1_2`.
2022-11-20 10:09:26 -08:00
garyscavone
9bf39f53c6 Merge pull request #126 from MaplePost/master
simple fix to force c++11 standard
2022-06-21 14:42:18 -04:00
Peter J Slack
4397e05158 simple fix to force c++11 standard 2022-06-21 10:20:58 -04:00
garyscavone
70835eccb4 Merge pull request #121 from navin-neu/biquad-filter-types
add support for different filter types in biquad
2022-05-15 10:02:17 -04:00
Navin K
79334d2c8d implemented changes proposed in #121 2022-05-15 01:40:16 -04:00
Gary Scavone
16918b0914 Merge branch 'master' of github.com:thestk/stk 2022-04-22 16:28:32 -04:00
Gary Scavone
3acb9502ae Added missing Twang::setLoopFilter() and ModalBar::setModulationDepth() functions. 2022-04-22 16:28:12 -04:00
Navin K
92d81d67c2 add support for different filter types in biquad 2022-03-21 18:32:51 -04:00
garyscavone
893ff3d954 Merge pull request #119 from tmatth/autotools/fix-pulse
configure: fix build for --with-pulse
2022-02-11 13:08:44 -05:00
Tristan Matthews
b343913233 configure: fix build for --with-pulse 2022-02-09 17:20:26 -05:00
215 changed files with 6998 additions and 4286 deletions

View File

@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.1) ##TODO: which version is better
project(STK VERSION 4.6.1)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
@@ -10,8 +11,14 @@ endif()
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo" "MinSizeRel")
message("Build type: " ${CMAKE_BUILD_TYPE})
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -D_STK_DEBUG_ -D__RTAUDIO_DEBUG__ -D__RTMIDI_DEBUG__")
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7 /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=2 /D_STK_DEBUG_ /D__RTAUDIO_DEBUG__ /D__RTMIDI_DEBUG__")
else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -D_STK_DEBUG_ -D__RTAUDIO_DEBUG__ -D__RTMIDI_DEBUG__")
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
message("GCC.")
@@ -29,6 +36,7 @@ option(ENABLE_DS "Enable DirectSound API support (windows only)" ON)
option(ENABLE_WASAPI "Enable Windows Audio Session API support (windows only)" OFF)
# option(ENABLE_CORE "Enable CoreAudio API support (mac only)" ON)
option(COMPILE_PROJECTS "Compile all the example projects" ON)
option(INSTALL_HEADERS "Install headers" ON)
include_directories("./include")
file(GLOB STK_SRC "./src/*.cpp") # GLOB instead of GLOB_RECURSE as the asio depends on system
@@ -77,7 +85,6 @@ if(REALTIME)
# Tested under MSYS2 with Mingw64 toolchain
#============== WINDOWS ================#
message("Windows DETECTED!")
link_libraries(winmm ole32 wsock32)
add_definitions(-D__WINDOWS_MM__)
@@ -112,17 +119,27 @@ TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if(NOT IS_BIG_ENDIAN)
add_definitions(-D__LITTLE_ENDIAN__)
endif()
add_definitions(-D_USE_MATH_DEFINES)
if(INSTALL_HEADERS)
file(GLOB STK_HEADERS "include/*.h")
install(FILES ${STK_HEADERS} DESTINATION include/stk)
endif()
#========================================#
#========== Build the Library ===========#
#========================================#
if(BUILD_STATIC)
add_library(stk STATIC ${STK_SRC} )
target_include_directories(stk PRIVATE include PUBLIC $<INSTALL_INTERFACE:include>)
set_target_properties(stk PROPERTIES PUBLIC_HEADER "${LIBSTK_HEADERS}")
list(APPEND STK_TARGETS stk)
endif()
if(BUILD_SHARED)
add_library(stk_SHARED SHARED ${STK_SRC})
set_target_properties(stk_SHARED PROPERTIES OUTPUT_NAME stk) # rename the shared library name
target_include_directories(stk_SHARED PRIVATE include PUBLIC $<INSTALL_INTERFACE:include>)
set_target_properties(stk_SHARED PROPERTIES PUBLIC_HEADER "${LIBSTK_HEADERS}")
list(APPEND STK_TARGETS stk_SHARED)
endif()
#========================================#
@@ -135,4 +152,16 @@ if(COMPILE_PROJECTS)
add_subdirectory(projects/demo)
add_subdirectory(projects/effects)
add_subdirectory(projects/ragamatic)
endif()
endif()
#========================================#
#========= Install ======================#
#========================================#
install(TARGETS ${STK_TARGETS} EXPORT stk-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include/stk)
install(EXPORT stk-config DESTINATION lib/cmake/stk)

View File

@@ -1,5 +1,5 @@
# The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2021.
By Perry R. Cook and Gary P. Scavone, 1995-2023.
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people simply choose the classes they need for a particular project and copy those to their project directory. Others like to compile and link to a library of object files. STK was not designed with one particular style of use in mind.

View File

@@ -1,6 +1,6 @@
The Synthesis ToolKit in C++ (STK)
Copyright (c) 1995-2021 Perry R. Cook and Gary P. Scavone
Copyright (c) 1995-2023 Perry R. Cook and Gary P. Scavone
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
# The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995--2021.
By Perry R. Cook and Gary P. Scavone, 1995--2023.
This distribution of the Synthesis ToolKit in C++ (STK) contains the following:

View File

@@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(STK, 4.6.2, gary.scavone@mcgill.ca, stk)
AC_INIT([STK],[5.0.0],[gary.scavone@mcgill.ca],[stk])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR(src/Stk.cpp)
AC_CONFIG_FILES(Makefile src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile projects/eguitar/Makefile)
@@ -20,13 +20,34 @@ if [[ $AR = "no" ]] ; then
fi
# Checks for header files.
AC_HEADER_STDC
m4_warn([obsolete],
[The preprocessor macro `STDC_HEADERS' is obsolete.
Except in unusual embedded environments, you can safely include all
ISO C90 headers unconditionally.])dnl
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change. They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h termio.h unistd.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
m4_warn([obsolete],
[Update your code to rely only on HAVE_SYS_TIME_H,
then remove this warning and the obsolete code below it.
All current systems provide time.h; it need not be checked for.
Not all systems provide sys/time.h, but those that do, all allow
you to include it and time.h simultaneously.])dnl
AC_CHECK_HEADERS_ONCE([sys/time.h])
# Obsolete code to be removed.
if test $ac_cv_header_sys_time_h = yes; then
AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
and <time.h>. This macro is obsolete.])
fi
# End of obsolete code.
AC_C_BIGENDIAN
AC_EGREP_CPP(yes,
[#ifndef WORDS_BIGENDIAN
@@ -162,6 +183,14 @@ api="$api -D__UNIX_JACK__"
AC_MSG_RESULT(using ALSA)
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))])
# Look for PulseAudio flag
AC_ARG_WITH(pulse, [ --with-pulse = choose PulseAudio support (linux only)])
AS_IF([test "x$with_pulse" == "xyes"], [
api="$api -D__LINUX_PULSE__"
AC_MSG_RESULT(using PulseAudio)
AC_CHECK_LIB(pulse, pa_proplist_gets, , AC_MSG_ERROR(PulseAudio support requires the libpulse library!))
AC_CHECK_LIB(pulse-simple, pa_simple_new, , AC_MSG_ERROR(PulseAudio support requires the libpulse-simple library!))])
# Look for OSS flag
AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (unixes only)])
AS_IF([test "x$with_oss" == "xyes"], [

View File

@@ -1,6 +1,6 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995--2021.
By Perry R. Cook and Gary P. Scavone, 1995--2023.
Please read the file README and INSTALL for more general STK information.

View File

@@ -1,6 +1,6 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995--2021.
By Perry R. Cook and Gary P. Scavone, 1995--2023.
Please read the file README and INSTALL for more general STK information.
@@ -10,7 +10,7 @@ It is necessary to install the OS X developer kit (or the command line tools) in
Tcl/Tk on OS X:
I think that Tcl/Tk interpreter is now included in the Xcode package, since I haven't had to download it for several years now.
The Tcl/Tk interpreter included in the Xcode package seems outdated. Try getting tcl-tk through HomeBrew for an updated version.
It appears that socket support in Tcl/Tk on OS X uses the Nagle algorithm, which produces poor response between changes made in the Tcl/Tk script and the resulting audio updates. Note that this is only a problem when using a socket connection from a Tcl/Tk script.

View File

@@ -1,6 +1,6 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995--2021.
By Perry R. Cook and Gary P. Scavone, 1995--2023.
Please read the file README and INSTALL for more general STK information.

View File

@@ -1,6 +1,6 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995--2021.
By Perry R. Cook and Gary P. Scavone, 1995--2023.
Please read the file README.md for more general STK information.

View File

@@ -1,6 +1,17 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995--2021.
By Perry R. Cook and Gary P. Scavone, 1995--2023.
v.5.0.1 (10 August 2023)
- see github site for complete details (github.com/thestk/stk)
- cmake updates
- fix for demo msvc project in Windows
v.5.0.0 (4 August 2023)
- see github site for complete details (github.com/thestk/stk)
- new filter design functionality in BiQuad (thanks to Navin Kumar!)
- update to PitShift to use a single delay line
- various updates for new RtAudio API
v.4.6.2 (17 November 2021)
- see github site for complete details (github.com/thestk/stk)

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,21 @@
/*! \page download Download and Release Notes
\section down Download Version 4.6.2 (17 November 2021):
\section down Download Version 5.0.1 (10 August 2023):
- <A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.6.2.tar.gz">Source distribution</A>
- <A HREF="http://ccrma.stanford.edu/software/stk/release/stk-5.0.1.tar.gz">Source distribution</A>
\section notes Release Notes:
\subsection v5dot0dot1 Version 5.0.1
- see github site for complete details (github.com/thestk/stk)
- cmake updates
- fix for demo msvc project in Windows
\subsection v5dot0dot0 Version 5.0.0
- see github site for complete details (github.com/thestk/stk)
- new filter design functionality in BiQuad (thanks to Navin Kumar!)
- update to PitShift to use a single delay line
- various updates for new RtAudio API
\subsection v4dot6dot2 Version 4.6.2
- see github site for complete details (github.com/thestk/stk)
- bug fixes in LentPitShift and Granulate classes

View File

@@ -25,7 +25,7 @@ STK GitHub site: https://github.com/thestk/stk
STK WWW site: http://ccrma.stanford.edu/software/stk/
The Synthesis ToolKit in C++ (STK)
Copyright (c) 1995--2021 Perry R. Cook and Gary P. Scavone
Copyright (c) 1995--2023 Perry R. Cook and Gary P. Scavone
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -2,7 +2,7 @@
<table>
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>&copy;1995--2021 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
<tr><td>&copy;1995--2023 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>

View File

@@ -30,6 +30,7 @@ platforms and should work with any standard C++ compiler.
- \ref links
- \ref faq
- \ref tutorial
- <A href="http://github.com/thestk/stk">Stk on GitHub</A>
*/

View File

@@ -1,6 +1,6 @@
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
By Perry R. Cook and Gary P. Scavone, 1995--2021.
By Perry R. Cook and Gary P. Scavone, 1995--2023.
STK Classes - See the HTML documentation in the html directory for complete information.

View File

@@ -17,7 +17,7 @@ namespace stk {
be non-negative. All time settings are in seconds and must be
positive.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -26,7 +26,7 @@ namespace stk {
to \e keyOn and \e keyOff messages by ramping to
1.0 on keyOn and to 0.0 on keyOff.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -35,7 +35,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -13,10 +13,15 @@ namespace stk {
Methods are provided for creating a resonance or notch in the
frequency response while maintaining a constant filter gain.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
Formulae used calculate coefficients for lowpass, highpass,
bandpass, bandreject and allpass are found on pg. 55 of
Udo Zölzer's "DAFX - Digital Audio Effects" (2011 2nd ed).
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/
const StkFloat RECIP_SQRT_2 = static_cast<StkFloat>( M_SQRT1_2 );
class BiQuad : public Filter
{
public:
@@ -74,12 +79,72 @@ public:
*/
void setNotch( StkFloat frequency, StkFloat radius );
//! Set the filter coefficients for a low-pass with cutoff frequency \e fc (in Hz) and Q-factor \e Q.
/*!
This method determines the filter coefficients corresponding to a
low-pass filter with cutoff placed at \e fc, where sloping behaviour
and resonance are determined by \e Q. The default value for \e Q is
1/sqrt(2), resulting in a gradual attenuation of frequencies higher than
\e fc without added resonance. Values greater than this will more
aggressively attenuate frequencies above \e fc while also adding a
resonance at \e fc. Values less than this will result in a more gradual
attenuation of frequencies above \e fc, but will also attenuate
frequencies below \e fc as well. Both \e fc and \e Q must be positive.
*/
void setLowPass( StkFloat fc, StkFloat Q=RECIP_SQRT_2 );
//! Set the filter coefficients for a high-pass with cutoff frequency \e fc (in Hz) and Q-factor \e Q.
/*!
This method determines the filter coefficients corresponding to a high-pass
filter with cutoff placed at \e fc, where sloping behaviour and resonance
are determined by \e Q. The default value for \e Q is 1/sqrt(2), resulting
in a gradual attenuation of frequencies lower than \e fc without added
resonance. Values greater than this will more aggressively attenuate
frequencies below \e fc while also adding a resonance at \e fc. Values less
than this will result in a more gradual attenuation of frequencies below
\e fc, but will also attenuate frequencies above \e fc as well.
Both \e fc and \e Q must be positive.
*/
void setHighPass( StkFloat fc, StkFloat Q=RECIP_SQRT_2 );
//! Set the filter coefficients for a band-pass centered at \e fc (in Hz) with Q-factor \e Q.
/*!
This method determines the filter coefficients corresponding to a band-pass
filter with pass-band centered at \e fc, where band width and slope a
determined by \e Q. Values for \e Q that are less than 1.0 will attenuate
frequencies above and below \e fc more gradually, resulting in a convex
slope and a wider band. Values for \e Q greater than 1.0 will attenuate
frequencies above and below \e fc more aggressively, resulting in a
concave slope and a narrower band. Both \e fc and \e Q must be positive.
*/
void setBandPass( StkFloat fc, StkFloat Q );
//! Set the filter coefficients for a band-reject centered at \e fc (in Hz) with Q-factor \e Q.
/*!
This method determines the filter coefficients corresponding to a
band-reject filter with stop-band centered at \e fc, where band width
and slope are determined by \e Q. Values for \e Q that are less than 1.0
will yield a wider band with greater attenuation of \e fc. Values for \e Q
greater than 1.0 will yield a narrower band with less attenuation of \e fc.
Both \e fc and \e Q must be positive.
*/
void setBandReject( StkFloat fc, StkFloat Q );
//! Set the filter coefficients for an all-pass centered at \e fc (in Hz) with Q-factor \e Q.
/*!
This method determines the filter coefficients corresponding to
an all-pass filter whose phase response crosses -pi radians at \e fc.
High values for \e Q will result in a more instantaenous shift in phase
response at \e fc. Lower values will result in a more gradual shift in
phase response around \e fc. Both \e fc and \e Q must be positive.
*/
void setAllPass( StkFloat fc, StkFloat Q );
//! Sets the filter zeroes for equal resonance gain.
/*!
When using the filter as a resonator, zeroes places at z = 1, z
= -1 will result in a constant gain at resonance of 1 / (1 - R),
where R is the pole radius setting.
*/
void setEqualGainZeroes( void );
@@ -114,6 +179,14 @@ public:
protected:
virtual void sampleRateChanged( StkFloat newRate, StkFloat oldRate );
// Helper function to update the three intermediate values for the predefined filter types
// along with the feedback filter coefficients. Performs the debug check for fc and Q-factor arguments.
void setCommonFilterValues( StkFloat fc, StkFloat Q );
StkFloat K_;
StkFloat kSqr_;
StkFloat denom_;
};
inline StkFloat BiQuad :: tick( StkFloat input )

View File

@@ -25,7 +25,7 @@ namespace stk {
- Vibrato Gain = 1
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -43,7 +43,7 @@ namespace stk {
- Register State = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -15,7 +15,7 @@ namespace stk {
(1986). The output is an instantaneous
reflection coefficient value.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -32,7 +32,7 @@ namespace stk {
- Frequency = 101
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
Contributions by Esteban Maestre, 2011.
*/
/***************************************************/

View File

@@ -28,7 +28,7 @@ namespace stk {
- Vibrato Gain = 1
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -14,7 +14,7 @@ namespace stk {
This class implements a chorus effect. It takes a monophonic
input signal and produces a stereo output signal.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -31,7 +31,7 @@ namespace stk {
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -17,7 +17,7 @@ namespace stk {
A non-interpolating delay line is typically used in fixed
delay-length applications, such as for reverberation.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -21,7 +21,7 @@ namespace stk {
minimum delay possible in this implementation is limited to a
value of 0.5.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -20,7 +20,7 @@ namespace stk {
delay setting. The use of higher order Lagrange interpolators can
typically improve (minimize) this attenuation characteristic.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -20,7 +20,7 @@ namespace stk {
of simultaneous voices) via a #define in the
Drummer.h.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -12,7 +12,7 @@ namespace stk {
This class implements an echo effect.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -14,7 +14,7 @@ namespace stk {
subclasses. It is general enough to support both monophonic and
polyphonic input/output classes.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -15,7 +15,7 @@ namespace stk {
keyOff messages, ramping to a specified target (default = 1.0) on
keyOn and to a specified target (default = 0.0) on keyOff.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -30,7 +30,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -33,7 +33,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -19,7 +19,7 @@ namespace stk {
the overloaded one that takes an StkFrames object for
multi-channel and/or multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -34,7 +34,7 @@ namespace stk {
such variable is found, the sample rate is
assumed to be 44100 Hz.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -24,7 +24,7 @@ namespace stk {
type, the data type will automatically be modified. Compressed
data types are not supported.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -45,7 +45,7 @@ namespace stk {
See the FileRead class for a description of the supported audio
file formats.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -25,7 +25,7 @@ namespace stk {
Currently, FileWvOut is non-interpolating and the output rate is
always Stk::sampleRate().
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -15,7 +15,7 @@ namespace stk {
filter subclasses. It is general enough to support both
monophonic and polyphonic input/output classes.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -23,7 +23,7 @@ namespace stk {
This structure results in one extra multiply per computed sample,
but allows easy control of the overall filter gain.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -32,7 +32,7 @@ namespace stk {
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@ namespace stk {
over time from one frequency setting to another. It provides
methods for controlling the sweep rate and target frequency.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@ namespace stk {
implement tables or other types of input to output function
mappings.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@ namespace stk {
generator sample-source subclasses. It is general enough to
support both monophonic and polyphonic output classes.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -21,7 +21,7 @@ namespace stk {
Chris Rolfe and Damian Keller, though there are likely to be a
number of differences in the actual implementation.
by Gary Scavone, 2005--2021.
by Gary Scavone, 2005--2023.
*/
/***************************************************/

View File

@@ -31,7 +31,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -27,7 +27,7 @@ namespace stk {
This structure results in one extra multiply per computed sample,
but allows easy control of the overall filter gain.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -31,7 +31,7 @@ namespace stk {
data type for the incoming stream is signed 16-bit integers,
though any of the defined StkFormats are permissible.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -25,7 +25,7 @@ namespace stk {
data type is signed 16-bit integers but any of the defined
StkFormats are permissible.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -12,7 +12,7 @@ namespace stk {
This class provides a common interface for
all STK instruments.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -24,7 +24,7 @@ namespace stk {
one-pole lowpass filters have been added inside
the feedback comb filters.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -16,7 +16,7 @@ namespace stk {
Consult Fletcher and Rossing, Karjalainen,
Cook, and others for more information.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -31,7 +31,7 @@ namespace stk {
- String Detuning = 1
- Microphone Position = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -46,7 +46,7 @@ namespace stk {
This class is primarily for use in STK example programs but it is
generic enough to work in many other contexts.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -22,7 +22,7 @@ namespace stk {
Tempo changes are internally tracked by the class and reflected in
the values returned by the function getTickSeconds().
by Gary P. Scavone, 2003--2021.
by Gary P. Scavone, 2003--2023.
*/
/**********************************************************************/

View File

@@ -19,7 +19,7 @@ namespace stk {
(non-sweeping BiQuad filters), where N is set
during instantiation.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -31,7 +31,7 @@ namespace stk {
- Two Fixed = 7
- Clump = 8
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/
@@ -53,7 +53,7 @@ public:
//! Select a bar preset (currently modulo 9).
void setPreset( int preset );
//! Set the modulation (vibrato) depth.
//! Set the modulation (vibrato) depth (0.0 - 1.0).
void setModulationDepth( StkFloat mDepth );
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).

View File

@@ -16,7 +16,7 @@ namespace stk {
modulations to give a nice, natural human
modulation function.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -22,7 +22,7 @@ namespace stk {
- Vibrato Gain = 1
- Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -29,7 +29,7 @@ namespace stk {
systems, the pthread library is used. Under
Windows, critical sections are used.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -18,7 +18,7 @@ namespace stk {
another allpass in series, followed by two allpass filters in
parallel with corresponding right and left outputs.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -14,7 +14,7 @@ namespace stk {
C rand() function. The quality of the rand()
function varies from one OS to another.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@ namespace stk {
provided for setting the pole position along the real axis of the
z-plane while maintaining a constant peak filter gain.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@ namespace stk {
provided for setting the zero position along the real axis of the
z-plane while maintaining a constant filter gain.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -17,7 +17,7 @@ namespace stk {
allpass and comb delay filters. This class implements two series
allpass units and two parallel comb filters.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -29,7 +29,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@ namespace stk {
set of 32 static phoneme formant parameters
and provide access to those values.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -11,9 +11,9 @@ namespace stk {
\brief STK simple pitch shifter effect class.
This class implements a simple pitch shifter
using delay lines.
using a delay line.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/
@@ -61,7 +61,7 @@ class PitShift : public Effect
protected:
DelayL delayLine_[2];
DelayL delayLine_;
StkFloat delay_[2];
StkFloat env_[2];
StkFloat rate_;
@@ -83,16 +83,15 @@ inline StkFloat PitShift :: tick( StkFloat input )
while ( delay_[1] < 12 ) delay_[1] += delayLength_;
// Set the new delay line lengths.
delayLine_[0].setDelay( delay_[0] );
delayLine_[1].setDelay( delay_[1] );
delayLine_.setDelay( delay_[0] );
// Calculate a triangular envelope.
env_[1] = fabs( ( delay_[0] - halfLength_ + 12 ) * ( 1.0 / (halfLength_ + 12 ) ) );
env_[0] = 1.0 - env_[1];
// Delay input and apply envelope.
lastFrame_[0] = env_[0] * delayLine_[0].tick( input );
lastFrame_[0] += env_[1] * delayLine_[1].tick( input );
lastFrame_[0] = env_[1] * delayLine_.tapOut( delay_[1] );
lastFrame_[0] = +env_[0] * delayLine_.tick( input );
// Compute effect mix and output.
lastFrame_[0] *= effectMix_;

View File

@@ -27,7 +27,7 @@ namespace stk {
Stanford, bearing the names of Karplus and/or
Strong.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -14,7 +14,7 @@ namespace stk {
coefficient. Another method is provided to create a DC blocking
filter.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -29,7 +29,7 @@ namespace stk {
- Breath Pressure = 128
by Mathias Bredholt, McGill University.
Formatted for STK by Gary Scavone, 2021.
Formatted for STK by Gary Scavone, 2023.
*/
/***************************************************/

View File

@@ -20,7 +20,7 @@ namespace stk {
Smith (1986), Hirschman, Cook, Scavone, and
others for more information.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -23,7 +23,7 @@ namespace stk {
- Zero Radii = 1
- Envelope Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -33,7 +33,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -11,7 +11,7 @@
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
RtAudio: realtime audio i/o C++ classes
Copyright (c) 2001-2021 Gary P. Scavone
Copyright (c) 2001-2023 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -46,7 +46,24 @@
#ifndef __RTAUDIO_H
#define __RTAUDIO_H
#define RTAUDIO_VERSION "5.2.0"
#define RTAUDIO_VERSION_MAJOR 6
#define RTAUDIO_VERSION_MINOR 0
#define RTAUDIO_VERSION_PATCH 1
#define RTAUDIO_VERSION_BETA 0
#define RTAUDIO_TOSTRING2(n) #n
#define RTAUDIO_TOSTRING(n) RTAUDIO_TOSTRING2(n)
#if RTAUDIO_VERSION_BETA > 0
#define RTAUDIO_VERSION RTAUDIO_TOSTRING(RTAUDIO_VERSION_MAJOR) \
"." RTAUDIO_TOSTRING(RTAUDIO_VERSION_MINOR) \
"." RTAUDIO_TOSTRING(RTAUDIO_VERSION_PATCH) \
"beta" RTAUDIO_TOSTRING(RTAUDIO_VERSION_BETA)
#else
#define RTAUDIO_VERSION RTAUDIO_TOSTRING(RTAUDIO_VERSION_MAJOR) \
"." RTAUDIO_TOSTRING(RTAUDIO_VERSION_MINOR) \
"." RTAUDIO_TOSTRING(RTAUDIO_VERSION_PATCH)
#endif
#if defined _WIN32 || defined __CYGWIN__
#if defined(RTAUDIO_EXPORT)
@@ -64,8 +81,8 @@
#include <string>
#include <vector>
#include <stdexcept>
#include <iostream>
#include <functional>
/*! \typedef typedef unsigned long RtAudioFormat;
\brief RtAudio data format type.
@@ -75,6 +92,8 @@
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.
Note that there are no range checks for floating-point values that
extend beyond plus/minus 1.0.
- \e RTAUDIO_SINT8: 8-bit signed integer.
- \e RTAUDIO_SINT16: 16-bit signed integer.
@@ -206,52 +225,19 @@ typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
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 RTAUDIO_DLL_PUBLIC RtAudioError : public std::runtime_error
{
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 occurred 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 occurred. */
SYSTEM_ERROR, /*!< A system error occurred. */
THREAD_ERROR /*!< A thread error occurred. */
};
//! The constructor.
RtAudioError( const std::string& message,
Type type = RtAudioError::UNSPECIFIED )
: std::runtime_error(message), type_(type) {}
//! Prints thrown error message to stderr.
virtual void printMessage( void ) const
{ std::cerr << '\n' << what() << "\n\n"; }
//! Returns the thrown error message type.
virtual const Type& getType(void) const { return type_; }
//! Returns the thrown error message string.
virtual const std::string getMessage(void) const
{ return std::string(what()); }
protected:
Type type_;
enum RtAudioErrorType {
RTAUDIO_NO_ERROR = 0, /*!< No error. */
RTAUDIO_WARNING, /*!< A non-critical error. */
RTAUDIO_UNKNOWN_ERROR, /*!< An unspecified error type. */
RTAUDIO_NO_DEVICES_FOUND, /*!< No devices found on system. */
RTAUDIO_INVALID_DEVICE, /*!< An invalid device ID was specified. */
RTAUDIO_DEVICE_DISCONNECT, /*!< A device in use was disconnected. */
RTAUDIO_MEMORY_ERROR, /*!< An error occurred during memory allocation. */
RTAUDIO_INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
RTAUDIO_INVALID_USE, /*!< The function was called incorrectly. */
RTAUDIO_DRIVER_ERROR, /*!< A system driver error occurred. */
RTAUDIO_SYSTEM_ERROR, /*!< A system error occurred. */
RTAUDIO_THREAD_ERROR /*!< A thread error occurred. */
};
//! RtAudio error callback function prototype.
@@ -259,7 +245,9 @@ class RTAUDIO_DLL_PUBLIC RtAudioError : public std::runtime_error
\param type Type of error.
\param errorText Error description.
*/
typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string &errorText );
typedef std::function<void(RtAudioErrorType type,
const std::string &errorText )>
RtAudioErrorCallback;
// **************************************************************** //
//
@@ -283,13 +271,13 @@ class RTAUDIO_DLL_PUBLIC RtAudio
//! Audio API specifier arguments.
enum Api {
UNSPECIFIED, /*!< Search for a working compiled API. */
MACOSX_CORE, /*!< Macintosh OS-X Core Audio API. */
LINUX_ALSA, /*!< The Advanced Linux Sound Architecture API. */
UNIX_JACK, /*!< The Jack Low-Latency Audio Server 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_WASAPI, /*!< The Microsoft WASAPI API. */
WINDOWS_DS, /*!< The Microsoft DirectSound API. */
RTAUDIO_DUMMY, /*!< A compilable but non-functional API. */
NUM_APIS /*!< Number of values in this enum. */
@@ -297,21 +285,23 @@ class RTAUDIO_DLL_PUBLIC RtAudio
//! 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 ID{}; /*!< Device ID used to specify a device to RtAudio. */
std::string name; /*!< Character string device name. */
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{false}; /*!< true if this is the default output device. */
bool isDefaultInput{false}; /*!< true if this is the default input device. */
std::vector<unsigned int> sampleRates; /*!< Supported sample rates (queried from list of standard rates). */
unsigned int currentSampleRate{}; /*!< Current sample rate, system sample rate as currently configured. */
unsigned int preferredSampleRate{}; /*!< Preferred sample rate, e.g. for WASAPI the system sample rate. */
RtAudioFormat nativeFormats{}; /*!< Bit mask of supported data formats. */
};
//! The structure for specifying input or output stream parameters.
struct StreamParameters {
unsigned int deviceId{}; /*!< Device index (0 to getDeviceCount() - 1). */
//std::string deviceName{}; /*!< Device name from device list. */
unsigned int deviceId{}; /*!< Device id as provided by getDeviceIds(). */
unsigned int nChannels{}; /*!< Number of channels. */
unsigned int firstChannel{}; /*!< First channel index on device (default = 0). */
};
@@ -369,9 +359,11 @@ class RTAUDIO_DLL_PUBLIC RtAudio
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.
when using the Jack API or the application name when using the
Pulse API. By default, the Jack 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. The default
Pulse application name is set to "RtAudio."
*/
struct StreamOptions {
RtAudioStreamFlags flags{}; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE, RTAUDIO_ALSA_USE_DEFAULT). */
@@ -409,21 +401,36 @@ class RTAUDIO_DLL_PUBLIC RtAudio
//! Return the compiled audio API having the given name.
/*!
A case insensitive comparison will check the specified name
against the list of compiled APIs, and return the one which
against the list of compiled APIs, and return the one that
matches. On failure, the function returns UNSPECIFIED.
*/
static RtAudio::Api getCompiledApiByName( const std::string &name );
//! Return the compiled audio API having the given display name.
/*!
A case sensitive comparison will check the specified display name
against the list of compiled APIs, and return the one that
matches. On failure, the function returns UNSPECIFIED.
*/
static RtAudio::Api getCompiledApiByDisplayName( const std::string &name );
//! The class constructor.
/*!
The constructor performs minor initialization tasks. An exception
can be thrown if no API support is compiled.
The constructor attempts to create an RtApi instance.
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).
If an API argument is specified but that API has not been
compiled, a warning is issued and an instance of an available API
is created. If no compiled API is found, the routine will abort
(though this should be impossible because RtDummy is the default
if no API-specific preprocessor definition is provided to the
compiler). 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).
An optional errorCallback function can be specified to
subsequently receive warning and error messages.
*/
RtAudio( RtAudio::Api api=UNSPECIFIED );
RtAudio( RtAudio::Api api=UNSPECIFIED, RtAudioErrorCallback&& errorCallback=0 );
//! The destructor.
/*!
@@ -437,65 +444,89 @@ class RTAUDIO_DLL_PUBLIC RtAudio
//! 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.
This function performs a system query of available devices each
time it is called, thus supporting devices (dis)connected \e after
instantiation. If a system error occurs during processing, a
warning will be issued.
*/
unsigned int getDeviceCount( void );
//! Return an RtAudio::DeviceInfo structure for a specified device number.
//! A public function that returns a vector of audio device IDs.
/*!
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".
The ID values returned by this function are used internally by
RtAudio to identify a given device. The values themselves are
arbitrary and do not correspond to device IDs used by the
underlying API (nor are they index values). This function performs
a system query of available devices each time it is called, thus
supporting devices (dis)connected \e after instantiation. If no
devices are available, the vector size will be zero. If a system
error occurs during processing, a warning will be issued.
*/
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
std::vector<unsigned int> getDeviceIds( void );
//! A function that returns the index of the default output device.
//! A public function that returns a vector of audio device names.
/*!
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.
This function performs a system query of available devices each
time it is called, thus supporting devices (dis)connected \e after
instantiation. If no devices are available, the vector size will
be zero. If a system error occurs during processing, a warning
will be issued.
*/
std::vector<std::string> getDeviceNames( void );
//! Return an RtAudio::DeviceInfo structure for a specified device ID.
/*!
Any device ID returned by getDeviceIds() is valid, unless it has
been removed between the call to getDevceIds() and this
function. If an invalid argument is provided, an
RTAUDIO_INVALID_USE will be passed to the user-provided
errorCallback function (or otherwise printed to stderr) and all
members of the returned RtAudio::DeviceInfo structure will be
initialized to default, invalid values (ID = 0, empty name, ...).
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 deviceId );
//! A function that returns the ID of the default output device.
/*!
If the underlying audio API does not provide a "default device",
the first probed output device ID will be returned. If no devices
are available, the return value will be 0 (which is an invalid
device identifier).
*/
unsigned int getDefaultOutputDevice( void );
//! A function that returns the index of the default input device.
//! A function that returns the ID 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.
If the underlying audio API does not provide a "default device",
the first probed input device ID will be returned. If no devices
are available, the return value will be 0 (which is an invalid
device identifier).
*/
unsigned int getDefaultInputDevice( void );
//! A public function for opening a stream with the specified parameters.
/*!
An RtAudioError (type = SYSTEM_ERROR) is thrown if a stream cannot be
An RTAUDIO_SYSTEM_ERROR is returned 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.
processing. An RTAUDIO_INVALID_USE is returned if a stream
is already open or any invalid stream 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.
argument should be NULL. The device ID is a value returned by
getDeviceIds().
\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.
argument should be NULL. The device ID is a value returned by
getDeviceIds().
\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
\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
@@ -513,48 +544,52 @@ class RTAUDIO_DLL_PUBLIC RtAudio
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 occurred.
*/
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 );
RtAudioErrorType openStream( RtAudio::StreamParameters *outputParameters,
RtAudio::StreamParameters *inputParameters,
RtAudioFormat format, unsigned int sampleRate,
unsigned int *bufferFrames, RtAudioCallback callback,
void *userData = NULL, RtAudio::StreamOptions *options = 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).
If a stream is not open, an RTAUDIO_WARNING will be passed to the
user-provided errorCallback function (or otherwise printed to
stderr).
*/
void closeStream( void );
//! 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.
An RTAUDIO_SYSTEM_ERROR is returned if an error occurs during
processing. An RTAUDIO_WARNING is returned if a stream is not open
or is already running.
*/
void startStream( void );
RtAudioErrorType 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.
An RTAUDIO_SYSTEM_ERROR is returned if an error occurs during
processing. An RTAUDIO_WARNING is returned if a stream is not
open or is already stopped.
*/
void stopStream( void );
RtAudioErrorType 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.
An RTAUDIO_SYSTEM_ERROR is returned if an error occurs during
processing. An RTAUDIO_WARNING is returned if a stream is not
open or is already stopped.
*/
void abortStream( void );
RtAudioErrorType abortStream( void );
//! Retrieve the error message corresponding to the last error or warning condition.
/*!
This function can be used to get a detailed error message when a
non-zero RtAudioErrorType is returned by a function. This is the
same message sent to the user-provided errorCallback function.
*/
const std::string getErrorText( void );
//! Returns true if a stream is open and false if not.
bool isStreamOpen( void ) const;
@@ -562,16 +597,17 @@ class RTAUDIO_DLL_PUBLIC RtAudio
//! Returns true if the stream is running and false if it is stopped or not open.
bool isStreamRunning( void ) const;
//! Returns the number of elapsed seconds since the stream was started.
//! Returns the number of seconds of processed data since the stream was started.
/*!
If a stream is not open, an RtAudioError (type = INVALID_USE) will be thrown.
The stream time is calculated from the number of sample frames
processed by the underlying audio system, which will increment by
units of the audio buffer size. It is not an absolute running
time. If a stream is not open, the returned value may not be
valid.
*/
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.
@@ -579,21 +615,29 @@ class RTAUDIO_DLL_PUBLIC RtAudio
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.
the input and output latencies. If a stream is not open, the
returned value will be invalid. 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.
*/
//! Returns actual sample rate in use by the (open) 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, a value of zero is returned.
*/
unsigned int getStreamSampleRate( void );
//! Specify whether warning messages should be printed to stderr.
//! Set a client-defined function that will be invoked when an error or warning occurs.
void setErrorCallback( RtAudioErrorCallback errorCallback );
//! Specify whether warning messages should be output or not.
/*!
The default behaviour is for warning messages to be output,
either to a client-defined error callback function (if specified)
or to stderr.
*/
void showWarnings( bool value = true );
protected:
@@ -603,7 +647,7 @@ class RTAUDIO_DLL_PUBLIC RtAudio
};
// Operating system dependent thread functionality.
#if defined(_WIN32) || defined(__CYGWIN__)
#if defined(_MSC_VER)
#ifndef NOMINMAX
#define NOMINMAX
@@ -642,11 +686,11 @@ struct CallbackInfo {
ThreadHandle thread{};
void *callback{};
void *userData{};
void *errorCallback{};
void *apiInfo{}; // void pointer for API specific callback information
bool isRunning{false};
bool doRealtime{false};
int priority{};
bool deviceDisconnected{false};
};
// **************************************************************** //
@@ -705,26 +749,29 @@ public:
RtApi();
virtual ~RtApi();
virtual RtAudio::Api getCurrentApi( void ) = 0;
virtual unsigned int getDeviceCount( void ) = 0;
virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0;
unsigned int getDeviceCount( void );
std::vector<unsigned int> getDeviceIds( void );
std::vector<std::string> getDeviceNames( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int deviceId );
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 );
RtAudioErrorType openStream( RtAudio::StreamParameters *outputParameters,
RtAudio::StreamParameters *inputParameters,
RtAudioFormat format, unsigned int sampleRate,
unsigned int *bufferFrames, RtAudioCallback callback,
void *userData, RtAudio::StreamOptions *options );
virtual void closeStream( void );
virtual void startStream( void ) = 0;
virtual void stopStream( void ) = 0;
virtual void abortStream( void ) = 0;
virtual RtAudioErrorType startStream( void ) = 0;
virtual RtAudioErrorType stopStream( void ) = 0;
virtual RtAudioErrorType abortStream( void ) = 0;
const std::string getErrorText( void ) const { return errorText_; }
long getStreamLatency( void );
unsigned int getStreamSampleRate( void );
virtual double getStreamTime( void );
virtual double getStreamTime( void ) const { return stream_.streamTime; }
virtual void setStreamTime( double time );
bool isStreamOpen( void ) const { return stream_.state != STREAM_CLOSED; }
bool isStreamRunning( void ) const { return stream_.state == STREAM_RUNNING; }
void setErrorCallback( RtAudioErrorCallback errorCallback ) { errorCallback_ = errorCallback; }
void showWarnings( bool value ) { showWarnings_ = value; }
@@ -760,7 +807,7 @@ protected:
// A protected structure for audio streams.
struct RtApiStream {
unsigned int device[2]; // Playback and record, respectively.
unsigned int deviceId[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
@@ -789,7 +836,7 @@ protected:
#endif
RtApiStream()
:apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }
:apiHandle(0), deviceBuffer(0) {} // { device[0] = std::string(); device[1] = std::string(); }
};
typedef S24 Int24;
@@ -800,10 +847,22 @@ protected:
std::ostringstream errorStream_;
std::string errorText_;
RtAudioErrorCallback errorCallback_;
bool showWarnings_;
std::vector<RtAudio::DeviceInfo> deviceList_;
unsigned int currentDeviceId_;
RtApiStream stream_;
bool firstErrorOccurred_;
/*!
Protected, api-specific method that attempts to probe all device
capabilities in a system. The function will not re-probe devices
that were previously found and probed. This function MUST be
implemented by all subclasses. If an error is encountered during
the probe, a "warning" message may be reported and the internal
list of devices may be incomplete.
*/
virtual void probeDevices( void );
/*!
Protected, api-specific method that attempts to open a device
with the given parameters. This function MUST be implemented by
@@ -811,7 +870,7 @@ protected:
"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,
virtual bool probeDeviceOpen( unsigned int deviceId, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
@@ -822,14 +881,8 @@ protected:
//! 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 );
RtAudioErrorType error( RtAudioErrorType type );
/*!
Protected method used to perform format, channel number, and/or interleaving
@@ -855,328 +908,25 @@ protected:
inline RtAudio::Api RtAudio :: getCurrentApi( void ) { return rtapi_->getCurrentApi(); }
inline unsigned int RtAudio :: getDeviceCount( void ) { return rtapi_->getDeviceCount(); }
inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); }
inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int deviceId ) { return rtapi_->getDeviceInfo( deviceId ); }
inline std::vector<unsigned int> RtAudio :: getDeviceIds( void ) { return rtapi_->getDeviceIds(); }
inline std::vector<std::string> RtAudio :: getDeviceNames( void ) { return rtapi_->getDeviceNames(); }
inline unsigned int RtAudio :: getDefaultInputDevice( void ) { return rtapi_->getDefaultInputDevice(); }
inline unsigned int RtAudio :: getDefaultOutputDevice( void ) { return rtapi_->getDefaultOutputDevice(); }
inline void RtAudio :: closeStream( void ) { 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 RtAudioErrorType RtAudio :: startStream( void ) { return rtapi_->startStream(); }
inline RtAudioErrorType RtAudio :: stopStream( void ) { return rtapi_->stopStream(); }
inline RtAudioErrorType RtAudio :: abortStream( void ) { return rtapi_->abortStream(); }
inline const std::string RtAudio :: getErrorText( void ) { return rtapi_->getErrorText(); }
inline bool RtAudio :: isStreamOpen( void ) const { return rtapi_->isStreamOpen(); }
inline bool RtAudio :: isStreamRunning( void ) const { 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 :: setErrorCallback( RtAudioErrorCallback errorCallback ) { rtapi_->setErrorCallback( errorCallback ); }
inline void RtAudio :: showWarnings( bool value ) { 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 ) override { return RtAudio::MACOSX_CORE; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
unsigned int getDefaultOutputDevice( void ) override;
unsigned int getDefaultInputDevice( void ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// 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 undesirable 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 ) override;
static const char* getErrorCode( OSStatus code );
};
#endif
#if defined(__UNIX_JACK__)
class RtApiJack: public RtApi
{
public:
RtApiJack();
~RtApiJack();
RtAudio::Api getCurrentApi( void ) override { return RtAudio::UNIX_JACK; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// 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 undesirable 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 ) override;
bool shouldAutoconnect_;
};
#endif
#if defined(__WINDOWS_ASIO__)
class RtApiAsio: public RtApi
{
public:
RtApiAsio();
~RtApiAsio();
RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_ASIO; }
unsigned int getDeviceCount( void ) override;
unsigned int getDefaultOutputDevice( void ) override;
unsigned int getDefaultInputDevice( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// 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 undesirable 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 ) override;
};
#endif
#if defined(__WINDOWS_DS__)
class RtApiDs: public RtApi
{
public:
RtApiDs();
~RtApiDs();
RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_DS; }
unsigned int getDeviceCount( void ) override;
unsigned int getDefaultOutputDevice( void ) override;
unsigned int getDefaultInputDevice( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// 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 undesirable 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 ) override;
};
#endif
#if defined(__WINDOWS_WASAPI__)
struct IMMDeviceEnumerator;
class RtApiWasapi : public RtApi
{
public:
RtApiWasapi();
virtual ~RtApiWasapi();
RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_WASAPI; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
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 ) override;
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() override { return RtAudio::LINUX_ALSA; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// 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 undesirable 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 ) override;
};
#endif
#if defined(__LINUX_PULSE__)
class RtApiPulse: public RtApi
{
public:
~RtApiPulse();
RtAudio::Api getCurrentApi() override { return RtAudio::LINUX_PULSE; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// 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 undesirable results!
void callbackEvent( void );
private:
void collectDeviceInfo( 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 ) override;
};
#endif
#if defined(__LINUX_OSS__)
class RtApiOss: public RtApi
{
public:
RtApiOss();
~RtApiOss();
RtAudio::Api getCurrentApi() override { return RtAudio::LINUX_OSS; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// 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 undesirable 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 ) override;
};
#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 ) override { return RtAudio::RTAUDIO_DUMMY; }
unsigned int getDeviceCount( void ) override { return 0; }
RtAudio::DeviceInfo getDeviceInfo( unsigned int /*device*/ ) override { RtAudio::DeviceInfo info; return info; }
void closeStream( void ) override {}
void startStream( void ) override {}
void stopStream( void ) override {}
void abortStream( void ) override {}
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*/ ) override { return false; }
};
#endif
#endif
// Indentation settings for Vim and Emacs

View File

@@ -9,7 +9,7 @@
RtMidi WWW site: http://www.music.mcgill.ca/~gary/rtmidi/
RtMidi: realtime MIDI i/o C++ classes
Copyright (c) 2003-2021 Gary P. Scavone
Copyright (c) 2003-2023 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -58,7 +58,24 @@
#endif
#endif
#define RTMIDI_VERSION "5.0.0"
#define RTMIDI_VERSION_MAJOR 6
#define RTMIDI_VERSION_MINOR 0
#define RTMIDI_VERSION_PATCH 0
#define RTMIDI_VERSION_BETA 0
#define RTMIDI_TOSTRING2(n) #n
#define RTMIDI_TOSTRING(n) RTMIDI_TOSTRING2(n)
#if RTMIDI_VERSION_BETA > 0
#define RTMIDI_VERSION RTMIDI_TOSTRING(RTMIDI_VERSION_MAJOR) \
"." RTMIDI_TOSTRING(RTMIDI_VERSION_MINOR) \
"." RTMIDI_TOSTRING(RTMIDI_VERSION_PATCH) \
"beta" RTMIDI_TOSTRING(RTMIDI_VERSION_BETA)
#else
#define RTMIDI_VERSION RTMIDI_TOSTRING(RTMIDI_VERSION_MAJOR) \
"." RTMIDI_TOSTRING(RTMIDI_VERSION_MINOR) \
"." RTMIDI_TOSTRING(RTMIDI_VERSION_PATCH)
#endif
#include <exception>
#include <iostream>
@@ -86,12 +103,12 @@ class RTMIDI_DLL_PUBLIC RtMidiError : public std::exception
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. */
MEMORY_ERROR, /*!< An error occurred 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. */
DRIVER_ERROR, /*!< A system driver error occurred. */
SYSTEM_ERROR, /*!< A system error occurred. */
THREAD_ERROR /*!< A thread error occurred. */
};
//! The constructor.
@@ -144,6 +161,8 @@ class RTMIDI_DLL_PUBLIC RtMidi
WINDOWS_MM, /*!< The Microsoft Multimedia MIDI API. */
RTMIDI_DUMMY, /*!< A compilable but non-functional API. */
WEB_MIDI_API, /*!< W3C Web MIDI API. */
WINDOWS_UWP, /*!< The Microsoft Universal Windows Platform MIDI API. */
ANDROID_AMIDI, /*!< Native Android MIDI API. */
NUM_APIS /*!< Number of values in this enum. */
};
@@ -206,9 +225,9 @@ class RTMIDI_DLL_PUBLIC RtMidi
*/
virtual bool isPortOpen( void ) const = 0;
//! Set an error callback function to be invoked when an error has occured.
//! Set an error callback function to be invoked when an error has occurred.
/*!
The callback function will be called whenever an error has occured. It is best
The callback function will be called whenever an error has occurred. It is best
to set the error callback function before opening a port.
*/
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 ) = 0;
@@ -373,9 +392,9 @@ class RTMIDI_DLL_PUBLIC RtMidiIn : public RtMidi
*/
double getMessage( std::vector<unsigned char> *message );
//! Set an error callback function to be invoked when an error has occured.
//! Set an error callback function to be invoked when an error has occurred.
/*!
The callback function will be called whenever an error has occured. It is best
The callback function will be called whenever an error has occurred. It is best
to set the error callback function before opening a port.
*/
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
@@ -491,9 +510,9 @@ class RTMIDI_DLL_PUBLIC RtMidiOut : public RtMidi
*/
void sendMessage( const unsigned char *message, size_t size );
//! Set an error callback function to be invoked when an error has occured.
//! Set an error callback function to be invoked when an error has occurred.
/*!
The callback function will be called whenever an error has occured. It is best
The callback function will be called whenever an error has occurred. It is best
to set the error callback function before opening a port.
*/
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
@@ -559,7 +578,7 @@ class RTMIDI_DLL_PUBLIC MidiInApi : public MidiApi
void setCallback( RtMidiIn::RtMidiCallback callback, void *userData );
void cancelCallback( void );
virtual void ignoreTypes( bool midiSysex, bool midiTime, bool midiSense );
double getMessage( std::vector<unsigned char> *message );
virtual double getMessage( std::vector<unsigned char> *message );
virtual void setBufferSize( unsigned int size, unsigned int count );
// A MIDI structure used internally by the class to store incoming

View File

@@ -24,7 +24,7 @@ namespace stk {
that takes an StkFrames object for multi-channel and/or
multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/
@@ -33,14 +33,14 @@ class RtWvIn : public WvIn
public:
//! Default constructor.
/*!
The default \e device argument value (zero) will select the
The default \e deviceIndex argument value (zero) will select the
default input device on your system. The first device enumerated
by the underlying audio API is specified with a value of one. The
default buffer size of RT_BUFFER_SIZE is defined in Stk.h. An
StkError will be thrown if an error occurs duing instantiation.
*/
RtWvIn( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );
int deviceIndex = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );
//! Class destructor.
~RtWvIn();

View File

@@ -23,7 +23,7 @@ namespace stk {
that takes a reference to an StkFrames object for multi-channel
and/or multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/
@@ -33,14 +33,14 @@ class RtWvOut : public WvOut
//! Default constructor.
/*!
The default \e device argument value (zero) will select the
The default \e deviceIndex argument value (zero) will select the
default output device on your system. The first device enumerated
by the underlying audio API is specified with a value of one. The
default buffer size of RT_BUFFER_SIZE is defined in Stk.h. An
StkError will be thrown if an error occurs duing instantiation.
*/
RtWvOut( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );
int deviceIndex = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );
//! Class destructor.
~RtWvOut();

View File

@@ -9,7 +9,7 @@
where <name> is the string used in the SKINI stream.
by Perry R. Cook, 1995--2021.
by Perry R. Cook, 1995--2023.
*/
/*********************************************************/

View File

@@ -15,7 +15,7 @@ namespace stk {
This instrument provides an ADSR envelope, a one-pole filter, and
structures for an arbitrary number of attack and looped files.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -44,7 +44,7 @@ namespace stk {
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -53,7 +53,7 @@ namespace stk {
- Water Drops = 21
- Tuned Bamboo Chimes = 22
by Perry R. Cook with updates by Gary Scavone, 1995--2021.
by Perry R. Cook with updates by Gary Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -25,7 +25,7 @@ namespace stk {
- Envelope Rate = 11
- Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -18,7 +18,7 @@ namespace stk {
The "table" length, set in SineWave.h, is 2048 samples by default.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -18,7 +18,7 @@ namespace stk {
Within STK, it is used as an excitation source for other
instruments.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -25,7 +25,7 @@ namespace stk {
Stanford, bearing the names of Karplus and/or
Strong.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -31,7 +31,7 @@ namespace stk {
\sa \ref skini
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -31,7 +31,7 @@ namespace stk {
number of static functions for use with external socket
descriptors.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@ namespace stk {
This class implements a spherical ball with
radius, mass, position, and velocity parameters.
by Perry R. Cook, 1995--2021.
by Perry R. Cook, 1995--2023.
*/
/***************************************************/

View File

@@ -29,7 +29,7 @@ namespace stk {
- String Sustain = 11
- String Stretch = 1
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -41,7 +41,7 @@ namespace stk {
STK WWW site: http://ccrma.stanford.edu/software/stk/
The Synthesis ToolKit in C++ (STK)
Copyright (c) 1995--2021 Perry R. Cook and Gary P. Scavone
Copyright (c) 1995--2023 Perry R. Cook and Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -271,7 +271,7 @@ protected:
Possible future improvements in this class could include functions
to convert to and return other data types.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/
@@ -622,7 +622,7 @@ const StkFloat ONE_OVER_128 = 0.0078125;
#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_MM__)
#define __OS_WINDOWS__
#define __STK_REALTIME__
#elif defined(__LINUX_OSS__) || defined(__LINUX_ALSA__) || defined(__UNIX_JACK__)
#elif defined(__LINUX_OSS__) || defined(__LINUX_ALSA__) || defined(__UNIX_JACK__) || defined(__LINUX_PULSE__)
#define __OS_LINUX__
#define __STK_REALTIME__
#elif defined(__IRIX_AL__)

View File

@@ -17,7 +17,7 @@ namespace stk {
A non-interpolating delay line is typically used in fixed
delay-length applications, such as for reverberation.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -26,7 +26,7 @@ namespace stk {
less than or equal to zero indicate a closed
or lost connection or the occurence of an error.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -26,7 +26,7 @@ namespace stk {
less than or equal to zero indicate a closed
or lost connection or the occurence of an error.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -42,7 +42,7 @@ namespace stk {
THREAD_RETURN THREAD_TYPE thread_function(void *ptr)
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -33,7 +33,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

View File

@@ -27,7 +27,7 @@ namespace stk {
use possibly subject to patents held by Stanford
University, Yamaha, and others.
by Perry R. Cook and Gary P. Scavone, 1995--2021.
by Perry R. Cook and Gary P. Scavone, 1995--2023.
*/
/***************************************************/

Some files were not shown because too many files have changed in this diff Show More