mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Version 4.4.4
This commit is contained in:
committed by
Stephen Sinclair
parent
0aec39260a
commit
fc877b87bf
6
INSTALL
6
INSTALL
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people simmply 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.
|
||||
|
||||
@@ -25,7 +25,7 @@ Several options can be passed to configure, including:
|
||||
--with-asio = choose ASIO API support (windows only)
|
||||
--with-ds = choose DirectSound API support (windows only)
|
||||
|
||||
It is now possible to specify more than one audio API where supported. Note, however, that the ALSA library is required in order to compile the RtMidi class in Linux, even if the "--with-oss" option is provided (only the OSS audio API will be used, not the OSS MIDI API). Typing "./configure --help" will display all the available options. In addition, it is possible to specify the RAWWAVES and INCLUDE paths to configure as (ex. to set to /home/me/rawwaves and /home/me/include):
|
||||
It is now possible to specify more than one audio and MIDI API where supported. Note, however, that the ALSA library is required in order to compile the RtMidi class in Linux if the "--with-oss" option is provided (only the OSS audio API will be used, not the OSS MIDI API). Typing "./configure --help" will display all the available options. In addition, it is possible to specify the RAWWAVES and INCLUDE paths to configure as (ex. to set to /home/me/rawwaves and /home/me/include):
|
||||
|
||||
./configure RAWWAVE_PATH='$(HOME)/rawwaves/'
|
||||
./configure INCLUDE_PATH='$(HOME)/include/'
|
||||
@@ -39,4 +39,4 @@ If you wish to use a different compiler than that selected by configure, specify
|
||||
|
||||
For Windows Users:
|
||||
|
||||
MinGW support is provided in the configure script. In addition, Visual C++ project files are included for each of the example STK projects.
|
||||
MinGW support is provided in the configure script. In addition, Visual C++ 6.0 project files are included for each of the example STK projects, though these may not work with more recent versions of Visual Studio.
|
||||
|
||||
@@ -7,6 +7,7 @@ all :
|
||||
cd projects/demo && $(MAKE) libdemo
|
||||
cd projects/effects && $(MAKE) libeffects
|
||||
cd projects/ragamatic && $(MAKE) libragamat
|
||||
cd projects/eguitar && $(MAKE) libeguitar
|
||||
cd projects/examples && $(MAKE) -f libMakefile
|
||||
|
||||
clean :
|
||||
@@ -15,6 +16,7 @@ clean :
|
||||
cd projects/demo && $(MAKE) clean
|
||||
cd projects/effects && $(MAKE) clean
|
||||
cd projects/ragamatic && $(MAKE) clean
|
||||
cd projects/eguitar && $(MAKE) clean
|
||||
cd projects/examples && $(MAKE) clean
|
||||
|
||||
distclean: clean
|
||||
@@ -23,5 +25,6 @@ distclean: clean
|
||||
cd projects/demo && $(MAKE) distclean
|
||||
cd projects/effects && $(MAKE) distclean
|
||||
cd projects/ragamatic && $(MAKE) distclean
|
||||
cd projects/eguitar && $(MAKE) distclean
|
||||
cd projects/examples && $(MAKE) distclean
|
||||
|
||||
|
||||
28
README
28
README
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
This distribution of the Synthesis ToolKit in C++ (STK) contains the following:
|
||||
|
||||
@@ -32,11 +32,10 @@ Macintosh OS X, and Windows computer platforms. Generic, non-realtime
|
||||
support has been tested under NeXTStep, Sun, and other platforms and
|
||||
should work with any standard C++ compiler.
|
||||
|
||||
The Synthesis ToolKit is free for non-commercial use. The only
|
||||
classes of the Synthesis ToolKit that are platform-dependent concern
|
||||
sockets, threads, mutexes, and real-time audio and MIDI input and
|
||||
output. The interface for MIDI input and the simple Tcl/Tk graphical
|
||||
user interfaces (GUIs) provided is the same, so it's easy to
|
||||
The only classes of the Synthesis ToolKit that are platform-dependent
|
||||
concern sockets, threads, mutexes, and real-time audio and MIDI input
|
||||
and output. The interface for MIDI input and the simple Tcl/Tk
|
||||
graphical user interfaces (GUIs) provided is the same, so it's easy to
|
||||
experiment in real time using either the GUIs or MIDI. The Synthesis
|
||||
ToolKit can generate simultaneous SND (AU), WAV, AIFF, and MAT-file
|
||||
output soundfile formats (as well as realtime sound output), so you
|
||||
@@ -95,11 +94,12 @@ messages. In most cases, this should eliminate the use of the
|
||||
Md2Skini program.
|
||||
|
||||
Realtime audio input capabilities were added to STK with release 3.0,
|
||||
though the behavior of such is very hardware dependent. Under Linux,
|
||||
Macintosh OS-X, and Irix, audio input and output are possible with
|
||||
very low latency. Using the Windoze DirectSound API, minimum
|
||||
dependable output sound latency seems to be around 20 milliseconds or
|
||||
so, while input sound latency is generally higher.
|
||||
though the behavior of such is very hardware dependent. Under Linux
|
||||
and Macintosh OS-X, audio input and output are possible with very low
|
||||
latency. Using the Windoze DirectSound API, minimum dependable output
|
||||
sound latency seems to be around 20 milliseconds or so, while input
|
||||
sound latency is generally higher. Performance with the ASIO audio
|
||||
API on Windoze provides much better performance.
|
||||
|
||||
As mentioned above, it is possible to record the audio ouput of an STK
|
||||
program to .snd, .wav, .raw, .aif, and .mat (Matlab MAT-file) output
|
||||
@@ -110,7 +110,7 @@ generic C++ compiler.
|
||||
|
||||
For those who wish to make a library from the core STK classes, the
|
||||
configure script generates a Makefile in the src directory that will
|
||||
accomplish that (Linux, SGI, and Macintosh OS X only).
|
||||
accomplish that.
|
||||
|
||||
|
||||
DISCLAIMER:
|
||||
@@ -129,7 +129,7 @@ for free, primarily for academic purposes, so if you use it, pass it
|
||||
on with this documentation, and for free.
|
||||
|
||||
If you make a million dollars with it, it would be nice if you would
|
||||
share. If you make compositions with it, put us in the program notes.
|
||||
share. If you make compositions with it, put us in the program notes.
|
||||
|
||||
Some of the concepts are covered by various patents, some known to us
|
||||
and likely others which are unknown. Many of the ones known to us are
|
||||
@@ -145,7 +145,7 @@ LICENSE:
|
||||
STK WWW site: http://ccrma.stanford.edu/software/stk/
|
||||
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
Copyright (c) 1995-2011 Perry R. Cook and Gary P. Scavone
|
||||
Copyright (c) 1995-2012 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
|
||||
|
||||
2
config/config.guess
vendored
2
config/config.guess
vendored
@@ -3,7 +3,7 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2001-04-20'
|
||||
timestamp='2004-02-26'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
||||
2
config/config.sub
vendored
2
config/config.sub
vendored
@@ -3,7 +3,7 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2001-04-20'
|
||||
timestamp='2004-02-26'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
|
||||
12
configure.ac
12
configure.ac
@@ -2,7 +2,7 @@
|
||||
AC_INIT(STK, 4.4, gary@music.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)
|
||||
AC_CONFIG_FILES(Makefile src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile projects/eguitar/Makefile)
|
||||
|
||||
# Fill GXX with something before test.
|
||||
AC_SUBST( GXX, ["no"] )
|
||||
@@ -121,8 +121,9 @@ if test $realtime = yes; then
|
||||
|
||||
# Look for OSS flag
|
||||
AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [
|
||||
api="$api -D__LINUX_OSS__"
|
||||
AC_MSG_RESULT(using OSS)], )
|
||||
api="$api -D__LINUX_OSS__ -D__LINUX_ALSA__"
|
||||
AC_MSG_RESULT(using OSS)
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(OSS support requires ALSA for RtMidi!))], )
|
||||
|
||||
# If no audio api flags specified, use ALSA
|
||||
if [test "$api" == "";] then
|
||||
@@ -131,11 +132,6 @@ if test $realtime = yes; then
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
|
||||
fi
|
||||
|
||||
# Look for ALSA library because we need it for RtMidi
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(STK in Linux requires the ALSA asound library for RtMidi!))
|
||||
api="$api -D__LINUX_ALSASEQ__"
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(realtime support requires the pthread library!))
|
||||
;;
|
||||
|
||||
*-apple*)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
Realtime audio support for Linux currently includes the Advanced Linux Sound Architecture (ALSA), the JACK low-latency audio server, and/or Open Sound System (OSS version 4.0 and higher only) APIs. That said, the OSS API support has not been tested in several years and is not considered a high priority. One or more APIs are selected during compilation using the __LINUX_ALSA__, __UNIX_JACK__, and/or __LINUX_OSS__ definitions. Because the ALSA library is now integrated into the standard Linux kernel, it is the default audio/MIDI API with STK versions 4.2 and higher.
|
||||
|
||||
The __LINUX_ALSASEQ__ definition is required to compile RtMidi with ALSA sequencer support. Native OSS MIDI support no longer exists in RtMidi. If the __LINUX_OSS__ preprocessor definition is specified, only OSS audio support will be compiled and RtMidi will still be compiled using the ALSA API. For this reason, STK now requires the asound library for realtime support. Realtime programs must also link with the pthread library.
|
||||
Realtime MIDI support Linux currently includes the Jack and ALSA sequencer support. Native OSS MIDI support no longer exists in RtMidi. If the __LINUX_OSS__ preprocessor definition is specified, only OSS audio support will be compiled and RtMidi will still be compiled using the ALSA API. For this reason, STK now requires the asound library for realtime support (unless only using the Jack API). Realtime programs must also link with the pthread library.
|
||||
|
||||
STK should compile without much trouble under Linux. Since all Linux distributions typically include the GNU makefile utilities, you should be able to use the default Makefiles. Typing "make" in a project directory will initiate the compilation process (after initially running the configure script in the top-level directory).
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
The default realtime support for Macintosh OS X uses the CoreAudio HAL API and is specified during compilation using the __MACOSX_CORE__ preprocessor definition. There is also support for the JACK audio server using the __UNIX_JACK__ preprocessor definition.
|
||||
|
||||
It is necessary to install the OS X developer kit in order to compile STK. STK was successfully tested on the latest version of OS X.
|
||||
It is necessary to install the OS X developer kit (or the command line tools) in order to compile STK. STK was successfully tested on the latest version of OS X.
|
||||
|
||||
Tcl/Tk on OS X:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
Please read the file README for more general STK information.
|
||||
|
||||
The configure script supports MinGW. As well, STK is distributed with Visual C++ .NET project and workspace files. It no longer compiles with Visual C++ 6.0.
|
||||
The configure script supports MinGW. As well, STK is distributed with Visual C++ .NET project and workspace files (though these may no longer work with current versions of Visual Studio). It no longer compiles with Visual C++ 6.0.
|
||||
|
||||
With Windows XP/7, piping works as under unix. Simply fire up the script files (ex. StkDemo.bat) by either double-clicking on them or from within a shell.
|
||||
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
v4.4.4: (24 August 2012)
|
||||
- new FreeVerb class (thanks to Greg Burlet)
|
||||
- new Guitar class
|
||||
- new electric guitar project
|
||||
- cleaned / revised Shakers class
|
||||
- updated versions of RtAudio and RtMidi
|
||||
- bug fix in LentPitShift
|
||||
- bug fix in Echo constructor
|
||||
- bug fix in FileWvIn (file size when chunking)
|
||||
- bug fix in StkFrames copy constructor
|
||||
|
||||
v4.4.3: (30 August 2011)
|
||||
- changed SINT24 to be lower 3 bytes of 32-bit word
|
||||
@@ -13,7 +24,7 @@ v4.4.3: (30 August 2011)
|
||||
- added WAVE_FORMAT_EXTENSIBLE support in FileWrite
|
||||
- added sample rate variable reading and writing for MAT-files in FileRead and FileWrite
|
||||
|
||||
v4.4.2: (4 February 2010)
|
||||
v4.4.2: (4 February 2011)
|
||||
- added various header file includes for newer compilers
|
||||
- new LentPitShift class (thanks to Francois Germain)
|
||||
- added "addTo" function to Delay class
|
||||
|
||||
@@ -31,7 +31,7 @@ PROJECT_NAME = STK
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.4.3
|
||||
PROJECT_NUMBER = 4.4.4
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
||||
@@ -37,19 +37,19 @@ STK compiles with realtime support on the following flavors of the Unix operatin
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>ALSA</TD>
|
||||
<TD>__LINUX_ALSA__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
|
||||
<TD>__LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>OSS (version 4.0 only, use ALSA for MIDI support)</TD>
|
||||
<TD>__LINUX_OSS__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
|
||||
<TD>__LINUX_OSS__, __LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux and Macintosh OS-X</TD>
|
||||
<TD>Jack (audio only, use ALSA for MIDI support)</TD>
|
||||
<TD>__UNIX_JACK__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
|
||||
<TD>Jack</TD>
|
||||
<TD>__UNIX_JACK__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread, jack</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
/*! \page download Download, Release Notes, and Bug Fixes
|
||||
|
||||
\section down Download Version 4.4.3 (30 August 2011):
|
||||
\section down Download Version 4.4.4 (24 August 2012):
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.4.3.tar.gz">Source distribution</A></LI>
|
||||
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.4.4.tar.gz">Source distribution</A></LI>
|
||||
</UL>
|
||||
|
||||
|
||||
\section notes Release Notes:
|
||||
|
||||
\subsection v4dot4dot4 Version 4.4.4
|
||||
|
||||
<ul>
|
||||
<li>New FreeVerb class (thanks to Greg Burlet)</li>
|
||||
<li>New Guitar class</li>
|
||||
<li>New electric guitar project</li>
|
||||
<li>Updated versions of RtAudio and RtMidi</li>
|
||||
<li>Cleaned / revised Shakers class</li>
|
||||
<li>Bug fix in LentPitShift</li>
|
||||
<li>Bug fix in Echo constructor</li>
|
||||
<li>Bug fix in FileWvIn (file size when chunking)</li>
|
||||
<li>Bug fix in StkFrames copy constructor</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot4dot3 Version 4.4.3
|
||||
|
||||
<ul>
|
||||
|
||||
@@ -24,7 +24,7 @@ work with any standard C++ compiler.
|
||||
STK WWW site: http://ccrma.stanford.edu/software/stk/
|
||||
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
Copyright (c) 1995-2011 Perry R. Cook and Gary P. Scavone
|
||||
Copyright (c) 1995-2012 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
|
||||
|
||||
@@ -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>©1995-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td>©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -4,26 +4,22 @@
|
||||
|
||||
- <A HREF="http://www.music.mcgill.ca/~gary/rtmidi/">The %RtMidi WWW site</A>
|
||||
|
||||
- <A HREF="http://momu.stanford.edu/stk/">MoMu-Stk: A lightly modified version of STK that supports the iPhone platform (iPhone, iPad, iPod Touches)</A>
|
||||
|
||||
- <A HREF="http://ccrma.stanford.edu/~woony/software/stkx/">StkX: A Cocoa STK Framework for Mac OS X by Woon Seung Yeo</A>
|
||||
|
||||
- <A HREF="http://sourceforge.net/projects/mobilestk">Mobile STK: A port of STK for mobile devices by Georg Essl and Michael Rohs</A>
|
||||
|
||||
- <A HREF="http://chuck.cs.princeton.edu/">ChucK: Concurrent, On-the-fly Audio Programming Language</A> using STK unit generators
|
||||
|
||||
- <A HREF="http://www.music.princeton.edu/paul/stkugens.tar.gz">Paul Lansky's port of STK to SuperCollider</A>
|
||||
|
||||
- <A HREF="http://kern.humdrum.net/">Kern Scores: A Library of Electronic Musical Scores</A> (with automatic conversion to SKINI format)
|
||||
- <A HREF="http://kern.ccarh.org">Kern Scores: A Library of Electronic Musical Scores</A> (with automatic conversion to SKINI format)
|
||||
|
||||
- <A HREF="http://stk.sapp.org/midi2skini">MIDI to SKINI file converter</A> by Craig Sapp
|
||||
|
||||
- <A HREF="http://stk.sapp.org/kern2skini">Kern Score to SKINI file converter</A> by Craig Sapp
|
||||
|
||||
- <A HREF="http://www.artassault.org/software/software.html">Calico - A Polyphonic Score File Parser for STK</A> by Greg Kellum
|
||||
- <A HREF="http://extra.humdrum.org/example/kern2skini/">Kern Score to SKINI file converter</A> by Craig Sapp
|
||||
|
||||
- <A HREF="http://www.music.columbia.edu/PeRColate/">PeRColate: A Port of STK for Max/MSP</A>
|
||||
|
||||
- <A HREF="http://mathmorphs.swiki.net/32/">A Partial Port of STK to Squeak</A>
|
||||
|
||||
- <a href="http://airy.andre.online.fr/AU/index.html">AUStk: a demo of integration of STK instruments into an AudioUnit</a> by Airy Andre
|
||||
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,6 @@ It appears that socket support in Tcl/Tk uses the Nagle algorithm, which produce
|
||||
<UL>
|
||||
<LI>A soundcard to use realtime audio input/output capabilities. In order to use the <I><B>effects</B></I> project, the soundcard and drivers must support full duplex mode.</LI>
|
||||
<LI><A HREF="http://www.microsoft.com/directx/">DirectX</A> 5.0 (or higher) runtime libraries.</LI>
|
||||
<LI>Visual C++ .NET or MinGW for compiling.</LI>
|
||||
<LI>For compiling the source (if not already in your system): <UL><LI><A HREF="Misc/dsound.h">dsound.h</A> header file (DirectX 6.1) - put somewhere in your header search path</LI><LI><A HREF="Misc/dsound.lib">dsound.lib</A> library file (DirectX 6.1) - put somewhere in your library search path</LI></UL></LI>
|
||||
</UL>
|
||||
|
||||
|
||||
@@ -38,13 +38,15 @@ This release of STK comes with four separate "project" directories:
|
||||
|
||||
<LI> The <I><B>ragamatic</B></I> project is just cool. Fire it up and be enlightened.<P></LI>
|
||||
|
||||
<LI> The <I><B>eguitar</B></I> project demonstrates how to make an electric guitar with feedback and distortion.<P></LI>
|
||||
|
||||
<LI> The <I><B>examples</B></I> project contains several simple programs that demonstrate audio input/output, including the audio internet streaming classes, as well as most of the tutorial programs.</LI>
|
||||
</OL>
|
||||
|
||||
\section compiling Compiling:
|
||||
|
||||
<UL>
|
||||
<LI><B>Windows95/98/2000/XP/7:</B> Realtime support is available using either DirectSound or ASIO audio drivers. For DirectSound support, use the <TT>__WINDOWS_DS__</TT> preprocessor definition and link with the <TT>dsound.lib</TT>, <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries. For ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition, include all the files in the <TT>src/asio/</TT> directory (i.e. <TT>asio.h,cpp</TT>, <TT>asiodrivers.h,cpp</TT>, ...), and link with the <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries. In addition, the <TT>__LITTLE_ENDIAN__</TT> and <TT>__WINDOWS_MM__</TT> preprocessor definitions are necessary for all Windows systems (RtMidi uses the Windows MultiMedia MIDI API). Visual C++ .NET project files are provided in each project directory. As well, the MinGW compiler is supported (see below). It is important to link with the non-debug libraries when compiling "release" program versions and debug libraries when compiling "debug" program versions.</LI>
|
||||
<LI><B>Windows95/98/2000/XP/7:</B> Realtime support is available using either DirectSound or ASIO audio drivers. For DirectSound support, use the <TT>__WINDOWS_DS__</TT> preprocessor definition and link with the <TT>dsound.lib</TT>, <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries. For ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition, include all the files in the <TT>src/asio/</TT> directory (i.e. <TT>asio.h,cpp</TT>, <TT>asiodrivers.h,cpp</TT>, ...), and link with the <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries. In addition, the <TT>__LITTLE_ENDIAN__</TT> and <TT>__WINDOWS_MM__</TT> preprocessor definitions are necessary for all Windows systems (RtMidi uses the Windows MultiMedia MIDI API). Fairly old Visual C++ project files are provided in each project directory, though they may not work on newer versions of MSVS. As well, the MinGW compiler is supported (see below). It is important to link with the non-debug libraries when compiling "release" program versions and debug libraries when compiling "debug" program versions.</LI>
|
||||
|
||||
<LI><B>Unix (and MinGW) Systems:</B> A GNU <TT>configure</TT> shell script is included in the distribution for unix-based systems. From the top-level distribution directory, type <TT>'./configure'</TT> and the script will create <TT>Makefiles</TT> in each project directory specific to the characteristics of the host computer. Then from within any given project directory (example <TT>demo</TT>), type <TT>'make'</TT> to compile the project. In addition, an STK library can be compiled from within the <TT>src</TT> directory.
|
||||
|
||||
@@ -87,7 +89,6 @@ All STK programs in this distribution take input control data in the form of <A
|
||||
<OL>
|
||||
<LI>Redirect or pipe SKINI scorefiles to an executable.</LI>
|
||||
<LI>Pipe realtime SKINI input messages to an executable (not possible under Windows95/98).</LI>
|
||||
<LI>Socket realtime SKINI input messages to an executable.</LI>
|
||||
<LI>Acquire realtime MIDI messages from a MIDI port on your computer.</LI>
|
||||
</OL>
|
||||
|
||||
@@ -158,12 +159,11 @@ where instruments include those described above and flags can be any or all of:
|
||||
<LI><I>-om \<file name\></I> for MAT-file output,</LI>
|
||||
<LI><I>-if \<file name\></I> for a SKINI formatted control file,</LI>
|
||||
<LI><I>-ip</I> for realtime SKINI control input via piping,</LI>
|
||||
<LI><I>-is \<port\></I> for realtime SKINI control input via socketing (with an optional port number),</LI>
|
||||
<LI><I>-im \<port\></I> for MIDI control input (with optional port, -1 = virtual port where possible),</LI>
|
||||
<LI><I>-s RATE</I> to specify a sample rate,</LI>
|
||||
<LI><I>-n NUMBER</I> to specify multivoice polyphony</LI>
|
||||
</UL>
|
||||
The <i>-ip</i> and <i>-is</i> flags must be used when piping or socketing realtime SKINI control data to an STK program. The <i>-im</i> flag must be used to read MIDI control input from your MIDI port. Note that you can use all three input types simultaneously.
|
||||
The <i>-ip</i> flag must be used when piping realtime SKINI control data to an STK program. The <i>-im</i> flag must be used to read MIDI control input from your MIDI port. Note that you can use both input types simultaneously.
|
||||
|
||||
Assuming a successful compilation of the <I><B>demo</B></I> program, typing:
|
||||
|
||||
@@ -182,16 +182,6 @@ There are a number of <A HREF="http://dev.scriptics.com">Tcl/Tk</A> GUIs supplie
|
||||
wish < tcl/Physical.tcl | demo Clarinet -or -ip
|
||||
\endcode
|
||||
|
||||
On WindowsXX and Unix platforms, the following operations are necessary to establish a socket connection between the Tcl/Tk GUI and the STK program:
|
||||
<OL>
|
||||
<LI>Open a DOS shell and start the STK program with the <I>-is</I> flag (ex. <I><B>demo Clarinet -or -is</B></I>).</LI>
|
||||
<LI>Open the Tcl/Tk GUI (e.g. tcl/Physical.tcl) by double-clicking on it, or type <TT>wish < tcl/Physical.tcl</TT> in another DOS shell.</LI>
|
||||
<LI>Establish the socket connection by selecting <I>Socket</I> under the Communications menu item in the Tcl/Tk GUI.</LI>
|
||||
</OL>
|
||||
|
||||
Note that it is possible to specify a hostname when establishing the socket connection from the socket client. Thus, the STK socket server program and the Tcl/Tk GUI need not necessarily reside on the same computer.
|
||||
|
||||
|
||||
\section midi Realtime MIDI Control Input:
|
||||
|
||||
On all supported realtime platforms, you can direct realtime MIDI input to the STK Clarinet by typing:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
STK Classes - See the HTML documentation in the html directory for complete information.
|
||||
|
||||
@@ -27,12 +27,14 @@ Stk -| UdpSocket
|
||||
|
|
||||
|- StkFrames
|
||||
|
|
||||
|- Effect - (Echo, Chorus, PitShift, PRCRev, JCRev, NRev)
|
||||
|- Effect - (Echo, Chorus, PitShift, LentPitShift, PRCRev, JCRev, NRev, FreeVerb)
|
||||
|
|
||||
|- Voicer, Message, Skini, MidiFileIn, Phonemes, Sphere, Vector3D
|
||||
|
|
||||
|- Messager
|
||||
|
|
||||
|- Twang, Guitar
|
||||
|
|
||||
| .- FM - (HevyMetl, PercFlut, Rhodey, Wurley, TubeBell, BeeThree, FMVoices)
|
||||
| |
|
||||
| |- Modal - ModalBar
|
||||
@@ -43,7 +45,7 @@ Stk -| UdpSocket
|
||||
| |
|
||||
| |- Resonate
|
||||
| |
|
||||
| |- PluckedTwo - Mandolin
|
||||
| |- Mandolin
|
||||
.- Instrmnt -|
|
||||
|- Drummer
|
||||
|
|
||||
@@ -115,45 +117,48 @@ Each class is listed either with some of the unit generators it uses,
|
||||
or in terms of the algorithm it implements. All inherit from Instrmnt,
|
||||
which inherits from Stk.
|
||||
|
||||
Simple.cpp Simple Instrument Pulse oscillator + resonant filtered noise
|
||||
Plucked.cpp Basic Plucked String DelayA, OneZero, OnePole, Noise
|
||||
StifKarp.cpp Plucked String with Stiffness DelayA, DelayL, OneZero, BiQuad, Noise
|
||||
PluckTwo.cpp Not So Basic Pluck DelayL, DlineA, OneZero
|
||||
Mandolin.cpp Commuted Mandolin <<flavor of PluckTwo>>
|
||||
Bowed.cpp So So Bowed String DelayL, BowTabl, OnePole, BiQuad, WaveLoop, ADSR
|
||||
Brass.cpp Not So Bad Brass Instrument DelayA, BiQuad, PoleZero, ADSR, WaveLoop
|
||||
Clarinet.cpp Pretty Good Clarinet DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
|
||||
BlowHole.cpp Clarinet w/ Tone & Vent Holes DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop, PoleZero
|
||||
Saxofony.cpp A Faux Saxophone DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
|
||||
Flute.cpp Pretty Good Flute JetTabl, DelayL, OnePole, PoleZero, Noise, ADSR, WaveLoop
|
||||
BlowBotl.cpp Blown Bottle JetTabl, BiQuad, PoleZero, Noise, ADSR, WaveLoop
|
||||
BandedWG.cpp Banded Waveguide Meta-Object Delay, BowTabl, ADSR, BiQuad
|
||||
Modal.cpp N Resonances Envelope, WaveLoop, BiQuad, OnePole
|
||||
ModalBar.cpp Various presets 4 Resonance Models
|
||||
FM.cpp N Operator FM Master ADSR, WaveLoop, TwoZero
|
||||
HevyMetl.cpp Distorted FM Synthesizer 3 Cascade with FB Modulator
|
||||
PercFlut.cpp Percussive Flute 3 Cascade Operators
|
||||
Rhodey.cpp Rhodes-Like Electric Piano 2 Parallel Simple FMs
|
||||
Wurley.cpp Wurlitzer Electric Piano 2 Parallel Simple FMs
|
||||
TubeBell.cpp Classic FM Bell 2 Parallel Simple FMs
|
||||
FMVoices.cpp 3 Formant FM Voice 3 Carriers Share 1 Modulator
|
||||
VoicForm.cpp 4 Formant Voice Synthesis FormSwep, SingWave, OnePole, OneZero, Envelope, Noise
|
||||
BeeThree.cpp Cheezy Additive Organ 4 Oscillators Additive
|
||||
Sampler.cpp Sampling Synthesizer 5 each ADSR, WvIn, WaveLoop, OnePole
|
||||
Moog.cpp Swept Filter Sampler with Swept Filter
|
||||
Resonate.cpp Filtered Noise ADSR, BiQuad, Noise
|
||||
Drummer.cpp Drum Synthesizer Bunch of WvIns, and OnePole
|
||||
Shakers.cpp PhISM statistical model for shakers and real-world sound effects
|
||||
Mesh2D.cpp Two-dimensional, rectilinear digital waveguide mesh.
|
||||
Whistle.cpp Hybrid physical/spectral model of a police whistle.
|
||||
Simple.cpp Simple Instrument Pulse oscillator + resonant filtered noise
|
||||
Plucked.cpp Basic Plucked String DelayA, OneZero, OnePole, Noise
|
||||
Twang.cpp Not So Basic Pluck DelayL, DlineA, Fir, allows commuted synthesis
|
||||
Mandolin.cpp Commuted Mandolin 2 Twangs
|
||||
Guitar.cpp N-String Guitar N Twangs, bridge coupling, allows feedback and body filter
|
||||
StifKarp.cpp Plucked String with Stiffness DelayA, DelayL, OneZero, BiQuad, Noise
|
||||
Bowed.cpp So So Bowed String DelayL, BowTabl, OnePole, BiQuad, WaveLoop, ADSR
|
||||
Brass.cpp Not So Bad Brass Instrument DelayA, BiQuad, PoleZero, ADSR, WaveLoop
|
||||
Clarinet.cpp Pretty Good Clarinet DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
|
||||
BlowHole.cpp Clarinet w/ Tone & Vent Holes DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop, PoleZero
|
||||
Saxofony.cpp A Faux Saxophone DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
|
||||
Flute.cpp Pretty Good Flute JetTabl, DelayL, OnePole, PoleZero, Noise, ADSR, WaveLoop
|
||||
BlowBotl.cpp Blown Bottle JetTabl, BiQuad, PoleZero, Noise, ADSR, WaveLoop
|
||||
BandedWG.cpp Banded Waveguide Meta-Object Delay, BowTabl, ADSR, BiQuad
|
||||
Modal.cpp N Resonances Envelope, WaveLoop, BiQuad, OnePole
|
||||
ModalBar.cpp Various presets 4 Resonance Models
|
||||
FM.cpp N Operator FM Master ADSR, WaveLoop, TwoZero
|
||||
HevyMetl.cpp Distorted FM Synthesizer 3 Cascade with FB Modulator
|
||||
PercFlut.cpp Percussive Flute 3 Cascade Operators
|
||||
Rhodey.cpp Rhodes-Like Electric Piano 2 Parallel Simple FMs
|
||||
Wurley.cpp Wurlitzer Electric Piano 2 Parallel Simple FMs
|
||||
TubeBell.cpp Classic FM Bell 2 Parallel Simple FMs
|
||||
FMVoices.cpp 3 Formant FM Voice 3 Carriers Share 1 Modulator
|
||||
VoicForm.cpp 4 Formant Voice Synthesis FormSwep, SingWave, OnePole, OneZero, Envelope, Noise
|
||||
BeeThree.cpp Cheezy Additive Organ 4 Oscillators Additive
|
||||
Sampler.cpp Sampling Synthesizer 5 each ADSR, WvIn, WaveLoop, OnePole
|
||||
Moog.cpp Swept Filter Sampler with Swept Filter
|
||||
Resonate.cpp Filtered Noise ADSR, BiQuad, Noise
|
||||
Drummer.cpp Drum Synthesizer Bunch of WvIns, and OnePole
|
||||
Shakers.cpp PhISM statistical model for shakers and real-world sound effects
|
||||
Mesh2D.cpp Two-dimensional, rectilinear digital waveguide mesh.
|
||||
Whistle.cpp Hybrid physical/spectral model of a police whistle.
|
||||
|
||||
Effect.h Effects Processor Base Class
|
||||
JCRev.cpp Chowning Reverberator 3 series allpass units, 4 parallel combs, 2 stereo delays
|
||||
NRev.cpp Another famous CCRMA Reverb 8 allpass, 6 parallel comb filters
|
||||
PRCRev.cpp Dirt Cheap Reverb by Cook 2 allpass, 2 comb filters
|
||||
Flanger.cpp Flanger Effects Processor DelayL, WaveLoop
|
||||
Chorus.cpp Chorus Effects Processor DelayL, WaveLoop
|
||||
PitShift.cpp Cheap Pitch Shifter DelayL
|
||||
Effect.h Effects Processor Base Class
|
||||
JCRev.cpp Chowning Reverberator 3 series allpass units, 4 parallel combs, 2 stereo delays
|
||||
NRev.cpp Another famous CCRMA Reverb 8 allpass, 6 parallel comb filters
|
||||
PRCRev.cpp Dirt Cheap Reverb by Cook 2 allpass, 2 comb filters
|
||||
FreeVerb.cpp Jezar at Dreampoint's FreeVerb 4 allpass, 8 lowpass comb filters
|
||||
Flanger.cpp Flanger Effects Processor DelayL, WaveLoop
|
||||
Chorus.cpp Chorus Effects Processor DelayL, WaveLoop
|
||||
PitShift.cpp Cheap Pitch Shifter DelayL
|
||||
LentPitShift.cpp Pitch Shifter based Lent Algorithm
|
||||
|
||||
|
||||
*********** OTHER SUPPORT CLASSES AND FILES **************
|
||||
|
||||
@@ -14,9 +14,10 @@ namespace stk {
|
||||
messages, keeping track of its state. The \e state = ADSR::IDLE
|
||||
before being triggered and after the envelope value reaches 0.0 in
|
||||
the ADSR::RELEASE state. All rate, target and level settings must
|
||||
be non-negative. All time settings must be positive.
|
||||
be non-negative. All time settings are in seconds and must be
|
||||
positive.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -45,22 +46,22 @@ class ADSR : public Generator
|
||||
//! Set target = 0, state = \e ADSR::RELEASE.
|
||||
void keyOff( void );
|
||||
|
||||
//! Set the attack rate.
|
||||
//! Set the attack rate (gain / sample).
|
||||
void setAttackRate( StkFloat rate );
|
||||
|
||||
//! Set the target value for the attack (default = 1.0).
|
||||
void setAttackTarget( StkFloat target );
|
||||
|
||||
//! Set the decay rate.
|
||||
//! Set the decay rate (gain / sample).
|
||||
void setDecayRate( StkFloat rate );
|
||||
|
||||
//! Set the sustain level.
|
||||
void setSustainLevel( StkFloat level );
|
||||
|
||||
//! Set the release rate.
|
||||
//! Set the release rate (gain / sample).
|
||||
void setReleaseRate( StkFloat rate );
|
||||
|
||||
//! Set the attack rate based on a time duration.
|
||||
//! Set the attack rate based on a time duration (seconds).
|
||||
void setAttackTime( StkFloat time );
|
||||
|
||||
//! Set the decay rate based on a time duration (seconds).
|
||||
@@ -69,7 +70,7 @@ class ADSR : public Generator
|
||||
//! Set the release rate based on a time duration (seconds).
|
||||
void setReleaseTime( StkFloat time );
|
||||
|
||||
//! Set sustain level and attack, decay, and release time durations.
|
||||
//! Set sustain level and attack, decay, and release time durations (seconds).
|
||||
void setAllTimes( StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime );
|
||||
|
||||
//! Set a sustain target value and attack or decay from current value to target.
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ 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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace stk {
|
||||
- Vibrato Gain = 1
|
||||
- Volume = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace stk {
|
||||
- Register State = 1
|
||||
- Breath Pressure = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace stk {
|
||||
(1986). The output is an instantaneous
|
||||
reflection coefficient value.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace stk {
|
||||
- Frequency = 101
|
||||
- Volume = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
Contributions by Esteban Maestre, 2011.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace stk {
|
||||
- Vibrato Gain = 1
|
||||
- Volume = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace stk {
|
||||
- Vibrato Gain = 1
|
||||
- Breath Pressure = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef STK_DELAYL_H
|
||||
#define STK_DELAYL_H
|
||||
|
||||
#include "Delay.h"
|
||||
#include "Filter.h"
|
||||
|
||||
namespace stk {
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace stk {
|
||||
|
||||
This class implements an echo effect.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -34,7 +34,7 @@ class Effect : public Stk
|
||||
virtual void clear() = 0;
|
||||
|
||||
//! Set the mixture of input and "effected" levels in the output (0.0 = input only, 1.0 = effect only).
|
||||
void setEffectMix( StkFloat mix );
|
||||
virtual void setEffectMix( StkFloat mix );
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace stk {
|
||||
specified \e rate. It also responds to simple \e keyOn and \e
|
||||
keyOff messages, ramping to 1.0 on keyOn and to 0.0 on keyOff.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -35,7 +35,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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
virtual void normalize( StkFloat peak );
|
||||
|
||||
//! Return the file size in sample frames.
|
||||
virtual unsigned long getSize( void ) const { return data_.frames(); };
|
||||
virtual unsigned long getSize( void ) const { return file_.fileSize(); };
|
||||
|
||||
//! Return the input file sample rate in Hz (not the data read rate).
|
||||
/*!
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -97,7 +97,7 @@ inline StkFloat Filter :: phaseDelay( StkFloat frequency )
|
||||
handleError( StkError::WARNING ); return 0.0;
|
||||
}
|
||||
|
||||
StkFloat omegaT = 2 * M_PI * frequency / Stk::sampleRate();
|
||||
StkFloat omegaT = 2 * PI * frequency / Stk::sampleRate();
|
||||
StkFloat real = 0.0, imag = 0.0;
|
||||
for ( unsigned int i=0; i<b_.size(); i++ ) {
|
||||
real += b_[i] * std::cos( i * omegaT );
|
||||
@@ -115,7 +115,7 @@ inline StkFloat Filter :: phaseDelay( StkFloat frequency )
|
||||
}
|
||||
|
||||
phase -= std::atan2( imag, real );
|
||||
phase = std::fmod( -phase, 2 * M_PI );
|
||||
phase = std::fmod( -phase, 2 * PI );
|
||||
return phase / omegaT;
|
||||
}
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace stk {
|
||||
- Vibrato Gain = 1
|
||||
- Breath Pressure = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
255
include/FreeVerb.h
Normal file
255
include/FreeVerb.h
Normal file
@@ -0,0 +1,255 @@
|
||||
#ifndef STK_FREEVERB_H
|
||||
#define STK_FREEVERB_H
|
||||
|
||||
#include "Effect.h"
|
||||
#include "Delay.h"
|
||||
#include "OnePole.h"
|
||||
|
||||
namespace stk {
|
||||
|
||||
/***********************************************************************/
|
||||
/*! \class FreeVerb
|
||||
\brief Jezar at Dreampoint's FreeVerb, implemented in STK.
|
||||
|
||||
Freeverb is a free and open-source Schroeder reverberator
|
||||
originally implemented in C++. The parameters of the reverberation
|
||||
model are exceptionally well tuned. FreeVerb uses 8
|
||||
lowpass-feedback-comb-filters in parallel, followed by 4 Schroeder
|
||||
allpass filters in series. The input signal can be either mono or
|
||||
stereo, and the output signal is stereo. The delay lengths are
|
||||
optimized for a sample rate of 44100 Hz.
|
||||
|
||||
Ported to STK by Gregory Burlet, 2012.
|
||||
*/
|
||||
/***********************************************************************/
|
||||
|
||||
class FreeVerb : public Effect
|
||||
{
|
||||
public:
|
||||
//! FreeVerb Constructor
|
||||
/*!
|
||||
Initializes the effect with default parameters. Note that these defaults
|
||||
are slightly different than those in the original implementation of
|
||||
FreeVerb [Effect Mix: 0.75; Room Size: 0.75; Damping: 0.25; Width: 1.0;
|
||||
Mode: freeze mode off].
|
||||
*/
|
||||
FreeVerb();
|
||||
|
||||
//! Destructor
|
||||
~FreeVerb();
|
||||
|
||||
//! Set the effect mix [0 = mostly dry, 1 = mostly wet].
|
||||
void setEffectMix( StkFloat mix );
|
||||
|
||||
//! Set the room size (comb filter feedback gain) parameter [0,1].
|
||||
void setRoomSize( StkFloat value );
|
||||
|
||||
//! Get the room size (comb filter feedback gain) parameter.
|
||||
StkFloat getRoomSize( void );
|
||||
|
||||
//! Set the damping parameter [0=low damping, 1=higher damping].
|
||||
void setDamping( StkFloat value );
|
||||
|
||||
//! Get the damping parameter.
|
||||
StkFloat getDamping( void );
|
||||
|
||||
//! Set the width (left-right mixing) parameter [0,1].
|
||||
void setWidth( StkFloat value );
|
||||
|
||||
//! Get the width (left-right mixing) parameter.
|
||||
StkFloat getWidth( void );
|
||||
|
||||
//! Set the mode [frozen = 1, unfrozen = 0].
|
||||
void setMode( bool isFrozen );
|
||||
|
||||
//! Get the current freeze mode [frozen = 1, unfrozen = 0].
|
||||
StkFloat getMode( void );
|
||||
|
||||
//! Clears delay lines, etc.
|
||||
void clear( void );
|
||||
|
||||
//! Return the specified channel value of the last computed stereo frame.
|
||||
/*!
|
||||
Use the lastFrame() function to get both values of the last
|
||||
computed stereo frame. The \c channel argument must be 0 or 1
|
||||
(the first channel is specified by 0). However, range checking is
|
||||
only performed if _STK_DEBUG_ is defined during compilation, in
|
||||
which case an out-of-range value will trigger an StkError
|
||||
exception.
|
||||
*/
|
||||
StkFloat lastOut( unsigned int channel = 0 );
|
||||
|
||||
//! Input one or two samples to the effect and return the specified \c channel value of the computed stereo frame.
|
||||
/*!
|
||||
Use the lastFrame() function to get both values of the computed
|
||||
stereo output frame. The \c channel argument must be 0 or 1 (the
|
||||
first channel is specified by 0). However, range checking is only
|
||||
performed if _STK_DEBUG_ is defined during compilation, in which
|
||||
case an out-of-range value will trigger an StkError exception.
|
||||
*/
|
||||
StkFloat tick( StkFloat inputL, StkFloat inputR = 0.0, unsigned int channel = 0 );
|
||||
|
||||
//! Take two channels of the StkFrames object as inputs to the effect and replace with stereo outputs.
|
||||
/*!
|
||||
The StkFrames argument reference is returned. The stereo
|
||||
inputs are taken from (and written back to) the StkFrames argument
|
||||
starting at the specified \c channel. Therefore, the \c channel
|
||||
argument must be less than ( channels() - 1 ) of the StkFrames
|
||||
argument (the first channel is specified by 0). However, range
|
||||
checking is only performed if _STK_DEBUG_ is defined during
|
||||
compilation, in which case an out-of-range value will trigger an
|
||||
StkError exception.
|
||||
*/
|
||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||
|
||||
//! Take one or two channels of the \c iFrames object as inputs to the effect and write stereo outputs to the \c oFrames object.
|
||||
/*!
|
||||
The \c iFrames object reference is returned. The \c iChannel
|
||||
argument must be less than the number of channels in the \c
|
||||
iFrames argument (the first channel is specified by 0). If more
|
||||
than one channel of data exists in \c iFrames starting from \c
|
||||
iChannel, stereo data is input to the effect. The \c oChannel
|
||||
argument must be less than ( channels() - 1 ) of the \c oFrames
|
||||
argument. However, range checking is only performed if
|
||||
_STK_DEBUG_ is defined during compilation, in which case an
|
||||
out-of-range value will trigger an StkError exception.
|
||||
*/
|
||||
StkFrames& tick( StkFrames& iFrames, StkFrames &oFrames, unsigned int iChannel = 0, unsigned int oChannel = 0 );
|
||||
|
||||
protected:
|
||||
//! Update interdependent parameters.
|
||||
void update( void );
|
||||
|
||||
// Clamp very small floats to zero, version from
|
||||
// http://music.columbia.edu/pipermail/linux-audio-user/2004-July/013489.html .
|
||||
// However, this is for 32-bit floats only.
|
||||
//static inline StkFloat undenormalize( volatile StkFloat s ) {
|
||||
// s += 9.8607615E-32f;
|
||||
// return s - 9.8607615E-32f;
|
||||
//}
|
||||
|
||||
static const int nCombs = 8;
|
||||
static const int nAllpasses = 4;
|
||||
static const int stereoSpread = 23;
|
||||
static const StkFloat fixedGain;
|
||||
static const StkFloat scaleWet;
|
||||
static const StkFloat scaleDry;
|
||||
static const StkFloat scaleDamp;
|
||||
static const StkFloat scaleRoom;
|
||||
static const StkFloat offsetRoom;
|
||||
|
||||
// Delay line lengths for 44100Hz sampling rate.
|
||||
static int cDelayLengths[nCombs];
|
||||
static int aDelayLengths[nAllpasses];
|
||||
|
||||
StkFloat g_; // allpass coefficient
|
||||
StkFloat gain_;
|
||||
StkFloat roomSizeMem_, roomSize_;
|
||||
StkFloat dampMem_, damp_;
|
||||
StkFloat wet1_, wet2_;
|
||||
StkFloat dry_;
|
||||
StkFloat width_;
|
||||
bool frozenMode_;
|
||||
|
||||
// LBFC: Lowpass Feedback Comb Filters
|
||||
Delay combDelayL_[nCombs];
|
||||
Delay combDelayR_[nCombs];
|
||||
OnePole combLPL_[nCombs];
|
||||
OnePole combLPR_[nCombs];
|
||||
|
||||
// AP: Allpass Filters
|
||||
Delay allPassDelayL_[nAllpasses];
|
||||
Delay allPassDelayR_[nAllpasses];
|
||||
};
|
||||
|
||||
inline StkFloat FreeVerb :: lastOut( unsigned int channel )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( channel > 1 ) {
|
||||
oStream_ << "FreeVerb::lastOut(): channel argument must be less than 2!";
|
||||
handleError( StkError::FUNCTION_ARGUMENT );
|
||||
}
|
||||
#endif
|
||||
|
||||
return lastFrame_[channel];
|
||||
}
|
||||
|
||||
inline StkFloat FreeVerb::tick( StkFloat inputL, StkFloat inputR, unsigned int channel )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( channel > 1 ) {
|
||||
oStream_ << "FreeVerb::tick(): channel argument must be less than 2!";
|
||||
handleError(StkError::FUNCTION_ARGUMENT);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !inputR ) {
|
||||
inputR = inputL;
|
||||
}
|
||||
|
||||
StkFloat fInput = (inputL + inputR) * gain_;
|
||||
StkFloat outL = 0.0;
|
||||
StkFloat outR = 0.0;
|
||||
|
||||
// Parallel LBCF filters
|
||||
for ( int i = 0; i < nCombs; i++ ) {
|
||||
// Left channel
|
||||
//StkFloat yn = fInput + (roomSize_ * FreeVerb::undenormalize(combLPL_[i].tick(FreeVerb::undenormalize(combDelayL_[i].nextOut()))));
|
||||
StkFloat yn = fInput + (roomSize_ * combLPL_[i].tick( combDelayL_[i].nextOut() ) );
|
||||
combDelayL_[i].tick(yn);
|
||||
outL += yn;
|
||||
|
||||
// Right channel
|
||||
//yn = fInput + (roomSize_ * FreeVerb::undenormalize(combLPR_[i].tick(FreeVerb::undenormalize(combDelayR_[i].nextOut()))));
|
||||
yn = fInput + (roomSize_ * combLPR_[i].tick( combDelayR_[i].nextOut() ) );
|
||||
combDelayR_[i].tick(yn);
|
||||
outR += yn;
|
||||
}
|
||||
|
||||
// Series allpass filters
|
||||
for ( int i = 0; i < nAllpasses; i++ ) {
|
||||
// Left channel
|
||||
//StkFloat vn_m = FreeVerb::undenormalize(allPassDelayL_[i].nextOut());
|
||||
StkFloat vn_m = allPassDelayL_[i].nextOut();
|
||||
StkFloat vn = outL + (g_ * vn_m);
|
||||
allPassDelayL_[i].tick(vn);
|
||||
|
||||
// calculate output
|
||||
outL = -vn + (1.0 + g_)*vn_m;
|
||||
|
||||
// Right channel
|
||||
//vn_m = FreeVerb::undenormalize(allPassDelayR_[i].nextOut());
|
||||
vn_m = allPassDelayR_[i].nextOut();
|
||||
vn = outR + (g_ * vn_m);
|
||||
allPassDelayR_[i].tick(vn);
|
||||
|
||||
// calculate output
|
||||
outR = -vn + (1.0 + g_)*vn_m;
|
||||
}
|
||||
|
||||
// Mix output
|
||||
lastFrame_[0] = outL*wet1_ + outR*wet2_ + inputL*dry_;
|
||||
lastFrame_[1] = outR*wet1_ + outL*wet2_ + inputR*dry_;
|
||||
|
||||
/*
|
||||
// Hard limiter ... there's not much else we can do at this point
|
||||
if ( lastFrame_[0] >= 1.0 ) {
|
||||
lastFrame_[0] = 0.9999;
|
||||
}
|
||||
if ( lastFrame_[0] <= -1.0 ) {
|
||||
lastFrame_[0] = -0.9999;
|
||||
}
|
||||
if ( lastFrame_[1] >= 1.0 ) {
|
||||
lastFrame_[1] = 0.9999;
|
||||
}
|
||||
if ( lastFrame_[1] <= -1.0 ) {
|
||||
lastFrame_[1] = -0.9999;
|
||||
}
|
||||
*/
|
||||
|
||||
return lastFrame_[channel];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
199
include/Guitar.h
Normal file
199
include/Guitar.h
Normal file
@@ -0,0 +1,199 @@
|
||||
#ifndef STK_GUITAR_H
|
||||
#define STK_GUITAR_H
|
||||
|
||||
#include "Stk.h"
|
||||
#include "Twang.h"
|
||||
#include "OnePole.h"
|
||||
#include "OneZero.h"
|
||||
|
||||
namespace stk {
|
||||
|
||||
/***************************************************/
|
||||
/*! \class Guitar
|
||||
\brief STK guitar model class.
|
||||
|
||||
This class implements a guitar model with an arbitrary number of
|
||||
strings (specified during instantiation). Each string is
|
||||
represented by an stk::Twang object. The model supports commuted
|
||||
synthesis, as discussed by Smith and Karjalainen. It also includes
|
||||
a basic body coupling model and supports feedback.
|
||||
|
||||
This class does not attempt voice management. Rather, most
|
||||
functions support a parameter to specify a particular string
|
||||
number and string (voice) management is assumed to occur
|
||||
externally. Note that this class does not inherit from
|
||||
stk::Instrmnt because of API inconsistencies.
|
||||
|
||||
This is a digital waveguide model, making its use possibly subject
|
||||
to patents held by Stanford University, Yamaha, and others.
|
||||
|
||||
Control Change Numbers:
|
||||
- Bridge Coupling Gain = 2
|
||||
- Pluck Position = 4
|
||||
- Loop Gain = 11
|
||||
- Coupling Filter Pole = 1
|
||||
- Pick Filter Pole = 128
|
||||
|
||||
by Gary P. Scavone, 2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
class Guitar : public Stk
|
||||
{
|
||||
public:
|
||||
//! Class constructor, specifying an arbitrary number of strings (default = 6).
|
||||
Guitar( unsigned int nStrings = 6, std::string bodyfile = "" );
|
||||
|
||||
//! Reset and clear all internal state.
|
||||
void clear( void );
|
||||
|
||||
//! Set the string excitation, using either a soundfile or computed noise.
|
||||
/*!
|
||||
If no argument is provided, the std::string is empty, or an error
|
||||
occurs reading the file data, an enveloped noise signal will be
|
||||
generated for use as the pluck excitation.
|
||||
*/
|
||||
void setBodyFile( std::string bodyfile = "" );
|
||||
|
||||
//! Set the pluck position for one or all strings.
|
||||
/*!
|
||||
If the \c string argument is < 0, the pluck position is set
|
||||
for all strings.
|
||||
*/
|
||||
void setPluckPosition( StkFloat position, int string = -1 );
|
||||
|
||||
//! Set the loop gain for one or all strings.
|
||||
/*!
|
||||
If the \c string argument is < 0, the loop gain is set for all
|
||||
strings.
|
||||
*/
|
||||
void setLoopGain( StkFloat gain, int string = -1 );
|
||||
|
||||
//! Set instrument parameters for a particular frequency.
|
||||
void setFrequency( StkFloat frequency, unsigned int string = 0 );
|
||||
|
||||
//! Start a note with the given frequency and amplitude.
|
||||
/*!
|
||||
If the \c amplitude parameter is less than 0.2, the string will
|
||||
be undamped but it will not be "plucked."
|
||||
*/
|
||||
void noteOn( StkFloat frequency, StkFloat amplitude, unsigned int string = 0 );
|
||||
|
||||
//! Stop a note with the given amplitude (speed of decay).
|
||||
void noteOff( StkFloat amplitude, unsigned int string = 0 );
|
||||
|
||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||
/*!
|
||||
If the \c string argument is < 0, then the control change is
|
||||
applied to all strings (if appropriate).
|
||||
*/
|
||||
void controlChange( int number, StkFloat value, int string = -1 );
|
||||
|
||||
//! Return the last computed output value.
|
||||
StkFloat lastOut( void ) { return lastFrame_[0]; };
|
||||
|
||||
//! Take an optional input sample and compute one output sample.
|
||||
StkFloat tick( StkFloat input = 0.0 );
|
||||
|
||||
//! Take a channel of the \c iFrames object as inputs to the class and write outputs to the \c oFrames object.
|
||||
/*!
|
||||
The \c iFrames object reference is returned. Each channel
|
||||
argument must be less than the number of channels in the
|
||||
corresponding StkFrames argument (the first channel is specified
|
||||
by 0). However, range checking is only performed if _STK_DEBUG_
|
||||
is defined during compilation, in which case an out-of-range value
|
||||
will trigger an StkError exception.
|
||||
*/
|
||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||
|
||||
//! Take a channel of the \c iFrames object as inputs to the effect and write outputs to the \c oFrames object.
|
||||
/*!
|
||||
The \c iFrames object reference is returned. Each channel
|
||||
argument must be less than the number of channels in the
|
||||
corresponding StkFrames argument (the first channel is specified
|
||||
by 0). However, range checking is only performed if _STK_DEBUG_
|
||||
is defined during compilation, in which case an out-of-range value
|
||||
will trigger an StkError exception.
|
||||
*/
|
||||
StkFrames& tick( StkFrames& iFrames, StkFrames &oFrames, unsigned int iChannel = 0, unsigned int oChannel = 0 );
|
||||
|
||||
protected:
|
||||
|
||||
std::vector< stk::Twang > strings_;
|
||||
std::vector< int > stringState_; // 0 = off, 1 = decaying, 2 = on
|
||||
std::vector< unsigned int > decayCounter_;
|
||||
std::vector< unsigned int > filePointer_;
|
||||
std::vector< StkFloat > pluckGains_;
|
||||
|
||||
OnePole pickFilter_;
|
||||
OnePole couplingFilter_;
|
||||
StkFloat couplingGain_;
|
||||
StkFrames excitation_;
|
||||
StkFrames lastFrame_;
|
||||
};
|
||||
|
||||
inline StkFloat Guitar :: tick( StkFloat input )
|
||||
{
|
||||
StkFloat temp, output = 0.0;
|
||||
lastFrame_[0] /= strings_.size(); // evenly spread coupling across strings
|
||||
for ( unsigned int i=0; i<strings_.size(); i++ ) {
|
||||
if ( stringState_[i] ) {
|
||||
temp = input;
|
||||
// If pluckGain < 0.2, let string ring but don't pluck it.
|
||||
if ( filePointer_[i] < excitation_.frames() && pluckGains_[i] > 0.2 )
|
||||
temp += pluckGains_[i] * excitation_[filePointer_[i]++];
|
||||
temp += couplingGain_ * couplingFilter_.tick( lastFrame_[0] ); // bridge coupling
|
||||
output += strings_[i].tick( temp );
|
||||
// Check if string energy has decayed sufficiently to turn it off.
|
||||
if ( stringState_[i] == 1 ) {
|
||||
if ( fabs( strings_[i].lastOut() ) < 0.001 ) decayCounter_[i]++;
|
||||
else decayCounter_[i] = 0;
|
||||
if ( decayCounter_[i] > (unsigned int) floor( 0.1 * Stk::sampleRate() ) ) {
|
||||
stringState_[i] = 0;
|
||||
decayCounter_[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lastFrame_[0] = output;
|
||||
}
|
||||
|
||||
inline StkFrames& Guitar :: tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( channel >= frames.channels() ) {
|
||||
oStream_ << "Guitar::tick(): channel and StkFrames arguments are incompatible!";
|
||||
handleError( StkError::FUNCTION_ARGUMENT );
|
||||
}
|
||||
#endif
|
||||
|
||||
StkFloat *samples = &frames[channel];
|
||||
unsigned int hop = frames.channels();
|
||||
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
|
||||
*samples = tick( *samples );
|
||||
|
||||
return frames;
|
||||
}
|
||||
|
||||
inline StkFrames& Guitar :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned int iChannel, unsigned int oChannel )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
|
||||
oStream_ << "Guitar::tick(): channel and StkFrames arguments are incompatible!";
|
||||
handleError( StkError::FUNCTION_ARGUMENT );
|
||||
}
|
||||
#endif
|
||||
|
||||
StkFloat *iSamples = &iFrames[iChannel];
|
||||
StkFloat *oSamples = &oFrames[oChannel];
|
||||
unsigned int iHop = iFrames.channels(), oHop = oFrames.channels();
|
||||
for ( unsigned int i=0; i<iFrames.frames(); i++, iSamples += iHop, oSamples += oHop )
|
||||
*oSamples = tick( *iSamples );
|
||||
|
||||
return iFrames;
|
||||
}
|
||||
|
||||
} // stk namespace
|
||||
|
||||
#endif
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef STK_LENLentPitShift_H
|
||||
#define STK_LENLentPitShift_H
|
||||
#ifndef STK_LENTPITSHIFT_H
|
||||
#define STK_LENTPITSHIFT_H
|
||||
|
||||
#include "Effect.h"
|
||||
#include "Delay.h"
|
||||
@@ -25,13 +25,9 @@ class LentPitShift : public Effect
|
||||
|
||||
~LentPitShift( void ) {
|
||||
delete window;
|
||||
window = NULL;
|
||||
delete dt;
|
||||
dt = NULL;
|
||||
delete dpt;
|
||||
dpt = NULL;
|
||||
delete cumDt;
|
||||
cumDt = NULL;
|
||||
}
|
||||
|
||||
//! Reset and clear all internal state.
|
||||
@@ -70,7 +66,7 @@ class LentPitShift : public Effect
|
||||
//! Apply the effect on the input samples and store it.
|
||||
/*!
|
||||
The samples stored in the input frame vector are processed
|
||||
and the delayed result are stored in the output frame vector
|
||||
and the delayed result are stored in the output frame vector.
|
||||
*/
|
||||
void process( );
|
||||
|
||||
@@ -195,8 +191,8 @@ inline void LentPitShift::process()
|
||||
for ( unsigned int j=0; j<2*lastPeriod_; j++,M--,N-- ) {
|
||||
sample = inputLine_.tapOut(M) * window[j] / 2.;
|
||||
// Linear interpolation
|
||||
outputLine_.addTo(N, env[0] * sample);
|
||||
outputLine_.addTo(N-1, env[1] * sample);
|
||||
outputLine_.addTo(env[0] * sample, N);
|
||||
outputLine_.addTo(env[1] * sample, N-1);
|
||||
}
|
||||
outputPtr = outputPtr + lastPeriod_ * periodRatio_; // new output pointer
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace stk {
|
||||
- String Detuning = 1
|
||||
- Microphone Position = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace stk {
|
||||
- Two Fixed = 7
|
||||
- Clump = 8
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace stk {
|
||||
modulations to give a nice, natural human
|
||||
modulation function.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace stk {
|
||||
- Vibrato Gain = 1
|
||||
- Gain = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define STK_NOISE_H
|
||||
|
||||
#include "Generator.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace stk {
|
||||
|
||||
@@ -13,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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace stk {
|
||||
This class implements a simple pitch shifter
|
||||
using delay lines.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace stk {
|
||||
Stanford, bearing the names of Karplus and/or
|
||||
Strong.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace stk {
|
||||
- Zero Radii = 1
|
||||
- Envelope Gain = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
|
||||
|
||||
RtAudio: realtime audio i/o C++ classes
|
||||
Copyright (c) 2001-2011 Gary P. Scavone
|
||||
Copyright (c) 2001-2012 Gary P. Scavone
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
@@ -42,7 +42,7 @@
|
||||
\file RtAudio.h
|
||||
*/
|
||||
|
||||
// RtAudio: Version 4.0.10
|
||||
// RtAudio: Version 4.0.11
|
||||
|
||||
#ifndef __RTAUDIO_H
|
||||
#define __RTAUDIO_H
|
||||
@@ -210,6 +210,7 @@ class RtAudio
|
||||
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. */
|
||||
@@ -511,7 +512,7 @@ class RtAudio
|
||||
typedef unsigned long ThreadHandle;
|
||||
typedef CRITICAL_SECTION StreamMutex;
|
||||
|
||||
#elif defined(__LINUX_ALSA__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)
|
||||
#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>
|
||||
|
||||
@@ -552,7 +553,7 @@ struct CallbackInfo {
|
||||
// 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, RtApiAl, RtApiDs, or RtApiAsio).
|
||||
// RtApiJack, RtApiCore, RtApiDs, or RtApiAsio).
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
@@ -599,6 +600,7 @@ protected:
|
||||
|
||||
enum StreamState {
|
||||
STREAM_STOPPED,
|
||||
STREAM_STOPPING,
|
||||
STREAM_RUNNING,
|
||||
STREAM_CLOSED = -50
|
||||
};
|
||||
@@ -911,6 +913,38 @@ public:
|
||||
|
||||
#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
|
||||
|
||||
601
include/RtMidi.h
601
include/RtMidi.h
@@ -8,7 +8,7 @@
|
||||
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
|
||||
|
||||
RtMidi: realtime MIDI i/o C++ classes
|
||||
Copyright (c) 2003-2011 Gary P. Scavone
|
||||
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
|
||||
@@ -22,8 +22,9 @@
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Any person wishing to distribute modifications to the Software is
|
||||
requested to send the modifications to the original developer so that
|
||||
they can be incorporated into the canonical version.
|
||||
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
|
||||
@@ -35,18 +36,42 @@
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
// RtMidi: Version 1.0.15
|
||||
/*!
|
||||
\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;
|
||||
|
||||
@@ -62,19 +87,13 @@ class RtMidi
|
||||
//! 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();
|
||||
RtMidi() {};
|
||||
virtual ~RtMidi() {};
|
||||
|
||||
// A basic error reporting function for internal use in the RtMidi
|
||||
// subclasses. The behavior of this function can be modified to
|
||||
// suit specific needs.
|
||||
void error( RtError::Type type );
|
||||
|
||||
void *apiData_;
|
||||
bool connected_;
|
||||
std::string errorString_;
|
||||
};
|
||||
|
||||
/**********************************************************************/
|
||||
@@ -91,11 +110,26 @@ class RtMidi
|
||||
to open a virtual input port to which other MIDI software clients
|
||||
can connect.
|
||||
|
||||
by Gary P. Scavone, 2003-2008.
|
||||
by Gary P. Scavone, 2003-2012.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
#include <vector>
|
||||
// **************************************************************** //
|
||||
//
|
||||
// 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
|
||||
{
|
||||
@@ -104,48 +138,57 @@ class RtMidiIn : public RtMidi
|
||||
//! User callback function type definition.
|
||||
typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData);
|
||||
|
||||
//! Default constructor that allows an optional client name and queue size.
|
||||
//! 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.
|
||||
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( const std::string clientName = std::string( "RtMidi Input Client"), unsigned int queueSizeLimit = 100 );
|
||||
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();
|
||||
~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.
|
||||
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" ) );
|
||||
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).
|
||||
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.
|
||||
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.
|
||||
Subsequent incoming MIDI messages will be written to the queue
|
||||
and can be retrieved with the \e getMessage function.
|
||||
*/
|
||||
void cancelCallback();
|
||||
|
||||
@@ -157,30 +200,148 @@ class RtMidiIn : public RtMidi
|
||||
|
||||
//! Return a string identifier for the specified MIDI input port number.
|
||||
/*!
|
||||
An empty string is returned if an invalid port specifier is provided.
|
||||
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.
|
||||
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.
|
||||
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 {
|
||||
@@ -188,8 +349,8 @@ o By default, MIDI timing and active sensing messages are ignored
|
||||
double timeStamp;
|
||||
|
||||
// Default constructor.
|
||||
MidiMessage()
|
||||
:bytes(0), timeStamp(0.0) {}
|
||||
MidiMessage()
|
||||
:bytes(0), timeStamp(0.0) {}
|
||||
};
|
||||
|
||||
struct MidiQueue {
|
||||
@@ -197,11 +358,11 @@ o By default, MIDI timing and active sensing messages are ignored
|
||||
unsigned int back;
|
||||
unsigned int size;
|
||||
unsigned int ringSize;
|
||||
MidiMessage *ring;
|
||||
MidiMessage *ring;
|
||||
|
||||
// Default constructor.
|
||||
MidiQueue()
|
||||
:front(0), back(0), size(0), ringSize(0) {}
|
||||
MidiQueue()
|
||||
:front(0), back(0), size(0), ringSize(0) {}
|
||||
};
|
||||
|
||||
// The RtMidiInData structure is used to pass private class data to
|
||||
@@ -219,88 +380,296 @@ o By default, MIDI timing and active sensing messages are ignored
|
||||
bool continueSysex;
|
||||
|
||||
// Default constructor.
|
||||
RtMidiInData()
|
||||
: ignoreFlags(7), doInput(false), firstMessage(true),
|
||||
apiData(0), usingCallback(false), userCallback(0), userData(0),
|
||||
continueSysex(false) {}
|
||||
RtMidiInData()
|
||||
: ignoreFlags(7), doInput(false), firstMessage(true),
|
||||
apiData(0), usingCallback(false), userCallback(0), userData(0),
|
||||
continueSysex(false) {}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
void initialize( const std::string& clientName );
|
||||
protected:
|
||||
virtual void initialize( const std::string& clientName ) = 0;
|
||||
RtMidiInData inputData_;
|
||||
|
||||
void *apiData_;
|
||||
bool connected_;
|
||||
std::string errorString_;
|
||||
};
|
||||
|
||||
/**********************************************************************/
|
||||
/*! \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.
|
||||
|
||||
by Gary P. Scavone, 2003-2008.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
class RtMidiOut : public RtMidi
|
||||
class MidiOutApi
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor that allows an optional client name.
|
||||
/*!
|
||||
An exception will be thrown if a MIDI system initialization error occurs.
|
||||
*/
|
||||
RtMidiOut( const std::string clientName = std::string( "RtMidi Output Client" ) );
|
||||
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;
|
||||
|
||||
//! The destructor closes any open MIDI connections.
|
||||
~RtMidiOut();
|
||||
protected:
|
||||
virtual void initialize( const std::string& clientName ) = 0;
|
||||
|
||||
//! 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" ) );
|
||||
void *apiData_;
|
||||
bool connected_;
|
||||
std::string errorString_;
|
||||
};
|
||||
|
||||
//! Close an open MIDI connection (if one exists).
|
||||
void closePort();
|
||||
// **************************************************************** //
|
||||
//
|
||||
// Inline RtMidiIn and RtMidiOut definitions.
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
//! 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" ) );
|
||||
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 ); }
|
||||
|
||||
//! Return the number of available MIDI output ports.
|
||||
unsigned int getPortCount();
|
||||
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 ); }
|
||||
|
||||
//! 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 );
|
||||
// **************************************************************** //
|
||||
//
|
||||
// MidiInApi and MidiOutApi subclass prototypes.
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
//! 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.
|
||||
*/
|
||||
#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 );
|
||||
|
||||
private:
|
||||
|
||||
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
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
where <name> is the string used in the SKINI stream.
|
||||
|
||||
by Perry R. Cook, 1995-2011.
|
||||
by Perry R. Cook, 1995-2012.
|
||||
*/
|
||||
/*********************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace stk {
|
||||
- Vibrato Gain = 1
|
||||
- Breath Pressure = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#define STK_SHAKERS_H
|
||||
|
||||
#include "Instrmnt.h"
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace stk {
|
||||
|
||||
@@ -9,67 +11,57 @@ namespace stk {
|
||||
/*! \class Shakers
|
||||
\brief PhISEM and PhOLIES class.
|
||||
|
||||
PhISEM (Physically Informed Stochastic Event
|
||||
Modeling) is an algorithmic approach for
|
||||
simulating collisions of multiple independent
|
||||
sound producing objects. This class is a
|
||||
meta-model that can simulate a Maraca, Sekere,
|
||||
Cabasa, Bamboo Wind Chimes, Water Drops,
|
||||
Tambourine, Sleighbells, and a Guiro.
|
||||
PhISEM (Physically Informed Stochastic Event Modeling) is an
|
||||
algorithmic approach for simulating collisions of multiple
|
||||
independent sound producing objects. This class is a meta-model
|
||||
that can simulate a Maraca, Sekere, Cabasa, Bamboo Wind Chimes,
|
||||
Water Drops, Tambourine, Sleighbells, and a Guiro.
|
||||
|
||||
PhOLIES (Physically-Oriented Library of
|
||||
Imitated Environmental Sounds) is a similar
|
||||
approach for the synthesis of environmental
|
||||
sounds. This class implements simulations of
|
||||
breaking sticks, crunchy snow (or not), a
|
||||
wrench, sandpaper, and more.
|
||||
PhOLIES (Physically-Oriented Library of Imitated Environmental
|
||||
Sounds) is a similar approach for the synthesis of environmental
|
||||
sounds. This class implements simulations of breaking sticks,
|
||||
crunchy snow (or not), a wrench, sandpaper, and more.
|
||||
|
||||
Control Change Numbers:
|
||||
- Shake Energy = 2
|
||||
- System Decay = 4
|
||||
- Number Of Objects = 11
|
||||
- Resonance Frequency = 1
|
||||
- Shake Energy = 128
|
||||
- Instrument Selection = 1071
|
||||
- Maraca = 0
|
||||
- Cabasa = 1
|
||||
- Sekere = 2
|
||||
- Guiro = 3
|
||||
- Water Drops = 4
|
||||
- Bamboo Chimes = 5
|
||||
- Tambourine = 6
|
||||
- Sleigh Bells = 7
|
||||
- Sticks = 8
|
||||
- Crunch = 9
|
||||
- Wrench = 10
|
||||
- Sand Paper = 11
|
||||
- Coke Can = 12
|
||||
- Next Mug = 13
|
||||
- Penny + Mug = 14
|
||||
- Nickle + Mug = 15
|
||||
- Dime + Mug = 16
|
||||
- Quarter + Mug = 17
|
||||
- Franc + Mug = 18
|
||||
- Peso + Mug = 19
|
||||
- Big Rocks = 20
|
||||
- Little Rocks = 21
|
||||
- Tuned Bamboo Chimes = 22
|
||||
- Shake Energy = 2
|
||||
- System Decay = 4
|
||||
- Number Of Objects = 11
|
||||
- Resonance Frequency = 1
|
||||
- Shake Energy = 128
|
||||
- Instrument Selection = 1071
|
||||
- Maraca = 0
|
||||
- Cabasa = 1
|
||||
- Sekere = 2
|
||||
- Tambourine = 3
|
||||
- Sleigh Bells = 4
|
||||
- Bamboo Chimes = 5
|
||||
- Sand Paper = 6
|
||||
- Coke Can = 7
|
||||
- Sticks = 8
|
||||
- Crunch = 9
|
||||
- Big Rocks = 10
|
||||
- Little Rocks = 11
|
||||
- Next Mug = 12
|
||||
- Penny + Mug = 13
|
||||
- Nickle + Mug = 14
|
||||
- Dime + Mug = 15
|
||||
- Quarter + Mug = 16
|
||||
- Franc + Mug = 17
|
||||
- Peso + Mug = 18
|
||||
- Guiro = 19
|
||||
- Wrench = 20
|
||||
- Water Drops = 21
|
||||
- Tuned Bamboo Chimes = 22
|
||||
|
||||
by Perry R. Cook, 1995-2011.
|
||||
by Perry R. Cook with updates by Gary Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
const int MAX_FREQS = 8;
|
||||
const int NUM_INSTR = 24;
|
||||
|
||||
class Shakers : public Instrmnt
|
||||
{
|
||||
public:
|
||||
//! Class constructor.
|
||||
Shakers( void );
|
||||
|
||||
//! Class destructor.
|
||||
~Shakers( void );
|
||||
//! Class constructor taking instrument type argument.
|
||||
Shakers( int type = 0 );
|
||||
|
||||
//! Start a note with the given instrument and amplitude.
|
||||
/*!
|
||||
@@ -97,45 +89,217 @@ class Shakers : public Instrmnt
|
||||
*/
|
||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||
|
||||
struct BiQuad {
|
||||
StkFloat gain;
|
||||
StkFloat b[3];
|
||||
StkFloat a[3]; // a0 term assumed equal to 1.0
|
||||
StkFloat inputs[3];
|
||||
StkFloat outputs[3];
|
||||
|
||||
// Default constructor.
|
||||
BiQuad()
|
||||
{
|
||||
gain = 0.0;
|
||||
for ( int i=0; i<3; i++ ) {
|
||||
b[i] = 0.0;
|
||||
a[i] = 0.0;
|
||||
inputs[i] = 0.0;
|
||||
outputs[i] = 0.0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
int setupName( char* instr );
|
||||
int setupNum( int inst );
|
||||
int setFreqAndReson( int which, StkFloat freq, StkFloat reson );
|
||||
void setDecays( StkFloat sndDecay, StkFloat sysDecay );
|
||||
void setFinalZs( StkFloat z0, StkFloat z1, StkFloat z2 );
|
||||
StkFloat wuter_tick( void );
|
||||
StkFloat tbamb_tick( void );
|
||||
StkFloat ratchet_tick( void );
|
||||
void setType( int type );
|
||||
void setResonance( BiQuad &filter, StkFloat frequency, StkFloat radius );
|
||||
StkFloat tickResonance( BiQuad &filter, StkFloat input );
|
||||
void setEqualization( StkFloat b0, StkFloat b1, StkFloat b2 );
|
||||
StkFloat tickEqualize( StkFloat input );
|
||||
int randomInt( int max );
|
||||
StkFloat randomFloat( StkFloat max = 1.0 );
|
||||
StkFloat noise( void );
|
||||
void waterDrop( void );
|
||||
|
||||
int instType_;
|
||||
int ratchetPos_, lastRatchetPos_;
|
||||
int shakerType_;
|
||||
unsigned int nResonances_;
|
||||
StkFloat shakeEnergy_;
|
||||
StkFloat inputs_[MAX_FREQS];
|
||||
StkFloat outputs_[MAX_FREQS][2];
|
||||
StkFloat coeffs_[MAX_FREQS][2];
|
||||
StkFloat sndLevel_;
|
||||
StkFloat baseGain_;
|
||||
StkFloat gains_[MAX_FREQS];
|
||||
int nFreqs_;
|
||||
StkFloat t_center_freqs_[MAX_FREQS];
|
||||
StkFloat center_freqs_[MAX_FREQS];
|
||||
StkFloat resons_[MAX_FREQS];
|
||||
StkFloat freq_rand_[MAX_FREQS];
|
||||
int freqalloc_[MAX_FREQS];
|
||||
StkFloat soundDecay_;
|
||||
StkFloat systemDecay_;
|
||||
StkFloat nObjects_;
|
||||
StkFloat totalEnergy_;
|
||||
StkFloat ratchet_, ratchetDelta_;
|
||||
StkFloat finalZ_[3];
|
||||
StkFloat finalZCoeffs_[3];
|
||||
StkFloat defObjs_[NUM_INSTR];
|
||||
StkFloat defDecays_[NUM_INSTR];
|
||||
StkFloat decayScale_[NUM_INSTR];
|
||||
StkFloat sndLevel_;
|
||||
StkFloat baseGain_;
|
||||
StkFloat currentGain_;
|
||||
StkFloat baseDecay_;
|
||||
StkFloat baseObjects_;
|
||||
StkFloat decayScale_;
|
||||
BiQuad equalizer_;
|
||||
StkFloat ratchetCount_;
|
||||
StkFloat ratchetDelta_;
|
||||
StkFloat baseRatchetDelta_;
|
||||
int lastRatchetValue_;
|
||||
|
||||
std::vector< BiQuad > filters_;
|
||||
std::vector< StkFloat > baseFrequencies_;
|
||||
std::vector< StkFloat > baseRadii_;
|
||||
std::vector< bool > doVaryFrequency_;
|
||||
std::vector< StkFloat > tempFrequencies_;
|
||||
StkFloat varyFactor_;
|
||||
};
|
||||
|
||||
inline void Shakers :: setResonance( BiQuad &filter, StkFloat frequency, StkFloat radius )
|
||||
{
|
||||
filter.a[1] = -2.0 * radius * cos( TWO_PI * frequency / Stk::sampleRate());
|
||||
filter.a[2] = radius * radius;
|
||||
}
|
||||
|
||||
inline StkFloat Shakers :: tickResonance( BiQuad &filter, StkFloat input )
|
||||
{
|
||||
filter.outputs[0] = input * filter.gain * currentGain_;
|
||||
filter.outputs[0] -= filter.a[1] * filter.outputs[1] + filter.a[2] * filter.outputs[2];
|
||||
filter.outputs[2] = filter.outputs[1];
|
||||
filter.outputs[1] = filter.outputs[0];
|
||||
return filter.outputs[0];
|
||||
}
|
||||
|
||||
inline void Shakers :: setEqualization( StkFloat b0, StkFloat b1, StkFloat b2 )
|
||||
{
|
||||
equalizer_.b[0] = b0;
|
||||
equalizer_.b[1] = b1;
|
||||
equalizer_.b[2] = b2;
|
||||
}
|
||||
|
||||
inline StkFloat Shakers :: tickEqualize( StkFloat input )
|
||||
{
|
||||
equalizer_.inputs[0] = input;
|
||||
equalizer_.outputs[0] = equalizer_.b[0] * equalizer_.inputs[0] + equalizer_.b[1] * equalizer_.inputs[1] + equalizer_.b[2] * equalizer_.inputs[2];
|
||||
equalizer_.inputs[2] = equalizer_.inputs[1];
|
||||
equalizer_.inputs[1] = equalizer_.inputs[0];
|
||||
return equalizer_.outputs[0];
|
||||
}
|
||||
|
||||
inline int Shakers :: randomInt( int max ) // Return random integer between 0 and max-1
|
||||
{
|
||||
return (int) ((float)max * rand() / (RAND_MAX + 1.0) );
|
||||
}
|
||||
|
||||
inline StkFloat Shakers :: randomFloat( StkFloat max ) // Return random float between 0.0 and max
|
||||
{
|
||||
return (StkFloat) (max * rand() / (RAND_MAX + 1.0) );
|
||||
}
|
||||
|
||||
inline StkFloat Shakers :: noise( void ) // Return random StkFloat float between -1.0 and 1.0
|
||||
{
|
||||
return ( (StkFloat) ( 2.0 * rand() / (RAND_MAX + 1.0) ) - 1.0 );
|
||||
}
|
||||
|
||||
const StkFloat MIN_ENERGY = 0.001;
|
||||
const StkFloat WATER_FREQ_SWEEP = 1.0001;
|
||||
|
||||
inline void Shakers :: waterDrop( void )
|
||||
{
|
||||
if ( randomInt( 32767 ) < nObjects_) {
|
||||
sndLevel_ = shakeEnergy_;
|
||||
unsigned int j = randomInt( 3 );
|
||||
if ( j == 0 && filters_[0].gain == 0.0 ) { // don't change unless fully decayed
|
||||
tempFrequencies_[0] = baseFrequencies_[1] * (0.75 + (0.25 * noise()));
|
||||
filters_[0].gain = fabs( noise() );
|
||||
}
|
||||
else if (j == 1 && filters_[1].gain == 0.0) {
|
||||
tempFrequencies_[1] = baseFrequencies_[1] * (1.0 + (0.25 * noise()));
|
||||
filters_[1].gain = fabs( noise() );
|
||||
}
|
||||
else if ( filters_[2].gain == 0.0 ) {
|
||||
tempFrequencies_[2] = baseFrequencies_[1] * (1.25 + (0.25 * noise()));
|
||||
filters_[2].gain = fabs( noise() );
|
||||
}
|
||||
}
|
||||
|
||||
// Sweep center frequencies.
|
||||
for ( unsigned int i=0; i<3; i++ ) { // WATER_RESONANCES = 3
|
||||
filters_[i].gain *= baseRadii_[i];
|
||||
if ( filters_[i].gain > 0.001 ) {
|
||||
tempFrequencies_[i] *= WATER_FREQ_SWEEP;
|
||||
filters_[i].a[1] = -2.0 * baseRadii_[i] * cos( TWO_PI * tempFrequencies_[i] / Stk::sampleRate() );
|
||||
}
|
||||
else
|
||||
filters_[i].gain = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
inline StkFloat Shakers :: tick( unsigned int )
|
||||
{
|
||||
unsigned int iTube = 0;
|
||||
StkFloat input = 0.0;
|
||||
if ( shakerType_ == 19 || shakerType_ == 20 ) {
|
||||
if ( ratchetCount_ <= 0 ) return lastFrame_[0] = 0.0;
|
||||
|
||||
shakeEnergy_ -= ( ratchetDelta_ + ( 0.002 * shakeEnergy_ ) );
|
||||
if ( shakeEnergy_ < 0.0 ) {
|
||||
shakeEnergy_ = 1.0;
|
||||
ratchetCount_--;
|
||||
}
|
||||
|
||||
if ( randomFloat( 1024 ) < nObjects_ )
|
||||
sndLevel_ += shakeEnergy_ * shakeEnergy_;
|
||||
|
||||
// Sound is enveloped noise
|
||||
input = sndLevel_ * noise() * shakeEnergy_;
|
||||
}
|
||||
else {
|
||||
if ( shakeEnergy_ < MIN_ENERGY ) return lastFrame_[0] = 0.0;
|
||||
|
||||
// Exponential system decay
|
||||
shakeEnergy_ *= systemDecay_;
|
||||
|
||||
// Random events
|
||||
if ( shakerType_ == 21 ) {
|
||||
waterDrop();
|
||||
input = sndLevel_;
|
||||
}
|
||||
else {
|
||||
if ( randomFloat( 1024.0 ) < nObjects_ ) {
|
||||
sndLevel_ += shakeEnergy_;
|
||||
input = sndLevel_;
|
||||
// Vary resonance frequencies if specified.
|
||||
for ( unsigned int i=0; i<nResonances_; i++ ) {
|
||||
if ( doVaryFrequency_[i] ) {
|
||||
StkFloat tempRand = baseFrequencies_[i] * ( 1.0 + ( varyFactor_ * noise() ) );
|
||||
filters_[i].a[1] = -2.0 * baseRadii_[i] * cos( TWO_PI * tempRand / Stk::sampleRate() );
|
||||
}
|
||||
}
|
||||
if ( shakerType_ == 22 ) iTube = randomInt( 7 ); // ANGKLUNG_RESONANCES
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Exponential sound decay
|
||||
sndLevel_ *= soundDecay_;
|
||||
|
||||
// Do resonance filtering
|
||||
lastFrame_[0] = 0.0;
|
||||
if ( shakerType_ == 22 ) {
|
||||
for ( unsigned int i=0; i<nResonances_; i++ ) {
|
||||
if ( i == iTube )
|
||||
lastFrame_[0] += tickResonance( filters_[i], input );
|
||||
else
|
||||
lastFrame_[0] += tickResonance( filters_[i], 0.0 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( unsigned int i=0; i<nResonances_; i++ )
|
||||
lastFrame_[0] += tickResonance( filters_[i], input );
|
||||
}
|
||||
|
||||
// Do final FIR filtering (lowpass or highpass)
|
||||
lastFrame_[0] = tickEqualize( lastFrame_[0] );
|
||||
|
||||
//if ( std::abs(lastFrame_[0]) > 1.0 )
|
||||
// std::cout << "lastOutput = " << lastFrame_[0] << std::endl;
|
||||
|
||||
return lastFrame_[0];
|
||||
}
|
||||
|
||||
inline StkFrames& Shakers :: tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
unsigned int nChannels = lastFrame_.channels();
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace stk {
|
||||
- Envelope Rate = 11
|
||||
- Gain = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace stk {
|
||||
Stanford, bearing the names of Karplus and/or
|
||||
Strong.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace stk {
|
||||
|
||||
\sa \ref skini
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace stk {
|
||||
This class implements a spherical ball with
|
||||
radius, mass, position, and velocity parameters.
|
||||
|
||||
by Perry R. Cook, 1995-2011.
|
||||
by Perry R. Cook, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace stk {
|
||||
- String Sustain = 11
|
||||
- String Stretch = 1
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
//#include <cstdlib>
|
||||
|
||||
/*! \namespace stk
|
||||
\brief The STK namespace.
|
||||
@@ -39,7 +39,7 @@ namespace stk {
|
||||
STK WWW site: http://ccrma.stanford.edu/software/stk/
|
||||
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
Copyright (c) 1995-2011 Perry R. Cook and Gary P. Scavone
|
||||
Copyright (c) 1995-2012 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
|
||||
@@ -264,7 +264,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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user