mirror of
https://github.com/thestk/stk
synced 2026-01-12 04:21:52 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a8a65870f | ||
|
|
9af41126cb | ||
|
|
d2ed001eb5 | ||
|
|
3706458166 | ||
|
|
c92cf7468d | ||
|
|
e54b0cefab | ||
|
|
1a8403e203 | ||
|
|
554a74374b | ||
|
|
21b93795e7 | ||
|
|
11cf5faa0a | ||
|
|
de344668dd | ||
|
|
fe20fe92a2 | ||
|
|
b6a2202011 | ||
|
|
eccd8c9981 | ||
|
|
d199342e86 | ||
|
|
27d9b79dc7 | ||
|
|
2cbce2d8bd | ||
|
|
a6381b9d38 |
25
INSTALL
25
INSTALL
@@ -1,12 +1,12 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people just 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.
|
||||
|
||||
To configure and compile (on Unix systems):
|
||||
To configure and compile (on Unix systems and MinGW):
|
||||
|
||||
1. Unpack the STK distribution (tar -xzf stk-4.x.tar.gz).
|
||||
1. Unpack the STK distribution (tar -xzf stk-4.x.x.tar.gz).
|
||||
2. From within the directory containing this file, run configure:
|
||||
|
||||
./configure
|
||||
@@ -18,14 +18,17 @@ Several options can be passed to configure, including:
|
||||
|
||||
--disable-realtime = only compile generic non-realtime classes
|
||||
--enable-debug = enable various debug output
|
||||
--with-alsa = choose native ALSA API support (linux only)
|
||||
--with-jack = choose native JACK server API support (linux only)
|
||||
--enable-midiator = enable native MS-124W MIDI support (linux only)
|
||||
--with-alsa = choose native ALSA API support (default, linux only)
|
||||
--with-oss = choose native OSS API support (linux only)
|
||||
--with-jack = choose native JACK server API support (linux and macintosh OS-X)
|
||||
--with-core = choose OS-X Core Audio API (macintosh OS-X only)
|
||||
--with-asio = choose ASIO API support (windows only)
|
||||
--with-ds = choose DirectSound API support (windows only)
|
||||
|
||||
At the moment, it is not possible to specify more than one Linux audio API, though this will change in the next release. 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/gary/rawwaves and /home/gary/include):
|
||||
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, 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/gary/rawwaves and /home/gary/include):
|
||||
|
||||
./configure RAWWAVE_PATH="/home/gary/rawwaves/"
|
||||
./configure INCLUDE_PATH="/home/gary/include/"
|
||||
./configure RAWWAVE_PATH='$(HOME)/rawwaves/'
|
||||
./configure INCLUDE_PATH='$(HOME)/include/'
|
||||
|
||||
The ending "/" is required for the RAWWAVES path. The default behavior will set a relative path that works for the project files included with the distribution (assuming they are not moved). You can also change the RAWWAVE_PATH dynamically via the static Stk::setRawwavePath() function.
|
||||
|
||||
@@ -33,9 +36,9 @@ If you wish to use a different compiler than that selected by configure, specify
|
||||
|
||||
./configure CXX=CC
|
||||
|
||||
In addition, a linux RPM is available from the STK WWW site (http://www-ccrma.stanford.edu/software/stk/).
|
||||
In addition, a linux RPM is available from the Planet CCRMA WWW site (http://ccrma.stanford.edu/planetccrma/software/).
|
||||
|
||||
|
||||
For Windows Users:
|
||||
|
||||
An STK distribution is available which contains precompiled executables. 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++ project files are included for each of the example STK projects.
|
||||
|
||||
208
README
208
README
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
This distribution of the Synthesis ToolKit in C++ (STK) contains the following:
|
||||
|
||||
@@ -8,7 +8,7 @@ include: STK class header files
|
||||
src: STK class source files
|
||||
rawwaves: STK audio files (1-channel, 16-bit, big-endian)
|
||||
doc: STK documentation
|
||||
projects: example STK programs
|
||||
projects: example STK projects and programs
|
||||
|
||||
Please read the Legal and Ethical notes near the bottom of this document.
|
||||
|
||||
@@ -17,98 +17,202 @@ For compiling and installing STK, see the INSTALL file in this directory.
|
||||
|
||||
OVERVIEW:
|
||||
|
||||
The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in C++. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, 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 in C++ (STK) is a set of open source audio
|
||||
signal processing and algorithmic synthesis classes written in the C++
|
||||
programming language. STK was designed to facilitate rapid
|
||||
development of music synthesis and audio processing software, with an
|
||||
emphasis on cross-platform functionality, realtime control, ease of
|
||||
use, and educational example code. The Synthesis ToolKit is extremely
|
||||
portable (it's mostly platform-independent C and C++ code), and it's
|
||||
completely user-extensible (all source included, no unusual libraries,
|
||||
and no hidden drivers). We like to think that this increases the
|
||||
chances that our programs will still work in another 5-10 years. In
|
||||
fact, the ToolKit has been working continuously for nearly 10 years
|
||||
now. STK currently runs with "realtime" support (audio and MIDI) on
|
||||
Linux, 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 parts of the Synthesis ToolKit that are platform-dependent concern real-time audio and MIDI input and output, and that is taken care of with a few special classes. 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 can view your results using one of a large variety of sound/signal analysis tools already available (e.g. Snd, Cool Edit, Matlab).
|
||||
The Synthesis ToolKit is free for non-commercial use. The only parts
|
||||
of the Synthesis ToolKit that are platform-dependent concern real-time
|
||||
audio and MIDI input and output, and that is taken care of with a few
|
||||
special classes. 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
|
||||
can view your results using one of a large variety of sound/signal
|
||||
analysis tools already available (e.g. Snd, Cool Edit, Matlab).
|
||||
|
||||
The Synthesis Toolkit is not one particular program. Rather, it is a set of C++ classes that you can use to create your own programs. A few example applications are provided to demonstrate some of the ways to use the classes. If you have specific needs, you will probably have to either modify the example programs or write a new program altogether. Further, the example programs don't have a fancy GUI wrapper. If you feel the need to have a "drag and drop" graphical patching GUI, you probably don't want to use the ToolKit. Spending hundreds of hours making platform-dependent graphics code would go against one of the fundamental design goals of the ToolKit - platform independence.
|
||||
The Synthesis Toolkit is not one particular program. Rather, it is a
|
||||
set of C++ classes that you can use to create your own programs. A
|
||||
few example applications are provided to demonstrate some of the ways
|
||||
to use the classes. If you have specific needs, you will probably
|
||||
have to either modify the example programs or write a new program
|
||||
altogether. Further, the example programs don't have a fancy GUI
|
||||
wrapper. If you feel the need to have a "drag and drop" graphical
|
||||
patching GUI, you probably don't want to use the ToolKit. Spending
|
||||
hundreds of hours making platform-dependent graphics code would go
|
||||
against one of the fundamental design goals of the ToolKit - platform
|
||||
independence.
|
||||
|
||||
For those instances where a simple GUI with sliders and buttons is helpful, we use Tcl/Tk (http://dev.scriptics.com) which is freely distributed for all the supported ToolKit platforms. A number of Tcl/Tk GUI scripts are distributed with the ToolKit release. For control, the Synthesis Toolkit uses raw MIDI (on supported platforms), and SKINI (Synthesis ToolKit Instrument Network Interface, a MIDI-like text message synthesis control format).
|
||||
For those instances where a simple GUI with sliders and buttons is
|
||||
helpful, we use Tcl/Tk (http://dev.scriptics.com) which is freely
|
||||
distributed for all the supported ToolKit platforms. A number of
|
||||
Tcl/Tk GUI scripts are distributed with the ToolKit release. For
|
||||
control, the Synthesis Toolkit uses raw MIDI (on supported platforms),
|
||||
and SKINI (Synthesis ToolKit Instrument Network Interface, a MIDI-like
|
||||
text message synthesis control format).
|
||||
|
||||
|
||||
SYSTEM REQUIREMENTS:
|
||||
|
||||
See the individual README's (eg. README-linux) in the /doc directory for platform specific information and system requirements. In general, you will use the configure script to create Makefiles on unix platforms or the VC++ workspace files to compile the example programs. To use the Tcl/Tk GUIs, you will need Tcl/Tk version 8.0 or higher.
|
||||
See the individual README's (eg. README-linux) in the /doc directory
|
||||
for platform specific information and system requirements. In
|
||||
general, you will use the configure script to create Makefiles on unix
|
||||
platforms (and MinGW) or the VC++ workspace files to compile the
|
||||
example programs. To use the Tcl/Tk GUIs, you will need Tcl/Tk
|
||||
version 8.0 or higher.
|
||||
|
||||
|
||||
WHAT'S NEW:
|
||||
WHAT'S NEW (AND NOT SO NEW):
|
||||
|
||||
Despite being available in one form or another since 1996, we still consider STK to be alpha software. Thus, backward compatability has not been a priority. Please read the Release Notes to see what has changed since the last release.
|
||||
Despite being available in one form or another since 1996, we still
|
||||
consider STK to be alpha software. We attempt to maintain backward
|
||||
compatability but changes are sometimes made in an effort to improve
|
||||
the overall design or performance of the software. Please read the
|
||||
Release Notes to see what has changed since the last release.
|
||||
|
||||
The control message handling scheme has been simplified greatly through the use of the Messager class. It is now possible to have access to simultaneous piped, socketed, and/or MIDI input control messages. In most cases, this should eliminate the use of the Md2Skini program.
|
||||
A new StkFrames class has been created to facilitate the handling and
|
||||
passing of multichannel, vectorized audio data. All STK classes have
|
||||
been updated to include tick() functions that accept StkFrames
|
||||
arguments.
|
||||
|
||||
Realtime audio input capabilities were added to STK with release 3.0, though the behavior of such is very hardware dependent. Under Linux 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 on the order of a hundred milliseconds or more!
|
||||
The control message handling scheme has been simplified greatly
|
||||
through the use of the Messager class. It is now possible to have
|
||||
access to simultaneous piped, socketed, and/or MIDI input control
|
||||
messages. In most cases, this should eliminate the use of the
|
||||
Md2Skini program.
|
||||
|
||||
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 file types. Though somewhat obsolete, the program Md2Skini can be used to write SKINI scorefiles from realtime MIDI input. Finally, STK should compile with non-realtime functionality on any platform with a generic C++ compiler.
|
||||
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 on the order of a hundred
|
||||
milliseconds or more!
|
||||
|
||||
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).
|
||||
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
|
||||
file types. Though somewhat obsolete, the program Md2Skini can be
|
||||
used to write SKINI scorefiles from realtime MIDI input. Finally, STK
|
||||
should compile with non-realtime functionality on any platform with a
|
||||
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).
|
||||
|
||||
|
||||
DISCLAIMER:
|
||||
|
||||
You probably already guessed this, but just to be sure, we don't guarantee anything works. :-) It's free ... what do you expect? If you find a bug, please let us know and we'll try to correct it. You can also make suggestions, but again, no guarantees. Send email to prc@cs.princeton.edu and gary@ccrma.stanford.edu.
|
||||
You probably already guessed this, but just to be sure, we don't
|
||||
guarantee anything works. :-) It's free ... what do you expect? If
|
||||
you find a bug, please let us know and we'll try to correct it. You
|
||||
can also make suggestions, but again, no guarantees. Send email to
|
||||
the mail list.
|
||||
|
||||
|
||||
LEGAL AND ETHICAL:
|
||||
|
||||
This software was designed and created to be made publicly available for free, primarily for academic purposes, so if you use it, pass it on with this documentation, and for free.
|
||||
This software was designed and created to be made publicly available
|
||||
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, give us some. If you make compositions with it, put us in the program notes.
|
||||
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.
|
||||
|
||||
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 administered by the Stanford Office of Technology and Licensing.
|
||||
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
|
||||
administered by the Stanford Office of Technology and Licensing.
|
||||
|
||||
The good news is that large hunks of the techniques used here are public domain. To avoid subtle legal issues, we'll not state what's freely useable here, but we'll try to note within the various classes where certain things are likely to be protected by patents.
|
||||
The good news is that large hunks of the techniques used here are
|
||||
public domain. To avoid subtle legal issues, we'll not state what's
|
||||
freely useable here, but we'll try to note within the various classes
|
||||
where certain things are likely to be protected by patents.
|
||||
|
||||
LICENSE:
|
||||
|
||||
STK WWW site: http://ccrma.stanford.edu/software/stk/
|
||||
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
Copyright (c) 1995-2009 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
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Any person wishing to distribute modifications to the Software is
|
||||
asked to send the modifications to the original developer so that they
|
||||
can be incorporated into the canonical version. This is, however, not
|
||||
a binding provision of this license.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
FURTHER READING:
|
||||
|
||||
For complete documentation on this ToolKit, the classes, etc., see the doc directory of the distribution or surf to http://www-ccrma.stanford.edu/software/stk/. Also check the platform specific README's for specific system requirements.
|
||||
For complete documentation on this ToolKit, the classes, etc., see the
|
||||
doc directory of the distribution or surf to
|
||||
http://ccrma.stanford.edu/software/stk/. Also check the platform
|
||||
specific README's for specific system requirements.
|
||||
|
||||
|
||||
PERRY'S NOTES FROM THE ORIGINAL DISTRIBUTION:
|
||||
|
||||
This whole world was created with no particular hardware in mind. These examples are intended to be tutorial in nature, as a platform for the continuation of my research, and as a possible starting point for a software synthesis system. The basic motivation was to create the necessary unit generators to do the synthesis, processing, and control that I want to do and teach about. Little thought for optimization was given (see Object.cpp), and therefore improvements, especially speed enhancements, should be possible with these classes. It was written with some basic concepts in mind about how to let compilers optimize.
|
||||
This whole world was created with no particular hardware in mind.
|
||||
These examples are intended to be tutorial in nature, as a platform
|
||||
for the continuation of my research, and as a possible starting point
|
||||
for a software synthesis system. The basic motivation was to create
|
||||
the necessary unit generators to do the synthesis, processing, and
|
||||
control that I want to do and teach about. Little thought for
|
||||
optimization was given and therefore improvements, especially speed
|
||||
enhancements, should be possible with these classes. It was written
|
||||
with some basic concepts in mind about how to let compilers optimize.
|
||||
|
||||
Your question at this point might be, "But Perry, with CMix, CMusic, CSound, CShells, CMonkeys, etc. already cluttering the landscape, why a new set of stupid C functions for music synthesis and processing?" The answers lie below.
|
||||
Your question at this point might be, "But Perry, with CMix, CMusic,
|
||||
CSound, CShells, CMonkeys, etc. already cluttering the landscape, why
|
||||
a new set of stupid C functions for music synthesis and processing?"
|
||||
The answers lie below.
|
||||
|
||||
1) I needed to port many of the things I've done
|
||||
into something which is generic enough to port
|
||||
further to different machines.
|
||||
1) I needed to port many of the things I've done into something which is generic enough to port further to different machines.
|
||||
|
||||
2) I really plan to document this stuff, so that
|
||||
you don't have to be me to figure out what's
|
||||
going on. (I'll probably be sorry I said this
|
||||
in a couple of years, when even I can't figure
|
||||
out what I was thinking.)
|
||||
2) I really plan to document this stuff, so that you don't have to be me to figure out what's going on. (I'll probably be sorry I said this in a couple of years, when even I can't figure out what I was thinking.)
|
||||
|
||||
3) The classic difficulties most people have in
|
||||
trying to implement physical models are:
|
||||
3) The classic difficulties most people have in trying to implement physical models are:
|
||||
|
||||
A) They have trouble understanding the papers,
|
||||
and/or in turning the theory into practice.
|
||||
A) They have trouble understanding the papers, and/or in turning the theory into practice.
|
||||
|
||||
B) The Physical Model instruments are a pain to get
|
||||
to oscillate, and coming up with stable and
|
||||
meaningful parameter values is required to
|
||||
get the models to work at all.
|
||||
B) The Physical Model instruments are a pain to get to oscillate, and coming up with stable and meaningful parameter values is required to get the models to work at all.
|
||||
|
||||
This set of C++ unit generators and instruments
|
||||
might help to diminish the scores of emails I
|
||||
get asking what to do with those block diagrams
|
||||
I put in my papers.
|
||||
This set of C++ unit generators and instruments might help to diminish the scores of emails I get asking what to do with those block diagrams I put in my papers.
|
||||
|
||||
4) I wanted to try some new stuff with modal synthesis,
|
||||
and implement some classic FM patches as well.
|
||||
4) I wanted to try some new stuff with modal synthesis, and implement some classic FM patches as well.
|
||||
|
||||
5) I wanted to reimplement, and newly implement
|
||||
more of the intelligent and physical performer
|
||||
models I've talked about in some of my papers.
|
||||
But I wanted to do it in a portable way, and in
|
||||
such a way that I can hook up modules quickly.
|
||||
I also wanted to make these instruments connectable
|
||||
to such player objects, so folks like Brad Garton
|
||||
who really think a lot about the players can connect
|
||||
them to my instruments, a lot about which I think.
|
||||
5) I wanted to reimplement, and newly implement more of the intelligent and physical performer models I've talked about in some of my papers. But I wanted to do it in a portable way, and in such a way that I can hook up modules quickly. I also wanted to make these instruments connectable to such player objects, so folks like Brad Garton who really think a lot about the players can connect them to my instruments, a lot about which I think.
|
||||
|
||||
6) More rationalizations to follow . . .
|
||||
|
||||
|
||||
0
config.guess → config/config.guess
vendored
0
config.guess → config/config.guess
vendored
0
config.sub → config/config.sub
vendored
0
config.sub → config/config.sub
vendored
158
configure.ac
158
configure.ac
@@ -1,12 +1,19 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(STK, 4.1.2, gary@ccrma.stanford.edu, stk)
|
||||
AC_INIT(STK, 4.4, gary@music.mcgill.ca, stk)
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AC_CONFIG_SRCDIR(src/Stk.cpp)
|
||||
AC_CONFIG_FILES(src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile)
|
||||
AC_CONFIG_FILES(src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile)
|
||||
|
||||
# Fill GXX with something before test.
|
||||
AC_SUBST( GXX, ["no"] )
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX(g++ CC c++ cxx)
|
||||
AC_PROG_CXX
|
||||
AC_PROG_RANLIB
|
||||
AC_PATH_PROG(AR, ar, no)
|
||||
if [[ $AR = "no" ]] ; then
|
||||
AC_MSG_ERROR("Could not find ar - needed to create a library");
|
||||
fi
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
@@ -39,79 +46,116 @@ AC_MSG_RESULT($realtime)
|
||||
# Check for math library
|
||||
AC_CHECK_LIB(m, cos, , AC_MSG_ERROR(math library is needed!))
|
||||
|
||||
if test $realtime = yes; then
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(realtime support requires the pthread library!))
|
||||
AC_CHECK_FUNCS(gettimeofday select socket)
|
||||
fi
|
||||
|
||||
# Check for debug
|
||||
AC_MSG_CHECKING(whether to compile debug version)
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug = enable various debug output],
|
||||
[AC_SUBST( debug, [-D_STK_DEBUG_] ) AC_SUBST( cflags, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
|
||||
[AC_SUBST( debug, [] ) AC_SUBST( cflags, [-O2] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
|
||||
[AC_SUBST( cppflag, ["-D_STK_DEBUG_ -D__RTAUDIO_DEBUG__ -D__RTMIDI_DEBUG__"] ) AC_SUBST( cxxflag, ["-g"] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
|
||||
[AC_SUBST( cppflag, [] ) AC_SUBST( cxxflag, [-O3] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
|
||||
|
||||
# Checks for functions
|
||||
if test $realtime = yes; then
|
||||
AC_CHECK_FUNCS(select socket)
|
||||
AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
|
||||
fi
|
||||
|
||||
# For -I and -D flags
|
||||
CPPFLAGS="$CPPFLAGS $cppflag"
|
||||
|
||||
# For debugging and optimization ... overwrite default because it has both -g and -O2
|
||||
CXXFLAGS="$cxxflag"
|
||||
|
||||
# Check compiler and use -Wall if gnu.
|
||||
if test $GXX = "yes" ; then
|
||||
AC_SUBST( warn, ["-Wall -g"] )
|
||||
if [test $GXX = "yes" ;] then
|
||||
AC_SUBST( cxxflag, [-Wall] )
|
||||
fi
|
||||
|
||||
CXXFLAGS="$CXXFLAGS $cxxflag"
|
||||
|
||||
if test $realtime = yes; then
|
||||
# Checks for package options and external software
|
||||
AC_CANONICAL_HOST
|
||||
AC_MSG_CHECKING(for audio API)
|
||||
case $host in
|
||||
*-*-linux*)
|
||||
AC_SUBST( sound_api, [_NO_API_] )
|
||||
AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)], [
|
||||
api="$api -D__UNIX_JACK__"
|
||||
AC_MSG_RESULT(using JACK)
|
||||
AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(Jack support also requires the asound library!))], )
|
||||
|
||||
# Look for Jack flag
|
||||
AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_JACK__] ) AC_MSG_RESULT(using JACK)] , )
|
||||
if [test $sound_api = -D__LINUX_JACK__;] then
|
||||
TEMP_LIBS=$LIBS
|
||||
AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
|
||||
LIBS="`pkg-config --cflags --libs jack` $TEMP_LIBS -lasound"
|
||||
audio_apis="-D__LINUX_JACK__"
|
||||
fi
|
||||
|
||||
# Look for Alsa flag
|
||||
AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_ALSA__] ) AC_MSG_RESULT(using ALSA)], )
|
||||
if test $sound_api = -D__LINUX_ALSA__; then
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
|
||||
audio_apis="-D__LINUX_ALSA__ $audio_apis"
|
||||
fi
|
||||
# Look for ALSA flag
|
||||
AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [
|
||||
api="$api -D__LINUX_ALSA__"
|
||||
AC_MSG_RESULT(using ALSA)
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))], )
|
||||
|
||||
# Look for OSS flag
|
||||
AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_OSS__] ) AC_MSG_RESULT(using OSS)], )
|
||||
if test $sound_api = -D__LINUX_OSS__; then
|
||||
audio_apis="-D__LINUX_OSS__ $audio_apis"
|
||||
AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [
|
||||
api="$api -D__LINUX_OSS__"
|
||||
AC_MSG_RESULT(using OSS)], )
|
||||
|
||||
# If no audio api flags specified, use ALSA
|
||||
if [test "$api" == "";] then
|
||||
AC_MSG_RESULT(using ALSA)
|
||||
AC_SUBST( api, [-D__LINUX_ALSA__] )
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
|
||||
fi
|
||||
|
||||
# If no audio api flags specified, use OSS
|
||||
if [test $sound_api = _NO_API_;] then
|
||||
AC_SUBST( sound_api, [-D__LINUX_OSS__] )
|
||||
AC_MSG_RESULT(using OSS)
|
||||
AC_SUBST( audio_apis, [-D__LINUX_OSS__] )
|
||||
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_ARG_ENABLE(midiator, [ --enable-midiator = enable native MS-124W MIDI support (linux only)], [AC_SUBST( midiator, [-D__MIDIATOR__] )], [AC_SUBST( midiator, [] )])
|
||||
;;
|
||||
|
||||
*-sgi*)
|
||||
AC_SUBST( audio_apis, ["-D__IRIX_AL__ -LANG:std -w"] )
|
||||
AC_MSG_RESULT(using IRIX AL)
|
||||
AC_CHECK_LIB(audio, alOpenPort, , AC_MSG_ERROR(IRIX audio support requires the audio library!) )
|
||||
AC_CHECK_LIB(md, mdOpenInPort, , AC_MSG_ERROR(IRIX MIDI support requires the md library!) )
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(realtime support requires the pthread library!))
|
||||
;;
|
||||
|
||||
*-apple*)
|
||||
# Check for CoreAudio and CoreMIDI framework
|
||||
AC_CHECK_HEADERS(CoreAudio/CoreAudio.h CoreMIDI/CoreMIDI.h CoreServices/CoreServices.h,
|
||||
[AC_SUBST( audio_apis, [-D__MACOSX_CORE__] )],
|
||||
[AC_MSG_ERROR(CoreAudio and/or CoreMIDI header files not found!)] )
|
||||
AC_SUBST( frameworks, ["-framework CoreAudio -framework CoreMIDI -framework CoreFoundation"] )
|
||||
# Explicitly link with c++ library.
|
||||
AC_CHECK_LIB(stdc++, printf, , AC_MSG_ERROR(Stk requires the C++ library!) )
|
||||
AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (unix only)], [
|
||||
api="$api -D__UNIX_JACK__"
|
||||
AC_MSG_RESULT(using JACK)
|
||||
AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))], )
|
||||
|
||||
# Look for Core flag
|
||||
AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)], [
|
||||
api="$api -D__MACOSX_CORE__"
|
||||
AC_MSG_RESULT(using CoreAudio)
|
||||
AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
|
||||
LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework CoreMidi" ], )
|
||||
|
||||
# If no audio api flags specified, use CoreAudio
|
||||
if [test "$api" == ""; ] then
|
||||
AC_SUBST( api, [-D__MACOSX_CORE__] )
|
||||
AC_MSG_RESULT(using CoreAudio)
|
||||
AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
|
||||
[],
|
||||
[AC_MSG_ERROR(CoreAudio header files not found!)] )
|
||||
AC_SUBST( LIBS, ["-framework CoreAudio -framework CoreFoundation -framework CoreMidi"] )
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
|
||||
;;
|
||||
|
||||
*-mingw32*)
|
||||
AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)], [
|
||||
api="$api -D__WINDOWS_ASIO__"
|
||||
AC_MSG_RESULT(using ASIO)
|
||||
AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] ) ], )
|
||||
|
||||
# Look for DirectSound flag
|
||||
AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [
|
||||
api="$api -D__WINDOWS_DS__"
|
||||
AC_MSG_RESULT(using DirectSound)
|
||||
LIBS="-ldsound -lwinmm $LIBS" ], )
|
||||
|
||||
# If no audio api flags specified, use DirectSound
|
||||
if [test "$api" == "";] then
|
||||
AC_SUBST( api, [-D__WINDOWS_DS__] )
|
||||
AC_MSG_RESULT(using DirectSound)
|
||||
LIBS="-ldsound -lwinmm $LIBS"
|
||||
fi
|
||||
|
||||
api="$api -D__WINDOWS_MM__"
|
||||
LIBS="-lole32 -lwinmm -lWsock32 $LIBS"
|
||||
;;
|
||||
|
||||
*)
|
||||
@@ -119,10 +163,8 @@ if test $realtime = yes; then
|
||||
AC_MSG_ERROR(Unknown system type for realtime support ... try --disable-realtime argument!)
|
||||
;;
|
||||
esac
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $api"
|
||||
fi
|
||||
|
||||
# Checks for library functions.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_CHECK_FUNCS(strstr)
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -1,23 +1,16 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
Realtime support for Linux is currently using either the Open Sound System (OSS) or the Advanced Linux Sound Architecture (ALSA) sound and MIDI APIs. The free version of OSS works as well (and in some cases better than the commercial OSS version ... such as with my Maestro 2e chipset). In general, the ALSA drivers also seem to perform well. You can read more about ALSA at http://www.alsa-project.org/. ALSA is open source and holds great promise for audio under Linux. The API is selected during compilation using either the __LINUX_ALSA__ or __LINUX_OSS__ definitions. The configure script uses the OSS API by default. The ALSA API can be selected by passing the "--with-alsa" option to configure.
|
||||
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. 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. The OSS audio API can be selected by passing the "--with-oss" option to configure.
|
||||
|
||||
STK should compile without much trouble under Linux ... afterall, it is primarily developed on Linux platforms. Since all Linux distributions typically include the GNU makefile utilities, you should be able to use the default Makefile. Typing "make" will initiate the compilation process.
|
||||
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 Makefile. Typing "make" will initiate the compilation process.
|
||||
|
||||
MIDIATOR SERIAL PORT MIDI SUPPORT:
|
||||
|
||||
STK now has special support for the MIDIator serial port MIDI interface. This is of primary interest to us laptop users, whose computers usually don't have a gameport. If you want to buy one of these devices, make sure you get the MS-124w model (www.midiator.com). For it to work in STK, you must provide the __MIDIATOR__ definition during compilation (in addition to either __LINUX_ALSA__ or __LINUX_OSS__) or pass the "--enable-midiator" option to configure.
|
||||
|
||||
There are a few things that need to be done on your system to get the MIDIator working. Assuming you wish to attach the MIDIator to serial port 0, add the following lines to your bootup sequence in /etc/rc.d/rc.local:
|
||||
|
||||
setserial /dev/ttyS0 baud_base 57600
|
||||
setserial /dev/ttyS0 divisor 1
|
||||
|
||||
You may need to specify the full path to the setserial function, depending on how your PATH variable is set up. Also, you may need to modify the permissions of /dev/ttyS0 (chmod a+rwx). And finally, the MIDIator should be set for "single addresssed" mode (the S/A switch on S and the A/B switch on A), which puts identical output on all 4 MIDI output ports. It is possible to use the MIDIator in a "multi-port" mode, though I'm not currently supporting that in STK.
|
||||
MIDIator support has been removed from RtMidi with STK versions 4.2 and higher. If you really need it, you can contact us to get an old distribution.
|
||||
|
||||
NOTE REGARDING PTHREADS:
|
||||
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
Realtime support for Macintosh OS X uses the CoreAudio HAL API and is specified during compilation using the __MACOSX_CORE__ preprocessor definition.
|
||||
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 download the OS X developer kit in order to compile STK. STK was successfully tested on OS X version 10.2.
|
||||
It is necessary to install the OS X developer kit in order to compile STK. STK was successfully tested on OS X versions 10.5.
|
||||
|
||||
The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. Therefore, it is necessary to either specify this rate as a command-line option to the STK example programs or to change the default sample rate inside the Stk.h file before compilation. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.
|
||||
The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. The default STK sample rate is now 44100 Hz and all current example programs use this rate. However, it is possible to manually override this value in some programs from the command-line. The default sample rate is set in Stk.h. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.
|
||||
|
||||
There is a potential conflict between the STK Delay class and a Delay() function declared in OSUtils.h (which is included via <CoreServices/CoreServices.h>). In general, this conflict can be avoided via the use of a namespace (an explicit Delay::Delay declaration), though this made the Windows Visual C++ compiler barf. If you use STK classes within a project that includes the OSUtils.h file, you will likely need to make changes in STK classes that use the Delay class.
|
||||
|
||||
|
||||
Tcl/Tk on OS X:
|
||||
|
||||
The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. The latest Tcl/Tk Aqua distribution (http://www.apple.com/downloads/macosx/unix_open_source/tcltk.html) has been successfully tested on a 10.2 system. The default installation will place a link to the wish interpretor at /usr/bin/wish.
|
||||
The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. The latest Tcl/Tk Aqua distribution (http://www.apple.com/downloads/macosx/unix_open_source/tcltk.html) has been successfully tested on 10.2 and 10.3 systems. The default installation will place a link to the wish interpretor at /usr/bin/wish.
|
||||
|
||||
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates.
|
||||
It appears that socket support in Tcl/Tk on OS X uses the Nagle algorithm, which produces poor response between changes made in the tcl/tk script and the resulting audio updates. Note that this is only a problem when using a socket connection from a Tcl/Tk script.
|
||||
|
||||
It is possible to connect a tcl/tk interface to an STK program via a socket connection. However, the tcl/tk interpreter does not appear to properly close the socket connection during disconnection. It is therefore necessary to type "Exit" in the STK program terminal window to properly exit the STK program.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
The project Makefiles are created by configure. If you have trouble running "make", try invoking "gmake" (for GNU make). If that doesn't work, try to download the GNU Makefile utilities from the Internet.
|
||||
|
||||
Another issue that has crept up with this release is proper compiler support for C++ error handling. If you experience problems, you probably don't have a recent version of the C++ compiler. Otherwise, STK should compile and run on SGI platforms without any problems. Release 4.0 of STK is confirmed to compile (with various warnings) using CC version 7.30.
|
||||
With STK version 4.3, realtime support for IRIX has been discontinued due to the inability to test it. If you need realtime support on an SGI, go back to version 4.2.1. Release 4.0 of STK is confirmed to compile (with various warnings) using CC version 7.30.
|
||||
|
||||
The __IRIX_AL__ and __IRIX_MD__ preprocessor definitions are required for realtime audio and MIDI support.
|
||||
|
||||
NOTE REGARDING PTHREADS:
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
Please read the file README for more general STK information.
|
||||
|
||||
DirectX and WindowsNT Issues:
|
||||
-----------------------------
|
||||
|
||||
STK is currently distributed with Visual C++ 6.0 project and workspace files. It has been tested using both Visual C++ 6.0 and Visual C++ .NET.
|
||||
STK is currently distributed with Visual C++ .NET project and workspace files. It no longer compiles with Visual C++ 6.0. I gave up attempting to fix all the problems created by such a bad compiler. This version of STK has been tested using Visual C++ .NET. As well, the configure script now supprots MinGW.
|
||||
|
||||
IMPORTANT VC++ NOTE: When compiling "release" versions of STK programs, link to the release multithreaded library. When compiling "debug" versions, link to the debug multithreaded library. Compiler errors will result otherwise. Also, the Microsoft folk are up to their old habits of trying to change standards. The .NET compiler will complain about cerr for some reason.
|
||||
|
||||
Both the DirectSound and Steinberg ASIO audio APIs are supported for realtime audio input/output. The Visual C++ project files included with this distribution are configured to use the DirectSound API. In order to use the ASIO API, it is necessary to change the preprocessor definition from __WINDOWS_DS__ to __WINDOWS_ASIO__, as well as include all the files in the /src/asio/ directory (i.e. asio.h, asio.cpp, ...). If you have a good quality soundcard and a native ASIO driver (not emulated), you are likely to get much better input/output response using that.
|
||||
Both the DirectSound and Steinberg ASIO audio APIs are supported for realtime audio input/output. The Visual C++ project files included with this distribution are configured to use the DirectSound API. In order to use the ASIO API, it is necessary to change the preprocessor definition from __WINDOWS_DS__ to __WINDOWS_ASIO__, as well as include all the files in the /src/include/ directory (i.e. asio.h, asio.cpp, ...). If you have a good quality soundcard and a native ASIO driver (not emulated), you are likely to get much better input/output response using that.
|
||||
|
||||
When using the DirectSound API for audio input, latency is typically pretty horrendous (should we be surprised?). Also, there is a slight chance you don't have DirectSoundCapture support on your computer. If not, you should download the DirectX 6.0 (or higher) runtime libraries from Microsoft's WWW site (http://www.microsoft.com/directx/download.asp) in order to run the pre-compiled STK executables for Windoze. The last time I checked, there was no DirectSoundCapture support for WindowsNT ... you'll have to switch to Windows 2000 or XP or use an ASIO driver. I stopped supporting the WinMM audio output code with release 3.2.
|
||||
|
||||
Realtime MIDI input is supported using the winmm.lib API.
|
||||
Realtime MIDI input/output is supported by RtMidi using the winmm.lib API and requires the __WINDOWS_MM__ preprocessor definition.
|
||||
|
||||
Visual C++ 6.0 workspaces have been created for the various STK projects. Everything has already been configured for you. The intermediate .obj files will be written to either the "Release" or "Debug" directories, but the executable files will be written to the main project directories (where they need to be for proper execution). If you should somehow lose or hose the VC++ workspace file for a project, then you will have to do a LOT of configuring to recreate it ... it's probably easier just to download the distribution again from our WWW sites. Anyway, for your benefit and mine, here is a list of things that need to be added to the various "Project Settings":
|
||||
Visual C++ workspaces have been created for the various STK projects. Everything has already been configured for you. The intermediate .obj files will be written to either the "Release" or "Debug" directories, but the executable files will be written to the main project directories (where they need to be for proper execution). If you should somehow lose or hose the VC++ workspace file for a project, then you will have to do a LOT of configuring to recreate it ... it's probably easier just to download the distribution again from our WWW sites. Anyway, for your benefit and mine, here is a list of things that need to be added to the various "Project Settings" (this was for VC 6.0 ... things have changed with the newer versions of the VC compiler):
|
||||
|
||||
1. Under General: Set "Output files:" to <blank> (this will put the executable in the main project directory.
|
||||
|
||||
@@ -27,7 +27,7 @@ Visual C++ 6.0 workspaces have been created for the various STK projects. Every
|
||||
|
||||
4. Under C/C++ > Preprocessor: Add "../../include" directory to the "extra include" field.
|
||||
|
||||
5. Under C/C++ > Preprocessor: Add "__WINDOWS_DS__" to the definitions field.
|
||||
5. Under C/C++ > Preprocessor: Add "__WINDOWS_DS__", "__WINDOWS_MM__", and "__LITTLE_ENDIAN__ to the definitions field.
|
||||
|
||||
6. Add all the necessary files to the project.
|
||||
|
||||
@@ -49,7 +49,7 @@ WINDOWS 95/98:
|
||||
|
||||
PLAY SKINI SCOREFILES IN REALTIME:
|
||||
|
||||
demo Clarinet -or < scores/streetsf.ski
|
||||
demo Clarinet -or -if scores/streetsf.ski
|
||||
|
||||
USE TCL/TK GUIs FOR REALTIME CONTROL:
|
||||
|
||||
|
||||
@@ -1,6 +1,98 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
v4.4.1: (3 June 2009)
|
||||
- added multi-channel/frame tick() virtual function to WvIn and WvOut abstract base classes (required update to RtWvOut class)
|
||||
- updated configure script to select g++ compiler by default
|
||||
- in demo.cpp: removed voicer grouping for messages, fixing polyphony when messages are on the same MIDI/SKINI channel
|
||||
- updates to RtAudio and RtMidi
|
||||
|
||||
v4.4: (30 April 2009)
|
||||
- all classes embedded in the "stk" namespace (except RtAudio, RtMidi, and RtError)
|
||||
- class WaveLoop renamed FileLoop
|
||||
- significant efficiency improvements via code restructuring and inlining
|
||||
- some class source (.cpp) files deleted as part of inlining (Generator, Filter, Function, WvIn, WvOut, Effect, Instrmnt, BowTable, ReedTable, JetTable, Vector3D)
|
||||
- updates to RtAudio and RtMidi
|
||||
- previous "tickFrame()" functions renamed "tick" for more consistent API
|
||||
- more consistent and scalable approach to multichannel data and computations
|
||||
- multichannel support added to Granulate class
|
||||
- Filter class made abstract. New Iir and Fir classes made for non-order-specific filtering.
|
||||
- new TapDelay class
|
||||
- SubNoise class deleted (same as sub-sampled "ticking" of Noise class)
|
||||
|
||||
|
||||
v4.3.1: (7 December 2007)
|
||||
- further headerless file support in FileRead
|
||||
- bug fix in RtWvOut.cpp
|
||||
- added configure support for MinGW
|
||||
- updates to RtAudio and RtMidi for MinGW
|
||||
- changes to channel assignment in demo.cpp
|
||||
|
||||
|
||||
v4.3.0: (13 August 2007)
|
||||
- an official MIT-like license
|
||||
- new functionality to automatically update class data when the STK sample rate changes (partly implemented)
|
||||
- updates for new RtAudio version 4.0
|
||||
- removed RtDuplex class, users should use RtAudio directly with a callback function
|
||||
- bug fix in interpolate() function in Stk.h for non-interleaved data
|
||||
- fixes / improvements to the Granulate class
|
||||
- fix in Whistle when doing animation
|
||||
- fixes in BlitSquare for frequency, harmonics, and dc offset
|
||||
- updates to Makefiles for non-realtime compile
|
||||
- fix in demo.cpp for voice channel assignment
|
||||
- updated versions of RtMidi and RtAudio
|
||||
- updated ASIO files for MinGW compiler
|
||||
- new FAQ in documentation
|
||||
- MAT-file bug fix in FileRead class
|
||||
|
||||
|
||||
v4.2.1: (14 October 2005)
|
||||
- greatly expanded StkFrames functionality (including interpolation and indexing by channel/frame)
|
||||
- new Granulate granular synthesis class
|
||||
- new Blit, BlitSaw, and BlitSquare bandlimited waveform classes (thanks to Robin Davies!)
|
||||
- removed Table class ... all functionality (including interpolation) now in StkFrames and FileRead classes
|
||||
- revised Socket class (now abstract) and added TcpServer, TcpClient, and UdpSocket subclasses
|
||||
- added Stk::showWarnings() and Stk::printErrors() functions to dis/enable warning and error printouts
|
||||
- extracted file I/O functionality to new FileRead and FileWrite classes
|
||||
- revised WvIn / WvOut class structure (WvIn / WvOut now abstract and file I/O functionality in new FileWvIn / FileWvOut subclasses)
|
||||
- new SineWave class which calculates its own static table of variable length (no rawwave dependency)
|
||||
- new sinewave.raw file of length 1024 samples (used to be 256)
|
||||
- TcpWvIn and TcpWvOut renamed InetWvIn and InetWvOut, with added support for UDP sockets
|
||||
- fixed bug in WvOut tickFrame( const StkFrames &frames ) function
|
||||
- fixed bug in demo.cpp when writing output soundfiles without realtime output
|
||||
- added "binary" open flag to MidiFileIn class for Windows
|
||||
- fixed oversized MAT-file header in WvOut.cpp
|
||||
- fixed case statement bug in MidiFileIn.cpp for sysex
|
||||
- added missing getDelay() function to DelayA.cpp
|
||||
- fixed modDepth omission in Chorus.cpp
|
||||
- fixed DC blocker initialization bug in Flute.cpp
|
||||
- changed Filter class behavior so no default clearing of state when changing coefficients
|
||||
- bug fixes to RtAudio, especially for Windows DirectSound and ASIO (thanks to Robin Davies)
|
||||
- bug fixes to RtMidi, especially for Linux (thanks to Pedro Pedro Lopez-Cabanillas)
|
||||
|
||||
|
||||
v4.2.0: (4 October 2004)
|
||||
- simultaneous multiple audio APIs supported at compile time
|
||||
- fixed hidden overloaded virtual functions
|
||||
- new Asymp exponential envelope class
|
||||
- various changes to better conform to standard C++ programming practices
|
||||
- MY_FLOAT type converted to StkFloat and changed throughout (use treesed utility to search/replace in old files)
|
||||
- most example programs rewritten to use an audio callback paradigm (which works better in OS-X)
|
||||
- new StkFrames class for vectorized multichannel data and associated new tick() functions making use of StkFrames
|
||||
- new RtMidi class with MIDI output capabilities (API changes)
|
||||
- new MidiFileIn class for reading MIDI files
|
||||
- revised Filter classes to use std::vectors for coefficients (API changes)
|
||||
- revised Messager class (now queues messages for retrieval) (API changes)
|
||||
- new abstract parent Effect class for various effects
|
||||
- added setT60 function to all reverbs
|
||||
- new abstract parent Generator class for various signal sources
|
||||
- new abstract parent Function class for tables and various non-linear functions
|
||||
- Skini class completely rewritten (simplified) using the C++ STL (API changes)
|
||||
- WvOut classes now clip to -1.0 to +1.0 and report out of range
|
||||
- new Mutex class
|
||||
- turned Nagle algorithm off by default in Socket class
|
||||
- error reporting standardized in all classes
|
||||
|
||||
v4.1.3: (22 March 2004)
|
||||
- bug fix in RtAudio for Windows DirectSound output only support
|
||||
@@ -108,7 +200,7 @@ v3.0: (10 October 1999)
|
||||
- added RawWvOut class
|
||||
- new WvIn class with RawWvIn, SndWvIn, WavWvIn, MatWvIn, and RTWvIn subclasses
|
||||
- removed RawWave, RawShot, RawInterp, and RawLoop classes (supplanted by RawWvIn)
|
||||
- multi-channel data support in WvIn and WvOut classes using MY_MULTI data type (pointer to MY_FLOAT) and the methods mtick() and mlastOutput()
|
||||
- multi-channel data support in WvIn and WvOut classes using MY_MULTI data type (pointer to StkFloat) and the methods mtick() and mlastOutput()
|
||||
- now writing to primary buffer under Windoze when allowed by hardware
|
||||
- cleaned up Object.h a bit
|
||||
- pulled various utility and thread functions out of syntmono.cpp (to aid readability of the code)
|
||||
|
||||
111
doc/SKINI.txt
111
doc/SKINI.txt
@@ -10,7 +10,7 @@ for the Synthesis Toolkit in C++ by Perry R. Cook.
|
||||
* A SKINI Haiku. *
|
||||
*********************************
|
||||
|
||||
Profound thanks to Dan Trueman, Brad Garton, and
|
||||
Profound thanks to Dan trueman, Brad Garton, and
|
||||
Gary Scavone for input on this revision. Thanks
|
||||
also to MIDI, the NeXT MusicKit, ZIPI and all
|
||||
the creators and modifiers of these for good bases
|
||||
@@ -120,7 +120,7 @@ upon/from which to build and depart.
|
||||
|
||||
4) C Files Used To Implement SKINI
|
||||
|
||||
SKINI.cpp is an object which can either open a SKINI file, and
|
||||
Skini.cpp is an object which can either open a SKINI file, and
|
||||
successively read and parse lines of text as SKINI strings, or
|
||||
accept strings from another object and parse them. The latter
|
||||
functionality would be used by a socket, pipe, or other connection
|
||||
@@ -128,11 +128,11 @@ upon/from which to build and depart.
|
||||
but not restricted to real time.
|
||||
|
||||
SKINI.msg should be included by anything wanting to use the
|
||||
SKINI.cpp object. This is not mandatory, but use of the __SK_blah_
|
||||
Skini.cpp object. This is not mandatory, but use of the __SK_blah_
|
||||
symbols which are defined in the .msg file will help to ensure
|
||||
clarity and consistency when messages are added and changed.
|
||||
|
||||
SKINI.tbl is used only by the SKINI parser object (SKINI.cpp).
|
||||
SKINI.tbl is used only by the SKINI parser object (Skini.cpp).
|
||||
In the file SKINI.tbl, an array of structures is declared and
|
||||
assigned values which instruct the parser as to what the message
|
||||
types are, and what the fields mean for those message types.
|
||||
@@ -240,7 +240,7 @@ upon/from which to build and depart.
|
||||
7) The SKINI.tbl File, How Messages are Parsed:
|
||||
|
||||
The SKINI.tbl file contains an array of structures which
|
||||
are accessed by the parser object SKINI.cpp. The struct is:
|
||||
are accessed by the parser object Skini.cpp. The struct is:
|
||||
|
||||
struct SKINISpec { char messageString[32];
|
||||
long type;
|
||||
@@ -322,70 +322,67 @@ upon/from which to build and depart.
|
||||
|
||||
8) Objects using SKINI
|
||||
|
||||
Here's a simple example of code which uses the SKINI object
|
||||
Here's a simple example of code which uses the Skini object
|
||||
to read a SKINI file and control a single instrument.
|
||||
|
||||
Skini score;
|
||||
Skini::Message message;
|
||||
instrument = new Mandolin(50.0);
|
||||
score = new SKINI(argv[1]);
|
||||
while(score->getType() > 0) {
|
||||
tempDouble = score->getDelta();
|
||||
if (tempDouble < 0) {
|
||||
tempDouble = - tempDouble;
|
||||
tempDouble = tempDouble - output.getTime();
|
||||
if (tempDouble < 0) {
|
||||
printf("Bad News Here!!! Backward Absolute Time Required.\n");
|
||||
tempDouble = 0.0;
|
||||
}
|
||||
score.setFile( argv[1] );
|
||||
while ( score.nextMessage( message ) != 0 ) {
|
||||
tempDouble = message.time;
|
||||
if (tempDouble < 0) {
|
||||
tempDouble = - tempDouble;
|
||||
tempDouble = tempDouble - output.getTime();
|
||||
if (tempDouble < 0) {
|
||||
printf("Bad News Here!!! Backward Absolute Time Required.\n");
|
||||
tempDouble = 0.0;
|
||||
}
|
||||
tempLong = (long) (tempDouble * Stk::sampleRate());
|
||||
for (i=0;i<tempLong;i++) {
|
||||
output.tick(instrument->tick());
|
||||
}
|
||||
tempLong = (long) ( tempDouble * Stk::sampleRate() );
|
||||
for ( i=0; i<tempLong; i++ ) {
|
||||
output.tick( instrument->tick() );
|
||||
}
|
||||
|
||||
tempDouble3 = message.floatValues[1] * NORM_MIDI;
|
||||
if ( message.type == __SK_NoteOn_ ) {
|
||||
if ( tempDouble3 == 0.0 ) {
|
||||
tempDouble3 = 0.5;
|
||||
instrument->noteOff( tempDouble3 );
|
||||
}
|
||||
tempDouble3 = score->getByteThree();
|
||||
if (score->getType()== __SK_NoteOn_ ) {
|
||||
tempDouble3 *= NORM_MIDI;
|
||||
if (score->getByteThree() == 0) {
|
||||
tempDouble3 = 0.5;
|
||||
instrument->noteOff(tempDouble3);
|
||||
}
|
||||
else {
|
||||
tempLong = (int) score->getByteTwo();
|
||||
tempDouble2 = Midi2Pitch[tempLong];
|
||||
instrument->noteOn(tempDouble2,tempDouble3);
|
||||
}
|
||||
else {
|
||||
tempLong = message.intValues[0];
|
||||
tempDouble2 = Midi2Pitch[tempLong];
|
||||
instrument->noteOn( tempDouble2, tempDouble3 );
|
||||
}
|
||||
else if (score->getType() == __SK_NoteOff_) {
|
||||
tempDouble3 *= NORM_MIDI;
|
||||
instrument->noteOff(tempDouble3);
|
||||
}
|
||||
else if (score->getType() == __SK_ControlChange_) {
|
||||
tempLong = score->getByteTwoInt();
|
||||
instrument->controlChange(tempLong,temp3.0);
|
||||
}
|
||||
score->nextMessage();
|
||||
}
|
||||
else if ( message.type == __SK_NoteOff_ ) {
|
||||
instrument->noteOff( tempDouble3 );
|
||||
}
|
||||
else if ( message.type == __SK_ControlChange_ ) {
|
||||
tempLong = message.intValues[0];
|
||||
instrument->controlChange( tempLong, tempDouble3 );
|
||||
}
|
||||
}
|
||||
|
||||
When the score (SKINI object) object is created from the
|
||||
filename in argv[1], the first valid command line is read
|
||||
from the file and parsed.
|
||||
When a SKINI score is passed to a Skini object using the
|
||||
Skini::setFile() function, valid messages are read from
|
||||
the file and returned using the Skini::nextMessage() function.
|
||||
|
||||
The score->getType() retrieves the messageType. If this is
|
||||
-1, there are no more valid messages in the file and the
|
||||
synthesis loop terminates. Otherwise, the message type is
|
||||
returned.
|
||||
A Skini::Message structure contains all the information parsed
|
||||
from a single SKINI message. A returned message type of zero
|
||||
indicates either an invalid message or the end of a scorefile.
|
||||
|
||||
getDelta() retrieves the deltaTime until the current message
|
||||
should occur. If this is greater than 0, synthesis occurs
|
||||
until the deltaTime has elapsed. If deltaTime is less than
|
||||
zero, the time is interpreted as absolute time and the output
|
||||
device is queried as to what time it is now. That is used to
|
||||
form a deltaTime, and if it's positive we synthesize. If
|
||||
it's negative, we print an error and pretend this never
|
||||
happened and we hang around hoping to eventually catch up.
|
||||
The "time" member of a Skini::Message is the deltaTime until the
|
||||
current message should occur. If this is greater than 0,
|
||||
synthesis occurs until the deltaTime has elapsed. If deltaTime is
|
||||
less than zero, the time is interpreted as absolute time and the
|
||||
output device is queried as to what time it is now. That is used
|
||||
to form a deltaTime, and if it's positive we synthesize. If it's
|
||||
negative, we print an error, pretend this never happened and we
|
||||
hang around hoping to eventually catch up.
|
||||
|
||||
The rest of the code sorts out message types NoteOn, NoteOff
|
||||
(including NoteOn with velocity 0), and ControlChange. The
|
||||
code implicitly takes into account the integer type of the
|
||||
control number, but all other data is treated as double float.
|
||||
|
||||
The last line reads and parses the next message in the file.
|
||||
|
||||
1344
doc/doxygen/Doxyfile
1344
doc/doxygen/Doxyfile
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,25 @@
|
||||
/*! \page compile Compiling
|
||||
|
||||
The Synthesis ToolKit can be used in a variety of ways, depending on your particular needs. Some people choose the classes they need for a particular project and copy those to their working directory. Others create <TT>Makefiles</TT> which compile project-specific class objects from common <TT>src</TT> and <TT>include</TT> directories. And still others like to compile and link to a common library of object files. STK was not designed with one particular style of use in mind.
|
||||
The Synthesis ToolKit can be used in a variety of ways, depending on your particular needs. Some people choose the classes they need for a particular project and copy those to their working directory. Others create <TT>Makefiles</TT> that compile project-specific class objects from common <TT>src</TT> and <TT>include</TT> directories. And still others like to compile and link to a common library of object files. STK was not designed with one particular style of use in mind.
|
||||
|
||||
|
||||
\section rtvsnonrt "Realtime" vs. "Non-Realtime"
|
||||
|
||||
Most of the Synthesis ToolKit classes are platform independent. That means that they should compile on any reasonably current C++ compiler. The functionality needed for realtime audio and MIDI input/output, as well as realtime control message acquistion, is inherently platform and operating-system (OS) <I>dependent</I>. STK classes which require specific platform/OS support include RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, TcpWvIn, TcpWvOut, Socket, and Thread. These classes currently can only be compiled on Linux, Irix, Macintosh OS X, and Windows systems using the <TT>__LINUX_OSS__</TT>, <TT>__LINUX_ALSA__</TT>, <TT>__IRIX_AL__</TT>, <TT>__MACOSX_CORE__</TT>, <TT>__WINDOWS_DS__</TT>, or <TT>__WINDOWS_ASIO__</TT> preprocessor definitions.
|
||||
Most of the Synthesis ToolKit classes are platform independent. That
|
||||
means that they should compile on any reasonably current C++ compiler.
|
||||
The functionality needed for realtime audio and MIDI input/output, as
|
||||
well as realtime control message acquistion, is inherently platform
|
||||
and operating-system (OS) <I>dependent</I>. STK classes that require
|
||||
specific platform/OS support include RtAudio, RtWvOut, RtWvIn,
|
||||
RtDuplex, RtMidi, InetWvIn, InetWvOut, Socket, UdpSocket, TcpServer,
|
||||
TcpClient, Thread, and Mutex. These classes currently can only be
|
||||
compiled on Linux, Macintosh OS X, and Windows systems.
|
||||
|
||||
Without the "realtime" classes, it is still possible to read SKINI scorefiles for control input and to read and write to/from a variety of audio file formats (WAV, SND, AIFF, MAT-file, and RAW). If compiling for a "little-endian" host processor, the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition should be provided.
|
||||
Without the "realtime" classes, it is still possible to read SKINI
|
||||
scorefiles for control input and to read and write to/from a variety
|
||||
of audio file formats (WAV, SND, AIFF, MAT-file, and RAW). If
|
||||
compiling for a "little-endian" host processor, the
|
||||
<TT>__LITTLE_ENDIAN__</TT> preprocessor definition should be provided.
|
||||
|
||||
|
||||
\section unix Unix Systems:
|
||||
@@ -25,47 +37,54 @@ STK compiles with realtime support on the following flavors of the Unix operatin
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>ALSA</TD>
|
||||
<TD>__LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
|
||||
<TD>__LINUX_ALSA__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>OSS</TD>
|
||||
<TD>__LINUX_OSS__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>pthread</TT></TD>
|
||||
<TD>OSS (version 4.0 only, use ALSA for MIDI support)</TD>
|
||||
<TD>__LINUX_OSS__, __LINUX_ALSASEQ__, __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><TT>asound, pthread, jack</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Macintosh OS X</TD>
|
||||
<TD>CoreAudio</TD>
|
||||
<TD>__MACOSX_CORE__</TD>
|
||||
<TD><TT>pthread, stdc++, CoreAudio, CoreMIDI, CoreFoundation</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Irix</TD>
|
||||
<TD>AL</TD>
|
||||
<TD>__IRIX_AL__</TD>
|
||||
<TD><TT>audio, pthread</TT></TD>
|
||||
<TD><TT>pthread, CoreAudio, CoreMidi, CoreFoundation</TT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
|
||||
The available C++ compilers on any of these systems can vary.
|
||||
|
||||
One approach in using STK is to simply copy the class files needed for a particular program into a project directory. Taking the <TT>sineosc.cpp</TT> example from the previous tutorial chapter, it would be necessary to set up a directory that includes the files <TT>sineosc.cpp</TT>, the rawwave file <TT>sinewave.raw</TT> in a subdirectory called <TT>rawwaves</TT>, and the header and source files for the classes Stk, WvIn, WaveLoop, and WvOut. The program could then be compiled on a Linux system using the GNU g++ compiler as follows:
|
||||
\code
|
||||
g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp sineosc.cpp
|
||||
\endcode
|
||||
One approach in using STK is to simply copy the class files needed for
|
||||
a particular program into a project directory. Taking the
|
||||
<TT>sineosc.cpp</TT> example from the previous tutorial chapter, it
|
||||
would be necessary to set up a directory that includes the files
|
||||
<TT>sineosc.cpp</TT>, the rawwave file <TT>sinewave.raw</TT> in a
|
||||
subdirectory called <TT>rawwaves</TT>, and the header and source files
|
||||
for the classes Stk, FileRead, FileWrite, FileWvIn, FileLoop, and
|
||||
FileWvOut. The program could then be compiled on a little-endian
|
||||
system, such as a PC running Linux, using the GNU g++ compiler as
|
||||
follows:
|
||||
\code g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc Stk.cpp FileRead.cpp FileWrite.cpp FileWvIn.cpp FileLoop.cpp FileWvOut.cpp sineosc.cpp \endcode
|
||||
|
||||
Note that the <TT>sineosc.cpp</TT> example does not make use of realtime audio or MIDI input/output classes. For programs using any of the STK realtime classes mentioned above, it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks.
|
||||
|
||||
When working with a number of different projects that make use of ToolKit classes, the above approach can become cumbersome (especially when trying to synchronize with new STK releases). Most of the STK projects (e.g., demo, effects, ...) contain <TT>Makefiles</TT> (built by the configure script) which compile project-specific class objects from the distribution <TT>src</TT> and <TT>include</TT> directories. This approach makes it relatively easy when upgrading to a new STK release (by making path substitutions in the <TT>Makefile</TT> or by moving the projects to a similar relative path within the new STK source tree). A <TT>Makefile</TT> is provided in the <TT>projects/examples</TT> directory for compiling all the tutorial programs, as well as other example programs. To compile the <TT>sineosc.cpp</TT> program, for example, one need only type <TT>make sineosc</TT> from within the <TT>projects/examples</TT> directory. Note that this particular <TT>Makefile</TT> depends on a static library, as described in the next section.
|
||||
When working with a number of different projects that make use of ToolKit classes, the above approach can become cumbersome (especially when trying to synchronize with new STK releases). Most of the STK projects (e.g., demo, effects, ...) contain <TT>Makefiles</TT> (built by the configure script) that compile project-specific class objects from the distribution <TT>src</TT> and <TT>include</TT> directories. This approach makes it relatively easy when upgrading to a new STK release (by making path substitutions in the <TT>Makefile</TT> or by moving the projects to a similar relative path within the new STK source tree). A <TT>Makefile</TT> is provided in the <TT>projects/examples</TT> directory for compiling all the tutorial programs, as well as other example programs. To compile the <TT>sineosc.cpp</TT> program, for example, one need only type <TT>make sineosc</TT> from within the <TT>projects/examples</TT> directory.
|
||||
|
||||
|
||||
\subsection library Library Use:
|
||||
|
||||
The STK distribution provides a <TT>Makefile</TT> that can be used on Unix systems to build a static library. After unpacking the distribution (<TT>tar -xzf stk-4.x.tar.gz</TT>), run the configure script by typing <TT>./configure</TT> from the top level distribution directory (see the INSTALL file in the same directory for more information). Then from within the <TT>src</TT> directory, type <TT>make</TT>. After a successful build, you may wish to move the library (<TT>libstk.a</TT>) and the contents of the <TT>include</TT> directory to standard library and include search paths on your system. For example, the linux RPM distribution of STK puts the library in <TT>/usr/lib/</TT> and the STK header files in <TT>/usr/include/stk/</TT>.
|
||||
The STK distribution provides a <TT>Makefile</TT> that can be used on Unix systems to build a static library. After unpacking the distribution (<TT>tar -xzf stk-4.x.x.tar.gz</TT>), run the configure script by typing <TT>./configure</TT> from the top level distribution directory (see the INSTALL file in the same directory for more information). Then from within the <TT>src</TT> directory, type <TT>make</TT>. After a successful build, you may wish to move the library (<TT>libstk.a</TT>) and the contents of the <TT>include</TT> directory to standard library and include search paths on your system. For example, the linux RPM distribution of STK puts the library in <TT>/usr/lib/</TT> and the STK header files in <TT>/usr/include/stk/</TT>.
|
||||
|
||||
Assuming the library is located in a standard search path and the header files are located in <TT>/usr/include/stk/</TT>, the <TT>sineosc.cpp</TT> example from the previous tutorial chapter can be compiled on a Linux system using the GNU g++ compiler as follows:
|
||||
Assuming the library is located in a standard search path and the header files are located in <TT>/usr/include/stk/</TT>, the <TT>sineosc.cpp</TT> example from the previous tutorial chapter can be compiled on a little-endian system using the GNU g++ compiler as follows:
|
||||
|
||||
\code
|
||||
g++ -Wall -D__LITTLE_ENDIAN__ -I/usr/include/stk -o sineosc sineosc.cpp -lstk
|
||||
@@ -74,8 +93,8 @@ g++ -Wall -D__LITTLE_ENDIAN__ -I/usr/include/stk -o sineosc sineosc.cpp -lstk
|
||||
With the header files in a standard search path, it is possible to modify the <TT>\#include</TT> statements in the <TT>sineosc.cpp</TT> program as follows:
|
||||
|
||||
\code
|
||||
#include "stk/WaveLoop.h"
|
||||
#include "stk/WvOut.h"
|
||||
#include "stk/FileLoop.h"
|
||||
#include "stk/FileWvOut.h"
|
||||
\endcode
|
||||
|
||||
and then compile without an explicit include path argument to the compiler:
|
||||
@@ -87,13 +106,22 @@ g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc sineosc.cpp -lstk
|
||||
|
||||
\section compileWin Windows:
|
||||
|
||||
STK has been tested on Windows platforms using the Visual C++ compiler only. It is assumed here that you're familiar with Visual C++ and its particular idiosyncrasies.
|
||||
STK has been tested on Windows platforms using the Visual .NET compiler
|
||||
only. It is assumed here that you're familiar with Visual C++ and its
|
||||
particular idiosyncrasies. STK won't compile in Visual C++ 6.0 any more.
|
||||
|
||||
The approach when using Visual C++ is to build a project which includes the necessary ToolKit files from the distribution <TT>src</TT> and <TT>include</TT> directories. For the example program from the previous tutorial chapter, create a VC++ console application project, add the Stk, WvIn, WaveLoop, and WvOut class files, as well as <TT>sineosc.cpp</TT>, and make sure the <TT>sinewave.raw</TT> file is in the subdirectory <TT>rawwaves</TT>.
|
||||
The approach when using Visual C++ is to build a project that
|
||||
includes the necessary ToolKit files from the distribution
|
||||
<TT>src</TT> and <TT>include</TT> directories. For the example
|
||||
program from the previous tutorial chapter, create a VC++ console
|
||||
application project, add the Stk, FileRead, FileWrite, WvIn, FileWvIn,
|
||||
FileLoop, WvOut, and FileWvOut class files, as well as
|
||||
<TT>sineosc.cpp</TT>, and make sure the <TT>sinewave.raw</TT> file is
|
||||
in the subdirectory <TT>rawwaves</TT>.
|
||||
|
||||
For programs using any of the STK realtime classes mentioned above, it is necessary to link with the DirectSound (<TT>dsound.lib</TT>), <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries, select the multithreaded library, and provide the <TT>__LITTLE_ENDIAN__</TT> and <TT>__WINDOWS_DS__</TT> preprocessor definitions.
|
||||
For programs using any of the STK realtime classes mentioned above, it is necessary to link with the DirectSound (<TT>dsound.lib</TT>), <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries, select the multithreaded library, and provide the <TT>__LITTLE_ENDIAN__</TT>, <TT>__WINDOWS_DS__</TT>, and <TT>__WINDOWS_MM__</TT> preprocessor definitions.
|
||||
|
||||
For Steinberg 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.
|
||||
For Steinberg ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition (and the <TT>__WINDOWS_MM__</TT> definition for RtMidi support), 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.
|
||||
|
||||
[<A HREF="realtime.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="filtering.html">Next tutorial</A>]
|
||||
*/
|
||||
|
||||
@@ -17,114 +17,38 @@ StringDetune 0.100000 2 12.0
|
||||
NoteOff 1.000000 2 69.0 64.0
|
||||
\endcode
|
||||
|
||||
MIDI messages (with the exception of Sysex) are easily represented within the SKINI protocol.
|
||||
MIDI messages are easily represented within the SKINI protocol.
|
||||
|
||||
The class Messager can be used to acquire and parse MIDI messages from a MIDI device and SKINI messages from STDIN and socket connections. Many of the example programs included with the ToolKit distribution use a Messager instance to accept control input from the accompanying tcl/tk graphical user interfaces, from external MIDI devices, or from SKINI scorefiles.
|
||||
The class stk::Messager can be used to acquire and parse MIDI messages
|
||||
from a MIDI device and SKINI messages from STDIN and socket
|
||||
connections. Incoming messages are acquired asynchronously and saved
|
||||
to an internal message queue of stk::Skini::Message types (MIDI
|
||||
messages are converted to the stk::Skini:Message format). The user
|
||||
then uses the stk::Messager:popMessage() function to retrieve incoming
|
||||
control messages. This function does not block, instead returning a
|
||||
message type of zero when no more messages are in the queue. Many of
|
||||
the example programs included with the ToolKit distribution use a
|
||||
stk::Messager instance to accept control input from the accompanying tcl/tk
|
||||
graphical user interfaces, from external MIDI devices, or from SKINI
|
||||
scorefiles.
|
||||
|
||||
In the following example, we'll modify the <TT>bethree.cpp</TT> program from the previous tutorial chapter and incorporate a Messager class to allow control via a SKINI scorefile.
|
||||
In the following example, we'll modify the <TT>bethree.cpp</TT> program from the previous tutorial chapter and incorporate a stk::Messager class to allow control via SKINI messages read from a SKINI file.
|
||||
|
||||
\include controlbee.cpp
|
||||
|
||||
A realtime control message will usually have a delta time of zero, in which case it is processed as soon as possible. Non-realtime messages, normally from a scorefile, will usually have non-zero delta times. The scheme used in this example is designed to work for both scorefile and realtime input types. When no message is available from the queue, the instrument is "ticked" for DELTA_CONTROL_TICKS and then the queue is checked again. The value of DELTA_CONTROL_TICKS roughly defines the program "control rate" in a realtime context, though multiple available messages in the queue are processed in immediate succession when their delta time values are zero.
|
||||
|
||||
The \c processMessage() function centralizes the handling of control messages. Other control update schemes can be implemented, perhaps using a separate thread or in the \c main() function, and this function should work in any context.
|
||||
|
||||
Assuming the program is compiled as <TT>controlbee</TT> and the SKINI scorefile <A HREF="tutorial/bookert.ski"><TT>bookert.ski</TT></A> is in the <TT>scores</TT> directory, the program can be run as:
|
||||
|
||||
\code
|
||||
// controlbee.cpp
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
#include "Messager.h"
|
||||
#include "SKINI.msg"
|
||||
#include <math.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
Instrmnt *instrument = 0;
|
||||
RtWvOut *output = 0;
|
||||
Messager *messager = 0;
|
||||
bool done = FALSE;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instrument
|
||||
instrument = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a Messager instance to read from a redirected SKINI scorefile.
|
||||
messager = new Messager();
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Play the instrument until the end of the scorefile.
|
||||
int i, nTicks, type;
|
||||
MY_FLOAT byte2, byte3, frequency;
|
||||
while (!done) {
|
||||
|
||||
// Look for new messages and return a delta time (in samples).
|
||||
type = messager->nextMessage();
|
||||
if (type < 0)
|
||||
done = TRUE;
|
||||
|
||||
nTicks = messager->getDelta();
|
||||
try {
|
||||
for ( i=0; i<nTicks; i++ )
|
||||
output->tick( instrument->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ( type > 0 ) {
|
||||
// Process the new control message.
|
||||
byte2 = messager->getByteTwo();
|
||||
byte3 = messager->getByteThree();
|
||||
|
||||
switch(type) {
|
||||
|
||||
case __SK_NoteOn_:
|
||||
frequency = (MY_FLOAT) 220.0 * pow( 2.0, (byte2 - 57.0) / 12.0 );
|
||||
instrument->noteOn( frequency, byte3 * ONE_OVER_128 );
|
||||
break;
|
||||
|
||||
case __SK_NoteOff_:
|
||||
instrument->noteOff( byte3 * ONE_OVER_128 );
|
||||
break;
|
||||
|
||||
case __SK_ControlChange_:
|
||||
instrument->controlChange( (int) byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_AfterTouch_:
|
||||
instrument->controlChange( 128, byte2 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete instrument;
|
||||
delete output;
|
||||
delete messager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
Assuming the program is compiled as <TT>controlbee</TT> and the SKINI scorefile <A HREF="tutorial/bookert.ski"><TT>bookert.ski</TT></A> is in the <TT>scores</TT> directory, the scorefile could be redirected to the program as:
|
||||
|
||||
\code
|
||||
controlbee < scores/bookert.ski
|
||||
controlbee scores/bookert.ski
|
||||
\endcode
|
||||
|
||||
Only a few basic SKINI message type case statements are included in this example. It is easy to extend the program to support a much more elaborate set of instrument control parameters.
|
||||
|
||||
This example could also be easily extended to accept "realtime" control input messages via STDIN, socket, or MIDI connections. The Messager class constructor takes an optional argument consisting of a bitmask of the following options: <TT>STK_PIPE</TT>, <TT>STK_SOCKET</TT>, and/or <TT>STK_MIDI</TT>.
|
||||
This example could also be easily extended to accept "realtime" control input messages via pipe, socket or MIDI connections. The stk::Messager class provides stk::Messager::startStdInput(), stk::Messager::startSocketInput(), and stk::Messager::startMidiInput() functions for this purpose.
|
||||
|
||||
[<A HREF="multichannel.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="multichannel.html">Next tutorial</A>]
|
||||
*/
|
||||
|
||||
74
doc/doxygen/crealtime.txt
Normal file
74
doc/doxygen/crealtime.txt
Normal file
@@ -0,0 +1,74 @@
|
||||
/*! \page crealtime Realtime Audio (callback)
|
||||
|
||||
An alternative scheme for audio input/output is to define a specific
|
||||
function in which audio computations are performed and to let the
|
||||
audio system call this function when more input/output data can be
|
||||
accepted by the hardware (referred to as a callback scheme). In this
|
||||
section, we show how the previous <TT>rtsine.cpp</TT> program can be
|
||||
modified to work in a callback scenario. There is no "single-sample"
|
||||
interface for this functionality. The callback function will be
|
||||
invoked automatically by the audio system controller (RtAudio) when
|
||||
new data is needed and it is necessary to compute a full audio buffer
|
||||
of samples at that time (see \ref callback for further information).
|
||||
|
||||
The previous section described the use of the stk::RtWvOut class for
|
||||
realtime audio output. The stk::RtWvOut::tick() function writes data to a
|
||||
large ring-buffer, from which data is periodically written to the
|
||||
computer's audio hardware via an underlying callback routine.
|
||||
|
||||
\include crtsine.cpp
|
||||
|
||||
The sinusoidal oscillator is created as before. The instantiation of
|
||||
RtAudio requires quite a few more parameters, including output/input
|
||||
device and channel specifiers, the data format, and the desired buffer
|
||||
length (in frames). In this example, we request a single output
|
||||
channel using the default output device, zero channels of input, the
|
||||
RtAudio data format which corresponds to an <tt>StkFloat</tt>, and the
|
||||
RT_BUFFER_SIZE defined in Stk.h. The \c bufferFrames argument is an
|
||||
API-dependent buffering parameter (see RtAudio for further
|
||||
information).
|
||||
|
||||
We also provide the audio system controller with a pointer to our
|
||||
callback function and an optional pointer to data that will be made
|
||||
available in the callback. In this example, we need to pass only the
|
||||
pointer to the oscillator. In more complex programs, it is typically
|
||||
necessary to put all shared data in a <tt>struct</tt> (see the next
|
||||
tutorial program for an example) or make use of global variables.
|
||||
|
||||
Our callback routine is the \c tick() function. Function arguments
|
||||
include pointers to the audio input and output data buffers, the
|
||||
buffer size (in frames), a stream time argument, a status argument to
|
||||
test for over/underruns, and the data pointer passed in the
|
||||
openStream() function (if it exists). It is necessary to cast these
|
||||
pointers to their corresponding data types before use. Our tick()
|
||||
routine simply "ticks" the oscillator for \c nBufferFrames counts and
|
||||
writes the result into the audio data buffer before returning.
|
||||
|
||||
The \c main() function blocks at the std::cin.get() call until the
|
||||
user hits the "enter" key, after which the audio controller is shut
|
||||
down and program execution ends.
|
||||
|
||||
\section callback Blocking vs. Callbacks
|
||||
|
||||
Prior to version 4.2.0, all STK example projects and programs used
|
||||
blocking audio input/output functionality (typically with the RtWvIn,
|
||||
RtWvOut, or RtDuplex classes). In many instances, a blocking scheme
|
||||
results in a clearer and more straight-forward program structure.
|
||||
Within a graphical user interface (GUI) programming context, however,
|
||||
callback routines are often more natural.
|
||||
|
||||
In order to allow all STK programs to function with equal proficiency
|
||||
on all supported computer platforms, a decision was made to modify the
|
||||
example projects to use audio callback routines. The result is a more
|
||||
complicated code structure, which is unfortunate given that we
|
||||
generally strive to make STK code as clear as possible for educational
|
||||
purposes. This was especially an issue with the demo program because
|
||||
it is designed to function in both realtime and non-realtime contexts.
|
||||
The use of global variables has been avoided by defining data
|
||||
structures to hold all variables that must be accessible to the
|
||||
callback routine and other functions. Alternative schemes for making
|
||||
control updates could be designed depending on particular program
|
||||
needs and constraints.
|
||||
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="instruments.html">Next tutorial</A>]
|
||||
*/
|
||||
@@ -1,15 +1,118 @@
|
||||
/*! \page download Download and Release Notes
|
||||
/*! \page download Download, Release Notes, and Bug Fixes
|
||||
|
||||
\section down Download Version 4.4.1 (3 June 2009):
|
||||
|
||||
<B>Version 4.1.3, 22 March 2004</B><P>
|
||||
<UL>
|
||||
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.3.tar.gz">Source distribution</A></LI>
|
||||
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.3.binaries.tar.gz">Source with precompiled Windows binaries</A></LI>
|
||||
<LI><A HREF="http://www-ccrma.stanford.edu/planetccrma/software/">Linux RPMs from Planet CCRMA</A></LI>
|
||||
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.4.1.tar.gz">Source distribution</A></LI>
|
||||
</UL>
|
||||
|
||||
|
||||
\section notes Release Notes:
|
||||
|
||||
\subsection v4dot4dot1 Version 4.4.1
|
||||
|
||||
<ul>
|
||||
<li>Added multi-channel/frame tick() virtual function to WvIn and WvOut abstract base classes (required update to RtWvOut class).</li>
|
||||
<li>Updated configure script to select g++ compiler by default.</li>
|
||||
<li>In demo.cpp: removed voicer grouping for messages, fixing polyphony when messages are on the same MIDI/SKINI channel.</li>
|
||||
<li>Updates to RtAudio and RtMidi.</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot4dot0 Version 4.4.0
|
||||
|
||||
<ul>
|
||||
<li>All classes embedded in the "stk" namespace (except RtAudio, RtMidi, and RtError).</li>
|
||||
<li>Class WaveLoop renamed FileLoop.</li>
|
||||
<li>Significant efficiency improvements via code restructuring and inlining.</li>
|
||||
<li>Some class source (.cpp) files deleted as part of inlining (Generator, Filter, Function, WvIn, WvOut, Effect, Instrmnt, BowTable, ReedTable, JetTable, Vector3D).</li>
|
||||
<li>Updates to RtAudio and RtMidi.</li>
|
||||
<li>Previous "tickFrame()" functions renamed "tick" for more consistent API.</li>
|
||||
<li>More consistent and scalable approach to multichannel data and computations.</li>
|
||||
<li>Multichannel support added to Granulate class.</li>
|
||||
<li>Filter class made abstract. New Iir and Fir classes made for non-order-specific filtering.</li>
|
||||
<li>New TapDelay class.</li>
|
||||
<li>SubNoise class deleted (same as sub-sampled "ticking" of Noise class).</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot3dot1 Version 4.3.1
|
||||
|
||||
<ul>
|
||||
<li>Further headerless file support in FileRead.</li>
|
||||
<li>Bug fix in RtWvOut.cpp.</li>
|
||||
<li>Added configure support for MinGW.</li>
|
||||
<li>Updates to RtAudio and RtMidi for MinGW.</li>
|
||||
<li>Changes to channel assignment in demo.cpp.</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot3dot0 Version 4.3.0
|
||||
|
||||
<ul>
|
||||
<li>An official MIT-like license.</li>
|
||||
<li>New functionality to automatically update class data when the STK sample rate changes (partly implemented).</li>
|
||||
<li>Updates for new RtAudio version 4.0.</li>
|
||||
<li>Removed RtDuplex class, users should use RtAudio directly with a callback function.</li>
|
||||
<li>Bug fix in interpolate() function in Stk.h for non-interleaved data.</li>
|
||||
<li>Fixes / improvements to the Granulate class.</li>
|
||||
<li>Fix in Whistle when doing animation.</li>
|
||||
<li>Fixes in BlitSquare for frequency, harmonics, and dc offset.</li>
|
||||
<li>Updates to Makefiles for non-realtime compile.</li>
|
||||
<li>Fix in demo.cpp for voice channel assignment.</li>
|
||||
<li>Updated versions of RtMidi and RtAudio.</li>
|
||||
<li>Updated ASIO files for MinGW compiler.</li>
|
||||
<li>New FAQ in documentation.</li>
|
||||
<li>MAT-file bug fix in FileRead class.</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot2dot1 Version 4.2.1
|
||||
|
||||
<ul>
|
||||
<li>Greatly expanded StkFrames functionality (including interpolation and indexing by channel/frame).</li>
|
||||
<li>New Blit, BlitSaw, and BlitSquare bandlimited waveform classes (thanks to Robin Davies!).</li>
|
||||
<li>New Granulate granular synthesis class.</li>
|
||||
<li>Removed Table class ... all functionality (including interpolation) now in StkFrames and FileRead classes.</li>
|
||||
<li>Revised Socket class (now abstract) and added TcpServer, TcpClient, and UdpSocket subclasses.</li>
|
||||
<li>Added Stk::showWarnings() and Stk::printErrors() functions to dis/enable warning and error printouts.</li>
|
||||
<li>Extracted file I/O functionality to FileRead and FileWrite classes.</li>
|
||||
<li>Revised WvIn / WvOut class structure (WvIn / WvOut now abstract and file I/O functionality in new FileWvIn / FileWvOut subclasses).</li>
|
||||
<li>New SineWave class which calculates its own static table of variable length (no rawwave dependency).</li>
|
||||
<li>New sinewave.raw file of length 1024 samples (used to be 256).</li>
|
||||
<li>TcpWvIn and TcpWvOut renamed InetWvIn and InetWvOut, with added support for UDP sockets.</li>
|
||||
<li>Fixed bug in WvOut tickFrame( const StkFrames &frames ) function.</li>
|
||||
<li>Fixed bug in demo.cpp when writing output soundfiles without realtime output.</li>
|
||||
<li>Added "binary" open flag to MidiFileIn class for Windows.</li>
|
||||
<li>Fixed oversized MAT-file header in WvOut.cpp</li>
|
||||
<li>Fixed case statement bug in MidiFileIn.cpp for sysex.</li>
|
||||
<li>Added missing getDelay() function to DelayA.cpp.</li>
|
||||
<li>Fixed modDepth omission in Chorus.cpp.</li>
|
||||
<li>Fixed DC blocker initialization bug in Flute.cpp.</li>
|
||||
<li>Changed Filter class behavior so no default clearing of state when changing coefficients.</li>
|
||||
<li>Fixes to RtAudio, especially for Windows DirectSound and ASIO (thanks to Robin Davies).</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot2dot0 Version 4.2.0
|
||||
|
||||
<ul>
|
||||
<li>Simultaneous multiple audio APIs supported at compile time.</li>
|
||||
<li>Various changes to better conform to standard C++ programming practices.</li>
|
||||
<li>Fixed hidden overloaded virtual functions.</li>
|
||||
<li>New Asymp exponential envelope class.</li>
|
||||
<li><tt>MY_FLOAT</tt> type converted to <tt>StkFloat</tt> and changed throughout (use \c treesed utility to search/replace in old files).</li>
|
||||
<li>Most example programs rewritten to use an audio callback paradigm (which works better in OS-X).</li>
|
||||
<li>New StkFrames class for vectorized multichannel data and associated new tick() functions making use of StkFrames.</li>
|
||||
<li>New RtMidi class with MIDI output capabilities (API changes).</li>
|
||||
<li>New MidiFileIn class for reading MIDI files.</li>
|
||||
<li>Revised Filter classes to use std::vectors for coefficients (API changes).</li>
|
||||
<li>Revised Messager class (API changes).</li>
|
||||
<li>New abstract parent Effect class for various effects.</li>
|
||||
<li>New abstract parent Generator class for various signal sources.</li>
|
||||
<li>New abstract parent Function class for tables and various non-linear functions.</li>
|
||||
<li>Skini class completely rewritten (simplified) using the C++ STL (API changes).</li>
|
||||
<li>WvOut classes now clip to -1.0 to +1.0 and report out of range.</li>
|
||||
<li>New Mutex class.</li>
|
||||
<li>Turned Nagle algorithm off by default in Socket class.</li>
|
||||
<li>Error reporting standardized in all classes.</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot1dot3 Version 4.1.3
|
||||
|
||||
<ul>
|
||||
@@ -30,7 +133,7 @@
|
||||
<li>Update to the contentsAt() method of Delay class.</li>
|
||||
<li>WAV file fixes (8-bit) in WvIn and WvOut classes.</li>
|
||||
<li>Configure script changes.</li>
|
||||
<li>Updated <iostream> include statements and appended "std::" as necessary throughout for compatibility with gcc 3.</li>
|
||||
<li>Updated \<iostream\> include statements and appended "std::" as necessary throughout for compatibility with gcc 3.</li>
|
||||
</UL>
|
||||
|
||||
\subsection v4dot1dot1 Version 4.1.1
|
||||
@@ -138,7 +241,7 @@
|
||||
<LI>Added RawWvOut class.</LI>
|
||||
<LI>New WvIn class with RawWvIn, SndWvIn, WavWvIn, MatWvIn, and RTWvIn subclasses.</LI>
|
||||
<LI>Removed RawWave, RawShot, RawInterp, and RawLoop classes (supplanted by RawWvIn).</LI>
|
||||
<LI>Multi-channel data support in WvIn and WvOut classes using MY_MULTI data type (pointer to MY_FLOAT) and the methods mtick() and mlastOutput().</LI>
|
||||
<LI>Multi-channel data support in WvIn and WvOut classes using MY_MULTI data type (pointer to StkFloat) and the methods mtick() and mlastOutput().</LI>
|
||||
<LI>Now writing to primary buffer under Windoze when allowed by hardware.</LI>
|
||||
<LI>Cleaned up Object.h a bit.</LI>
|
||||
<LI>Pulled various utility and thread functions out of syntmono.cpp (to aid readability of the code).</LI>
|
||||
@@ -160,11 +263,11 @@
|
||||
<UL>
|
||||
<LI>Unification of the capabilities of STK across the various platforms. All of the previous SGI functionality has been ported to Linux and Windows, including realtime sound output and MIDI input.</LI>
|
||||
<LI>MIDI input (with optional time-stamping) supported on SGI, Linux (OSS device drivers only), and Windows operating systems. Time stamping under IRIX and Windows is quantized to milliseconds and under Linux to hundredths of a second.</LI>
|
||||
<LI>Various Sound Output Options - .wav, .snd, and .mat (Matlab MAT-file) soundfile outputs are supported on all operating systems. I hacked out the MAT-file structure, so you don't have to include any platform-specific libraries. Realtime sound output is provided as well, except under NeXTStep. </LI>
|
||||
<LI>Various Sound Output Options - .wav, .snd, and .mat (Matlab MAT-file) soundfile outputs are supported on all operating systems. I hacked out the MAT-file structure, so you don't have to include any platform-specific libraries. Realtime sound output is provided as well, except under NeXTStep.</LI>
|
||||
<LI>Multiple Reverberator Implementations - Reverb subclasses of JCRev and NRev (popular reverberator implementations from CCRMA) have been written. Perry's original reverb implementation still exists as PRCRev. All reverberators now take a T60 initializer argument.</LI>
|
||||
<LI>MD2SKINI - A program which parses a MIDI input stream and spits out SKINI code. The output of MD2SKINI is typically piped into an STK instrument executable (eg. <FONT FACE="Geneva">MD2SKINI | syntmono Clarinet -r -i</FONT>). In addition, you can supply a filename argument to MD2SKINI and have it simultaneously record a SKINI score file for future reuse.
|
||||
<LI>Modifications to <I>Object.h</I> for OS_TYPE compilation dependencies. <I>Makefile</I> automatically determines OS_TYPE when invoked (if you have the GNU makefile utilities installed on your system).
|
||||
<LI>A single distribution for all platforms. The Unix and Windows versions have been merged into a single set of classes. Makefiles and Visual C++ workspace/project files are provided for compiling.
|
||||
<LI>MD2SKINI - A program which parses a MIDI input stream and spits out SKINI code. The output of MD2SKINI is typically piped into an STK instrument executable (eg. <tt>MD2SKINI | syntmono Clarinet -r -i</tt>). In addition, you can supply a filename argument to MD2SKINI and have it simultaneously record a SKINI score file for future reuse.</LI>
|
||||
<LI>Modifications to <I>Object.h</I> for OS_TYPE compilation dependencies. <I>Makefile</I> automatically determines OS_TYPE when invoked (if you have the GNU makefile utilities installed on your system).</LI>
|
||||
<LI>A single distribution for all platforms. The Unix and Windows versions have been merged into a single set of classes. Makefiles and Visual C++ workspace/project files are provided for compiling.</LI>
|
||||
</UL>
|
||||
|
||||
*/
|
||||
|
||||
80
doc/doxygen/faq.txt
Normal file
80
doc/doxygen/faq.txt
Normal file
@@ -0,0 +1,80 @@
|
||||
/*! \page faq Frequently Asked Questions
|
||||
|
||||
- \ref license
|
||||
- \ref filerate
|
||||
- \ref endianness
|
||||
- \ref xwindows
|
||||
|
||||
\section license Does STK have a license?
|
||||
|
||||
Yes, we finally made something official for release 4.3.0. It is listed in the Stk class and a few other places in the distribution, but I'll repeat it here for clarity:
|
||||
|
||||
\verbatim
|
||||
The Synthesis ToolKit in C++ (STK) is a set of open source audio
|
||||
signal processing and algorithmic synthesis classes written in the
|
||||
C++ programming language. STK was designed to facilitate rapid
|
||||
development of music synthesis and audio processing software, with
|
||||
an emphasis on cross-platform functionality, realtime control,
|
||||
ease of use, and educational example code. STK currently runs
|
||||
with realtime support (audio and MIDI) on Linux, 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.
|
||||
|
||||
STK WWW site: http://ccrma.stanford.edu/software/stk/
|
||||
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
Copyright (c) 1995-2009 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
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Any person wishing to distribute modifications to the Software is
|
||||
asked to send the modifications to the original developer so that they
|
||||
can be incorporated into the canonical version. This is, however, not
|
||||
a binding provision of this license.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
\endverbatim
|
||||
|
||||
\section filerate Why is my file sample rate wrong?
|
||||
|
||||
When the FileWvIn class loads a soundfile, it automatically sets its internal read increment based on the soundfile rate and the current STK sample rate. For example, if the current STK sample rate is 44100 Hz and the soundfile rate is 22050 Hz, the read increment, or rate, will be set to 0.5 and the file will be interpolated so that is sounds correct at 44100 Hz. For most cases, this works fine. However, consider the following example:
|
||||
|
||||
\code
|
||||
FileWvIn input( "infile" ); // read an input soundfile
|
||||
StkFloat sampleRate = input.getFileRate();
|
||||
Stk::setSampleRate( sampleRate ); // set a new STK sample rate based on the file rate
|
||||
\endcode
|
||||
|
||||
With version 4.3 and higher of STK, the FileWvIn class will be notified of a sample rate change and it will automatically adjust its read rate accordingly. Previous versions of STK did not perform this change and thus, the read rate could end up being incorrect. If you do not want FileWvIn to perform this automatic adjustment, you can call the \c ignoreSampleRateChange() function for a given class instance.
|
||||
|
||||
\section endianness Why does the sound I generated with STK sound like *&#@!?
|
||||
|
||||
If the resultant sound generated by an STK program sounds like noise (and you're not doing an MLS experiment), the problem is likely related to the byte "endianness" of your computer. By default, STK assumes "big endian" byte order. If you are working with STK classes on a PC (Windows or Linux), you \e must define the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition \e before compiling. If after reading this you realize you need to make this change, do not forget to recompile all STK classes from scratch.
|
||||
|
||||
\section xwindows Why do I get a Tk display error message?
|
||||
|
||||
The following error may be printed to your terminal window (depending on the version of the tcl/tk interpreter you are running) if you attempt to start an STK tcl/tk interface without the X Server first running:
|
||||
|
||||
\code
|
||||
Application initialization failed: this isn't a Tk applicationcouldn't connect to display ":0.0"
|
||||
\endcode
|
||||
|
||||
Simply start your X server and then try the command again.
|
||||
|
||||
*/
|
||||
91
doc/doxygen/filtering.txt
Normal file
91
doc/doxygen/filtering.txt
Normal file
@@ -0,0 +1,91 @@
|
||||
/*! \page filtering Using Filters
|
||||
|
||||
In this section, we demonstrate the use of a few of the STK filter classes. The stk::Iir class provides functionality to implement a generalized infinite impulse response (IIR) digital filter, similar to the \c filter function in Matlab. In this example, we create an stk::Iir instance and initialize it with specific numerator and denominator coefficients. We then compute its impulse response for 20 samples.
|
||||
|
||||
\code
|
||||
#include "Iir.h"
|
||||
using namespace stk;
|
||||
|
||||
int main()
|
||||
{
|
||||
StkFrames output( 20, 1 ); // initialize StkFrames to 20 frames and 1 channel (default: interleaved)
|
||||
output[0] = 1.0;
|
||||
|
||||
std::vector<StkFloat> numerator( 5, 0.1 ); // create and initialize numerator coefficients
|
||||
std::vector<StkFloat> denominator; // create empty denominator coefficients
|
||||
denominator.push_back( 1.0 ); // populate our denomintor values
|
||||
denominator.push_back( 0.3 );
|
||||
denominator.push_back( -0.5 );
|
||||
|
||||
Iir filter( numerator, denominator );
|
||||
|
||||
filter.tick( output );
|
||||
for ( unsigned int i=0; i<output.size(); i++ ) {
|
||||
std::cout << "i = " << i << " : output = " << output[i] << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
The stk::Iir class implements the standard difference equation
|
||||
\code
|
||||
a[0]*y[n] = b[0]*x[n] + ... + b[nb]*x[n-nb] - a[1]*y[n-1] - ... - a[na]*y[n-na],
|
||||
\endcode
|
||||
|
||||
where "b" values are numerator coefficients and "a" values are denominator coefficients. Note that if the first denominator coefficient is not 1.0, the Iir class automatically normalizes all filter coefficients by that value. The coefficient values are passed to the Iir class via a C++ <a href="http://www.roguewave.com/support/docs/sourcepro/stdlibref/vector.html">vector</a>, a container object provided by the C++ Standard Library.
|
||||
|
||||
Most STK classes use more specific types of digital filters, such as the stk::OneZero, stk::OnePole, stk::TwoPole, or stk::BiQuad varieties. These classes inherit from the stk::Filter abstract base class and provide specific functionality particular to their use, as well as functions to independently control individual coefficient values.
|
||||
|
||||
\section reson Resonances:
|
||||
|
||||
The STK stk::BiQuad and stk::TwoPole classes provide functionality for creating resonance filters. The following example demonstrates how to create a resonance centered at 440 Hz that is used to filter the output of a stk::Noise generator.
|
||||
|
||||
\code
|
||||
#include "BiQuad.h"
|
||||
#include "Noise.h"
|
||||
using namespace stk;
|
||||
|
||||
int main()
|
||||
{
|
||||
StkFrames output( 20, 1 ); // initialize StkFrames to 20 frames and 1 channel (default: interleaved)
|
||||
Noise noise;
|
||||
|
||||
BiQuad biquad;
|
||||
biquad.setResonance( 440.0, 0.98, true ); // automatically normalize for unity peak gain
|
||||
|
||||
for ( unsigned int i=0; i<output.size(); i++ ) {
|
||||
output[i] = biquad.tick( noise.tick() ); // single-sample computations
|
||||
std::cout << "i = " << i << " : output = " << output[i] << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
By passing a boolian value of \c true as the third argument to the stk::BiQuad::setResonance() function, the filter coefficients are automatically scaled to achieve unity gain at the resonance peak frequency. The previous code could be easily modified for "vector-based" calculations:
|
||||
|
||||
\code
|
||||
#include "BiQuad.h"
|
||||
#include "Noise.h"
|
||||
using namespace stk;
|
||||
|
||||
int main()
|
||||
{
|
||||
StkFrames output( 20, 1 ); // initialize StkFrames to 20 frames and 1 channel (default: interleaved)
|
||||
Noise noise;
|
||||
|
||||
BiQuad biquad;
|
||||
biquad.setResonance( 440.0, 0.98, true ); // automatically normalize for unity peak gain
|
||||
|
||||
biquad.tick( noise.tick( output ) ); // vector-based computations
|
||||
for ( unsigned int i=0; i<output.size(); i++ ) {
|
||||
std::cout << "i = " << i << " : output = " << output[i] << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="realtime.html">Next tutorial</A>]
|
||||
*/
|
||||
@@ -1,8 +1,8 @@
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
65
doc/doxygen/fundamentals.txt
Normal file
65
doc/doxygen/fundamentals.txt
Normal file
@@ -0,0 +1,65 @@
|
||||
/*! \page fundamentals STK Fundamentals
|
||||
|
||||
The Synthesis ToolKit is implemented in the C++ programming language. STK does not attempt to provide a new programming environment or paradigm but rather provides a set of objects that can be used within a normal C++ programming framework. Therefore, it is expected that users of STK will have some familiarity with C/C++ programming concepts. That said, the STK classes do have some particular idiosyncrasies that we will mention here. Starting with STK version 4.4, all STK classes except RtAudio, RtMidi, and RtError are defined within the stk namespace.
|
||||
|
||||
\section Signal Computations:
|
||||
|
||||
Audio and control signals throughout STK use a floating-point data type, <tt>StkFloat</tt>, the exact precision of which can be controlled via a typedef statement in Stk.h. By default, an StkFloat is a double-precision floating-point value. Thus, the ToolKit can use any normalization scheme desired. The base instruments and algorithms are implemented with a general audio sample dynamic maximum of +/-1.0.
|
||||
|
||||
In general, the computation and/or passing of values is performed on a "single-sample" basis. For example, the stk::Noise class outputs random floating-point numbers in the range +/-1.0. The computation of such values occurs in the stk::Noise::tick() function. The following program will generate 20 random floating-point (<tt>StkFloat</tt>) values in the range -1.0 to +1.0:
|
||||
|
||||
\code
|
||||
#include "Noise.h"
|
||||
using namespace stk;
|
||||
|
||||
int main()
|
||||
{
|
||||
StkFloat output;
|
||||
Noise noise;
|
||||
|
||||
for ( unsigned int i=0; i<20; i++ ) {
|
||||
output = noise.tick();
|
||||
std::cout << "i = " << i << " : output = " << output << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
Nearly all STK classes implement <TT>tick()</TT> functions that take and/or return sample values. Within the <TT>tick()</TT> function, the fundamental sample calculations are performed for a given class. Most STK classes consume/generate a single sample per operation and their <TT>tick()</TT> method takes/returns each sample "by value". In addition, every class implementing a <TT>tick()</TT> function also provides one or more overloaded <TT>tick()</TT> functions that can be used for vectorized computations, as shown in the next example.
|
||||
|
||||
\code
|
||||
#include "Noise.h"
|
||||
using namespace stk;
|
||||
|
||||
int main()
|
||||
{
|
||||
StkFrames output(20, 1); // initialize StkFrames to 20 frames and 1 channel (default: interleaved)
|
||||
Noise noise;
|
||||
|
||||
noise.tick( output );
|
||||
for ( unsigned int i=0; i<output.size(); i++ ) {
|
||||
std::cout << "i = " << i << " : output = " << output[i] << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
In this way, it might be possible to achieve improved processing efficiency using vectorized computations. The StkFrames class is a relatively new addition to the ToolKit to provide a general "mechanism" for handling and passing vectorized, multi-channel audio data. The StkFrames "type" provides functions to set and/or determine the number of audio channels and sample frames it holds. Further, the StkFrames class provides data interpolation and subscripting functionality by frame/channel values.
|
||||
|
||||
\section STK Inheritance:
|
||||
|
||||
Nearly all STK classes inherit from the Stk abstract base class, which provides common functionality related to error reporting, sample rate control, and byte swapping. Several other base classes exist that roughly group many of the classes according to function as follows:
|
||||
|
||||
- stk::Generator: source signal unit generator classes [stk::Envelope, stk::ADSR, stk::Asymp, stk::Noise, stk::SubNoise, stk::Modulate, stk::SingWave, stk::SineWave, stk::Blit, stk::BlitSaw, stk::BlitSquare, stk::Granulate]
|
||||
- stk::Filter: digital filtering classes [stk::OneZero, stk::OnePole, stk::PoleZero, stk::TwoZero, stk::TwoPole, stk::BiQuad, stk::FormSwep, stk::Delay, stk::DelayL, stk::DelayA, stk::TapDelay]
|
||||
- stk::Function: input to output function mappings [stk::BowTable, stk::JetTable, stk::ReedTable]
|
||||
- stk::Instrmnt: sound synthesis algorithms, including physical, FM, modal, and particle models
|
||||
- stk::Effect: sound processing effect classes [stk::Echo, stk::Chorus, stk::PitShift, stk::PRCRev, stk::JCRev, stk::NRev]
|
||||
- stk::WvOut: audio data output classes [stk::FileWvOut, stk::RtWvOut, stk::InetWvOut]
|
||||
- stk::WvIn: audio data input classes [stk::FileWvIn, stk::FileLoop, stk::RtWvIn, stk::InetWvIn]
|
||||
|
||||
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="hello.html">Next tutorial</A>]
|
||||
*/
|
||||
@@ -6,5 +6,5 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
\vspace*{1cm}
|
||||
{\large by Perry R. Cook and Gary P. Scavone}\\
|
||||
\vspace*{0.5cm}
|
||||
{\small \copyright 1995--2002}\\
|
||||
{\small \copyright 1995--2007}\\
|
||||
\end{center}
|
||||
\end{titlepage}
|
||||
\clearemptydoublepage
|
||||
\pagenumbering{roman}
|
||||
\rfoot[\fancyplain{}{\bfseries\scriptsize The Synthesis ToolKit in C++ by Perry R. Cook and Gary P. Scavone, \copyright~1995--2002}]{}
|
||||
\lfoot[]{\fancyplain{}{\bfseries\scriptsize The Synthesis ToolKit in C++ by Perry R. Cook and Gary P. Scavone, \copyright~1995--2002}}
|
||||
\rfoot[\fancyplain{}{\bfseries\scriptsize The Synthesis ToolKit in C++ by Perry R. Cook and Gary P. Scavone, \copyright~1995--2007}]{}
|
||||
\lfoot[]{\fancyplain{}{\bfseries\scriptsize The Synthesis ToolKit in C++ by Perry R. Cook and Gary P. Scavone, \copyright~1995--2007}}
|
||||
\tableofcontents
|
||||
\clearemptydoublepage
|
||||
\pagenumbering{arabic}
|
||||
|
||||
@@ -1,104 +1,94 @@
|
||||
/*! \page hello Hello Sine!
|
||||
|
||||
We'll begin our introduction to the Synthesis ToolKit with a simple sine-wave oscillator program. STK does not provide a specific oscillator for sine waves. Instead, it provides a generic waveform oscillator class, WaveLoop, which can load a variety of common file types. In this example, we load a sine "table" from an STK RAW file (defined as monophonic, 16-bit, big-endian data). We use the class WvOut to write the result to a 16-bit, WAV formatted audio file.
|
||||
We'll continue our introduction to the Synthesis ToolKit with a simple
|
||||
sine-wave oscillator program. STK provides two different classes for
|
||||
sine-wave generation. We will first look at a generic waveform
|
||||
oscillator class, stk::FileLoop, that can load a variety of common file
|
||||
types. In this example, we load a sine "table" from an STK RAW file
|
||||
(defined as monophonic, 16-bit, big-endian data). We use the class
|
||||
stk::FileWvOut to write the result to a 16-bit, WAV formatted audio file.
|
||||
|
||||
\code
|
||||
|
||||
// sineosc.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
#include "FileLoop.h"
|
||||
#include "FileWvOut.h"
|
||||
using namespace stk;
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
// Define and load the sine wave file
|
||||
WaveLoop *input = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
input->setFrequency( 440.0 );
|
||||
FileLoop input;
|
||||
FileWvOut output;
|
||||
|
||||
// Define and open a 16-bit, one-channel WAV formatted output file
|
||||
output = new WvOut( "hellosine.wav", 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
|
||||
// Load the sine wave file.
|
||||
input.openFile( "rawwaves/sinewave.raw", true );
|
||||
|
||||
// Open a 16-bit, one-channel WAV formatted output file
|
||||
output.openFile( "hellosine.wav", 1, FileWrite::FILE_WAV, Stk::STK_SINT16 );
|
||||
|
||||
input.setFrequency( 440.0 );
|
||||
|
||||
// Run the oscillator for 40000 samples, writing to the output file
|
||||
int i;
|
||||
for ( i=0; i<40000; i++ ) {
|
||||
output->tick( input->tick() );
|
||||
}
|
||||
|
||||
// Clean up
|
||||
delete input;
|
||||
delete output;
|
||||
for ( int i=0; i<40000; i++ )
|
||||
output.tick( input.tick() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
WaveLoop is a subclass of WvIn, which supports WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. WvIn provides interpolating, read once ("oneshot") functionality, as well as methods for setting the read rate and read position.
|
||||
stk::FileLoop is a subclass of stk::FileWvIn, which supports WAV, SND
|
||||
(AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and
|
||||
32-bit integer and 32- and 64-bit floating-point data types.
|
||||
stk::FileWvIn provides interpolating, read-once ("oneshot")
|
||||
functionality, as well as methods for setting the read rate and read
|
||||
position.
|
||||
|
||||
The WvIn and WvOut classes are complementary, both supporting WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. However, WvOut does not perform data interpolation.
|
||||
stk::FileWvIn provides a "tick level" and interpolating interface to
|
||||
the stk::FileRead class. Likewise, stk::FileWvOut provides a "tick
|
||||
level" interface to the stk::FileWrite class. stk::FileRead and
|
||||
FileWrite both support WAV, SND(AU), AIFF, MAT-file (Matlab), and RAW
|
||||
file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit
|
||||
floating-point data types. stk::FileWvOut does not currently offer
|
||||
data interpolation functionality.
|
||||
|
||||
Nearly all STK classes implement <TT>tick()</TT> functions which take and/or return sample values. Within the <TT>tick()</TT> function, the fundamental sample calculations are performed for a given class. Most STK classes consume/generate a single sample per operation and their <TT>tick()</TT> method takes/returns each sample "by value". In addition, every class implementing a <TT>tick()</TT> function also provides an overloaded <TT>tick()</TT> function taking pointer and size arguments which can be used for vectorized computations.
|
||||
A number of STK parent classes, including stk::WvIn, stk::WvOut,
|
||||
stk::Instrmnt, stk::Generator, and stk::Effect, (and some or all of
|
||||
their subclasses) support multi-channel sample frames. If a
|
||||
single-sample version of the <TT>tick()</TT> function is called for
|
||||
these classes, a full sample frame is computed but only a single value
|
||||
is either input and/or output. For example, if the single-sample
|
||||
<TT>tick()</TT> function is called for subclasses of stk::WvOut, the
|
||||
sample argument is written to all channels in the one computed frame.
|
||||
For classes returning values, an optional \c channel argument
|
||||
specifies which channel value is returned from the computed frame (the
|
||||
default is always channel 0). To input and/or output multichannel data
|
||||
to these classes, the overloaded <TT>tick()</TT> functions taking
|
||||
StkFrames reference arguments should be used.
|
||||
|
||||
The WvIn and WvOut classes support multi-channel sample frames. To distinguish single-sample frame operations from multi-channel frame operations, these classes also implement <TT>tickFrame()</TT> functions. When a <TT>tick()</TT> method is called for multi-channel data, frame averages are returned or the input sample is distributed across all channels of a sample frame.
|
||||
|
||||
Nearly all STK classes inherit from the Stk base class. Stk provides a static sample rate which is queried by subclasses as needed. Because many classes use the current sample rate value during instantiation, it is important that the desired value be set at the beginning of a program. The default STK sample rate is 22050 Hz.
|
||||
|
||||
Another primary concept that is somewhat obscurred in this example concerns the data format in which sample values are passed and received. Audio and control signals throughout STK use a floating-point data type, the exact precision of which can be controlled via the <TT>MY_FLOAT</TT> \#define statement in Stk.h. Thus, the ToolKit can use any normalization scheme desired. The base instruments and algorithms are implemented with a general audio sample dynamic maximum of +/-1.0, and the WvIn and WvOut classes and subclasses scale appropriately for DAC or soundfile input and output.
|
||||
Nearly all STK classes inherit from the stk::Stk base class. Stk
|
||||
provides a static sample rate that is queried by subclasses as needed.
|
||||
Because many classes use the current sample rate value during
|
||||
instantiation, it is important that the desired value be set at the
|
||||
beginning of a program. The default STK sample rate is 44100 Hz.
|
||||
|
||||
\section error Error Handling
|
||||
|
||||
The ToolKit has some basic C++ error handling functionality built in. Classes which access files and/or hardware are most prone to runtime errors. To properly "catch" such errors, the above example should be rewritten as shown below.
|
||||
The ToolKit has some basic C++ error handling functionality built in.
|
||||
Classes that access files and/or hardware are most prone to runtime
|
||||
errors. To properly "catch" such errors, the above example should be
|
||||
rewritten as shown below.
|
||||
|
||||
\code
|
||||
// sineosc.cpp
|
||||
\include sineosc.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
In this particular case, we simply exit the program if an error occurs
|
||||
(an error message is automatically printed to stderr). A more refined
|
||||
program might attempt to recover from or fix a particular problem and,
|
||||
if successful, continue processing. See the \ref classes to determine
|
||||
which constructors and functions can throw an error.
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *input = 0;
|
||||
WvOut *output = 0;
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
input = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
|
||||
// Define and open a 16-bit, one-channel WAV formatted output file
|
||||
output = new WvOut( "hellosine.wav", 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
|
||||
}
|
||||
catch ( StkError & ) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
input->setFrequency( 440.0 );
|
||||
|
||||
// Run the oscillator for 40000 samples, writing to the output file
|
||||
for ( int i=0; i<40000; i++ ) {
|
||||
|
||||
try {
|
||||
output->tick( input->tick() );
|
||||
}
|
||||
catch ( StkError & ) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
In this particular case, we simply exit the program if an error occurs (an error message is automatically printed to stderr). A more refined program might attempt to recover from or fix a particular problem and, if successful, continue processing. See the \ref classes to determine which constructors and functions can throw an error.
|
||||
|
||||
[<A HREF="compile.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
[<A HREF="fundamentals.html">Main tutorial page</A>] [<A HREF="compile.html">Next tutorial</A>]
|
||||
*/
|
||||
|
||||
441
doc/doxygen/html/doxygen.css
Normal file
441
doc/doxygen/html/doxygen.css
Normal file
@@ -0,0 +1,441 @@
|
||||
body, table, div, p, dl {
|
||||
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* @group Heading Levels */
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
caption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.qindex, div.navtab{
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
div.qindex, div.navpath {
|
||||
width: 100%;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
div.navtab {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
/* @group Link Styling */
|
||||
|
||||
a {
|
||||
color: #153788;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.contents a:visited {
|
||||
color: #1b77c5;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a.qindex {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.qindexHL {
|
||||
font-weight: bold;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
border: 1px double #9295C2;
|
||||
}
|
||||
|
||||
.contents a.qindexHL:visited {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
a.el {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.elRef {
|
||||
}
|
||||
|
||||
a.code {
|
||||
}
|
||||
|
||||
a.codeRef {
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
dl.el {
|
||||
margin-left: -1cm;
|
||||
}
|
||||
|
||||
.fragment {
|
||||
font-family: monospace, fixed;
|
||||
font-size: 105%;
|
||||
}
|
||||
|
||||
pre.fragment {
|
||||
border: 1px solid #CCCCCC;
|
||||
background-color: #f5f5f5;
|
||||
padding: 4px 6px;
|
||||
margin: 4px 8px 4px 2px;
|
||||
}
|
||||
|
||||
div.ah {
|
||||
background-color: black;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
margin-bottom: 3px;
|
||||
margin-top: 3px
|
||||
}
|
||||
|
||||
div.groupHeader {
|
||||
margin-left: 16px;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.groupText {
|
||||
margin-left: 16px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
body {
|
||||
background: white;
|
||||
color: black;
|
||||
margin-right: 20px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
td.indexkey {
|
||||
background-color: #e8eef2;
|
||||
font-weight: bold;
|
||||
border: 1px solid #CCCCCC;
|
||||
margin: 2px 0px 2px 0;
|
||||
padding: 2px 10px;
|
||||
}
|
||||
|
||||
td.indexvalue {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #CCCCCC;
|
||||
padding: 2px 10px;
|
||||
margin: 2px 0px;
|
||||
}
|
||||
|
||||
tr.memlist {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
p.formulaDsp {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img.formulaDsp {
|
||||
|
||||
}
|
||||
|
||||
img.formulaInl {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* @group Code Colorization */
|
||||
|
||||
span.keyword {
|
||||
color: #008000
|
||||
}
|
||||
|
||||
span.keywordtype {
|
||||
color: #604020
|
||||
}
|
||||
|
||||
span.keywordflow {
|
||||
color: #e08000
|
||||
}
|
||||
|
||||
span.comment {
|
||||
color: #800000
|
||||
}
|
||||
|
||||
span.preprocessor {
|
||||
color: #806020
|
||||
}
|
||||
|
||||
span.stringliteral {
|
||||
color: #002080
|
||||
}
|
||||
|
||||
span.charliteral {
|
||||
color: #008080
|
||||
}
|
||||
|
||||
span.vhdldigit {
|
||||
color: #ff00ff
|
||||
}
|
||||
|
||||
span.vhdlchar {
|
||||
color: #000000
|
||||
}
|
||||
|
||||
span.vhdlkeyword {
|
||||
color: #700070
|
||||
}
|
||||
|
||||
span.vhdllogic {
|
||||
color: #ff0000
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
.search {
|
||||
color: #003399;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
form.search {
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
input.search {
|
||||
font-size: 75%;
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
background-color: #e8eef2;
|
||||
}
|
||||
|
||||
td.tiny {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.dirtab {
|
||||
padding: 4px;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #84b0c7;
|
||||
}
|
||||
|
||||
th.dirtab {
|
||||
background: #e8eef2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 0;
|
||||
border: none;
|
||||
border-top: 1px solid #666;
|
||||
}
|
||||
|
||||
/* @group Member Descriptions */
|
||||
|
||||
.mdescLeft, .mdescRight,
|
||||
.memItemLeft, .memItemRight,
|
||||
.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
|
||||
background-color: #FAFAFA;
|
||||
border: none;
|
||||
margin: 4px;
|
||||
padding: 1px 0 0 8px;
|
||||
}
|
||||
|
||||
.mdescLeft, .mdescRight {
|
||||
padding: 0px 8px 4px 8px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.memItemLeft, .memItemRight, .memTemplParams {
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.memTemplParams {
|
||||
color: #606060;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Member Details */
|
||||
|
||||
/* Styles for detailed member documentation */
|
||||
|
||||
.memtemplate {
|
||||
font-size: 80%;
|
||||
color: #606060;
|
||||
font-weight: normal;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.memnav {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
margin-right: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.memitem {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.memname {
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.memproto, .memdoc {
|
||||
border: 1px solid #84b0c7;
|
||||
}
|
||||
|
||||
.memproto {
|
||||
padding: 0;
|
||||
background-color: #d5e1e8;
|
||||
font-weight: bold;
|
||||
-webkit-border-top-left-radius: 8px;
|
||||
-webkit-border-top-right-radius: 8px;
|
||||
-moz-border-radius-topleft: 8px;
|
||||
-moz-border-radius-topright: 8px;
|
||||
}
|
||||
|
||||
.memdoc {
|
||||
padding: 2px 5px;
|
||||
background-color: #eef3f5;
|
||||
border-top-width: 0;
|
||||
-webkit-border-bottom-left-radius: 8px;
|
||||
-webkit-border-bottom-right-radius: 8px;
|
||||
-moz-border-radius-bottomleft: 8px;
|
||||
-moz-border-radius-bottomright: 8px;
|
||||
}
|
||||
|
||||
.paramkey {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.paramtype {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.paramname {
|
||||
color: #602020;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.paramname em {
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Directory (tree) */
|
||||
|
||||
/* for the tree view */
|
||||
|
||||
.ftvtree {
|
||||
font-family: sans-serif;
|
||||
margin: 0.5em;
|
||||
}
|
||||
|
||||
/* these are for tree view when used as main index */
|
||||
|
||||
.directory {
|
||||
font-size: 9pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.directory h3 {
|
||||
margin: 0px;
|
||||
margin-top: 1em;
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
/*
|
||||
The following two styles can be used to replace the root node title
|
||||
with an image of your choice. Simply uncomment the next two styles,
|
||||
specify the name of your image and be sure to set 'height' to the
|
||||
proper pixel height of your image.
|
||||
*/
|
||||
|
||||
/*
|
||||
.directory h3.swap {
|
||||
height: 61px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url("yourimage.gif");
|
||||
}
|
||||
.directory h3.swap span {
|
||||
display: none;
|
||||
}
|
||||
*/
|
||||
|
||||
.directory > h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.directory p {
|
||||
margin: 0px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.directory div {
|
||||
display: none;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.directory img {
|
||||
vertical-align: -30%;
|
||||
}
|
||||
|
||||
/* these are for tree view when not used as main index */
|
||||
|
||||
.directory-alt {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.directory-alt h3 {
|
||||
margin: 0px;
|
||||
margin-top: 1em;
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
.directory-alt > h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.directory-alt p {
|
||||
margin: 0px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.directory-alt div {
|
||||
display: none;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.directory-alt img {
|
||||
vertical-align: -30%;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
address {
|
||||
font-style: normal;
|
||||
color: #333;
|
||||
}
|
||||
BIN
doc/doxygen/html/doxygen.png
Normal file
BIN
doc/doxygen/html/doxygen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
23
doc/doxygen/html/index.html
Normal file
23
doc/doxygen/html/index.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Main Page</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head><body>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li class="current"><a href="index.html"><span>Main Page</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1></h1>
|
||||
<p>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right;"><small>Generated on Sun May 17 21:46:45 2009 by
|
||||
<a href="http://www.doxygen.org/index.html">
|
||||
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||
</body>
|
||||
</html>
|
||||
BIN
doc/doxygen/html/tab_b.gif
Normal file
BIN
doc/doxygen/html/tab_b.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 B |
BIN
doc/doxygen/html/tab_l.gif
Normal file
BIN
doc/doxygen/html/tab_l.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 706 B |
BIN
doc/doxygen/html/tab_r.gif
Normal file
BIN
doc/doxygen/html/tab_r.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
105
doc/doxygen/html/tabs.css
Normal file
105
doc/doxygen/html/tabs.css
Normal file
@@ -0,0 +1,105 @@
|
||||
/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
|
||||
|
||||
DIV.tabs
|
||||
{
|
||||
float : left;
|
||||
width : 100%;
|
||||
background : url("tab_b.gif") repeat-x bottom;
|
||||
margin-bottom : 4px;
|
||||
}
|
||||
|
||||
DIV.tabs UL
|
||||
{
|
||||
margin : 0px;
|
||||
padding-left : 10px;
|
||||
list-style : none;
|
||||
}
|
||||
|
||||
DIV.tabs LI, DIV.tabs FORM
|
||||
{
|
||||
display : inline;
|
||||
margin : 0px;
|
||||
padding : 0px;
|
||||
}
|
||||
|
||||
DIV.tabs FORM
|
||||
{
|
||||
float : right;
|
||||
}
|
||||
|
||||
DIV.tabs A
|
||||
{
|
||||
float : left;
|
||||
background : url("tab_r.gif") no-repeat right top;
|
||||
border-bottom : 1px solid #84B0C7;
|
||||
font-size : 80%;
|
||||
font-weight : bold;
|
||||
text-decoration : none;
|
||||
}
|
||||
|
||||
DIV.tabs A:hover
|
||||
{
|
||||
background-position: 100% -150px;
|
||||
}
|
||||
|
||||
DIV.tabs A:link, DIV.tabs A:visited,
|
||||
DIV.tabs A:active, DIV.tabs A:hover
|
||||
{
|
||||
color: #1A419D;
|
||||
}
|
||||
|
||||
DIV.tabs SPAN
|
||||
{
|
||||
float : left;
|
||||
display : block;
|
||||
background : url("tab_l.gif") no-repeat left top;
|
||||
padding : 5px 9px;
|
||||
white-space : nowrap;
|
||||
}
|
||||
|
||||
DIV.tabs INPUT
|
||||
{
|
||||
float : right;
|
||||
display : inline;
|
||||
font-size : 1em;
|
||||
}
|
||||
|
||||
DIV.tabs TD
|
||||
{
|
||||
font-size : 80%;
|
||||
font-weight : bold;
|
||||
text-decoration : none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Commented Backslash Hack hides rule from IE5-Mac \*/
|
||||
DIV.tabs SPAN {float : none;}
|
||||
/* End IE5-Mac hack */
|
||||
|
||||
DIV.tabs A:hover SPAN
|
||||
{
|
||||
background-position: 0% -150px;
|
||||
}
|
||||
|
||||
DIV.tabs LI.current A
|
||||
{
|
||||
background-position: 100% -150px;
|
||||
border-width : 0px;
|
||||
}
|
||||
|
||||
DIV.tabs LI.current SPAN
|
||||
{
|
||||
background-position: 0% -150px;
|
||||
padding-bottom : 6px;
|
||||
}
|
||||
|
||||
DIV.navpath
|
||||
{
|
||||
background : none;
|
||||
border : none;
|
||||
border-bottom : 1px solid #84B0C7;
|
||||
text-align : center;
|
||||
margin : 2px;
|
||||
padding : 2px;
|
||||
}
|
||||
@@ -1,10 +1,25 @@
|
||||
/*! \mainpage <I>The Synthesis ToolKit in C++ (STK)</I>
|
||||
/*! \mainpage The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
\htmlonly
|
||||
<BODY BGCOLOR="white">
|
||||
<h3><center><a href="http://www.cs.princeton.edu/~prc/">Perry R. Cook</a> & <a href="http://music.mcgill.ca/~gary/">Gary P. Scavone</a></center></h3>
|
||||
\endhtmlonly
|
||||
|
||||
<center><h3>Perry R. Cook & Gary P. Scavone</h3></center>
|
||||
|
||||
The <B>Synthesis ToolKit in C++ (STK)</B> is a set of open source audio signal processing and algorithmic synthesis classes written in C++. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, 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 <B>Synthesis ToolKit in C++ (STK)</B> is a set of open source
|
||||
audio signal processing and algorithmic synthesis classes written in
|
||||
the C++ programming language. STK was designed to facilitate rapid
|
||||
development of music synthesis and audio processing software, with an
|
||||
emphasis on cross-platform functionality, realtime control, ease of
|
||||
use, and educational example code. The Synthesis ToolKit is extremely
|
||||
portable (it's mostly platform-independent C and C++ code), and it's
|
||||
completely user-extensible (all source included, no unusual libraries,
|
||||
and no hidden drivers). We like to think that this increases the
|
||||
chances that our programs will still work in another 5-10 years. In
|
||||
fact, the ToolKit has been working continuously for nearly 15 years
|
||||
now. STK currently runs with realtime support (audio and MIDI) on
|
||||
Linux, 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.
|
||||
|
||||
- \ref information
|
||||
- \ref classes
|
||||
@@ -13,6 +28,7 @@ The <B>Synthesis ToolKit in C++ (STK)</B> is a set of open source audio signal p
|
||||
- \ref maillist
|
||||
- \ref system
|
||||
- \ref links
|
||||
- \ref faq
|
||||
- \ref tutorial
|
||||
|
||||
*/
|
||||
|
||||
@@ -2,49 +2,132 @@
|
||||
|
||||
<H3>References</H3>
|
||||
<UL>
|
||||
<LI><A HREF="Papers/stkicmc99.pdf">ICMC99 Paper</A></LI>
|
||||
<LI><A HREF="papers/stkupdate.pdf">ICMC2005 Paper</A></LI>
|
||||
<BR>
|
||||
A somewhat recent paper by Perry and Gary about the Synthesis ToolKit in C++.
|
||||
A paper by Gary and Perry detailing recent updates to the Synthesis ToolKit in C++.
|
||||
<P>
|
||||
<LI><A HREF="Papers/STKsiggraph96.pdf">SIGGRAPH96 Paper</A></LI>
|
||||
<LI><A HREF="papers/stkicmc99.pdf">ICMC99 Paper</A></LI>
|
||||
<BR>
|
||||
A not-so-recent paper by Perry about the Synthesis ToolKit in C++.
|
||||
A not-so-recent paper by Perry and Gary about the Synthesis ToolKit in C++.
|
||||
<P>
|
||||
<LI><A HREF="http://www.cs.princeton.edu/~prc/NewWork.html#STK">Perry's STK Web Page</A></LI>
|
||||
<LI>Book Chapter: <A HREF="http://www.akpeters.com/product.asp?ProdCode=1047">Audio Anecdotes</A></LI>
|
||||
<BR>
|
||||
This is a link to Perry Cook's STK Web page. He has information about the \ref skini, the protocol used to control STK instruments, as well as a lot of other cool stuff.
|
||||
Here's a link to a book that includes an chapter on STK.
|
||||
</UL>
|
||||
|
||||
|
||||
<H4>What is the <I>Synthesis ToolKit</I>?</H4>
|
||||
|
||||
The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in C++. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, 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 in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 15 years now. STK currently runs with realtime support (audio and MIDI) on Linux, 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 parts of the Synthesis ToolKit that are platform-dependent concern real-time audio and MIDI input and output, and that is taken care of with a few special classes. The interface for MIDI input and the simple <A HREF="http://dev.scriptics.com">Tcl/Tk</A> 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 can view your results using one of a large variety of sound/signal analysis tools already available (e.g. <A HREF="http://www-ccrma.stanford.edu/software/snd/">Snd</A>, Cool Edit, Matlab).
|
||||
The Synthesis ToolKit is free. The only parts of the Synthesis ToolKit that are platform-dependent concern real-time audio and MIDI input and output, and that is taken care of with a few special classes. The interface for MIDI input and the simple <A HREF="http://dev.scriptics.com">Tcl/Tk</A> 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 can view your results using one of a large variety of sound/signal analysis tools already available (e.g. <A HREF="http://www-ccrma.stanford.edu/software/snd/">Snd</A>, Cool Edit, Matlab).
|
||||
|
||||
|
||||
<H4>What the <I>Synthesis ToolKit</I> is not.</H4>
|
||||
|
||||
The Synthesis Toolkit is not one particular program. Rather, it is a set of C++ classes that you can use to create your own programs. A few example applications are provided to demonstrate some of the ways to use the classes. If you have specific needs, you will probably have to either modify the example programs or write a new program altogether. Further, the example programs don't have a fancy GUI wrapper. If you feel the need to have a "drag and drop" graphical patching GUI, you probably don't want to use the ToolKit. Spending hundreds of hours making platform-dependent graphics code would go against one of the fundamental design goals of the ToolKit - platform independence.
|
||||
The Synthesis Toolkit is not one particular program. Rather, it is a set of C++ classes that you can use to create your own programs. A few example applications are provided to demonstrate some of the ways to use the classes. If you have specific needs, you will probably have to either modify the example programs or write a new program altogether. Further, the example programs don't have a fancy GUI wrapper. It is easy to embed STK classes inside a GUI environment but we have chosen to focus our energy on the audio signal processing issues. Spending hundreds of hours making platform-dependent graphical user interfaces would go against one of the fundamental design goals of the ToolKit - platform independence.
|
||||
|
||||
For those instances where a simple GUI with sliders and buttons is helpful, we use <A HREF="http://dev.scriptics.com">Tcl/Tk</A> (which is freely distributed for all the supported ToolKit platforms). A number of Tcl/Tk GUI scripts are distributed with the ToolKit release. For control, the Synthesis Toolkit uses raw MIDI (on supported platforms), and SKINI (Synthesis ToolKit Instrument Network Interface, a MIDI-like text message synthesis control format).
|
||||
For those instances where a simple GUI with sliders and buttons is helpful, we use <A HREF="http://dev.scriptics.com">Tcl/Tk</A> (that is freely distributed for all the supported ToolKit platforms). A number of Tcl/Tk GUI scripts are distributed with the ToolKit release. For control, the Synthesis Toolkit uses raw MIDI (on supported platforms), and SKINI (Synthesis ToolKit Instrument Network Interface, a MIDI-like text message synthesis control format).
|
||||
|
||||
<H4>A brief history of the <I>Synthesis ToolKit in C++.</I></H4>
|
||||
|
||||
Perry Cook began developing a pre-cursor to the Synthesis ToolKit (also called STK) under NeXTStep at the Center for Computer Research in Music and Acoustics (CCRMA) at Stanford University in the early-1990s. With his move to Princeton University in 1996, he ported everything to C++ on SGI hardware, added real-time capabilities, and greatly expanded the synthesis techniques available. With the help of Bill Putnam, Perry also made a port of STK to Windows95. Gary Scavone began using STK extensively in the summer of 1997 and completed a full port of STK to Linux early in 1998. He finished the fully compatable Windows port (using Direct Sound API) in June 1998. Numerous improvements and extensions have been made since then.
|
||||
Perry Cook began developing a pre-cursor to the Synthesis ToolKit
|
||||
(also called STK) under NeXTStep at the Center for Computer Research
|
||||
in Music and Acoustics (CCRMA) at Stanford University in the
|
||||
early-1990s. With his move to Princeton University in 1996, he ported
|
||||
everything to C++ on SGI hardware, added real-time capabilities, and
|
||||
greatly expanded the synthesis techniques available. With the help of
|
||||
Bill Putnam, Perry also made a port of STK to Windows95. Gary Scavone
|
||||
began using STK extensively in the summer of 1997 and completed a full
|
||||
port of STK to Linux early in 1998. He finished the fully compatable
|
||||
Windows port (using Direct Sound API) in June 1998. Numerous
|
||||
improvements and extensions have been made since then.
|
||||
|
||||
The Toolkit has been distributed continuously since 1996 via the <A HREF="http://www.music.princeton.edu/psk">Princeton Sound Kitchen</A>, <A HREF="http://www.cs.princeton.edu/~prc">Perry Cook's home page</A> at Princeton, <A HREF="http://www-ccrma.stanford.edu/~gary/">Gary Scavone's home page</A> at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), and the <A HREF="http://www-ccrma.stanford.edu/software/stk">Synthesis ToolKit home page</A>. The ToolKit has been in included in various collections of software. Much of it has also been ported to MAX/MSP on Macintosh computers by Dan Trueman and Luke Dubois of Columbia University, and is distributed as <A HREF="http://music.columbia.edu/PeRColate">PeRColate</A>. Help on real-time sound and MIDI has been provided by Tim Stilson, Bill Putnam, and Gabriel Maldonado.
|
||||
The Toolkit has been distributed continuously since 1996 via the <A
|
||||
HREF="http://www.music.princeton.edu/psk">Princeton Sound Kitchen</A>,
|
||||
<A HREF="http://www.cs.princeton.edu/~prc">Perry Cook's home page</A>
|
||||
at Princeton, <A HREF="http://www.music.mcgill.ca/~gary/">Gary
|
||||
Scavone's home page</A> at McGill University, and the <A HREF="http://ccrma.stanford.edu/software/stk">Synthesis ToolKit
|
||||
home page</A>. The ToolKit has been included in various collections
|
||||
of software. Much of it has also been ported to Max/MSP on Macintosh
|
||||
computers by Dan Trueman and Luke Dubois of Columbia University, and
|
||||
is distributed as <A
|
||||
HREF="http://music.columbia.edu/PeRColate">PeRColate</A>. Help on
|
||||
real-time sound and MIDI has been provided over the years by Tim
|
||||
Stilson, Bill Putnam, and Gabriel Maldonado.
|
||||
|
||||
<H4>Legal and Ethical Notes</H4>
|
||||
|
||||
This software was designed and created to be made publicly available 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, give us some. If you make compositions with it, put us in the program notes.
|
||||
<P>
|
||||
This software was designed and created to be made publicly available
|
||||
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.
|
||||
|
||||
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 administered by the Stanford Office of Technology and Licensing. The good news is that large hunks of the techniques used here are public domain. To avoid subtle legal issues, we will not state what's freely useable here, but we will try to note within the various classes where certain things are likely to be protected by patents.
|
||||
Some of the concepts are covered by various patents, some known to us
|
||||
and likely others that are unknown. Many of the ones known to us are
|
||||
administered by the Stanford Office of Technology and Licensing. The
|
||||
good news is that large hunks of the techniques used here are public
|
||||
domain. To avoid subtle legal issues, we will not state what's freely
|
||||
useable here, but we will try to note within the various classes where
|
||||
certain things are likely to be protected by patents.
|
||||
|
||||
<H4>License</H4>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Any person wishing to distribute modifications to the Software is
|
||||
asked to send the modifications to the original developer so that they
|
||||
can be incorporated into the canonical version. This is, however, not
|
||||
a binding provision of this license.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
<H4>Disclaimer</H4>
|
||||
|
||||
STK is free and we do not guarantee anything. We've been hacking on this code for a while now and most of it seems to work pretty well. But, there surely are some bugs floating around. Sometimes things work fine on one computer platform but not so fine on another. FPU overflows and underflows cause <I>very</I> weird behavior which also depends on the particular CPU and OS. Let us know about bugs you find and we'll do our best to correct them.
|
||||
STK is free and we do not guarantee anything. We've been hacking on this code for a while now and most of it seems to work pretty well. But, there surely are some bugs floating around. Sometimes things work fine on one computer platform but not so fine on another. FPU overflows and underflows cause <I>very</I> weird behavior that also depends on the particular CPU and OS. Let us know about bugs you find and we'll do our best to correct them.
|
||||
|
||||
*/
|
||||
<H4>Perry's Notes From the Original Distribution of STK</H4>
|
||||
|
||||
This whole world was created with no particular hardware in mind. These examples are intended to be tutorial in nature, as a platform for the continuation of my research, and as a possible starting point for a software synthesis system. The basic motivation was to create the necessary unit generators to do the synthesis, processing, and control that I want to do and teach about. Little thought for optimization was given and therefore improvements, especially speed enhancements, should be possible with these classes. It was written with some basic concepts in mind about how to let compilers optimize.
|
||||
|
||||
Your question at this point might be, "But Perry, with CMix, CMusic, CSound, CShells, CMonkeys, etc. already cluttering the landscape, why a new set of stupid C functions for music synthesis and processing?" The answers lie below.
|
||||
|
||||
<ol>
|
||||
<li>I needed to port many of the things I've done into something that is generic enough to port further to different machines.</li>
|
||||
|
||||
<li>I really plan to document this stuff, so that you don't have to be me to figure out what's going on. (I'll probably be sorry I said this in a couple of years, when even I can't figure out what I was thinking.)</li>
|
||||
|
||||
<li>The classic difficulties most people have in trying to implement physical models are:
|
||||
|
||||
<ul>
|
||||
<li>They have trouble understanding the papers, and/or in turning the theory into practice.</li>
|
||||
|
||||
<li>The physical model instruments are a pain to get to oscillate, and coming up with stable and meaningful parameter values is required to get the models to work at all.</li>
|
||||
</ul>
|
||||
|
||||
This set of C++ unit generators and instruments might help to diminish the scores of emails I get asking what to do with those block diagrams I put in my papers.</li>
|
||||
|
||||
<li>I wanted to try some new stuff with modal synthesis, and implement some classic FM patches as well.</li>
|
||||
|
||||
<li>I wanted to reimplement, and newly implement more of the intelligent and physical performer models I've talked about in some of my papers. But I wanted to do it in a portable way, and in such a way that I can hook up modules quickly. I also wanted to make these instruments connectable to such player objects, so folks like Brad Garton who really think a lot about the players can connect them to my instruments, a lot about which I think.</li>
|
||||
|
||||
<li>More rationalizations to follow ...</li>
|
||||
</ol>
|
||||
|
||||
*/
|
||||
|
||||
@@ -1,73 +1,19 @@
|
||||
/*! \page instruments Instruments
|
||||
|
||||
The ToolKit comes with a wide variety of synthesis algorithms, all of which inherit from the Instrmnt class. In this example, we'll fire up an instance of the BeeThree FM synthesis class and show how it's frequency can be modified over time.
|
||||
The ToolKit comes with a wide variety of synthesis algorithms, all of which inherit from the stk::Instrmnt class. In this example, we'll fire up an instance of the stk::BeeThree FM synthesis class and show how its frequency can be modified over time.
|
||||
|
||||
\code
|
||||
// bethree.cpp
|
||||
\include bethree.cpp
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
We have used an Instrmnt pointer when referencing the BeeThree
|
||||
instance above, so it would be simple to replace the BeeThree class
|
||||
with any other STK instrument class. It should be noted, however,
|
||||
that a few classes do not respond to the setFrequency() function
|
||||
(e.g., Shakers, Drummer).
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
Instrmnt *instrument = 0;
|
||||
RtWvOut *output = 0;
|
||||
MY_FLOAT frequency, amplitude, scaler;
|
||||
long counter, i;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instrument
|
||||
instrument = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
scaler = 1.0;
|
||||
frequency = 220.0;
|
||||
amplitude = 0.5;
|
||||
instrument->noteOn( frequency, amplitude );
|
||||
|
||||
// Play the instrument for 80000 samples, changing the frequency every 2000 samples
|
||||
counter = 0;
|
||||
while ( counter < 80000 ) {
|
||||
for ( i=0; i<2000; i++ ) {
|
||||
try {
|
||||
output->tick( instrument->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
counter += 2000;
|
||||
scaler += 0.025;
|
||||
instrument->setFrequency( frequency * scaler );
|
||||
}
|
||||
|
||||
// Turn the instrument off with maximum decay envelope.
|
||||
instrument->noteOff( 1.0 );
|
||||
|
||||
cleanup:
|
||||
delete instrument;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
We have used an Instrmnt pointer when referencing the BeeThree instance above, so it would be simple to replace the BeeThree class with any other STK instrument class. It should be noted, however, that a few classes do not respond to the setFrequency() function (e.g., Shakers, Drummer).
|
||||
|
||||
The noteOn() function initiates an instrument attack. Instruments which are continuously excited (e.g., Clarinet, BeeThree) will continue to sound until stopped with a noteOff(). Impulsively excited instrument sounds (e.g., Plucked, Wurley) typically decay within a few seconds time, requiring subsequent noteOn() messages for re-attack.
|
||||
The noteOn() function initiates an instrument attack. Instruments that are continuously excited (e.g., stk::Clarinet, stk::BeeThree) will continue to sound until stopped with a noteOff(). Impulsively excited instrument sounds (e.g., stk::Plucked, stk::Wurley) typically decay within a few seconds time, requiring subsequent noteOn() messages for re-attack.
|
||||
|
||||
Instrument parameters can be precisely controlled as demonstrated above. A more flexible approach to instrument control, allowing arbitrary scorefile or realtime updates, is described in the next tutorial chapter.
|
||||
|
||||
[<A HREF="controlin.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="controlin.html">Next tutorial</A>]
|
||||
*/
|
||||
|
||||
|
||||
BIN
doc/doxygen/latex/FreeSans.ttf
Normal file
BIN
doc/doxygen/latex/FreeSans.ttf
Normal file
Binary file not shown.
86
doc/doxygen/latex/doxygen.sty
Normal file
86
doc/doxygen/latex/doxygen.sty
Normal file
@@ -0,0 +1,86 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{doxygen}
|
||||
\RequirePackage{calc}
|
||||
\RequirePackage{array}
|
||||
\pagestyle{fancyplain}
|
||||
\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}
|
||||
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
|
||||
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
|
||||
\lhead[\fancyplain{}{\bfseries\thepage}]
|
||||
{\fancyplain{}{\bfseries\rightmark}}
|
||||
\rhead[\fancyplain{}{\bfseries\leftmark}]
|
||||
{\fancyplain{}{\bfseries\thepage}}
|
||||
\rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Sun May 17 21:46:45 2009 by Doxygen }]{}
|
||||
\lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Sun May 17 21:46:45 2009 by Doxygen }}
|
||||
\cfoot{}
|
||||
\newenvironment{Code}
|
||||
{\footnotesize}
|
||||
{\normalsize}
|
||||
\newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})}
|
||||
\newenvironment{DocInclude}
|
||||
{\footnotesize}
|
||||
{\normalsize}
|
||||
\newenvironment{VerbInclude}
|
||||
{\footnotesize}
|
||||
{\normalsize}
|
||||
\newenvironment{Image}
|
||||
{\begin{figure}[H]}
|
||||
{\end{figure}}
|
||||
\newenvironment{ImageNoCaption}{}{}
|
||||
\newenvironment{CompactList}
|
||||
{\begin{list}{}{
|
||||
\setlength{\leftmargin}{0.5cm}
|
||||
\setlength{\itemsep}{0pt}
|
||||
\setlength{\parsep}{0pt}
|
||||
\setlength{\topsep}{0pt}
|
||||
\renewcommand{\makelabel}{\hfill}}}
|
||||
{\end{list}}
|
||||
\newenvironment{CompactItemize}
|
||||
{
|
||||
\begin{itemize}
|
||||
\setlength{\itemsep}{-3pt}
|
||||
\setlength{\parsep}{0pt}
|
||||
\setlength{\topsep}{0pt}
|
||||
\setlength{\partopsep}{0pt}
|
||||
}
|
||||
{\end{itemize}}
|
||||
\newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
|
||||
\newlength{\tmplength}
|
||||
\newenvironment{TabularC}[1]
|
||||
{
|
||||
\setlength{\tmplength}
|
||||
{\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)}
|
||||
\par\begin{tabular*}{\linewidth}
|
||||
{*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|}
|
||||
}
|
||||
{\end{tabular*}\par}
|
||||
\newcommand{\entrylabel}[1]{
|
||||
{\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\vspace{1.5\baselineskip}}}}
|
||||
\newenvironment{Desc}
|
||||
{\begin{list}{}
|
||||
{
|
||||
\settowidth{\labelwidth}{40pt}
|
||||
\setlength{\leftmargin}{\labelwidth}
|
||||
\setlength{\parsep}{0pt}
|
||||
\setlength{\itemsep}{-4pt}
|
||||
\renewcommand{\makelabel}{\entrylabel}
|
||||
}
|
||||
}
|
||||
{\end{list}}
|
||||
\newenvironment{Indent}
|
||||
{\begin{list}{}{\setlength{\leftmargin}{0.5cm}}
|
||||
\item[]\ignorespaces}
|
||||
{\unskip\end{list}}
|
||||
\setlength{\parindent}{0cm}
|
||||
\setlength{\parskip}{0.2cm}
|
||||
\addtocounter{secnumdepth}{1}
|
||||
\sloppy
|
||||
\usepackage[T1]{fontenc}
|
||||
\makeatletter
|
||||
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{0ex}%
|
||||
{-3.25ex plus -1ex minus -0.2ex}%
|
||||
{1.5ex plus 0.2ex}%
|
||||
{\normalfont\normalsize\bfseries}}
|
||||
\makeatother
|
||||
\stepcounter{secnumdepth}
|
||||
\stepcounter{tocdepth}
|
||||
50
doc/doxygen/latex/refman.tex
Normal file
50
doc/doxygen/latex/refman.tex
Normal file
@@ -0,0 +1,50 @@
|
||||
\documentclass[a4paper]{book}
|
||||
\usepackage{a4wide}
|
||||
\usepackage{makeidx}
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{multicol}
|
||||
\usepackage{float}
|
||||
\usepackage{textcomp}
|
||||
\usepackage{alltt}
|
||||
\usepackage{times}
|
||||
\usepackage{ifpdf}
|
||||
\ifpdf
|
||||
\usepackage[pdftex,
|
||||
pagebackref=true,
|
||||
colorlinks=true,
|
||||
linkcolor=blue,
|
||||
unicode
|
||||
]{hyperref}
|
||||
\else
|
||||
\usepackage[ps2pdf,
|
||||
pagebackref=true,
|
||||
colorlinks=true,
|
||||
linkcolor=blue,
|
||||
unicode
|
||||
]{hyperref}
|
||||
\usepackage{pspicture}
|
||||
\fi
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{doxygen}
|
||||
\makeindex
|
||||
\setcounter{tocdepth}{3}
|
||||
\renewcommand{\footrulewidth}{0.4pt}
|
||||
\begin{document}
|
||||
\begin{titlepage}
|
||||
\vspace*{7cm}
|
||||
\begin{center}
|
||||
{\Large Reference Manual}\\
|
||||
\vspace*{1cm}
|
||||
{\large Generated by Doxygen 1.5.8}\\
|
||||
\vspace*{0.5cm}
|
||||
{\small Sun May 17 21:46:45 2009}\\
|
||||
\end{center}
|
||||
\end{titlepage}
|
||||
\clearemptydoublepage
|
||||
\pagenumbering{roman}
|
||||
\tableofcontents
|
||||
\clearemptydoublepage
|
||||
\pagenumbering{arabic}
|
||||
\printindex
|
||||
\end{document}
|
||||
@@ -1,6 +1,16 @@
|
||||
/*! \page links Miscellaneous Links
|
||||
|
||||
- <A HREF="http://www-ccrma.stanford.edu/~gary/rtaudio/">The RtAudio WWW site</A>
|
||||
- <A HREF="http://www.music.mcgill.ca/~gary/rtaudio/">The %RtAudio WWW site</A>
|
||||
|
||||
- <A HREF="http://www.music.mcgill.ca/~gary/rtmidi/">The %RtMidi WWW site</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)
|
||||
|
||||
|
||||
@@ -1,70 +1,30 @@
|
||||
/*! \page multichannel Multi-Channel I/O
|
||||
|
||||
The ToolKit WvIn and WvOut classes (and their subclasses) support multi-channel audio data input and output. A set of interleaved audio samples representing a single time "slice" is referred to as a <I>sample frame</I>. At a sample rate of 44.1 kHz, a four-channel audio stream will have 44100 sample frames per second and a total of 176400 individual samples per second.
|
||||
The ToolKit stk::WvIn and stk::WvOut classes (and their subclasses) support multi-channel audio data input and output. Several other abstract base classes, such as stk::Instrmnt, stk::Generator, and stk::Effect, also support multi-channel computations though not all of their subclasses produce or take multi-channel data. A set of interleaved audio samples representing a single time "slice" is referred to as a <I>sample frame</I>. At a sample rate of 44.1 kHz, a four-channel audio stream will have 44100 sample frames per second and a total of 176400 individual samples per second.
|
||||
|
||||
Most STK classes process single-sample data streams via their <TT>tick()</TT> function. In order to distinguish single-sample and sample frame calculations, the WvIn and WvOut classes implement both <TT>tick()</TT> and <TT>tickFrame()</TT> functions. The <TT>tickFrame()</TT> functions take or return a pointer to an array of audio data representing one or more sample frames. For single-channel streams, the <TT>tick()</TT> and <TT>tickFrame()</TT> functions produce equivalent results. When <TT>tick()</TT> is called for a multi-channel stream, however, the function either returns a sample frame average (WvIn) or writes a single sample argument to all channels (WvOut).
|
||||
Most STK classes process single-sample data streams via their
|
||||
<TT>tick()</TT> function. For classes supporting multi-channel data,
|
||||
one must distinguish the <TT>tick()</TT> functions taking or producing
|
||||
single \c StkFloat arguments from those taking stk::StkFrames& arguments. If
|
||||
a single-sample version of the <TT>tick()</TT> function is called for
|
||||
these classes, a full sample frame is computed but only a single value
|
||||
is either input and/or output. For example, if the single-sample
|
||||
<TT>tick()</TT> function is called for subclasses of WvOut, the sample
|
||||
argument is written to all channels in the one computed frame. For
|
||||
classes returning values, an optional \c channel argument specifies
|
||||
which channel value is returned from the computed frame (the default
|
||||
is always channel 0). To input and/or output multichannel data to
|
||||
these classes, the overloaded <TT>tick()</TT> functions taking
|
||||
StkFrames reference arguments should be used.
|
||||
|
||||
Multi-channel support for realtime audio input and output is dependent on the audio device(s) available on your system.
|
||||
|
||||
The following example demonstrates the use of the WvOut class for creating a four channel, 16-bit AIFF formatted audio file. We will use four sinewaves of different frequencies for the first two seconds and then a single sinewave for the last two seconds.
|
||||
The following example demonstrates the use of the stk::FileWvOut class for
|
||||
creating a four channel, 16-bit AIFF formatted audio file. We will
|
||||
use four sinewaves of different frequencies for the first two seconds
|
||||
and then a single sinewave for the last two seconds.
|
||||
|
||||
\code
|
||||
// foursine.cpp
|
||||
\include foursine.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
int i, j;
|
||||
WvOut *output = 0;
|
||||
WaveLoop *inputs[4];
|
||||
for ( i=0; i<4; i++ ) inputs[i] = 0;
|
||||
|
||||
// Define and load the sine waves
|
||||
try {
|
||||
for ( i=0; i<4; i++ ) {
|
||||
inputs[i] = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
inputs[i]->setFrequency( 220.0 * (i+1) );
|
||||
}
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Define and open a 16-bit, four-channel AIFF formatted output file
|
||||
try {
|
||||
output = new WvOut( "foursine.aif", 4, WvOut::WVOUT_AIF, Stk::STK_SINT16 );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Write two seconds of four sines to the output file
|
||||
MY_FLOAT frame[4];
|
||||
for ( j=0; j<88200; j++ ) {
|
||||
for ( i=0; i<4; i++ )
|
||||
frame[i] = inputs[i]->tick();
|
||||
|
||||
output->tickFrame( frame );
|
||||
}
|
||||
|
||||
// Now write the first sine to all four channels for two seconds
|
||||
for ( j=0; j<88200; j++ ) {
|
||||
output->tick( inputs[0]->tick() );
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for ( i=0; i<4; i++ ) delete inputs[i];
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
||||
[<A HREF="polyvoices.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="polyvoices.html">Next tutorial</A>]
|
||||
*/
|
||||
|
||||
@@ -1,122 +1,22 @@
|
||||
/*! \page polyvoices Voice Management
|
||||
|
||||
The previous tutorial chapters were concerned only with monophonic ToolKit instrument playback and control. At this point, it should be relatively clear that one can instantiate multiple instruments and perhaps sum together their sounds or even direct their sounds to separate output channels. It is less clear how one might go about controlling a group of instruments. The Voicer class is designed to serve just this purpose.
|
||||
The previous tutorial chapters were concerned only with monophonic ToolKit instrument playback and control. At this point, it should be relatively clear that one can instantiate multiple instruments and perhaps sum together their outputs or even direct their outputs to separate channels. It is less clear how one might go about controlling a group of instruments. The stk::Voicer class is designed to serve just this purpose.
|
||||
|
||||
The STK Voicer class is a relatively simple voice manager. The user can dynamically add and delete instruments from its "control", with the option of controlling specific instruments via unique note tags and/or grouping sets of instruments via a "channel" number. All sounding instrument outputs are summed and returned via the <TT>tick()</TT> function. The Voicer class responds to noteOn, noteOff, setFrequency, pitchBend, and controlChange messages, automatically assigning incoming messages to the voices in its control. When all voices are sounding and a new noteOn is encountered, the Voicer interrupts the oldest sounding voice. The user is responsible for creating and deleting all instrument instances.
|
||||
The stk::Voicer class is a relatively simple voice manager. The user can dynamically add and delete instruments to/from its "control", with the option of controlling specific instruments via unique note tags and/or grouping sets of instruments via a "group" number. All sounding instrument outputs are summed and returned via the <TT>tick()</TT> function. The stk::Voicer class responds to noteOn, noteOff, setFrequency, pitchBend, and controlChange messages, automatically assigning incoming messages to the voices in its control. When all voices are sounding and a new noteOn is encountered, the stk::Voicer interrupts the oldest sounding voice. The user is responsible for creating and deleting all instrument instances.
|
||||
|
||||
In the following example, we modify the <TT>controlbee.cpp</TT> program to make use of three BeeThree instruments, all controlled using a Voicer.
|
||||
In the following example, we modify the <TT>controlbee.cpp</TT> program to make use of three stk::BeeThree instruments, all controlled using a stk::Voicer.
|
||||
|
||||
\include threebees.cpp
|
||||
|
||||
We have written this program to accept control messages from \c STDIN. Assuming the program is compiled as <TT>threebees</TT>, the three-voice SKINI scorefile <A HREF="tutorial/bachfugue.ski"><TT>bachfugue.ski</TT></A> (located in the <tt>scores</tt> directory with the examples) can be redirected to the program as:
|
||||
|
||||
\code
|
||||
// threebees.cpp
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
#include "Messager.h"
|
||||
#include "Voicer.h"
|
||||
#include "SKINI.msg"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
int i;
|
||||
RtWvOut *output = 0;
|
||||
Messager *messager = 0;
|
||||
Voicer *voicer = 0;
|
||||
bool done = FALSE;
|
||||
Instrmnt *instrument[3];
|
||||
for ( i=0; i<3; i++ ) instrument[i] = 0;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instruments
|
||||
for ( i=0; i<3; i++ )
|
||||
instrument[i] = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a Messager instance to read from a redirected SKINI scorefile.
|
||||
messager = new Messager();
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Instantiate the voicer for a maximum of three voices.
|
||||
voicer = new Voicer( 3 );
|
||||
for ( i=0; i<3; i++ )
|
||||
voicer->addInstrument( instrument[i] );
|
||||
|
||||
// Play the instrument until the end of the scorefile.
|
||||
int nTicks, type;
|
||||
MY_FLOAT byte2, byte3;
|
||||
while (!done) {
|
||||
|
||||
// Look for new messages and return a delta time (in samples).
|
||||
type = messager->nextMessage();
|
||||
if (type < 0)
|
||||
done = TRUE;
|
||||
|
||||
nTicks = messager->getDelta();
|
||||
try {
|
||||
for ( i=0; i<nTicks; i++ )
|
||||
output->tick( voicer->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ( type > 0 ) {
|
||||
// Process the new control message.
|
||||
byte2 = messager->getByteTwo();
|
||||
byte3 = messager->getByteThree();
|
||||
|
||||
switch(type) {
|
||||
|
||||
case __SK_NoteOn_:
|
||||
voicer->noteOn( byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_NoteOff_:
|
||||
voicer->noteOff( byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_ControlChange_:
|
||||
voicer->controlChange( (int) byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_AfterTouch_:
|
||||
voicer->controlChange( 128, byte2 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for ( i=0; i<3; i++ ) delete instrument[i];
|
||||
delete output;
|
||||
delete messager;
|
||||
delete voicer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
threebees < scores/bachfugue.ski
|
||||
\endcode
|
||||
|
||||
Assuming the program is compiled as <TT>threebees</TT>, the three-voice SKINI scorefile <A HREF="tutorial/bachfugue.ski"><TT>bachfugue.ski</TT></A> (also located in the <tt>scores</tt> directory with the examples) could be redirected to the program as:
|
||||
For more fun, surf to <A HREF="http://kern.humdrum.net/">Kern Scores</A> for a huge assortment of other scorefiles that can be downloaded in the SKINI format.
|
||||
|
||||
\code
|
||||
threebees < bachfugue.ski
|
||||
\endcode
|
||||
|
||||
For more fun, surf to <A HREF="http://kern.humdrum.net/">Kern Scores</A> for a huge assortment of other scorefiles which can be downloaded in the SKINI format.
|
||||
|
||||
Another easy extension would be to use the <TT>STK_MIDI</TT> constructor argument to the Messager class and then play the instruments via a MIDI keyboard.
|
||||
Another easy extension would be to add the \c stk::Messager::startMidiInput() function to the program and then play the instruments via a MIDI keyboard.
|
||||
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
*/
|
||||
|
||||
@@ -1,72 +1,49 @@
|
||||
/*! \page realtime Realtime Audio
|
||||
/*! \page realtime Realtime Audio (blocking)
|
||||
|
||||
In this section, we modify the <TT>sineosc.cpp</TT> program in order to send the output to the default audio playback device on your system.
|
||||
In this section, we modify the <TT>sineosc.cpp</TT> program in order
|
||||
to send the output to the default audio playback device on your
|
||||
computer system. We also make use of the stk::SineWave class as a
|
||||
sine-wave oscillator. stk::SineWave computes an internal, static sine-wave
|
||||
table when its first instance is created. Subsequent instances make
|
||||
use of the same table. The default table length, specified in
|
||||
SineWave.h, is 2048 samples.
|
||||
|
||||
\include rtsine.cpp
|
||||
|
||||
The class stk::RtWvOut is a protected subclass of stk::WvOut. A number of
|
||||
optional constructor arguments can be used to fine tune its
|
||||
performance for a given system. stk::RtWvOut provides a "single-sample",
|
||||
blocking interface to the RtAudio class. Note that stk::RtWvOut (as well
|
||||
as the stk::RtWvIn class described below) makes use of RtAudio's callback
|
||||
input/output functionality by creating a large ring-buffer into which
|
||||
data is written. These classes should not be used when low-latency
|
||||
and robust performance is necessary
|
||||
|
||||
Though not used here, an stk::RtWvIn class exists as well that can be used
|
||||
to read realtime audio data from an input device. See the
|
||||
<TT>record.cpp</TT> example program in the <TT>examples</TT> project
|
||||
for more information.
|
||||
|
||||
It may be possible to use an instance of stk::RtWvOut and an instance of
|
||||
stk::RtWvIn to simultaneously read and write realtime audio to and from a
|
||||
hardware device or devices. However, it is recommended to instead use
|
||||
a single instance of RtAudio to achieve this behavior, as described in the next section.
|
||||
See the <TT>effects</TT> project or the <TT>duplex.cpp</TT> example
|
||||
program in the <TT>examples</TT> project for more information.
|
||||
|
||||
When using any realtime STK class (RtAudio, stk::RtWvOut, stk::RtWvIn, RtMidi, stk::InetWvIn, stk::InetWvOut, stk::Socket, stk::UdpSocket, stk::TcpServer, stk::TcpClient, and stk::Thread), it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks. For example, the above program could be compiled on a Linux system using the GNU g++ compiler and the ALSA audio API as follows (assuming all necessary files exist in the project directory):
|
||||
|
||||
\code
|
||||
// rtsine.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *input = 0;
|
||||
RtWvOut *output = 0;
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
input = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
input->setFrequency(440.0);
|
||||
|
||||
// Play the oscillator for 40000 samples
|
||||
int i;
|
||||
for ( i=0; i<40000; i++ ) {
|
||||
try {
|
||||
output->tick(input->tick());
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
The class RtWvOut is a protected subclass of WvOut. A number of optional constructor arguments can be used to fine tune its performance for a given system.
|
||||
|
||||
Though not used here, an RtWvIn class exists as well which can be used to read realtime audio data from an input device. See the <TT>record.cpp</TT> example program in the <TT>examples</TT> project for more information.
|
||||
|
||||
It is possible to use an instance of RtWvOut and an instance of RtWvIn to simultaneously read and write realtime audio to and from a hardware device or devices. However, it is recommended to instead use a single instance of RtDuplex to achieve this behavior, in that it guarantees better synchronization between the input and output data. See the <TT>effects</TT> project or the <TT>io.cpp</TT> example program in the <TT>examples</TT> project for more information.
|
||||
|
||||
When using any realtime STK class (RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, TcpWvIn, TcpWvOut, Socket, and Thread), it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks. For example, the above program could be compiled on a Linux system using the GNU g++ compiler and the ALSA audio/MIDI API as follows (assuming all necessary files exist in the project directory):
|
||||
|
||||
\code
|
||||
g++ -Wall -D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ -o rtsine Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp \
|
||||
RtWvOut.cpp RtAudio.cpp rtsine.cpp -lpthread -lasound -lstk
|
||||
g++ -Wall -D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ -o rtsine Stk.cpp Generator.cpp SineWave.cpp WvOut.cpp \
|
||||
RtWvOut.cpp RtAudio.cpp rtsine.cpp -lpthread -lasound
|
||||
\endcode
|
||||
|
||||
On a Macintosh OS X system, the syntax would be:
|
||||
|
||||
\code
|
||||
CC -D__MACOSX_CORE__ -o rtsine Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp RtWvOut.cpp RtAudio.cpp \
|
||||
rtsine.cpp -lpthread -lstdc++ -lstk -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
|
||||
g++ -Wall -D__MACOSX_CORE__ -o rtsine Stk.cpp Generator.cpp SineWave.cpp WvOut.cpp RtWvOut.cpp RtAudio.cpp \
|
||||
rtsine.cpp -lpthread -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
|
||||
\endcode
|
||||
|
||||
[<A HREF="instruments.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="crealtime.html">Next tutorial</A>]
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@ This describes the latest (version 1.1) implementation of SKINI for the Synthesi
|
||||
A SKINI haiku.
|
||||
\endcode
|
||||
|
||||
Profound thanks to Dan Trueman, Brad Garton, and Gary Scavone for input on this revision. Thanks also to MIDI, the NeXT MusicKit, ZIPI and all the creators and modifiers of these for good bases upon/from which to build and depart.
|
||||
Profound thanks to Dan trueman, Brad Garton, and Gary Scavone for input on this revision. Thanks also to MIDI, the NeXT MusicKit, ZIPI and all the creators and modifiers of these for good bases upon/from which to build and depart.
|
||||
|
||||
\section compatibility MIDI Compatibility
|
||||
|
||||
@@ -16,7 +16,7 @@ SKINI was designed to be MIDI compatible wherever possible, and extend MIDI in i
|
||||
|
||||
Differences from MIDI, and motivations, include:
|
||||
|
||||
- Text-based messages are used, with meaningful names wherever possible. This allows any language or system capable of formatted printing to generate SKINI. Similarly, any system capable of reading in a string and turning delimited fields into strings, floats, and ints can consume SKINI for control. More importantly, humans can actually read, and even write if they want, SKINI files and streams. Use an editor and search/replace or macros to change a channel or control number. Load a SKINI score into a spread sheet to apply transformations to time, control parameters, MIDI velocities, etc. Put a monkey on a special typewriter and get your next great work. Life's too short to debug bit/nybble packed variable length mumble messages. Disk space gets cheaper, available bandwidth increases, music takes up so little space and bandwidth compared to video and grapics. Live a little.
|
||||
- Text-based messages are used, with meaningful names wherever possible. This allows any language or system capable of formatted printing to generate SKINI. Similarly, any system capable of reading in a string and turning delimited fields into strings, floats, and ints can consume SKINI for control. More importantly, humans can actually read, and even write if they want, SKINI files and streams. Use an editor and search/replace or macros to change a channel or control number. Load a SKINI score into a spread sheet to apply transformations to time, control parameters, MIDI velocities, etc. Put a monkey on a special typewriter and get your next great work. Life's too short to debug bit/nybble packed variable length mumble messages. Disk space gets cheaper, available bandwidth increases, music takes up so little space and bandwidth compared to video and graphics. Live a little.
|
||||
|
||||
- Floating point numbers are used wherever possible. Note Numbers, Velocities, Controller Values, and Delta and Absolute Times are all represented and scanned as ASCII double-precision floats. MIDI byte values are preserved, so that incoming MIDI bytes from an interface can be put directly into SKINI messages. 60.0 or 60 is middle C, 127.0 or 127 is maximum velocity etc. But, unlike MIDI, 60.5 can cause a 50 cent sharp middle C to be played. As with MIDI byte values like velocity, use of the integer and SKINI-added fractional parts is up to the implementor of the algorithm being controlled by SKINI messages. But the extra precision is there to be used or ignored.
|
||||
|
||||
@@ -28,23 +28,25 @@ I am basically a bottom-up designer with an awareness of top-down design ideas,
|
||||
|
||||
\section messages SKINI Messages
|
||||
|
||||
A basic SKINI message is a line of text. There are only three required fields, the message type (an ASCII name), the time (either delta or absolute), and the channel number. Don't freak out and think that this is MIDI channel 0-15 (which is supported), because the channel number is scanned as a long int. Channels could be socket numbers, machine IDs, serial numbers, or even unique tags for each event in a synthesis. Other fields might be used, as specified in the SKINI.tbl file. This is described in more detail later.
|
||||
A basic SKINI message is a line of text. There are only three required fields, the message type (an ASCII name), the time (either delta or absolute), and the channel number. Don't freak out and think that this is MIDI channel 0-15 (which is supported), because the channel number is scanned as a long int. Channels could be socket numbers, machine IDs, serial numbers, or even unique tags for each event in a synthesis. Other fields might be used, as specified in the \c SKINI.tbl file. This is described in more detail later.
|
||||
|
||||
Fields in a SKINI line are delimited by spaces, commas, or tabs. The SKINI parser only operates on a line at a time, so a newline means the message is over. Multiple messages are NOT allowed directly on a single line (by use of the ; for example in C). This could be supported, but it isn't in version 1.1.
|
||||
|
||||
Message types include standard MIDI types like NoteOn, NoteOff, ControlChange, etc. MIDI extension message types (messages which look better than MIDI but actually get turned into MIDI-like messages) include LipTension, StringDamping, etc. Non-MIDI message types include SetPath (sets a path for file use later), and OpenReadFile (for streaming, mixing, and applying effects to soundfiles along with synthesis, for example). Other non-MIDI message types include Trilling, HammerOn, etc. (these translate to gestures, behaviors, and contexts for use by intellegent players and instruments using SKINI). Where possible I will still use these as MIDI extension messages, so foot switches, etc. can be used to control them in real time.
|
||||
Message types include standard MIDI types like NoteOn, NoteOff, ControlChange, etc. MIDI extension message types (messages which look better than MIDI but actually get turned into MIDI-like messages) include LipTension, StringDamping, etc. Non-MIDI message types include SetPath (sets a path for file use later), and OpenReadFile (for streaming, mixing, and applying effects to soundfiles along with synthesis, for example). Other non-MIDI message types include Trilling, HammerOn, etc. (these translate to gestures, behaviors, and contexts for use by intelligent players and instruments using SKINI). Where possible I will still use these as MIDI extension messages, so foot switches, etc. can be used to control them in real time.
|
||||
|
||||
All fields other than type, time, and channel are optional, and the types and useage of the additional fields is defined in the file SKINI.tbl.
|
||||
All fields other than type, time, and channel are optional, and the
|
||||
types and useage of the additional fields is defined in the file \c
|
||||
SKINI.tbl.
|
||||
|
||||
The other important file used by SKINI is SKINI.msg, which is a set of #defines to make C code more readable, and to allow reasonably quick re-mapping of control numbers, etc.. All of these defined symbols are assigned integer values. For Java, the #defines could be replaced by declaration and assignment statements, preserving the look and behavior of the rest of the code.
|
||||
The other important file used by SKINI is \c SKINI.msg, which is a set of #defines to make C code more readable, and to allow reasonably quick re-mapping of control numbers, etc.. All of these defined symbols are assigned integer values. For Java, the #defines could be replaced by declaration and assignment statements, preserving the look and behavior of the rest of the code.
|
||||
|
||||
\section cfiles C Files Used To Implement SKINI
|
||||
\section cfiles Files Used To Implement SKINI
|
||||
|
||||
SKINI.cpp is an object which can either open a SKINI file, and successively read and parse lines of text as SKINI strings, or accept strings from another object and parse them. The latter functionality would be used by a socket, pipe, or other connection receiving SKINI messages a line at a time, usually in real time, but not restricted to real time.
|
||||
Skini is a C++ class which can either open a SKINI file and successively read and parse lines of text as SKINI strings, or accept strings from another object and parse them. The latter functionality would be used by a socket, pipe, or other connection receiving SKINI messages a line at a time, usually in real time, but not restricted to real time.
|
||||
|
||||
SKINI.msg should be included by anything wanting to use the SKINI.cpp object. This is not mandatory, but use of the __SK_blah_ symbols which are defined in the .msg file will help to ensure clarity and consistency when messages are added and changed.
|
||||
\c SKINI.msg should be included by anything wanting to use the Skini object. This is not mandatory, but use of the __SK_blah_ symbols which are defined in the .msg file will help to ensure clarity and consistency when messages are added and changed.
|
||||
|
||||
SKINI.tbl is used only by the SKINI parser object (SKINI.cpp). In the file SKINI.tbl, an array of structures is declared and assigned values which instruct the parser as to what the message types are, and what the fields mean for those message types. This table is compiled and linked into applications using SKINI, but could be dynamically loaded and changed in a future version of SKINI.
|
||||
\c SKINI.tbl is used only by the Skini parser object (Skini.cpp). In the file \c SKINI.tbl, an array of structures is declared and assigned values which instruct the parser as to what the message types are, and what the fields mean for those message types. This table is compiled and linked into applications using SKINI, but could be dynamically loaded and changed in a future version of SKINI.
|
||||
|
||||
\section parser SKINI Messages and the SKINI Parser:
|
||||
|
||||
@@ -52,8 +54,6 @@ The parser isn't all that smart, but neither am I. Here are the basic rules gov
|
||||
|
||||
- If the first (non-delimiter ... see below) character in a SKINI string is '/' that line is treated as a comment and echoed to stdout.
|
||||
|
||||
- If there are no characters on a line, that line is treated as blank and echoed to stdout. Tabs and spaces are treated as non-characters.
|
||||
|
||||
- Spaces, commas, and tabs delimit the fields in a SKINI message line. (We might allow for multiple messages per line later using the semicolon, but probably not. A series of lines with deltaTimes of 0.0 denotes simultaneous events. For read-ability, multiple messages per line doesn't help much, so it's unlikely to be supported later).
|
||||
|
||||
- The first field must be a SKINI message name (like NoteOn). These might become case-insensitive in future versions, so don't plan on exciting clever overloading of names (like noTeOn being different from NoTeON). There can be a number of leading spaces or tabs, but don't exceed 32 or so.
|
||||
@@ -62,7 +62,7 @@ The parser isn't all that smart, but neither am I. Here are the basic rules gov
|
||||
|
||||
- The third field must be an integer channel number. Don't go crazy and think that this is just MIDI channel 0-15 (which is supported). The channel number is scanned as a long int. Channels 0-15 are in general to be treated as MIDI channels. After that it's wide open. Channels could be socket numbers, machine IDs, serial numbers, or even unique tags for each event in a synthesis. A -1 channel can be used as don't care, omni, or other functions depending on your needs and taste.
|
||||
|
||||
- All remaining fields are specified in the SKINI.tbl file. In general, there are maximum two more fields, which are either SK_INT (long), SK_DBL (double float), or SK_STR (string). The latter is the mechanism by which more arguments can be specified on the line, but the object using SKINI must take that string apart (retrived by using getRemainderString()) and scan it. Any excess fields are stashed in remainderString.
|
||||
- All remaining fields are specified in the \c SKINI.tbl file. In general, there are maximum two more fields, which are either SK_INT (long), SK_DBL (double float), or SK_STR (string). The latter is the mechanism by which more arguments can be specified on the line, but the object using SKINI must take that string apart (retrived by using getRemainderString()) and scan it. Any excess fields are stashed in remainderString.
|
||||
|
||||
\section file A Short SKINI File:
|
||||
|
||||
@@ -80,7 +80,7 @@ The parser isn't all that smart, but neither am I. Here are the basic rules gov
|
||||
StringDetune 0.100000 2 22
|
||||
StringDetune 0.100000 2 12
|
||||
//
|
||||
StringDamping 0.000100 2 0.0
|
||||
StringDamping 0.000100 2 0.0
|
||||
NoteOn 0.000082 2 55 82
|
||||
NoteOn 0.200000 2 62 82
|
||||
NoteOn 0.100000 2 71 82
|
||||
@@ -89,7 +89,7 @@ The parser isn't all that smart, but neither am I. Here are the basic rules gov
|
||||
NoteOff 0.000000 2 62 82
|
||||
NoteOff 0.000000 2 71 82
|
||||
NoteOff 0.000000 2 79 82
|
||||
StringDamping =4.000000 2 0.0
|
||||
StringDamping =4.000000 2 0.0
|
||||
NoteOn 0.000082 2 55 82
|
||||
NoteOn 0.200000 2 62 82
|
||||
NoteOn 0.100000 2 71 82
|
||||
@@ -102,7 +102,7 @@ The parser isn't all that smart, but neither am I. Here are the basic rules gov
|
||||
|
||||
\section table The SKINI.tbl File and Message Parsing:
|
||||
|
||||
The SKINI.tbl file contains an array of structures which are accessed by the parser object SKINI.cpp. The struct is:
|
||||
The \c SKINI.tbl file contains an array of structures which are accessed by the parser object Skini.cpp. The struct is:
|
||||
|
||||
\code
|
||||
struct SKINISpec {
|
||||
@@ -129,9 +129,21 @@ so an assignment of one of these structs looks like:
|
||||
|
||||
- SK_DBL : double precision floating point. SKINI uses these in the MIDI context for note numbers with micro tuning, velocities, controller values, etc.
|
||||
|
||||
- SK_STR : only valid in final field. This allows (nearly) arbitrary message types to be supported by simply scanning the string to EndOfLine and then passing it to a more intellegent handler. For example, MIDI SYSEX (system exclusive) messages of up to 256 bytes can be read as space-delimited integers into the 1K SK_STR buffer. Longer bulk dumps, soundfiles, etc. should be handled as a new message type pointing to a FileName, Socket, or something else stored in the SK_STR field, or as a new type of multi-line message.
|
||||
- SK_STR : only valid in final field. This allows (nearly) arbitrary message types to be supported by simply scanning the string to EOL (End Of Line) and then passing it to a more intelligent handler. For example, MIDI SYSEX (system exclusive) messages can be read as space-delimited integers into the SK_STR buffer. Longer bulk dumps, soundfiles, etc. should be handled as a new message type pointing to a FileName, Socket, or something else stored in the SK_STR field, or as a new type of multi-line message.
|
||||
|
||||
Here's a couple of lines from the SKINI.tbl file
|
||||
Each individual SKINI message is parsed and saved to a Skini::Message structure of the form:
|
||||
\code
|
||||
struct Message {
|
||||
long type; /*!< The message type, as defined in SKINI.msg. */
|
||||
long channel; /*!< The message channel (not limited to 16!). */
|
||||
StkFloat time; /*!< The message time stamp in seconds (delta or absolute). */
|
||||
std::vector<StkFloat> floatValues; /*!< The message values read as floats (values are type-specific). */
|
||||
std::vector<long> intValues; /*!< The message values read as ints (number and values are type-specific). */
|
||||
std::string remainder; /*!< Any remaining message data, read as ascii text. */
|
||||
};
|
||||
\endcode
|
||||
|
||||
Here's a couple of lines from the \c SKINI.tbl file
|
||||
|
||||
\code
|
||||
{"NoteOff" , __SK_NoteOff_, SK_DBL, SK_DBL},
|
||||
@@ -144,7 +156,7 @@ Here's a couple of lines from the SKINI.tbl file
|
||||
{"StringDetune" , __SK_ControlChange_, __SK_StringDetune_, SK_DBL},
|
||||
\endcode
|
||||
|
||||
The first three are basic MIDI messages. The first two would cause the parser, after recognizing a match of the string "NoteOff" or "NoteOn", to set the message type to 128 or 144 (__SK_NoteOff_ and __SK_NoteOn_ are #defined in the file SKINI.msg to be the MIDI byte value, without channel, of the actual MIDI messages for NoteOn and NoteOff). The parser would then set the time or delta time (this is always done and is therefore not described in the SKINI Message Struct). The next two fields would be scanned as double-precision floats and assigned to the byteTwo and byteThree variables of the SKINI parser. The remainder of the line is stashed in the remainderString variable.
|
||||
The first three are basic MIDI messages. The first two would cause the parser, after recognizing a match of the string "NoteOff" or "NoteOn", to set the message type to 128 or 144 (__SK_NoteOff_ and __SK_NoteOn_ are #defined in the file \c SKINI.msg to be the MIDI byte value, without channel, of the actual MIDI messages for NoteOn and NoteOff). The parser would then set the time or delta time (this is always done and is therefore not described in the SKINI Message Struct). The next two fields would be scanned either as double-precision \c floats or as <tt>long ints</tt>, depending on the format specified in \c SKINI.tbl, and saved to the corresponding C++ vector variables in the Skini::Message structure (either \c floatValues or \c intValues). Floating-point values are also cast to <tt>ints</tt> (and vice-versa) and stored to their respective variables. For example, an expected integer value of 64 will also be saved as 64.0 in the corresponding \c floatValues variable of the Skini::Message structure. The remainder of the line is stashed in the remainderString variable.
|
||||
|
||||
The ControlChange spec is basically the same as NoteOn and NoteOff, but the second data byte is set to an integer (for checking later as to what MIDI control is being changed).
|
||||
|
||||
@@ -155,64 +167,60 @@ The Volume spec is a MIDI Extension message, which behaves like a ControlChange
|
||||
Volume 0.000000 2 64.1
|
||||
\endcode
|
||||
|
||||
I like the 2nd line better, thus my motivation for SKINI in the first place.
|
||||
I like the second line better, thus my motivation for SKINI in the first place.
|
||||
|
||||
The StringDamping and StringDetune messages behave the same as the Volume message, but use Control Numbers which aren't specifically nailed-down in MIDI. Note that these Control Numbers are carried around as long ints, so we're not limited to 0-127. If, however, you want to use a MIDI controller to play an instrument, using controller numbers in the 0-127 range might make sense.
|
||||
|
||||
\section using Using SKINI:
|
||||
|
||||
Here's a simple example of code which uses the SKINI object to read a SKINI file and control a single instrument.
|
||||
Here's a simple example of code which uses the Skini object to read a SKINI file and control a single instrument.
|
||||
|
||||
\code
|
||||
Skini score;
|
||||
Skini::Message message;
|
||||
instrument = new Mandolin(50.0);
|
||||
score = new SKINI(argv[1]);
|
||||
while(score->getType() > 0) {
|
||||
tempDouble = score->getDelta();
|
||||
if (tempDouble < 0) {
|
||||
tempDouble = - tempDouble;
|
||||
tempDouble = tempDouble - output.getTime();
|
||||
if (tempDouble < 0) {
|
||||
printf("Bad News Here!!! Backward Absolute Time Required.\n");
|
||||
tempDouble = 0.0;
|
||||
}
|
||||
score.setFile( argv[1] );
|
||||
while ( score.nextMessage( message ) != 0 ) {
|
||||
tempDouble = message.time;
|
||||
if (tempDouble < 0) {
|
||||
tempDouble = - tempDouble;
|
||||
tempDouble = tempDouble - output.getTime();
|
||||
if (tempDouble < 0) {
|
||||
printf("Bad News Here!!! Backward Absolute Time Required.\n");
|
||||
tempDouble = 0.0;
|
||||
}
|
||||
tempLong = (long) (tempDouble * Stk::sampleRate());
|
||||
for (i=0;i<tempLong;i++) {
|
||||
output.tick(instrument->tick());
|
||||
}
|
||||
tempLong = (long) ( tempDouble * Stk::sampleRate() );
|
||||
for ( i=0; i<tempLong; i++ ) {
|
||||
output.tick( instrument->tick() );
|
||||
}
|
||||
|
||||
tempDouble3 = message.floatValues[1] * NORM_MIDI;
|
||||
if ( message.type == __SK_NoteOn_ ) {
|
||||
if ( tempDouble3 == 0.0 ) {
|
||||
tempDouble3 = 0.5;
|
||||
instrument->noteOff( tempDouble3 );
|
||||
}
|
||||
tempDouble3 = score->getByteThree();
|
||||
if (score->getType()== __SK_NoteOn_ ) {
|
||||
tempDouble3 *= NORM_MIDI;
|
||||
if (score->getByteThree() == 0) {
|
||||
tempDouble3 = 0.5;
|
||||
instrument->noteOff(tempDouble3);
|
||||
}
|
||||
else {
|
||||
tempLong = (int) score->getByteTwo();
|
||||
tempDouble2 = Midi2Pitch[tempLong];
|
||||
instrument->noteOn(tempDouble2,tempDouble3);
|
||||
}
|
||||
else {
|
||||
tempLong = message.intValues[0];
|
||||
tempDouble2 = Midi2Pitch[tempLong];
|
||||
instrument->noteOn( tempDouble2, tempDouble3 );
|
||||
}
|
||||
else if (score->getType() == __SK_NoteOff_) {
|
||||
tempDouble3 *= NORM_MIDI;
|
||||
instrument->noteOff(tempDouble3);
|
||||
}
|
||||
else if (score->getType() == __SK_ControlChange_) {
|
||||
tempLong = score->getByteTwoInt();
|
||||
instrument->controlChange(tempLong,temp3.0);
|
||||
}
|
||||
score->nextMessage();
|
||||
}
|
||||
else if ( message.type == __SK_NoteOff_ ) {
|
||||
instrument->noteOff( tempDouble3 );
|
||||
}
|
||||
else if ( message.type == __SK_ControlChange_ ) {
|
||||
tempLong = message.intValues[0];
|
||||
instrument->controlChange( tempLong, tempDouble3 );
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
When the score (SKINI object) object is created from the filename in argv[1], the first valid command line is read from the file and parsed.
|
||||
When a SKINI score is passed to a Skini object using the Skini::setFile() function, valid messages are read from the file and returned using the Skini::nextMessage() function.
|
||||
|
||||
The score->getType() retrieves the messageType. If this is -1, there are no more valid messages in the file and the synthesis loop terminates. Otherwise, the message type is returned.
|
||||
|
||||
getDelta() retrieves the deltaTime until the current message should occur. If this is greater than 0, synthesis occurs until the deltaTime has elapsed. If deltaTime is less than zero, the time is interpreted as absolute time and the output device is queried as to what time it is now. That is used to form a deltaTime, and if it's positive we synthesize. If it's negative, we print an error and pretend this never happened and we hang around hoping to eventually catch up.
|
||||
The "time" member of a Skini::Message is the deltaTime until the current message should occur. If this is greater than 0, synthesis occurs until the deltaTime has elapsed. If deltaTime is less than zero, the time is interpreted as absolute time and the output device is queried as to what time it is now. That is used to form a deltaTime, and if it's positive we synthesize. If it's negative, we print an error, pretend this never happened and we hang around hoping to eventually catch up.
|
||||
|
||||
The rest of the code sorts out message types NoteOn, NoteOff (including NoteOn with velocity 0), and ControlChange. The code implicitly takes into account the integer type of the control number, but all other data is treated as double float.
|
||||
|
||||
The last line reads and parses the next message in the file.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -2,23 +2,24 @@
|
||||
|
||||
<B>General:</B>
|
||||
<UL>
|
||||
<LI>A MIDI interface to use MIDI input controls. (NOTE: This may be built into the soundcard on your computer.)</LI>
|
||||
<LI>A MIDI interface to use MIDI input/output controls. (NOTE: This may be built into the soundcard on your computer.)</LI>
|
||||
<LI><A HREF="http://dev.scriptics.com">Tcl/Tk</A> version 8.0 or higher to use the simple Tcl/Tk GUIs provided with the STK distribution (available free over the WWW for all supported realtime platforms).</LI>
|
||||
</UL>
|
||||
|
||||
<B>Linux (specific):</B>
|
||||
<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.opensound.com">OSS</A> or <A HREF="http://www.alsa-project.org/">ALSA</A> device drivers for realtime sound output and MIDI input.</LI>
|
||||
<LI><A HREF="http://www.alsa-project.org/">ALSA</A> device drivers and library for realtime sound and MIDI input/output.</LI>
|
||||
<LI><A HREF="http://www.opensound.com">OSS</A> device drivers (version 4.0 and higher only) can be used for audio input/output, but MIDI support requires the ALSA library to compile.</LI>
|
||||
</UL>
|
||||
|
||||
<B>Macintosh OS X (specific):</B>
|
||||
<UL>
|
||||
<LI>A C++ compiler does not ship by default with OS X. It is necessary to download the Developer Kit from the Apple WWW site in order to compile STK.</LI>
|
||||
<LI><B>IMPORTANT:</B>The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. Therefore, it is necessary to either specify this rate as a command-line option to the STK example programs or to change the default sample rate inside the Stk.h file before compilation. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.</LI>
|
||||
<LI>The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. The latest Tcl/Tk Aqua distribution (http://www.apple.com/downloads/macosx/unix_open_source/tcltk.html) has been successfully tested on a 10.2 system. The default installation will place a link to the wish interpretor at /usr/bin/wish.
|
||||
<LI>A C++ compiler is not installed by default with OS X. It is necessary to download the Developer Kit from the Apple WWW site in order to compile STK or load it from the installation CD-ROM.</LI>
|
||||
<LI>If you experience frequent audio input/output "glitches", try increasing the RT_BUFFER_SIZE specified in Stk.h.</LI>
|
||||
<LI>The tcl/tk interpreter does not ship by default with OS X and must be downloaded from the internet. The latest Tcl/Tk Aqua distribution (http://www.apple.com/downloads/macosx/unix_open_source/tcltk.html) has been successfully tested on 10.2 and 10.3 systems. The default installation will place a link to the wish interpretor at /usr/bin/wish.
|
||||
|
||||
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates. It is possible to connect a tcl/tk interface to an STK program via a socket connection. However, the tcl/tk interpreter does not appear to properly close the socket connection during disconnection. It is therefore necessary to type "Exit" in the STK program terminal window to properly exit the STK program.</LI>
|
||||
It appears that socket support in Tcl/Tk uses the Nagle algorithm, which produces poor response between changes made in the tcl/tk script and the resulting audio updates. Note that this is only a problem when using a socket connection from a Tcl/Tk script.</LI>
|
||||
|
||||
</UL>
|
||||
|
||||
@@ -26,15 +27,10 @@ Initial tests have shown somewhat poor response between changes made in the tcl/
|
||||
<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 to use the precompiled binaries.</LI>
|
||||
<LI>Visual C++ 6.0 for compiling (though a precompiled distribution is available).</LI>
|
||||
<LI>Visual C++ .NET for compiling (though a precompiled distribution is available).</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>
|
||||
|
||||
<B>WindowsNT (specific):</B>
|
||||
<UL>
|
||||
<LI>DirectX support for NT is inadequate, so it is not possible to use STK under WindowsNT with realtime DirectX support. It may be possible to use STK under WindowsNT with realtime ASIO support, though this has not been tested.</LI>
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
/*! \page tutorial Tutorial
|
||||
|
||||
The Synthesis ToolKit is a set of C++ classes. In order to go beyond the simple example programs we provide, it is necessary to know some basics about programming in C or C++. STK's "target audience" includes people who:
|
||||
The Synthesis ToolKit is a set of C++ classes. In order to go beyond the simple example programs we provide, it is necessary to know some basics about programming in C and C++. STK's "target audience" includes people who:
|
||||
<UL>
|
||||
<LI>want to create audio DSP and/or synthesis programs</LI>
|
||||
<LI>want to save some time by using our unit generators and input/output routines</LI>
|
||||
<LI>want to use our unit generators and input/output routines rather than code their own</LI>
|
||||
<LI>want to learn about synthesis and processing algorithms</LI>
|
||||
<LI>wish to teach real-time synthesis and processing, and wish to use some of our classes and examples</LI>
|
||||
<LI>wish to teach real-time synthesis and processing and wish to use some of our classes and examples</LI>
|
||||
</UL>
|
||||
|
||||
Most ToolKit programmers will likely end up writing a class or two for their own particular needs, but this task is typically simplified by making use of pre-existing STK classes (filters, oscillators, etc.).
|
||||
|
||||
The following tutorial chapters describe many of the fundamental ToolKit concepts and classes. All tutorial programs are included in the <TT>projects/examples</TT> directory.
|
||||
|
||||
-# \ref fundamentals
|
||||
-# \ref hello
|
||||
-# \ref compile
|
||||
-# \ref filtering
|
||||
-# \ref realtime
|
||||
-# \ref crealtime
|
||||
-# \ref instruments
|
||||
-# \ref controlin
|
||||
-# \ref multichannel
|
||||
-# \ref polyvoices
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@ The top level distribution contains the following directories:
|
||||
|
||||
<LI> The <I><B>include</B></I> directory contains the header files for all the STK unit generator and algorithm classes.</LI><P>
|
||||
|
||||
<LI> The <I><B>rawwaves</B></I> directory contains various raw, monophonic, 16-bit, big-endian soundfiles used with the STK classes.</LI><P>
|
||||
<LI> The <I><B>rawwaves</B></I> directory contains various raw, monophonic, 16-bit, big-endian, 22050 Hz soundfiles used with the STK classes.</LI><P>
|
||||
|
||||
<LI> The <I><B>doc</B></I> directory contains documentation about STK.</LI><P>
|
||||
|
||||
@@ -31,21 +31,19 @@ The top level distribution contains the following directories:
|
||||
This release of STK comes with four separate "project" directories:
|
||||
|
||||
<OL>
|
||||
<LI> The <I><B>demo</B></I> project is used to demonstrate nearly all of the STK instruments. The <I><B>demo</B></I> program has been written to allow a variety of control input and sound data output options. %Simple graphical user interfaces (GUIs) are also provided.<P></LI>
|
||||
<LI> The <I><B>demo</B></I> project is used to demonstrate nearly all of the STK instruments. The <I><B>demo</B></I> program has been written to allow a variety of control input and sound data output options. Simple graphical user interfaces (GUIs) are also provided.<P></LI>
|
||||
|
||||
<LI> The <I><B>effects</B></I> project demonstrates realtime duplex mode (simultaneous audio input and output) operation, when available, as well as various delay-line based effects algorithms.<P></LI>
|
||||
|
||||
<LI> The <I><B>ragamatic</B></I> project is just cool. Fire it up and be enlightened.<P></LI>
|
||||
|
||||
<LI> The <I><B>examples</B></I> project contains several simple programs which demonstrate audio input/output, as well as the use of the audio internet streaming classes.</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:</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> preprocessor definition is necessary for all Windows systems. A distribution of the release is available with precompiled binaries (using DirectSound) for all the projects. In order for these binaries to function properly, your system must have the DirectX 5.0 (or higher) runtime libraries installed (available from <A HREF="http://www.microsoft.com/directx/">Microsoft</A>). Further, the <I><B>effects</B></I> project requires that your soundcard and drivers provide full duplex mode capabilities. Visual C++ 6.0 project files are provided in each project directory as well should you wish to compile your own binaries. 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>WindowsNT:</B> DirectX support for NT is inadequate, so it is not possible to use STK under WindowsNT with realtime DirectX support. It may be possible to use STK under WindowsNT with realtime ASIO support, though this has not been tested.</LI>
|
||||
<LI><B>Windows95/98/2000/XP:</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). A distribution of the release is available with precompiled binaries (using DirectSound) for all the projects. In order for these binaries to function properly, your system must have the DirectX 5.0 (or higher) runtime libraries installed (available from <A HREF="http://www.microsoft.com/directx/">Microsoft</A>). Further, the <I><B>effects</B></I> project requires that your soundcard and drivers provide full duplex mode capabilities. Visual C++ .NET project files are provided in each project directory as well should you wish to compile your own binaries. 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 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.
|
||||
|
||||
@@ -53,11 +51,13 @@ Several options can be supplied to the <TT>configure</TT> script to customize th
|
||||
<UL>
|
||||
<LI><TT>--disable-realtime</TT> to only compile generic non-realtime classes</LI>
|
||||
<LI><TT>--enable-debug</TT> to enable various debug output</LI>
|
||||
<LI><TT>--enable-midiator</TT> to enable native MS-124W MIDI support (linux only)</LI>
|
||||
<LI><TT>--with-alsa</TT> to choose native ALSA API support (linux only)</LI>
|
||||
<LI><TT>--with-alsa</TT> to choose native ALSA API support (default, linux only)</LI>
|
||||
<LI><TT>--with-oss</TT> to choose native OSS audio API support (linux only, no native OSS MIDI support)</LI>
|
||||
<LI><TT>--with-jack</TT> to choose native JACK API support (linux and Macintosh OS-X)</LI>
|
||||
<LI><TT>--with-core</TT> to choose Core Audio API support (Macintosh OS-X)</LI>
|
||||
</UL>
|
||||
<P>
|
||||
In addition, it is possible to specify the location of the STK rawwaves and the STK include path as follows:
|
||||
Note that it is possible to specify as many of the "--with-" options as desired to compile multi-API support. In addition, it is possible to specify the location of the STK rawwaves and the STK include path as follows:
|
||||
\code
|
||||
./configure RAWWAVE_PATH="/home/gary/rawwaves/"
|
||||
./configure INCLUDE_PATH="/home/gary/include/"
|
||||
@@ -68,13 +68,11 @@ For novice STK users, the default configuration should be adequate.
|
||||
|
||||
For those who wish to create their own system-specific <TT>Makefiles</TT>:
|
||||
<UL>
|
||||
<LI><B>Linux:</B> Realtime support is enabled with either the <TT>__LINUX_OSS__</TT> or <TT>__LINUX_ALSA__</TT> preprocessor definitions, which are used to select the underlying audio/MIDI system API. Realtime programs must also link with the <TT>pthread</TT> library. When using the ALSA API, it is also necessary to link with the <TT>asound</TT> library. In addition, the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition is necessary if compiling on a little-endian system. Special support exists under Linux for the MIDIator serial MIDI device, enabled using the <TT>__MIDIATOR__</TT> preprocessor definition (together with either the <TT>__LINUX_ALSA__</TT> or <TT>__LINUX_OSS__</TT> definitions). See the README-Linux file for further system configuration information.</LI>
|
||||
<LI><B>Linux:</B> Realtime audio support is enabled with either the <TT>__LINUX_ALSA__</TT>, <TT>__UNIX_JACK__</TT>, and/or <TT>__LINUX_OSS__</TT> preprocessor definitions, which are used to select the underlying audio system API(s). 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 <TT>__LINUX_ALSASEQ__</TT> preprocessor definition must be included for MIDI support. Note that native OSS MIDI support no longer exists in RtMidi. If the <TT>__LINUX_OSS__</TT> preprocessor definition is specified, only OSS (version 4.0) audio support will be compiled and RtMidi will still be compiled using the ALSA API (assuming the <TT>__LINUX_ALSASEQ__</TT> definition is defined). For this reason, STK now requires the <TT>asound</TT> library for realtime support. Realtime programs must also link with the <TT>pthread</TT> library. In addition, the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition is necessary if compiling on a little-endian system. See the README-Linux file for further system configuration information.</LI>
|
||||
|
||||
<LI><B>Macintosh OS X:</B> Realtime support is enabled with the <TT>__MACOSX_CORE__</TT> preprocessor definitions, which incorporates the CoreAudio audio/MIDI API. Realtime programs must also link with the <TT>pthread</TT> library and the <TT>CoreAudio</TT>, <TT>CoreMIDI</TT>, and <TT>CoreFoundation</TT> frameworks. See the README-MacOSX file for further system configuration information.</LI>
|
||||
<LI><B>Macintosh OS X:</B> Realtime support is enabled with the <TT>__MACOSX_CORE__</TT> and <TT>__UNIX_JACK__</TT> preprocessor definitions, which incorporate the CoreAudio audio/MIDI API and/or the JACK API. Realtime programs must also link with the <TT>pthread</TT> library and the <TT>CoreAudio</TT>, <TT>CoreMIDI</TT>, and <TT>CoreFoundation</TT> frameworks (for Core Audio support) and/or the JACK library. See the README-MacOSX file for further system configuration information.</LI>
|
||||
|
||||
<LI><B>SGI:</B> Realtime support is enabled with the <TT>__IRIX_AL__</TT> preprocessor definition and linkage with the <TT>audio</TT>, <TT>md</TT>, and <TT>pthread</TT> libraries. STK 4.0 (and higher) is confirmed to compile using CC version 7.30. There may be problems with old compiler versions.</LI>
|
||||
|
||||
<LI><B>Generic (non-realtime):</B> Most STK classes are operating system <I>independent</I> and can be compiled using any current C++ compiler. STK assumes big-endian host byte order by default, so if your system is little-endian (i.e. Intel processor), you must provide the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition to your compiler. The <I><B>demo</B></I> project will compile without realtime support, allowing the use of SKINI scorefiles for input control and output to a variety of soundfile formats. The following classes <I>cannot</I> be used without realtime support: RtAudio, RtWvIn, RtWvOut, RtDuplex, RtMidi, Socket, Thread, TcpWvIn, TcpWvOut. Because of this, it is not possible to compile the <I><B>effects</B></I>, <I><B>ragamatic</B></I>, and most of the <I><B>examples</B></I> projects for non-realtime use.</LI>
|
||||
<LI><B>Generic (non-realtime):</B> Most STK classes are operating system <I>independent</I> and can be compiled using any current C++ compiler. STK assumes big-endian host byte order by default, so if your system is little-endian (i.e. Intel processor), you must provide the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition to your compiler. The <I><B>demo</B></I> project will compile without realtime support, allowing the use of SKINI scorefiles for input control and output to a variety of soundfile formats. The following classes <I>cannot</I> be used without realtime support: RtAudio, RtWvIn, RtWvOut, RtDuplex, RtMidi, Socket, Thread, Mutex, TcpWvIn, TcpWvOut. Because of this, it is not possible to compile the <I><B>effects</B></I>, <I><B>ragamatic</B></I>, and most of the <I><B>examples</B></I> projects for non-realtime use.</LI>
|
||||
</UL>
|
||||
|
||||
|
||||
@@ -89,7 +87,7 @@ All STK programs in this distribution take input control data in the form of <A
|
||||
<LI>Acquire realtime MIDI messages from a MIDI port on your computer.</LI>
|
||||
</OL>
|
||||
|
||||
<A HREF="http://dev.scriptics.com">Tcl/Tk</A> graphical user interfaces (GUI) are provided with this distribution which can generate realtime SKINI messages. Note that the Messager class allows multiple simultaneous socket client connections, together with MIDI and/or piped input. The <I><B>Md2Skini</B></I> program (in the <I><B>demo</B></I> directory) is mostly obsolete but can be used to create SKINI scorefiles from realtime MIDI input.
|
||||
<A HREF="http://dev.scriptics.com">Tcl/Tk</A> graphical user interfaces (GUI) are provided with this distribution that can generate realtime SKINI messages. Note that the Messager class allows multiple simultaneous socket client connections, together with MIDI and/or piped input. The <I><B>Md2Skini</B></I> program (in the <I><B>demo</B></I> directory) is mostly obsolete but can be used to create SKINI scorefiles from realtime MIDI input.
|
||||
|
||||
|
||||
\section voices Demo: STK Instruments
|
||||
@@ -98,7 +96,7 @@ The <I><B>demo</B></I> project demonstrates the behavior of all the distributed
|
||||
<UL>
|
||||
<LI>Clarinet: Pretty good physical model of the clarinet</LI>
|
||||
<LI>BlowHole: A clarinet physical model with one tonehole and one register vent</LI>
|
||||
<LI>Saxofony: A psuedo-conical bore reed instrument which sometimes sounds like a saxophone</LI>
|
||||
<LI>Saxofony: A psuedo-conical bore reed instrument that sometimes sounds like a saxophone</LI>
|
||||
<LI>Flute: Pretty good physical model of the flute</LI>
|
||||
<LI>Brass: Not so bad physical model of a brass instrument</LI>
|
||||
<LI>BlowBotl: A basic helmholtz resonator and air jet model</LI>
|
||||
@@ -132,21 +130,15 @@ See the information above with respect to compiling STK for non-realtime use.
|
||||
In non-realtime mode, it is assumed that input control messages are provided from a SKINI scorefile and that audio output is written to a soundfile (.snd, .wav, .aif, .mat, .raw). A number of SKINI scorefiles are provided in the <I>scores</I> directory of the <I><B>demo</B></I> project. Assuming a successful compilation of the <I><B>demo</B></I> program, typing:
|
||||
|
||||
\code
|
||||
cat scores/bookert.ski | demo BeeThree -ow myfile.wav
|
||||
demo BeeThree -ow myfile.wav -if scores/bookert.ski
|
||||
\endcode
|
||||
|
||||
or (on WindowsXX and/or Unix)
|
||||
|
||||
\code
|
||||
demo BeeThree -ow myfile.wav < scores\bookert.ski
|
||||
\endcode
|
||||
|
||||
from the <I><B>demo</B></I> directory will play the scorefile <I>bookert.ski</I> using the STK BeeThree instrument and write the resulting audio data to a WAV formatted soundfile called "myfile.wav". Typing <TT>demo</TT> without any arguments will provide a full program usage description.
|
||||
from the <I><B>demo</B></I> directory will play the scorefile <I>bookert.ski</I> using the STK BeeThree instrument and write the resulting audio data to a WAV formatted soundfile called "myfile.wav" (note that you may need to append <TT>./</TT> to the program name if your default shell setup is not set to look in the current directory). Typing <TT>demo</TT> without any arguments will provide a full program usage description.
|
||||
|
||||
|
||||
\section rt Demo: Realtime Use
|
||||
|
||||
STK realtime audio and MIDI input/output and realtime SKINI control input via socketing support is provided for Linux, SGI, Mac OS X, and Windows95/98/2000/XP operating systems. STK realtime SKINI control input via piping is possible under Linux, SGI, Mac OS X, and Windows2000/XP only.
|
||||
STK realtime audio and MIDI input/output and realtime SKINI control input via socketing support is provided for Linux, Mac OS-X, and Windows95/98/2000/XP operating systems. STK realtime SKINI control input via piping is possible under Linux, Mac OS X, and Windows2000/XP only.
|
||||
<P>
|
||||
Control input and audio output options are typically specified as command-line arguments to STK programs. For example, the <I><B>demo</B></I> program is invoked as:
|
||||
|
||||
@@ -157,27 +149,22 @@ demo instrument flags
|
||||
where instruments include those described above and flags can be any or all of:
|
||||
<UL>
|
||||
<LI><I>-or</I> for realtime audio output,</LI>
|
||||
<LI><I>-ow <file name></I> for WAV soundfile output,</LI>
|
||||
<LI><I>-os <file name></I> for SND (AU) soundfile output,</LI>
|
||||
<LI><I>-om <file name></I> for MAT-file output,</LI>
|
||||
<LI><I>-ow \<file name\></I> for WAV soundfile output,</LI>
|
||||
<LI><I>-os \<file name\></I> for SND (AU) soundfile output,</LI>
|
||||
<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 <file name></I> for MIDI control input</LI>
|
||||
<LI><I>-s RATE</I> to specify a sample rate</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 <-ip> and <-is> flags must be used when piping or socketing realtime SKINI control data to an STK program. The <-im> 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> 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.
|
||||
|
||||
Assuming a successful compilation of the <I><B>demo</B></I> program, typing:
|
||||
|
||||
\code
|
||||
cat scores/bookert.ski | demo BeeThree -or
|
||||
\endcode
|
||||
|
||||
or (on WindowsXX and/or Unix)
|
||||
|
||||
\code
|
||||
demo BeeThree -or < scores\bookert.ski
|
||||
demo BeeThree -or -if scores/bookert.ski
|
||||
\endcode
|
||||
|
||||
from the <I><B>demo</B></I> directory will play the scorefile <I>bookert.ski</I> using the STK BeeThree instrument and stream the resulting audio data in realtime to the audio output channel of your computer. Typing <TT>demo</TT> without any arguments will provide a full program usage description.
|
||||
@@ -209,6 +196,7 @@ On all supported realtime platforms, you can direct realtime MIDI input to the S
|
||||
demo Clarinet -or -im
|
||||
\endcode
|
||||
|
||||
This will attempt to use the default MIDI port for input. An optional MIDI port number can be specified after the <TT>-im</TT> flag. Valid MIDI ports are numbered from 0 (default) and higher. On Linux and Macintosh OS-X systems, it is possible to open a virtual MIDI input port (that other software applications can connect to) by specifying a port identifier of -1.
|
||||
|
||||
\section polyphony Polyphony:
|
||||
|
||||
|
||||
@@ -1,42 +1,38 @@
|
||||
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
STK Classes - See the HTML documentation in the html directory for complete information.
|
||||
|
||||
.- Envelope - ADSR
|
||||
|
||||
.- Generator - (Modulate, Noise, SingWave, Envelope, ADSR, Asymp, SineWave, Blit, BlitSaw, BlitSquare, Granulate)
|
||||
|
|
||||
|- Noise - SubNoise
|
||||
|- Function - (BowTable, JetTable, ReedTable)
|
||||
|
|
||||
|- Table
|
||||
|- FileRead, FileWrite
|
||||
|
|
||||
|- WvIn - (WaveLoop, RtWvIn, TcpWvIn)
|
||||
|- WvIn - (FileWvIn, RtWvIn, InetWvIn)
|
||||
| |
|
||||
| FileLoop
|
||||
|
|
||||
|- WvOut - (RtWvOut, TcpWvOut)
|
||||
|- WvOut - (FileWvOut, RtWvOut, TcpWvOut)
|
||||
|
|
||||
|- Filter - (OnePole, OneZero, Delay, TwoPole, TwoZero, PoleZero, Biquad)
|
||||
| | |
|
||||
| DelayL FormSwep
|
||||
| DelayA
|
||||
|- Filter - (OnePole, OneZero, TwoPole, TwoZero, PoleZero, Biquad, FormSwep, Delay, DelayL, DelayA, TapDelay)
|
||||
|
|
||||
|- Echo, Chorus, PitShift
|
||||
|- RtAudio, RtMidi, RtDuplex, Socket, Thread, Mutex
|
||||
| |
|
||||
Stk -| UdpSocket
|
||||
| TcpServer
|
||||
| TcpClient
|
||||
|
|
||||
|- RtAudio, RtMidi, Socket, Thread
|
||||
Stk -|
|
||||
|- Reverb - (PRCRev, JCRev, NRev)
|
||||
|- StkFrames
|
||||
|
|
||||
|- Modulate
|
||||
|- Effect - (Echo, Chorus, PitShift, PRCRev, JCRev, NRev)
|
||||
|
|
||||
|- SingWave
|
||||
|
|
||||
|- Voicer
|
||||
|- Voicer, Message, Skini, MidiFileIn, Phonemes, Sphere, Vector3D
|
||||
|
|
||||
|- Messager
|
||||
|
|
||||
|- SKINI
|
||||
|
|
||||
|- ReedTabl, JetTabl, BowTabl
|
||||
|
|
||||
| .- FM - (HevyMetl, PercFlut, Rhodey, Wurley, TubeBell, BeeThree, FMVoices)
|
||||
| |
|
||||
| |- Modal - ModalBar
|
||||
@@ -66,40 +62,53 @@ Stk -|
|
||||
|
||||
Master Class: Stk.cpp Sample rate, byte-swapping, error handling functionality
|
||||
|
||||
Sources: Envelope.cpp Linearly Goes to Target by Rate
|
||||
ADSR.cpp ADSR Flavor of Envelope
|
||||
Noise.cpp Random Number Generator
|
||||
SubNoise.cpp Random Numbers each N samples
|
||||
Table.cpp Lookup Table (assumes given data in big-endian format)
|
||||
WvIn.cpp Data Input Class (interpolating) for RAW, WAV, SND (AU), AIFF, MAT-file files
|
||||
WaveLoop.cpp Wavetable looping (subclass of WvIn)
|
||||
RtWvIn.cpp Realtime Audio Input Class (subclass of WvIn)
|
||||
TcpWvIn.cpp Audio Streaming (socket server) Input Class (subclass of WvIn)
|
||||
Sources: Generator.h Abstract base class for various source signal classes
|
||||
Function.h Abstract base class for various input/output mapping classes
|
||||
Envelope.cpp Linearly goes to target by rate
|
||||
ADSR.cpp ADSR envelope
|
||||
Asymp.cpp Exponentially approaches target
|
||||
Noise.cpp Random number generator
|
||||
SineWave.cpp Sinusoidal oscillator with internally computed static table
|
||||
Blit.cpp Bandlimited impulse train
|
||||
BlitSaw.cpp Bandlimited sawtooth generator
|
||||
BlitSquare.cpp Bandlimited square wave generator
|
||||
Granulate.cpp Granular synthesis class that processes a monophonic audio file
|
||||
FileRead.cpp Audio file input class (no internal data storage) for RAW, WAV, SND (AU), AIFF, MAT-file files
|
||||
WvIn.h Abstract base class for audio data input classes
|
||||
FileWvIn.cpp Audio file input interface class with interpolation
|
||||
FileLoop.cpp Wavetable looping (subclass of FileWvIn)
|
||||
RtWvIn.cpp Realtime audio input class (subclass of WvIn)
|
||||
InetWvIn.cpp Audio streaming (socket server) input class (subclass of WvIn)
|
||||
|
||||
Sinks: WvOut.cpp Output Master Class for RAW, WAV, SND (AU), AIFF, MAT-file files
|
||||
RtWvOut.cpp Realtime Audio Output Class (subclass of WvOut)
|
||||
TcpWvOut.cpp Audio Streaming (socket client) Output Class (subclass of WvOut)
|
||||
Sinks: FileWrite.cpp Audio file output class (no internal data storage) for RAW, WAV, SND (AU), AIFF, MAT-file files
|
||||
WvOut.h Abstract base class for audio data output classes
|
||||
FileWvOut.cpp Audio file output interface class to FileWrite
|
||||
RtWvOut.cpp Realtime audio output class (subclass of WvOut)
|
||||
InetWvOut.cpp Audio streaming (socket client) output class (subclass of WvOut)
|
||||
|
||||
Duplex: RtDuplex.cpp Synchronous Realtime Audio Input/Output Class
|
||||
Duplex: RtDuplex.cpp Synchronous realtime audio input/output class (blocking)
|
||||
|
||||
Filters: Filter.cpp Filter Master Class
|
||||
OneZero.cpp One Zero Filter
|
||||
OnePole.cpp One Pole Filter
|
||||
PoleZero.cpp One Pole/One Zero Filter
|
||||
TwoZero.cpp Two Zero Filter
|
||||
TwoPole.cpp Two Pole Filter
|
||||
BiQuad.cpp Two Pole/Two Zero Filter
|
||||
FormSwep.cpp Sweepable BiQuad Filter (goes to target by rate)
|
||||
Delay.cpp Non-Interpolating Delay Line Class
|
||||
DelayL.cpp Linearly Interpolating Delay Line (subclass of Delay)
|
||||
DelayA.cpp Allpass Interpolating Delay Line (subclass of Delay)
|
||||
Filters: Filter.h Filter master class
|
||||
Iir.h General infinite-impulse response filter
|
||||
Fir.h General finite-impulse response filter
|
||||
OneZero.cpp One zero filter
|
||||
OnePole.cpp One pole filter
|
||||
PoleZero.cpp One pole/one zero filter
|
||||
TwoZero.cpp Two zero filter
|
||||
TwoPole.cpp Two pole filter
|
||||
BiQuad.cpp Two pole/two zero filter
|
||||
FormSwep.cpp Sweepable biquad filter (goes to target by rate)
|
||||
Delay.cpp Non-interpolating delay line class
|
||||
DelayL.cpp Linearly interpolating delay line
|
||||
DelayA.cpp Allpass interpolating delay line
|
||||
TapDelay.cpp Multi-tap non-interpolating delay line class
|
||||
|
||||
Non-Linear: JetTabl.cpp Cubic Jet Non-Linearity
|
||||
BowTabl.cpp x^(-3) Bow Non-Linearity
|
||||
ReedTabl.cpp One Breakpoint Saturating Reed Non-Linearity
|
||||
Non-Linear: JetTabl.h Cubic jet non-linearity
|
||||
BowTabl.h x^(-3) Bow non-linearity
|
||||
ReedTabl.h One breakpoint saturating reed non-linearity
|
||||
|
||||
Derived: Modulate.cpp Periodic and Random Vibrato: WvIn, SubNoise, OnePole
|
||||
SingWave.cpp Looping wave table with randomness: Modulate, WaveLoop, Envelope
|
||||
Derived: Modulate.cpp Periodic and random vibrato: WvIn, Noise, OnePole
|
||||
SingWave.cpp Looping wave table with randomness: Modulate, FileLoop, Envelope
|
||||
|
||||
|
||||
********** INSTRUMENTS AND ALGORITHMS **************
|
||||
@@ -140,7 +149,7 @@ 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.
|
||||
|
||||
Reverb.cpp Reverberator Effects Processor Master Class for reverberators
|
||||
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
|
||||
@@ -160,7 +169,7 @@ demo.cpp Demonstration program for most synthesis algorithms
|
||||
effects.cpp Effects demonstration program
|
||||
ragamatic.cpp Nirvana just waiting to happen
|
||||
|
||||
SKINI.cpp SKINI file/message parser object
|
||||
Skini.cpp SKINI file/message parser object
|
||||
SKINI.msg #defines for often used and universal MIDI/SKINI symbols
|
||||
SKINI.tbl Table of SKINI messages
|
||||
|
||||
@@ -6,70 +6,146 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>ADSR.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ADSR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ADSR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a><a class="code" href="namespacestk.html">00006</a> <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1ADSR.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <span class="keyword">enum</span> {
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba9518c737b76795fa49f997c09e074c8e">00027</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba9518c737b76795fa49f997c09e074c8e">ATTACK</a>,
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba75e1deeb861fe2989250b1977018cacf">00028</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba75e1deeb861fe2989250b1977018cacf">DECAY</a>,
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba139dc35648a28ddc99a7a606e185f6ad">00029</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>,
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba7efc189b0b53e581201fd64f357a1756">00030</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba7efc189b0b53e581201fd64f357a1756">RELEASE</a>,
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154bac9fd188b8e5ad469e002f7ba3498028b">00031</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154bac9fd188b8e5ad469e002f7ba3498028b">DONE</a>
|
||||
<a name="l00032"></a>00032 };
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1ADSR.html#c7473272021307b0dcf1ef602143e144" title="Default constructor.">ADSR</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1ADSR.html#714f0b9deb325050eba819bc1fe22127" title="Class destructor.">~ADSR</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#ad03e82009a20cfb49c1f04bae791631" title="Set target = 1, state = ADSR::ATTACK.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#9400e04b313ab8900a3ba9b693f448e6" title="Set target = 0, state = ADSR::RELEASE.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#ff18347235fd52ce307c4b5de18a9c62" title="Set the attack rate.">setAttackRate</a>( StkFloat rate );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#285f500b1e149aed48dba2a155b95cdd" title="Set the decay rate.">setDecayRate</a>( StkFloat rate );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#85138fb6bbcc7b7cd85ec8449d68f7d8" title="Set the sustain level.">setSustainLevel</a>( StkFloat level );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#29da04231df73c2968c0e9387b43be6e" title="Set the release rate.">setReleaseRate</a>( StkFloat rate );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#48885319b8175cd4d6312fdf7980f116" title="Set the attack rate based on a time duration.">setAttackTime</a>( StkFloat time );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#450703c45384ae27eb766551843ce82d" title="Set the decay rate based on a time duration.">setDecayTime</a>( StkFloat time );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#91c14442557cb65286a327f8b297237a" title="Set the release rate based on a time duration.">setReleaseTime</a>( StkFloat time );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#3567b02a0e8ab82d18eb949d362f9708" title="Set sustain level and attack, decay, and release time durations.">setAllTimes</a>( StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#428eebd510e464ccd7bb4e5728f80d63" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1ADSR.html#87f9918cfa4104a841dc5b44f26f8904">00074</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1ADSR.html#87f9918cfa4104a841dc5b44f26f8904" title="Return the current envelope state (ATTACK, DECAY, SUSTAIN, RELEASE, DONE).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a99bf5fca3885bf8d99a3edc4072a4b5" title="Set to state = ADSR::SUSTAIN with current and target values of value.">setValue</a>( StkFloat value );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1ADSR.html#edbcb85346c354139f139b3232f36f39">00080</a> StkFloat <a class="code" href="classstk_1_1ADSR.html#edbcb85346c354139f139b3232f36f39" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 StkFloat <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keyword">protected</span>:
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00100"></a>00100 StkFloat value_;
|
||||
<a name="l00101"></a>00101 StkFloat target_;
|
||||
<a name="l00102"></a>00102 StkFloat attackRate_;
|
||||
<a name="l00103"></a>00103 StkFloat decayRate_;
|
||||
<a name="l00104"></a>00104 StkFloat releaseRate_;
|
||||
<a name="l00105"></a>00105 StkFloat sustainLevel_;
|
||||
<a name="l00106"></a>00106 };
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a><a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975">00108</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00109"></a>00109 {
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">switch</span> ( state_ ) {
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba9518c737b76795fa49f997c09e074c8e">ATTACK</a>:
|
||||
<a name="l00113"></a>00113 value_ += attackRate_;
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00115"></a>00115 value_ = target_;
|
||||
<a name="l00116"></a>00116 target_ = sustainLevel_;
|
||||
<a name="l00117"></a>00117 state_ = <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba75e1deeb861fe2989250b1977018cacf">DECAY</a>;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 lastFrame_[0] = value_;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">break</span>;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba75e1deeb861fe2989250b1977018cacf">DECAY</a>:
|
||||
<a name="l00123"></a>00123 value_ -= decayRate_;
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">if</span> ( value_ <= sustainLevel_ ) {
|
||||
<a name="l00125"></a>00125 value_ = sustainLevel_;
|
||||
<a name="l00126"></a>00126 state_ = <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>;
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = value_;
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">break</span>;
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba7efc189b0b53e581201fd64f357a1756">RELEASE</a>:
|
||||
<a name="l00132"></a>00132 value_ -= releaseRate_;
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">if</span> ( value_ <= 0.0 ) {
|
||||
<a name="l00134"></a>00134 value_ = (StkFloat) 0.0;
|
||||
<a name="l00135"></a>00135 state_ = <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154bac9fd188b8e5ad469e002f7ba3498028b">DONE</a>;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 lastFrame_[0] = value_;
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a><a class="code" href="classstk_1_1ADSR.html#97a617c65e62aadb4f88bd10cf437a6a">00144</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00145"></a>00145 {
|
||||
<a name="l00146"></a>00146 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00147"></a>00147 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00148"></a>00148 errorString_ << <span class="stringliteral">"ADSR::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00149"></a>00149 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
||||
<a name="l00152"></a>00152 <span class="preprocessor"></span>
|
||||
<a name="l00153"></a>00153 StkFloat *samples = &frames[channel];
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00156"></a>00156 *samples = <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR::tick</a>();
|
||||
<a name="l00157"></a>00157
|
||||
<a name="l00158"></a>00158 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>ADSR.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00016 <span class="comment">/***************************************************/</span>
|
||||
00017
|
||||
00018 <span class="preprocessor">#if !defined(__ADSR_H)</span>
|
||||
00019 <span class="preprocessor"></span><span class="preprocessor">#define __ADSR_H</span>
|
||||
00020 <span class="preprocessor"></span>
|
||||
00021 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
00022
|
||||
<a name="l00023"></a><a class="code" href="classADSR.html">00023</a> <span class="keyword">class </span><a class="code" href="classADSR.html">ADSR</a> : <span class="keyword">public</span> <a class="code" href="classEnvelope.html">Envelope</a>
|
||||
00024 {
|
||||
00025 <span class="keyword">public</span>:
|
||||
00026
|
||||
00028 <span class="keyword">enum</span> { ATTACK, DECAY, SUSTAIN, RELEASE, DONE };
|
||||
00029
|
||||
00031 <a class="code" href="classADSR.html#a0">ADSR</a>(<span class="keywordtype">void</span>);
|
||||
00032
|
||||
00034 <a class="code" href="classADSR.html#a1">~ADSR</a>(<span class="keywordtype">void</span>);
|
||||
00035
|
||||
00037 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a2">keyOn</a>(<span class="keywordtype">void</span>);
|
||||
00038
|
||||
00040 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a3">keyOff</a>(<span class="keywordtype">void</span>);
|
||||
00041
|
||||
00043 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a4">setAttackRate</a>(MY_FLOAT aRate);
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a5">setDecayRate</a>(MY_FLOAT aRate);
|
||||
00047
|
||||
00049 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a6">setSustainLevel</a>(MY_FLOAT aLevel);
|
||||
00050
|
||||
00052 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a7">setReleaseRate</a>(MY_FLOAT aRate);
|
||||
00053
|
||||
00055 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a8">setAttackTime</a>(MY_FLOAT aTime);
|
||||
00056
|
||||
00058 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a9">setDecayTime</a>(MY_FLOAT aTime);
|
||||
00059
|
||||
00061 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a10">setReleaseTime</a>(MY_FLOAT aTime);
|
||||
00062
|
||||
00064 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a11">setAllTimes</a>(MY_FLOAT aTime, MY_FLOAT dTime, MY_FLOAT sLevel, MY_FLOAT rTime);
|
||||
00065
|
||||
00067 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a12">setTarget</a>(MY_FLOAT aTarget);
|
||||
00068
|
||||
00070 <span class="keywordtype">int</span> <a class="code" href="classADSR.html#a13">getState</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00071
|
||||
00073 <span class="keywordtype">void</span> <a class="code" href="classADSR.html#a14">setValue</a>(MY_FLOAT aValue);
|
||||
00074
|
||||
00076 MY_FLOAT <a class="code" href="classADSR.html#a15">tick</a>(<span class="keywordtype">void</span>);
|
||||
00077
|
||||
00079 MY_FLOAT *<a class="code" href="classADSR.html#a15">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00080
|
||||
00081 <span class="keyword">protected</span>:
|
||||
00082 MY_FLOAT attackRate;
|
||||
00083 MY_FLOAT decayRate;
|
||||
00084 MY_FLOAT sustainLevel;
|
||||
00085 MY_FLOAT releaseRate;
|
||||
00086 };
|
||||
00087
|
||||
00088 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
122
doc/html/Asymp_8h-source.html
Normal file
122
doc/html/Asymp_8h-source.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Asymp.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ASYMP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ASYMP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a>00033 <span class="keyword">const</span> StkFloat TARGET_THRESHOLD = 0.000001;
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Asymp.html">00035</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Asymp.html" title="STK asymptotic curve envelope class.">Asymp</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00036"></a>00036 {
|
||||
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Asymp.html#d8ea9fc5621a1d8b81001d459de265a0" title="Default constructor.">Asymp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1Asymp.html#d869abbd938c263a2c177de636f5a57c" title="Class destructor.">~Asymp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#51f0aad846eb6bda4c20eb63534786e2" title="Set target = 1.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#082e765dc3bd6b452e92b602af7a1042" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#ebd8ebaf6f6c9570d3ee78e1bcbbcbd2" title="Set the asymptotic rate via the time factor tau (must be &gt; 0).">setTau</a>( StkFloat tau );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#ca998e9c4ae86b4958da59fc9433268c" title="Set the asymptotic rate based on a time duration (must be &gt; 0).">setTime</a>( StkFloat time );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#7b0f7025ba5f268f1e5ce097b209f0ec" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#81881bb8aca615f69bbbfd56267f971c" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1Asymp.html#aba01ef0ac1a493a14a73c3b29259bde">00070</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Asymp.html#aba01ef0ac1a493a14a73c3b29259bde" title="Return the current envelope state (0 = at target, 1 otherwise).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Asymp.html#eb868c171e07206e2d5d30f8ce8f4436">00073</a> StkFloat <a class="code" href="classstk_1_1Asymp.html#eb868c171e07206e2d5d30f8ce8f4436" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keyword">protected</span>:
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 StkFloat value_;
|
||||
<a name="l00093"></a>00093 StkFloat target_;
|
||||
<a name="l00094"></a>00094 StkFloat factor_;
|
||||
<a name="l00095"></a>00095 StkFloat constant_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00097"></a>00097 };
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e">00099</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 value_ = factor_ * value_ + constant_;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Check threshold.</span>
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">if</span> ( target_ - value_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00108"></a>00108 value_ = target_;
|
||||
<a name="l00109"></a>00109 state_ = 0;
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">else</span> {
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">if</span> ( value_ - target_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00114"></a>00114 value_ = target_;
|
||||
<a name="l00115"></a>00115 state_ = 0;
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 lastFrame_[0] = value_;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1Asymp.html#2647bc013816f026915b1e92ddd6a322">00124</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00125"></a>00125 {
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00128"></a>00128 errorString_ << <span class="stringliteral">"Asymp::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#endif</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span>
|
||||
<a name="l00133"></a>00133 StkFloat *samples = &frames[channel];
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00136"></a>00136 *samples = <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp::tick</a>();
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,85 +6,93 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BandedWG.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BANDEDWG_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BANDEDWG_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BowTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a>00043 <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_BANDED_MODES = 20;
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1BandedWG.html">00045</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BandedWG.html" title="Banded waveguide modeling class.">BandedWG</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00046"></a>00046 {
|
||||
<a name="l00047"></a>00047 <span class="keyword">public</span>:
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BandedWG.html#d449f248adaa49344c2bd25be4a7872d" title="Class constructor.">BandedWG</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1BandedWG.html#c4044055c28bad672c9537b985d18289" title="Class destructor.">~BandedWG</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#182dbf5d75aebf5714bd6df15b0df90c" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#4394ee4cd1c84a8b3f92713e60715c4d" title="Set strike position (0.0 - 1.0).">setStrikePosition</a>( StkFloat position );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#b1e3a367eef86e6cb372b4ee232e1804" title="Select a preset.">setPreset</a>( <span class="keywordtype">int</span> preset );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#cf104d4ed663b5f0cd034c8025f4d420" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#37b20c2554e7100241a99758f5a4433e" title="Apply bow velocity/pressure to instrument with given amplitude and rate of increase...">startBowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a14786c32af030311e2118db3b68a892" title="Decrease bow velocity/breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#271573afaa2dc655446482bad6745cc1" title="Pluck the instrument with given amplitude.">pluck</a>( StkFloat amp );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#8f334ae49b7baf561d74a0b6ec3c4f9a" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#c9c3c3ec0e821b1a080774bb55d3b881" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#16baac1cc6612332d6d0aa40a661c137" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085 StkFloat <a class="code" href="classstk_1_1BandedWG.html#44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="keyword">protected</span>:
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">bool</span> doPluck_;
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">bool</span> trackVelocity_;
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">int</span> nModes_;
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">int</span> presetModes_;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bandpass_[MAX_BANDED_MODES];
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delay_[MAX_BANDED_MODES];
|
||||
<a name="l00097"></a>00097 StkFloat maxVelocity_;
|
||||
<a name="l00098"></a>00098 StkFloat modes_[MAX_BANDED_MODES];
|
||||
<a name="l00099"></a>00099 StkFloat frequency_;
|
||||
<a name="l00100"></a>00100 StkFloat baseGain_;
|
||||
<a name="l00101"></a>00101 StkFloat gains_[MAX_BANDED_MODES];
|
||||
<a name="l00102"></a>00102 StkFloat basegains_[MAX_BANDED_MODES];
|
||||
<a name="l00103"></a>00103 StkFloat excitation_[MAX_BANDED_MODES];
|
||||
<a name="l00104"></a>00104 StkFloat integrationConstant_;
|
||||
<a name="l00105"></a>00105 StkFloat velocityInput_;
|
||||
<a name="l00106"></a>00106 StkFloat bowVelocity_;
|
||||
<a name="l00107"></a>00107 StkFloat bowTarget_;
|
||||
<a name="l00108"></a>00108 StkFloat bowPosition_;
|
||||
<a name="l00109"></a>00109 StkFloat strikeAmp_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">int</span> strikePosition_;
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>BandedWG.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00030 <span class="comment">/***************************************************/</span>
|
||||
00031
|
||||
00032 <span class="preprocessor">#if !defined(__BANDEDWG_H)</span>
|
||||
00033 <span class="preprocessor"></span><span class="preprocessor">#define __BANDEDWG_H</span>
|
||||
00034 <span class="preprocessor"></span>
|
||||
00035 <span class="preprocessor">#define MAX_BANDED_MODES 20</span>
|
||||
00036 <span class="preprocessor"></span>
|
||||
00037 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00038 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
00039 <span class="preprocessor">#include "BowTabl.h"</span>
|
||||
00040 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
00041 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
00042
|
||||
<a name="l00043"></a><a class="code" href="classBandedWG.html">00043</a> <span class="keyword">class </span><a class="code" href="classBandedWG.html">BandedWG</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00044 {
|
||||
00045 <span class="keyword">public</span>:
|
||||
00047 <a class="code" href="classBandedWG.html#a0">BandedWG</a>();
|
||||
00048
|
||||
00050 <a class="code" href="classBandedWG.html#a1">~BandedWG</a>();
|
||||
00051
|
||||
00053 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a2">clear</a>();
|
||||
00054
|
||||
00056 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a3">setStrikePosition</a>(MY_FLOAT position);
|
||||
00057
|
||||
00059 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a4">setPreset</a>(<span class="keywordtype">int</span> preset);
|
||||
00060
|
||||
00062 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a5">setFrequency</a>(MY_FLOAT frequency);
|
||||
00063
|
||||
00065 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a6">startBowing</a>(MY_FLOAT amplitude, MY_FLOAT rate);
|
||||
00066
|
||||
00068 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a7">stopBowing</a>(MY_FLOAT rate);
|
||||
00069
|
||||
00071 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a8">pluck</a>(MY_FLOAT amp);
|
||||
00072
|
||||
00074 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a9">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00075
|
||||
00077 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a10">noteOff</a>(MY_FLOAT amplitude);
|
||||
00078
|
||||
00080 MY_FLOAT <a class="code" href="classBandedWG.html#a11">tick</a>();
|
||||
00081
|
||||
00083 <span class="keywordtype">void</span> <a class="code" href="classBandedWG.html#a12">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00084
|
||||
00085 <span class="keyword">protected</span>:
|
||||
00086
|
||||
00087 <span class="keywordtype">bool</span> doPluck;
|
||||
00088 <span class="keywordtype">bool</span> trackVelocity;
|
||||
00089 <span class="keywordtype">int</span> nModes;
|
||||
00090 <span class="keywordtype">int</span> presetModes;
|
||||
00091 <a class="code" href="classBowTabl.html">BowTabl</a> *bowTabl;
|
||||
00092 <a class="code" href="classADSR.html">ADSR</a> *adsr;
|
||||
00093 <a class="code" href="classBiQuad.html">BiQuad</a> *bandpass;
|
||||
00094 <a class="code" href="classDelayL.html">DelayL</a> *delay;
|
||||
00095 MY_FLOAT maxVelocity;
|
||||
00096 MY_FLOAT modes[MAX_BANDED_MODES];
|
||||
00097 MY_FLOAT freakency;
|
||||
00098 MY_FLOAT baseGain;
|
||||
00099 MY_FLOAT gains[MAX_BANDED_MODES];
|
||||
00100 MY_FLOAT basegains[MAX_BANDED_MODES];
|
||||
00101 MY_FLOAT excitation[MAX_BANDED_MODES];
|
||||
00102 MY_FLOAT integrationConstant;
|
||||
00103 MY_FLOAT velocityInput;
|
||||
00104 MY_FLOAT bowVelocity;
|
||||
00105 MY_FLOAT bowTarget;
|
||||
00106 MY_FLOAT bowPosition;
|
||||
00107 MY_FLOAT strikeAmp;
|
||||
00108 <span class="keywordtype">int</span> strikePosition;
|
||||
00109
|
||||
00110 };
|
||||
00111
|
||||
00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,35 +6,71 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BeeThree.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BEETHREE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BEETHREE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BeeThree.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BeeThree.html" title="STK Hammond-oid organ FM synthesis instrument.">BeeThree</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BeeThree.html#b4534210b85a2c4798bf1c88b348c20a" title="Class constructor.">BeeThree</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1BeeThree.html#f2a0c982731438cf6200b3e5642a288d" title="Class destructor.">~BeeThree</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BeeThree.html#480c0fe8d4c2df9c00b82b192dd7eae4" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1BeeThree.html#4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a>00060 <span class="keyword">protected</span>:
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1BeeThree.html#4649b9471bde3b978c20fcafcbef0fc7">00064</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BeeThree.html#4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">BeeThree :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00065"></a>00065 {
|
||||
<a name="l00066"></a>00066 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keywordflow">if</span> ( modDepth_ > 0.0 ) {
|
||||
<a name="l00069"></a>00069 temp = 1.0 + ( modDepth_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * 0.1 );
|
||||
<a name="l00070"></a>00070 waves_[0]->setFrequency( baseFrequency_ * temp * ratios_[0] );
|
||||
<a name="l00071"></a>00071 waves_[1]->setFrequency( baseFrequency_ * temp * ratios_[1] );
|
||||
<a name="l00072"></a>00072 waves_[2]->setFrequency( baseFrequency_ * temp * ratios_[2] );
|
||||
<a name="l00073"></a>00073 waves_[3]->setFrequency( baseFrequency_ * temp * ratios_[3] );
|
||||
<a name="l00074"></a>00074 }
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00077"></a>00077 temp = control1_ * 2.0 * gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00078"></a>00078 twozero_.<a class="code" href="classstk_1_1TwoZero.html#cf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 temp += control2_ * 2.0 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00081"></a>00081 temp += gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00082"></a>00082 temp += gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 lastFrame_[0] = temp * 0.125;
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00086"></a>00086 }
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>BeeThree.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00033 <span class="comment">/***************************************************/</span>
|
||||
00034
|
||||
00035 <span class="preprocessor">#if !defined(__BEETHREE_H)</span>
|
||||
00036 <span class="preprocessor"></span><span class="preprocessor">#define __BEETHREE_H</span>
|
||||
00037 <span class="preprocessor"></span>
|
||||
00038 <span class="preprocessor">#include "FM.h"</span>
|
||||
00039
|
||||
<a name="l00040"></a><a class="code" href="classBeeThree.html">00040</a> <span class="keyword">class </span><a class="code" href="classBeeThree.html">BeeThree</a> : <span class="keyword">public</span> <a class="code" href="classFM.html">FM</a>
|
||||
00041 {
|
||||
00042 <span class="keyword">public</span>:
|
||||
00044 <a class="code" href="classBeeThree.html#a0">BeeThree</a>();
|
||||
00045
|
||||
00047 <a class="code" href="classBeeThree.html#a1">~BeeThree</a>();
|
||||
00048
|
||||
00050 <span class="keywordtype">void</span> <a class="code" href="classBeeThree.html#a2">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00051
|
||||
00053 MY_FLOAT <a class="code" href="classBeeThree.html#a3">tick</a>();
|
||||
00054 };
|
||||
00055
|
||||
00056 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,64 +6,142 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BiQuad.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BIQUAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BIQUAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1BiQuad.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1BiQuad.html#91aab9d1b4833e156edcf59cbe276e3f" title="Default constructor creates a second-order pass-through filter.">BiQuad</a>();
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1BiQuad.html#d7e81be1c4e5c5ab69474f6df2610984" title="Class destructor.">~BiQuad</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BiQuad.html#ab468cd1aa79b95442b15bb04d8bb211">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#ab468cd1aa79b95442b15bb04d8bb211" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#eed58196cf798f664cddbb9a8564c7b5" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, StkFloat b2, StkFloat a1, StkFloat a2, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1BiQuad.html#26ee25d08116b20f326001166f087853">00037</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#26ee25d08116b20f326001166f087853" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1BiQuad.html#dd364ed410b3ed2a2b29b8a5fea127c8">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#dd364ed410b3ed2a2b29b8a5fea127c8" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1BiQuad.html#208a654dd3393ed0b2b86ad56d9cf3e1">00043</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#208a654dd3393ed0b2b86ad56d9cf3e1" title="Set the b[2] coefficient value.">setB2</a>( StkFloat b2 ) { b_[2] = b2; };
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a><a class="code" href="classstk_1_1BiQuad.html#1c9799e47163fe8a59fd85196c089cb3">00046</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#1c9799e47163fe8a59fd85196c089cb3" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1BiQuad.html#e28afd560df11435ea54f128d23b9383">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#e28afd560df11435ea54f128d23b9383" title="Set the a[2] coefficient value.">setA2</a>( StkFloat a2 ) { a_[2] = a2; };
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#55aaa01fd4156f1fac1168f526e3d969" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius, <span class="keywordtype">bool</span> normalize = <span class="keyword">false</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#e10a26fc319ba357bc92df4e528c2d8f" title="Set the filter coefficients for a notch at frequency (in Hz).">setNotch</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#28881f5876ce5bdcc846367cca9363f7" title="Sets the filter zeroes for equal resonance gain.">setEqualGainZeroes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1BiQuad.html#412f224363b1a222423ecf0cd7be9063">00084</a> StkFloat <a class="code" href="classstk_1_1BiQuad.html#412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 StkFloat <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keyword">protected</span>:
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00114"></a>00114 };
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a><a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635">00116</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( StkFloat input )
|
||||
<a name="l00117"></a>00117 {
|
||||
<a name="l00118"></a>00118 inputs_[0] = gain_ * input;
|
||||
<a name="l00119"></a>00119 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00120"></a>00120 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00121"></a>00121 inputs_[2] = inputs_[1];
|
||||
<a name="l00122"></a>00122 inputs_[1] = inputs_[0];
|
||||
<a name="l00123"></a>00123 outputs_[2] = outputs_[1];
|
||||
<a name="l00124"></a>00124 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a><a class="code" href="classstk_1_1BiQuad.html#f903e41217838470a5f267a20b905a12">00129</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00130"></a>00130 {
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00133"></a>00133 errorString_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00134"></a>00134 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 <span class="preprocessor">#endif</span>
|
||||
<a name="l00137"></a>00137 <span class="preprocessor"></span>
|
||||
<a name="l00138"></a>00138 StkFloat *samples = &frames[channel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00141"></a>00141 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00142"></a>00142 *samples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00143"></a>00143 *samples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00144"></a>00144 inputs_[2] = inputs_[1];
|
||||
<a name="l00145"></a>00145 inputs_[1] = inputs_[0];
|
||||
<a name="l00146"></a>00146 outputs_[2] = outputs_[1];
|
||||
<a name="l00147"></a>00147 outputs_[1] = *samples;
|
||||
<a name="l00148"></a>00148 }
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a><a class="code" href="classstk_1_1BiQuad.html#c9836f0e074ea9516727f27eb9b411aa">00154</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00155"></a>00155 {
|
||||
<a name="l00156"></a>00156 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00157"></a>00157 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00158"></a>00158 errorString_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161 <span class="preprocessor">#endif</span>
|
||||
<a name="l00162"></a>00162 <span class="preprocessor"></span>
|
||||
<a name="l00163"></a>00163 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00164"></a>00164 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00166"></a>00166 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00167"></a>00167 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00168"></a>00168 *oSamples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00169"></a>00169 *oSamples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00170"></a>00170 inputs_[2] = inputs_[1];
|
||||
<a name="l00171"></a>00171 inputs_[1] = inputs_[0];
|
||||
<a name="l00172"></a>00172 outputs_[2] = outputs_[1];
|
||||
<a name="l00173"></a>00173 outputs_[1] = *oSamples;
|
||||
<a name="l00174"></a>00174 }
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00177"></a>00177 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a>00180 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 <span class="preprocessor">#endif</span>
|
||||
<a name="l00183"></a>00183 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>BiQuad.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00013 <span class="comment">/***************************************************/</span>
|
||||
00014
|
||||
00015 <span class="preprocessor">#if !defined(__BIQUAD_H)</span>
|
||||
00016 <span class="preprocessor"></span><span class="preprocessor">#define __BIQUAD_H</span>
|
||||
00017 <span class="preprocessor"></span>
|
||||
00018 <span class="preprocessor">#include "Filter.h"</span>
|
||||
00019
|
||||
<a name="l00020"></a><a class="code" href="classBiQuad.html">00020</a> <span class="keyword">class </span><a class="code" href="classBiQuad.html">BiQuad</a> : <span class="keyword">protected</span> <a class="code" href="classFilter.html">Filter</a>
|
||||
00021 {
|
||||
00022 <span class="keyword">public</span>:
|
||||
00023
|
||||
00025 <a class="code" href="classBiQuad.html#a0">BiQuad</a>();
|
||||
00026
|
||||
00028 <span class="keyword">virtual</span> <a class="code" href="classBiQuad.html#a1">~BiQuad</a>();
|
||||
00029
|
||||
00031 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a2">clear</a>(<span class="keywordtype">void</span>);
|
||||
00032
|
||||
00034 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a3">setB0</a>(MY_FLOAT b0);
|
||||
00035
|
||||
00037 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a4">setB1</a>(MY_FLOAT b1);
|
||||
00038
|
||||
00040 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a5">setB2</a>(MY_FLOAT b2);
|
||||
00041
|
||||
00043 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a6">setA1</a>(MY_FLOAT a1);
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a7">setA2</a>(MY_FLOAT a2);
|
||||
00047
|
||||
00049
|
||||
00060 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a8">setResonance</a>(MY_FLOAT frequency, MY_FLOAT radius, <span class="keywordtype">bool</span> normalize = FALSE);
|
||||
00061
|
||||
00063
|
||||
00069 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a9">setNotch</a>(MY_FLOAT frequency, MY_FLOAT radius);
|
||||
00070
|
||||
00072
|
||||
00078 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a10">setEqualGainZeroes</a>();
|
||||
00079
|
||||
00081
|
||||
00085 <span class="keywordtype">void</span> <a class="code" href="classBiQuad.html#a11">setGain</a>(MY_FLOAT theGain);
|
||||
00086
|
||||
00088 MY_FLOAT <a class="code" href="classBiQuad.html#a12">getGain</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00089
|
||||
00091 MY_FLOAT <a class="code" href="classBiQuad.html#a13">lastOut</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00092
|
||||
00094 MY_FLOAT <a class="code" href="classBiQuad.html#a14">tick</a>(MY_FLOAT sample);
|
||||
00095
|
||||
00097 MY_FLOAT *<a class="code" href="classBiQuad.html#a14">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00098 };
|
||||
00099
|
||||
00100 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
129
doc/html/BlitSaw_8h-source.html
Normal file
129
doc/html/BlitSaw_8h-source.html
Normal file
@@ -0,0 +1,129 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlitSaw.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLITSAW_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLITSAW_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BlitSaw.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlitSaw.html" title="STK band-limited sawtooth wave class.">BlitSaw</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1BlitSaw.html#8a245ef05cc58c521edaded5c6cdd5ee" title="Class constructor.">BlitSaw</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1BlitSaw.html#24cd2cc9852ce73252a99f7eff63879b" title="Class destructor.">~BlitSaw</a>();
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#3010cf9a0905368b857df2d332968036" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#fa6f1103a61221eebf5f49f3a7df4145" title="Set the sawtooth oscillator rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#8abd2b9a5b8d26926a383c1e56605545" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1BlitSaw.html#254758ecd4166cc4e7d6fced5650a198">00062</a> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#254758ecd4166cc4e7d6fced5650a198" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 StkFloat <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 <span class="keyword">protected</span>:
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00083"></a>00083 StkFloat rate_;
|
||||
<a name="l00084"></a>00084 StkFloat phase_;
|
||||
<a name="l00085"></a>00085 StkFloat p_;
|
||||
<a name="l00086"></a>00086 StkFloat C2_;
|
||||
<a name="l00087"></a>00087 StkFloat a_;
|
||||
<a name="l00088"></a>00088 StkFloat state_;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 <span class="comment">// The code below implements the BLIT algorithm of Stilson and</span>
|
||||
<a name="l00095"></a>00095 <span class="comment">// Smith, followed by a summation and filtering operation to produce</span>
|
||||
<a name="l00096"></a>00096 <span class="comment">// a sawtooth waveform. After experimenting with various approaches</span>
|
||||
<a name="l00097"></a>00097 <span class="comment">// to calculate the average value of the BLIT over one period, I</span>
|
||||
<a name="l00098"></a>00098 <span class="comment">// found that an estimate of C2_ = 1.0 / period (in samples) worked</span>
|
||||
<a name="l00099"></a>00099 <span class="comment">// most consistently. A "leaky integrator" is then applied to the</span>
|
||||
<a name="l00100"></a>00100 <span class="comment">// difference of the BLIT output and C2_. (GPS - 1 October 2005)</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// A fully optimized version of this code would replace the two sin </span>
|
||||
<a name="l00103"></a>00103 <span class="comment">// calls with a pair of fast sin oscillators, for which stable fast </span>
|
||||
<a name="l00104"></a>00104 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00105"></a>00105 <span class="comment">// which favors clarity over performance, the optimization has </span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// not been made here.</span>
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Avoid a divide by zero, or use of a denormalized divisor </span>
|
||||
<a name="l00109"></a>00109 <span class="comment">// at the sinc peak, which has a limiting value of m_ / p_.</span>
|
||||
<a name="l00110"></a>00110 StkFloat tmp, denominator = sin( phase_ );
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ( fabs(denominator) <= std::numeric_limits<StkFloat>::epsilon() )
|
||||
<a name="l00112"></a>00112 tmp = a_;
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">else</span> {
|
||||
<a name="l00114"></a>00114 tmp = sin( m_ * phase_ );
|
||||
<a name="l00115"></a>00115 tmp /= p_ * denominator;
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 tmp += state_ - C2_;
|
||||
<a name="l00119"></a>00119 state_ = tmp * 0.995;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 phase_ += rate_;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( phase_ >= PI ) phase_ -= PI;
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 lastFrame_[0] = tmp;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a><a class="code" href="classstk_1_1BlitSaw.html#b53f6ba99ef5c4f8982f6c0f07bf2e1d">00128</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00129"></a>00129 {
|
||||
<a name="l00130"></a>00130 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00131"></a>00131 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00132"></a>00132 errorString_ << <span class="stringliteral">"BlitSaw::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00133"></a>00133 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135 <span class="preprocessor">#endif</span>
|
||||
<a name="l00136"></a>00136 <span class="preprocessor"></span>
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 StkFloat *samples = &frames[channel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00141"></a>00141 *samples = <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw::tick</a>();
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/BlitSquare_8h-source.html
Normal file
134
doc/html/BlitSquare_8h-source.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlitSquare.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLITSQUARE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLITSQUARE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BlitSquare.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlitSquare.html" title="STK band-limited square wave class.">BlitSquare</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1BlitSquare.html#2cb3aee415a6ee75fa85b01e4e85d70b" title="Default constructor that initializes BLIT frequency to 220 Hz.">BlitSquare</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BlitSquare.html#4bc6e424ca1631f353f55846084634ef" title="Class destructor.">~BlitSquare</a>();
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#8f6dbe07d7f64b24cc9a41f6208dd6c4" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1BlitSquare.html#eface58980a3ec865131f3cad59bbbef">00058</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#eface58980a3ec865131f3cad59bbbef" title="Set the phase of the signal.">setPhase</a>( StkFloat phase ) { phase_ = PI * phase; };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1BlitSquare.html#bbda8cb84bcd36fc6d96130e9832a6af">00064</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#bbda8cb84bcd36fc6d96130e9832a6af" title="Get the current phase of the signal.">getPhase</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phase_ / PI; };
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#8d0d8e0a12987ebccc56c09c7e7dbd6a" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#94521b4224d0873f5e783c721c123b21" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a><a class="code" href="classstk_1_1BlitSquare.html#77972e4e1c53600bf80cf692601ccae1">00085</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#77972e4e1c53600bf80cf692601ccae1" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00088"></a>00088 StkFloat <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00106"></a>00106 StkFloat rate_;
|
||||
<a name="l00107"></a>00107 StkFloat phase_;
|
||||
<a name="l00108"></a>00108 StkFloat p_;
|
||||
<a name="l00109"></a>00109 StkFloat a_;
|
||||
<a name="l00110"></a>00110 StkFloat lastBlitOutput_;
|
||||
<a name="l00111"></a>00111 StkFloat dcbState_;
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 StkFloat temp = lastBlitOutput_;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// A fully optimized version of this would replace the two sin calls</span>
|
||||
<a name="l00119"></a>00119 <span class="comment">// with a pair of fast sin oscillators, for which stable fast </span>
|
||||
<a name="l00120"></a>00120 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00121"></a>00121 <span class="comment">// which favors clarity over performance, the optimization has </span>
|
||||
<a name="l00122"></a>00122 <span class="comment">// not been made here.</span>
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="comment">// Avoid a divide by zero, or use of a denomralized divisor</span>
|
||||
<a name="l00125"></a>00125 <span class="comment">// at the sinc peak, which has a limiting value of 1.0.</span>
|
||||
<a name="l00126"></a>00126 StkFloat denominator = sin( phase_ );
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( fabs( denominator ) < std::numeric_limits<StkFloat>::epsilon() ) {
|
||||
<a name="l00128"></a>00128 <span class="comment">// Inexact comparison safely distinguishes betwen *close to zero*, and *close to PI*.</span>
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">if</span> ( phase_ < 0.1f || phase_ > TWO_PI - 0.1f )
|
||||
<a name="l00130"></a>00130 lastBlitOutput_ = a_;
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">else</span>
|
||||
<a name="l00132"></a>00132 lastBlitOutput_ = -a_;
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">else</span> {
|
||||
<a name="l00135"></a>00135 lastBlitOutput_ = sin( m_ * phase_ );
|
||||
<a name="l00136"></a>00136 lastBlitOutput_ /= p_ * denominator;
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 lastBlitOutput_ += temp;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Now apply DC blocker.</span>
|
||||
<a name="l00142"></a>00142 lastFrame_[0] = lastBlitOutput_ - dcbState_ + 0.999 * lastFrame_[0];
|
||||
<a name="l00143"></a>00143 dcbState_ = lastBlitOutput_;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 phase_ += rate_;
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">if</span> ( phase_ >= TWO_PI ) phase_ -= TWO_PI;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a><a class="code" href="classstk_1_1BlitSquare.html#7df894d40b3d6effbb2a09819356258d">00151</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00152"></a>00152 {
|
||||
<a name="l00153"></a>00153 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00155"></a>00155 errorString_ << <span class="stringliteral">"BlitSquare::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span>
|
||||
<a name="l00160"></a>00160 StkFloat *samples = &frames[channel];
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00163"></a>00163 *samples = <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare::tick</a>();
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
124
doc/html/Blit_8h-source.html
Normal file
124
doc/html/Blit_8h-source.html
Normal file
@@ -0,0 +1,124 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Blit.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLIT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLIT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1Blit.html">00033</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Blit.html" title="STK band-limited impulse train class.">Blit</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00034"></a>00034 {
|
||||
<a name="l00035"></a>00035 <span class="keyword">public</span>:
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Blit.html#63c5e6dca28aa3b3c01808e049f3da33" title="Default constructor that initializes BLIT frequency to 220 Hz.">Blit</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Blit.html#bed25206cc6cdb5fa8d667e7db0056a9" title="Class destructor.">~Blit</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#bbe50319cd6ed762c15e148a8abb4920" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Blit.html#58e2197cedfc366145b729256bf365cb">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#58e2197cedfc366145b729256bf365cb" title="Set the phase of the signal.">setPhase</a>( StkFloat phase ) { phase_ = PI * phase; };
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Blit.html#01fb40970e8905e47b7f39a1fb01589f">00055</a> StkFloat <a class="code" href="classstk_1_1Blit.html#01fb40970e8905e47b7f39a1fb01589f" title="Get the current phase of the signal.">getPhase</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phase_ / PI; };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#5571562e489947c4beccc206ecccfbdd" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#5a1fd506ab12ae614afaf0e402d24d30" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Blit.html#530af82a27731734af4f4b58bce283de">00076</a> StkFloat <a class="code" href="classstk_1_1Blit.html#530af82a27731734af4f4b58bce283de" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00097"></a>00097 StkFloat rate_;
|
||||
<a name="l00098"></a>00098 StkFloat phase_;
|
||||
<a name="l00099"></a>00099 StkFloat p_;
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 };
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a><a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717">00103</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00104"></a>00104 {
|
||||
<a name="l00105"></a>00105 <span class="comment">// The code below implements the SincM algorithm of Stilson and</span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// Smith with an additional scale factor of P / M applied to</span>
|
||||
<a name="l00107"></a>00107 <span class="comment">// normalize the output.</span>
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="comment">// A fully optimized version of this code would replace the two sin</span>
|
||||
<a name="l00110"></a>00110 <span class="comment">// calls with a pair of fast sin oscillators, for which stable fast</span>
|
||||
<a name="l00111"></a>00111 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00112"></a>00112 <span class="comment">// which favors clarity over performance, the optimization has not</span>
|
||||
<a name="l00113"></a>00113 <span class="comment">// been made here.</span>
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="comment">// Avoid a divide by zero at the sinc peak, which has a limiting</span>
|
||||
<a name="l00116"></a>00116 <span class="comment">// value of 1.0.</span>
|
||||
<a name="l00117"></a>00117 StkFloat tmp, denominator = sin( phase_ );
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( denominator <= std::numeric_limits<StkFloat>::epsilon() )
|
||||
<a name="l00119"></a>00119 tmp = 1.0;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">else</span> {
|
||||
<a name="l00121"></a>00121 tmp = sin( m_ * phase_ );
|
||||
<a name="l00122"></a>00122 tmp /= m_ * denominator;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 phase_ += rate_;
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">if</span> ( phase_ >= PI ) phase_ -= PI;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = tmp;
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a><a class="code" href="classstk_1_1Blit.html#20a3634131ff890641931c1d04df19ad">00132</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00133"></a>00133 {
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00136"></a>00136 errorString_ << <span class="stringliteral">"Blit::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00137"></a>00137 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
|
||||
<a name="l00140"></a>00140 <span class="preprocessor"></span>
|
||||
<a name="l00141"></a>00141 StkFloat *samples = &frames[channel];
|
||||
<a name="l00142"></a>00142 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00144"></a>00144 *samples = <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit::tick</a>();
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,66 +6,98 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlowBotl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLOWBOTL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLOWBOTL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "JetTable.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1BlowBotl.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlowBotl.html" title="STK blown bottle instrument class.">BlowBotl</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1BlowBotl.html#a505b4fc32ffe974b5840163395c321c" title="Class constructor.">BlowBotl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1BlowBotl.html#dae826b0487471da1779761b0f885cb8" title="Class destructor.">~BlowBotl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#271161f45e0a706d8ccd299f9aaf2ada" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#75b679cd641bb4bae9bc4ac3021a03e3" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#926d428669edf9c87a1f88faf01550c4" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#91a174c3501aafbbfe6841f6915fe4f3" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#faf3f964cbdf99eddd7af99626169c02" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#132c87a453ecf25301243dc62f57f587" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#21a4b2aaaac7afcc67b4abe5ed833bfd" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1BlowBotl.html#68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keyword">protected</span>:
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00071"></a>00071 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> resonator_;
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00074"></a>00074 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00076"></a>00076 StkFloat maxPressure_;
|
||||
<a name="l00077"></a>00077 StkFloat noiseGain_;
|
||||
<a name="l00078"></a>00078 StkFloat vibratoGain_;
|
||||
<a name="l00079"></a>00079 StkFloat outputGain_;
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 };
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1BlowBotl.html#68501c2422994c8dca50086b3d944119">00083</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowBotl.html#68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">BlowBotl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00084"></a>00084 {
|
||||
<a name="l00085"></a>00085 StkFloat breathPressure;
|
||||
<a name="l00086"></a>00086 StkFloat randPressure;
|
||||
<a name="l00087"></a>00087 StkFloat pressureDiff;
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="comment">// Calculate the breath pressure (envelope + vibrato)</span>
|
||||
<a name="l00090"></a>00090 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00091"></a>00091 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 pressureDiff = breathPressure - resonator_.<a class="code" href="classstk_1_1BiQuad.html#412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 randPressure = noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00096"></a>00096 randPressure *= breathPressure;
|
||||
<a name="l00097"></a>00097 randPressure *= (1.0 + pressureDiff);
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 resonator_.<a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( breathPressure + randPressure - ( jetTable_.<a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) * pressureDiff ) );
|
||||
<a name="l00100"></a>00100 lastFrame_[0] = 0.2 * outputGain_ * dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>BlowBotl.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00017 <span class="comment">/***************************************************/</span>
|
||||
00018
|
||||
00019 <span class="preprocessor">#if !defined(__BOTTLE_H)</span>
|
||||
00020 <span class="preprocessor"></span><span class="preprocessor">#define __BOTTLE_H</span>
|
||||
00021 <span class="preprocessor"></span>
|
||||
00022 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00023 <span class="preprocessor">#include "JetTabl.h"</span>
|
||||
00024 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
00025 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
00026 <span class="preprocessor">#include "Noise.h"</span>
|
||||
00027 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
00028 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00029
|
||||
<a name="l00030"></a><a class="code" href="classBlowBotl.html">00030</a> <span class="keyword">class </span><a class="code" href="classBlowBotl.html">BlowBotl</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00031 {
|
||||
00032 <span class="keyword">public</span>:
|
||||
00034 <a class="code" href="classBlowBotl.html#a0">BlowBotl</a>();
|
||||
00035
|
||||
00037 <a class="code" href="classBlowBotl.html#a1">~BlowBotl</a>();
|
||||
00038
|
||||
00040 <span class="keywordtype">void</span> <a class="code" href="classBlowBotl.html#a2">clear</a>();
|
||||
00041
|
||||
00043 <span class="keywordtype">void</span> <a class="code" href="classBlowBotl.html#a3">setFrequency</a>(MY_FLOAT frequency);
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classBlowBotl.html#a4">startBlowing</a>(MY_FLOAT amplitude, MY_FLOAT rate);
|
||||
00047
|
||||
00049 <span class="keywordtype">void</span> <a class="code" href="classBlowBotl.html#a5">stopBlowing</a>(MY_FLOAT rate);
|
||||
00050
|
||||
00052 <span class="keywordtype">void</span> <a class="code" href="classBlowBotl.html#a6">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00053
|
||||
00055 <span class="keywordtype">void</span> <a class="code" href="classBlowBotl.html#a7">noteOff</a>(MY_FLOAT amplitude);
|
||||
00056
|
||||
00058 MY_FLOAT <a class="code" href="classBlowBotl.html#a8">tick</a>();
|
||||
00059
|
||||
00061 <span class="keywordtype">void</span> <a class="code" href="classBlowBotl.html#a9">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00062
|
||||
00063 <span class="keyword">protected</span>:
|
||||
00064 <a class="code" href="classJetTabl.html">JetTabl</a> *jetTable;
|
||||
00065 <a class="code" href="classBiQuad.html">BiQuad</a> *resonator;
|
||||
00066 <a class="code" href="classPoleZero.html">PoleZero</a> *dcBlock;
|
||||
00067 <a class="code" href="classNoise.html">Noise</a> *noise;
|
||||
00068 <a class="code" href="classADSR.html">ADSR</a> *adsr;
|
||||
00069 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00070 MY_FLOAT maxPressure;
|
||||
00071 MY_FLOAT noiseGain;
|
||||
00072 MY_FLOAT vibratoGain;
|
||||
00073 MY_FLOAT outputGain;
|
||||
00074
|
||||
00075 };
|
||||
00076
|
||||
00077 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,78 +6,121 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlowHole.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLOWHOLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLOWHOLE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00048"></a>00048 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a><a class="code" href="classstk_1_1BlowHole.html">00050</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlowHole.html" title="STK clarinet physical model with one register hole and one tonehole.">BlowHole</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00051"></a>00051 {
|
||||
<a name="l00052"></a>00052 <span class="keyword">public</span>:
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1BlowHole.html#7f0aed9f79544d930c7f91dfa3e0efd9" title="Class constructor.">BlowHole</a>( StkFloat lowestFrequency );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1BlowHole.html#691a14023e9283d12b0105dd886fba86" title="Class destructor.">~BlowHole</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#43b829201197f2d0f0e8a72072e6798a" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#023aa77cd11c9dc3a8013242ff92f982" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#aacb152624133d82e311b9e0b8218289" title="Set the tonehole state (0.0 = closed, 1.0 = fully open).">setTonehole</a>( StkFloat newValue );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#11c8a4a8483acf0f3e73c1d00008daff" title="Set the register hole state (0.0 = closed, 1.0 = fully open).">setVent</a>( StkFloat newValue );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#1be64a601f2fbc8e9efaec5a53c55866" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#eb4dfd7d75b1996e15833c0928ed39c4" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#67e071cb26c1bba35e32f168d59b9be1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#bc3743ac2c8a9620c44cca41ce73e5b0" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#0d8ad0201c455894acb1416ffb21614b" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1BlowHole.html#3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="keyword">protected</span>:
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delays_[3];
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> tonehole_;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> vent_;
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00103"></a>00103 StkFloat scatter_;
|
||||
<a name="l00104"></a>00104 StkFloat thCoeff_;
|
||||
<a name="l00105"></a>00105 StkFloat rhGain_;
|
||||
<a name="l00106"></a>00106 StkFloat outputGain_;
|
||||
<a name="l00107"></a>00107 StkFloat noiseGain_;
|
||||
<a name="l00108"></a>00108 StkFloat vibratoGain_;
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 };
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a><a class="code" href="classstk_1_1BlowHole.html#3438c72b975481dae7d51f33f6f6fd94">00112</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowHole.html#3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">BlowHole :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00113"></a>00113 {
|
||||
<a name="l00114"></a>00114 StkFloat pressureDiff;
|
||||
<a name="l00115"></a>00115 StkFloat breathPressure;
|
||||
<a name="l00116"></a>00116 StkFloat temp;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00119"></a>00119 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00120"></a>00120 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00121"></a>00121 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="comment">// Calculate the differential pressure = reflected - mouthpiece pressures</span>
|
||||
<a name="l00124"></a>00124 pressureDiff = delays_[0].<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() - breathPressure;
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">// Do two-port junction scattering for register vent</span>
|
||||
<a name="l00127"></a>00127 StkFloat pa = breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff );
|
||||
<a name="l00128"></a>00128 StkFloat pb = delays_[1].<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00129"></a>00129 vent_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa+pb );
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = delays_[0].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( vent_.<a class="code" href="classstk_1_1PoleZero.html#03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>()+pb );
|
||||
<a name="l00132"></a>00132 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="comment">// Do three-port junction scattering (under tonehole)</span>
|
||||
<a name="l00135"></a>00135 pa += vent_.<a class="code" href="classstk_1_1PoleZero.html#03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00136"></a>00136 pb = delays_[2].<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00137"></a>00137 StkFloat pth = tonehole_.<a class="code" href="classstk_1_1PoleZero.html#03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00138"></a>00138 temp = scatter_ * (pa + pb - 2 * pth);
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 delays_[2].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>(pa + temp) * -0.95 );
|
||||
<a name="l00141"></a>00141 delays_[1].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pb + temp );
|
||||
<a name="l00142"></a>00142 tonehole_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa + pb - pth + temp );
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>BlowHole.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00034 <span class="comment">/***************************************************/</span>
|
||||
00035
|
||||
00036 <span class="preprocessor">#if !defined(__BLOWHOLE_H)</span>
|
||||
00037 <span class="preprocessor"></span><span class="preprocessor">#define __BLOWHOLE_H</span>
|
||||
00038 <span class="preprocessor"></span>
|
||||
00039 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00040 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
00041 <span class="preprocessor">#include "ReedTabl.h"</span>
|
||||
00042 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
00043 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
00044 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
00045 <span class="preprocessor">#include "Noise.h"</span>
|
||||
00046 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00047
|
||||
<a name="l00048"></a><a class="code" href="classBlowHole.html">00048</a> <span class="keyword">class </span><a class="code" href="classBlowHole.html">BlowHole</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00049 {
|
||||
00050 <span class="keyword">public</span>:
|
||||
00052 <a class="code" href="classBlowHole.html#a0">BlowHole</a>(MY_FLOAT lowestFrequency);
|
||||
00053
|
||||
00055 <a class="code" href="classBlowHole.html#a1">~BlowHole</a>();
|
||||
00056
|
||||
00058 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a2">clear</a>();
|
||||
00059
|
||||
00061 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a3">setFrequency</a>(MY_FLOAT frequency);
|
||||
00062
|
||||
00064 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a4">setTonehole</a>(MY_FLOAT newValue);
|
||||
00065
|
||||
00067 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a5">setVent</a>(MY_FLOAT newValue);
|
||||
00068
|
||||
00070 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a6">startBlowing</a>(MY_FLOAT amplitude, MY_FLOAT rate);
|
||||
00071
|
||||
00073 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a7">stopBlowing</a>(MY_FLOAT rate);
|
||||
00074
|
||||
00076 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a8">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00077
|
||||
00079 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a9">noteOff</a>(MY_FLOAT amplitude);
|
||||
00080
|
||||
00082 MY_FLOAT <a class="code" href="classBlowHole.html#a10">tick</a>();
|
||||
00083
|
||||
00085 <span class="keywordtype">void</span> <a class="code" href="classBlowHole.html#a11">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00086
|
||||
00087 <span class="keyword">protected</span>:
|
||||
00088 <a class="code" href="classDelayL.html">DelayL</a> *delays[3];
|
||||
00089 <a class="code" href="classReedTabl.html">ReedTabl</a> *reedTable;
|
||||
00090 <a class="code" href="classOneZero.html">OneZero</a> *filter;
|
||||
00091 <a class="code" href="classPoleZero.html">PoleZero</a> *tonehole;
|
||||
00092 <a class="code" href="classPoleZero.html">PoleZero</a> *vent;
|
||||
00093 <a class="code" href="classEnvelope.html">Envelope</a> *envelope;
|
||||
00094 <a class="code" href="classNoise.html">Noise</a> *noise;
|
||||
00095 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00096 <span class="keywordtype">long</span> length;
|
||||
00097 MY_FLOAT scatter;
|
||||
00098 MY_FLOAT th_coeff;
|
||||
00099 MY_FLOAT r_th;
|
||||
00100 MY_FLOAT rh_coeff;
|
||||
00101 MY_FLOAT rh_gain;
|
||||
00102 MY_FLOAT outputGain;
|
||||
00103 MY_FLOAT noiseGain;
|
||||
00104 MY_FLOAT vibratoGain;
|
||||
00105
|
||||
00106 };
|
||||
00107
|
||||
00108 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>BowTabl.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00010 <span class="comment">/***************************************************/</span>
|
||||
00011
|
||||
00012 <span class="preprocessor">#if !defined(__BOWTABL_H)</span>
|
||||
00013 <span class="preprocessor"></span><span class="preprocessor">#define __BOWTABL_H</span>
|
||||
00014 <span class="preprocessor"></span>
|
||||
00015 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00016
|
||||
<a name="l00017"></a><a class="code" href="classBowTabl.html">00017</a> <span class="keyword">class </span><a class="code" href="classBowTabl.html">BowTabl</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00018 {
|
||||
00019 <span class="keyword">public</span>:
|
||||
00021 <a class="code" href="classBowTabl.html#a0">BowTabl</a>();
|
||||
00022
|
||||
00024 <a class="code" href="classBowTabl.html#a1">~BowTabl</a>();
|
||||
00025
|
||||
00027
|
||||
00033 <span class="keywordtype">void</span> <a class="code" href="classBowTabl.html#a2">setOffset</a>(MY_FLOAT aValue);
|
||||
00034
|
||||
00036
|
||||
00040 <span class="keywordtype">void</span> <a class="code" href="classBowTabl.html#a3">setSlope</a>(MY_FLOAT aValue);
|
||||
00041
|
||||
00043 MY_FLOAT <a class="code" href="classBowTabl.html#a4">lastOut</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00044
|
||||
00046
|
||||
00050 MY_FLOAT <a class="code" href="classBowTabl.html#a5">tick</a>(<span class="keyword">const</span> MY_FLOAT input);
|
||||
00051
|
||||
00053 MY_FLOAT *<a class="code" href="classBowTabl.html#a5">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00054
|
||||
00055 <span class="keyword">protected</span>:
|
||||
00056 MY_FLOAT offSet;
|
||||
00057 MY_FLOAT slope;
|
||||
00058 MY_FLOAT lastOutput;
|
||||
00059
|
||||
00060 };
|
||||
00061
|
||||
00062 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
128
doc/html/BowTable_8h-source.html
Normal file
128
doc/html/BowTable_8h-source.html
Normal file
@@ -0,0 +1,128 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BowTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BOWTABL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BOWTABL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1BowTable.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1BowTable.html#25d0985fd6821a7e1608af1e8f51952a">00024</a> <a class="code" href="classstk_1_1BowTable.html#25d0985fd6821a7e1608af1e8f51952a" title="Default constructor.">BowTable</a>( <span class="keywordtype">void</span> ) : offset_(0.0), slope_(0.1) {};
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1BowTable.html#9adcc3c36085b73d3b877828071a3b2c">00033</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#9adcc3c36085b73d3b877828071a3b2c" title="Set the table offset value.">setOffset</a>( StkFloat offset ) { offset_ = offset; };
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1BowTable.html#d8391e46941ff9f49b78bf4f77c35143">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#d8391e46941ff9f49b78bf4f77c35143" title="Set the table slope value.">setSlope</a>( StkFloat slope ) { slope_ = slope; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 StkFloat <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00054"></a>00054 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00065"></a>00065 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="keyword">protected</span>:
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 StkFloat offset_;
|
||||
<a name="l00070"></a>00070 StkFloat slope_;
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19">00074</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( StkFloat input )
|
||||
<a name="l00075"></a>00075 {
|
||||
<a name="l00076"></a>00076 <span class="comment">// The input represents differential string vs. bow velocity.</span>
|
||||
<a name="l00077"></a>00077 StkFloat sample = input + offset_; <span class="comment">// add bias to input</span>
|
||||
<a name="l00078"></a>00078 sample *= slope_; <span class="comment">// then scale it</span>
|
||||
<a name="l00079"></a>00079 lastFrame_[0] = (StkFloat) fabs( (<span class="keywordtype">double</span>) sample ) + (StkFloat) 0.75;
|
||||
<a name="l00080"></a>00080 lastFrame_[0] = (StkFloat) pow( lastFrame_[0], (StkFloat) -4.0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="comment">// Set minimum friction to 0.0</span>
|
||||
<a name="l00083"></a>00083 <span class="comment">// if ( lastFrame_[0] < 0.0 ) lastFrame_[0] = 0.0;</span>
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00085"></a>00085 <span class="comment">// Set maximum friction to 1.0.</span>
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">if</span> ( lastFrame_[0] > 1.0 ) lastFrame_[0] = (StkFloat) 1.0;
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00089"></a>00089 }
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a><a class="code" href="classstk_1_1BowTable.html#8ad2766def014b62dcbbd8765e133246">00091</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00092"></a>00092 {
|
||||
<a name="l00093"></a>00093 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00094"></a>00094 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00095"></a>00095 errorString_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
<a name="l00099"></a>00099 <span class="preprocessor"></span>
|
||||
<a name="l00100"></a>00100 StkFloat *samples = &frames[channel];
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00103"></a>00103 *samples = *samples + offset_;
|
||||
<a name="l00104"></a>00104 *samples *= slope_;
|
||||
<a name="l00105"></a>00105 *samples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *samples ) + 0.75;
|
||||
<a name="l00106"></a>00106 *samples = (StkFloat) pow( *samples, (StkFloat) -4.0 );
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1BowTable.html#af72f823f210b18f417337ac7181cde5">00114</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00117"></a>00117 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00118"></a>00118 errorString_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00119"></a>00119 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121 <span class="preprocessor">#endif</span>
|
||||
<a name="l00122"></a>00122 <span class="preprocessor"></span>
|
||||
<a name="l00123"></a>00123 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00124"></a>00124 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00127"></a>00127 *oSamples = *iSamples + offset_;
|
||||
<a name="l00128"></a>00128 *oSamples *= slope_;
|
||||
<a name="l00129"></a>00129 *oSamples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *oSamples ) + 0.75;
|
||||
<a name="l00130"></a>00130 *oSamples = (StkFloat) pow( *oSamples, (StkFloat) -4.0 );
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,69 +6,99 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Bowed.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BOWED_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BOWED_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BowTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1Bowed.html">00037</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Bowed.html" title="STK bowed string instrument class.">Bowed</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00038"></a>00038 {
|
||||
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Bowed.html#b776c34c271de25c0cd036946d764158" title="Class constructor, taking the lowest desired playing frequency.">Bowed</a>( StkFloat lowestFrequency );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Bowed.html#8067e4808bf7576922be4698f853c96c" title="Class destructor.">~Bowed</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#8d522c36a35b86f90a06cf135fc83b11" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#02dbcfbd0766fee8a2e75a8df809e62c" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#7cf229e206a61259d381cf153a1c5096" title="Set vibrato gain.">setVibrato</a>( StkFloat gain );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#519d511ddcc1cf23e897aeacdfe45020" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#ae2a57d8e23536fd37a00af1fe07f21c" title="Decrease breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#4ebaf6bd27d90975e7b0aea0ee727dc1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#b86db568328b51e4adfae8b62987fc85" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#d066af9bb1340b6fcf9002d6922021f4" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 StkFloat <a class="code" href="classstk_1_1Bowed.html#4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <span class="keyword">protected</span>:
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> neckDelay_;
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> bridgeDelay_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> stringFilter_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bodyFilter_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00082"></a>00082 StkFloat maxVelocity_;
|
||||
<a name="l00083"></a>00083 StkFloat baseDelay_;
|
||||
<a name="l00084"></a>00084 StkFloat vibratoGain_;
|
||||
<a name="l00085"></a>00085 StkFloat betaRatio_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Bowed.html#4d583369f0b22335fff8cee3ce6f2750">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Bowed.html#4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">Bowed :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat bowVelocity = maxVelocity_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092 StkFloat bridgeRefl = -stringFilter_.<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00093"></a>00093 StkFloat nutRefl = -neckDelay_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00094"></a>00094 StkFloat stringVel = bridgeRefl + nutRefl; <span class="comment">// Sum is string velocity</span>
|
||||
<a name="l00095"></a>00095 StkFloat velDiff = bowVelocity - stringVel; <span class="comment">// Differential velocity</span>
|
||||
<a name="l00096"></a>00096 StkFloat newVel = velDiff * bowTable_.<a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( velDiff ); <span class="comment">// Non-Linear bow function</span>
|
||||
<a name="l00097"></a>00097 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(bridgeRefl + newVel); <span class="comment">// Do string propagations</span>
|
||||
<a name="l00098"></a>00098 bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(nutRefl + newVel);
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">if</span> ( vibratoGain_ > 0.0 ) {
|
||||
<a name="l00101"></a>00101 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( (baseDelay_ * (1.0 - betaRatio_) ) +
|
||||
<a name="l00102"></a>00102 (baseDelay_ * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>()) );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 lastFrame_[0] = bodyFilter_.<a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Bowed.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00022 <span class="comment">/***************************************************/</span>
|
||||
00023
|
||||
00024 <span class="preprocessor">#if !defined(__BOWED_H)</span>
|
||||
00025 <span class="preprocessor"></span><span class="preprocessor">#define __BOWED_H</span>
|
||||
00026 <span class="preprocessor"></span>
|
||||
00027 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00028 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
00029 <span class="preprocessor">#include "BowTabl.h"</span>
|
||||
00030 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
00031 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
00032 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00033 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
00034
|
||||
<a name="l00035"></a><a class="code" href="classBowed.html">00035</a> <span class="keyword">class </span><a class="code" href="classBowed.html">Bowed</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00036 {
|
||||
00037 <span class="keyword">public</span>:
|
||||
00039 <a class="code" href="classBowed.html#a0">Bowed</a>(MY_FLOAT lowestFrequency);
|
||||
00040
|
||||
00042 <a class="code" href="classBowed.html#a1">~Bowed</a>();
|
||||
00043
|
||||
00045 <span class="keywordtype">void</span> <a class="code" href="classBowed.html#a2">clear</a>();
|
||||
00046
|
||||
00048 <span class="keywordtype">void</span> <a class="code" href="classBowed.html#a3">setFrequency</a>(MY_FLOAT frequency);
|
||||
00049
|
||||
00051 <span class="keywordtype">void</span> <a class="code" href="classBowed.html#a4">setVibrato</a>(MY_FLOAT gain);
|
||||
00052
|
||||
00054 <span class="keywordtype">void</span> <a class="code" href="classBowed.html#a5">startBowing</a>(MY_FLOAT amplitude, MY_FLOAT rate);
|
||||
00055
|
||||
00057 <span class="keywordtype">void</span> <a class="code" href="classBowed.html#a6">stopBowing</a>(MY_FLOAT rate);
|
||||
00058
|
||||
00060 <span class="keywordtype">void</span> <a class="code" href="classBowed.html#a7">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00061
|
||||
00063 <span class="keywordtype">void</span> <a class="code" href="classBowed.html#a8">noteOff</a>(MY_FLOAT amplitude);
|
||||
00064
|
||||
00066 MY_FLOAT <a class="code" href="classBowed.html#a9">tick</a>();
|
||||
00067
|
||||
00069 <span class="keywordtype">void</span> <a class="code" href="classBowed.html#a10">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00070
|
||||
00071 <span class="keyword">protected</span>:
|
||||
00072 <a class="code" href="classDelayL.html">DelayL</a> *neckDelay;
|
||||
00073 <a class="code" href="classDelayL.html">DelayL</a> *bridgeDelay;
|
||||
00074 <a class="code" href="classBowTabl.html">BowTabl</a> *bowTable;
|
||||
00075 <a class="code" href="classOnePole.html">OnePole</a> *stringFilter;
|
||||
00076 <a class="code" href="classBiQuad.html">BiQuad</a> *bodyFilter;
|
||||
00077 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00078 <a class="code" href="classADSR.html">ADSR</a> *adsr;
|
||||
00079 MY_FLOAT maxVelocity;
|
||||
00080 MY_FLOAT baseDelay;
|
||||
00081 MY_FLOAT vibratoGain;
|
||||
00082 MY_FLOAT betaRatio;
|
||||
00083
|
||||
00084 };
|
||||
00085
|
||||
00086 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,67 +6,96 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Brass.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BRASS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BRASS_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayA.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00010"></a>00010
|
||||
<a name="l00011"></a>00011 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Brass.html">00035</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Brass.html" title="STK simple brass instrument class.">Brass</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00036"></a>00036 {
|
||||
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Brass.html#96b223221f536efdaad4e724db01f11b" title="Class constructor, taking the lowest desired playing frequency.">Brass</a>( StkFloat lowestFrequency );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Brass.html#474528a75bd4fb88cdb9c783d73df8f6" title="Class destructor.">~Brass</a>( );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#64e48334efdc8f2508c29c5ea4281f2d" title="Reset and clear all internal state.">clear</a>( );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#5e99e7fee1b92138566a46c828df93e8" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#2e1a150328504050499c5cb9fa0e536f" title="Set the lips frequency.">setLip</a>( StkFloat frequency );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#02533e02818e2848fb6480106a54ce94" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#8bf1624aca6283fafb830a3f22546199" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#e74eba698f27abd43e66e825f5ce72da" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#32e2a6d2c9285bb5cf033d8a6b90e3c9" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#4d75ac361d11fcc870a330d393dbad80" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Brass.html#4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> lipFilter_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00082"></a>00082 StkFloat lipTarget_;
|
||||
<a name="l00083"></a>00083 StkFloat slideTarget_;
|
||||
<a name="l00084"></a>00084 StkFloat vibratoGain_;
|
||||
<a name="l00085"></a>00085 StkFloat maxPressure_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Brass.html#4af1b7c4c1b374b65e04ccaa90886321">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Brass.html#4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">Brass :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 StkFloat mouthPressure = 0.3 * breathPressure;
|
||||
<a name="l00095"></a>00095 StkFloat borePressure = 0.85 * delayLine_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00096"></a>00096 StkFloat deltaPressure = mouthPressure - borePressure; <span class="comment">// Differential pressure.</span>
|
||||
<a name="l00097"></a>00097 deltaPressure = lipFilter_.<a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( deltaPressure ); <span class="comment">// Force - > position.</span>
|
||||
<a name="l00098"></a>00098 deltaPressure *= deltaPressure; <span class="comment">// Basic position to area mapping.</span>
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">if</span> ( deltaPressure > 1.0 ) deltaPressure = 1.0; <span class="comment">// Non-linear saturation.</span>
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="comment">// The following input scattering assumes the mouthPressure = area.</span>
|
||||
<a name="l00102"></a>00102 lastFrame_[0] = deltaPressure * mouthPressure + ( 1.0 - deltaPressure) * borePressure;
|
||||
<a name="l00103"></a>00103 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] ) );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Brass.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00021 <span class="comment">/***************************************************/</span>
|
||||
00022
|
||||
00023 <span class="preprocessor">#if !defined(__BRASS_H)</span>
|
||||
00024 <span class="preprocessor"></span><span class="preprocessor">#define __BRASS_H</span>
|
||||
00025 <span class="preprocessor"></span>
|
||||
00026 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00027 <span class="preprocessor">#include "DelayA.h"</span>
|
||||
00028 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
00029 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
00030 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
00031 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00032
|
||||
<a name="l00033"></a><a class="code" href="classBrass.html">00033</a> <span class="keyword">class </span><a class="code" href="classBrass.html">Brass</a>: <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00034 {
|
||||
00035 <span class="keyword">public</span>:
|
||||
00037 <a class="code" href="classBrass.html#a0">Brass</a>(MY_FLOAT lowestFrequency);
|
||||
00038
|
||||
00040 <a class="code" href="classBrass.html#a1">~Brass</a>();
|
||||
00041
|
||||
00043 <span class="keywordtype">void</span> <a class="code" href="classBrass.html#a2">clear</a>();
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classBrass.html#a3">setFrequency</a>(MY_FLOAT frequency);
|
||||
00047
|
||||
00049 <span class="keywordtype">void</span> <a class="code" href="classBrass.html#a4">setLip</a>(MY_FLOAT frequency);
|
||||
00050
|
||||
00052 <span class="keywordtype">void</span> <a class="code" href="classBrass.html#a5">startBlowing</a>(MY_FLOAT amplitude,MY_FLOAT rate);
|
||||
00053
|
||||
00055 <span class="keywordtype">void</span> <a class="code" href="classBrass.html#a6">stopBlowing</a>(MY_FLOAT rate);
|
||||
00056
|
||||
00058 <span class="keywordtype">void</span> <a class="code" href="classBrass.html#a7">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00059
|
||||
00061 <span class="keywordtype">void</span> <a class="code" href="classBrass.html#a8">noteOff</a>(MY_FLOAT amplitude);
|
||||
00062
|
||||
00064 MY_FLOAT <a class="code" href="classBrass.html#a9">tick</a>();
|
||||
00065
|
||||
00067 <span class="keywordtype">void</span> <a class="code" href="classBrass.html#a10">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00068
|
||||
00069 <span class="keyword">protected</span>:
|
||||
00070 <a class="code" href="classDelayA.html">DelayA</a> *delayLine;
|
||||
00071 <a class="code" href="classBiQuad.html">BiQuad</a> *lipFilter;
|
||||
00072 <a class="code" href="classPoleZero.html">PoleZero</a> *dcBlock;
|
||||
00073 <a class="code" href="classADSR.html">ADSR</a> *adsr;
|
||||
00074 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00075 <span class="keywordtype">long</span> length;
|
||||
00076 MY_FLOAT lipTarget;
|
||||
00077 MY_FLOAT slideTarget;
|
||||
00078 MY_FLOAT vibratoGain;
|
||||
00079 MY_FLOAT maxPressure;
|
||||
00080
|
||||
00081 };
|
||||
00082
|
||||
00083 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,61 +6,139 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Chorus.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CHORUS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CHORUS_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Chorus.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Chorus.html" title="STK chorus effect class.">Chorus</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1Chorus.html#529f668e66188ae5a42e4cc30779059f" title="Class constructor, taking the median desired delay length.">Chorus</a>( StkFloat baseDelay = 6000 );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#63acbdd04d13110712c36a5cac5d972d" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Chorus.html#cb3a55518c919dafa6c19698c1ab3389">00034</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#cb3a55518c919dafa6c19698c1ab3389" title="Set modulation depth.">setModDepth</a>( StkFloat depth ) { modDepth_ = depth; };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#a4372095b8526d62ff9cfbdb03f21c4d" title="Set modulation frequency.">setModFrequency</a>( StkFloat frequency );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00048"></a>00048 StkFloat <a class="code" href="classstk_1_1Chorus.html#abcc110787ec3b443c21845b2f06bb3c" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_[2];
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> mods_[2];
|
||||
<a name="l00088"></a>00088 StkFloat baseLength_;
|
||||
<a name="l00089"></a>00089 StkFloat modDepth_;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 };
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a><a class="code" href="classstk_1_1Chorus.html#abcc110787ec3b443c21845b2f06bb3c">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#abcc110787ec3b443c21845b2f06bb3c" title="Return the specified channel value of the last computed stereo frame.">Chorus :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00094"></a>00094 {
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00097"></a>00097 errorString_ << <span class="stringliteral">"Chorus::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00099"></a>00099 }
|
||||
<a name="l00100"></a>00100 <span class="preprocessor">#endif</span>
|
||||
<a name="l00101"></a>00101 <span class="preprocessor"></span>
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a><a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf">00105</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00106"></a>00106 {
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00109"></a>00109 errorString_ << <span class="stringliteral">"Chorus::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00110"></a>00110 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
<a name="l00113"></a>00113 <span class="preprocessor"></span>
|
||||
<a name="l00114"></a>00114 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00115"></a>00115 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00116"></a>00116 lastFrame_[0] = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00117"></a>00117 lastFrame_[1] = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1Chorus.html#ef55c6fb93a1d00498ae436868f84501">00121</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00125"></a>00125 errorString_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00126"></a>00126 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#endif</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span>
|
||||
<a name="l00130"></a>00130 StkFloat *samples = &frames[channel];
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1;
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 *samples = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00134"></a>00134 samples++;
|
||||
<a name="l00135"></a>00135 *samples = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00139"></a>00139 lastFrame_[1] = *(samples-hop+1);
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a><a class="code" href="classstk_1_1Chorus.html#bdb8802a83f6b89716316399138e3032">00143</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00144"></a>00144 {
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00147"></a>00147 errorString_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00148"></a>00148 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#endif</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span>
|
||||
<a name="l00152"></a>00152 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00153"></a>00153 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00156"></a>00156 *oSamples++ = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00157"></a>00157 *oSamples = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00161"></a>00161 lastFrame_[1] = *(oSamples-oHop+1);
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00163"></a>00163 }
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a>00167 <span class="preprocessor">#endif</span>
|
||||
<a name="l00168"></a>00168 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Chorus.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00009 <span class="comment">/***************************************************/</span>
|
||||
00010
|
||||
00011 <span class="preprocessor">#if !defined(__CHORUS_H)</span>
|
||||
00012 <span class="preprocessor"></span><span class="preprocessor">#define __CHORUS_H</span>
|
||||
00013 <span class="preprocessor"></span>
|
||||
00014 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00015 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
00016 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00017
|
||||
<a name="l00018"></a><a class="code" href="classChorus.html">00018</a> <span class="keyword">class </span><a class="code" href="classChorus.html">Chorus</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00019 {
|
||||
00020 <span class="keyword">public</span>:
|
||||
00022 <a class="code" href="classChorus.html#a0">Chorus</a>(MY_FLOAT baseDelay);
|
||||
00023
|
||||
00025 <a class="code" href="classChorus.html#a1">~Chorus</a>();
|
||||
00026
|
||||
00028 <span class="keywordtype">void</span> <a class="code" href="classChorus.html#a2">clear</a>();
|
||||
00029
|
||||
00031 <span class="keywordtype">void</span> <a class="code" href="classChorus.html#a3">setModDepth</a>(MY_FLOAT depth);
|
||||
00032
|
||||
00034 <span class="keywordtype">void</span> <a class="code" href="classChorus.html#a4">setModFrequency</a>(MY_FLOAT frequency);
|
||||
00035
|
||||
00037 <span class="keywordtype">void</span> <a class="code" href="classChorus.html#a5">setEffectMix</a>(MY_FLOAT mix);
|
||||
00038
|
||||
00040 MY_FLOAT <a class="code" href="classChorus.html#a6">lastOut</a>() <span class="keyword">const</span>;
|
||||
00041
|
||||
00043 MY_FLOAT <a class="code" href="classChorus.html#a7">lastOutLeft</a>() <span class="keyword">const</span>;
|
||||
00044
|
||||
00046 MY_FLOAT <a class="code" href="classChorus.html#a8">lastOutRight</a>() <span class="keyword">const</span>;
|
||||
00047
|
||||
00049 MY_FLOAT <a class="code" href="classChorus.html#a9">tick</a>(MY_FLOAT input);
|
||||
00050
|
||||
00052 MY_FLOAT *<a class="code" href="classChorus.html#a9">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00053
|
||||
00054 <span class="keyword">protected</span>:
|
||||
00055 <a class="code" href="classDelayL.html">DelayL</a> *delayLine[2];
|
||||
00056 <a class="code" href="classWaveLoop.html">WaveLoop</a> *mods[2];
|
||||
00057 MY_FLOAT baseLength;
|
||||
00058 MY_FLOAT modDepth;
|
||||
00059 MY_FLOAT lastOutput[2];
|
||||
00060 MY_FLOAT effectMix;
|
||||
00061
|
||||
00062 };
|
||||
00063
|
||||
00064 <span class="preprocessor">#endif</span>
|
||||
00065 <span class="preprocessor"></span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,66 +6,101 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Clarinet.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CLARINET_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CLARINET_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Clarinet.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Clarinet.html" title="STK clarinet physical model class.">Clarinet</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Clarinet.html#82e32a30e6d9664ac9fe748070bec23c" title="Class constructor, taking the lowest desired playing frequency.">Clarinet</a>( StkFloat lowestFrequency );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Clarinet.html#5166db9f4cf180fa189ba2e135affe34" title="Class destructor.">~Clarinet</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#7eae4377eb4178067c2dba704032a2d1" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#f7c1cda6af97908c9b81b1be0c2a896d" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#0e4d016135c3ee291f4d74e9b030caee" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#e33627365f66f30c3685dc72cd7fadce" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#35f9158176c1b654c74bdf6f1296df67" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#501413064397d1650e18edac92a98b2e" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#63582205ab940101f5f9419fc717ff78" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Clarinet.html#4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">long</span> length_;
|
||||
<a name="l00083"></a>00083 StkFloat outputGain_;
|
||||
<a name="l00084"></a>00084 StkFloat noiseGain_;
|
||||
<a name="l00085"></a>00085 StkFloat vibratoGain_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Clarinet.html#4cd08bca954ad434bc636eda957ca8d5">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Clarinet.html#4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">Clarinet :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat pressureDiff;
|
||||
<a name="l00092"></a>00092 StkFloat breathPressure;
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00095"></a>00095 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00096"></a>00096 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00097"></a>00097 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Perform commuted loss filtering.</span>
|
||||
<a name="l00100"></a>00100 pressureDiff = -0.95 * filter_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// Calculate pressure difference of reflected and mouthpiece pressures.</span>
|
||||
<a name="l00103"></a>00103 pressureDiff = pressureDiff - breathPressure;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Perform non-linear scattering using pressure difference in reed function.</span>
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>(pressureDiff));
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Apply output gain.</span>
|
||||
<a name="l00109"></a>00109 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Clarinet.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00023 <span class="comment">/***************************************************/</span>
|
||||
00024
|
||||
00025 <span class="preprocessor">#if !defined(__CLARINET_H)</span>
|
||||
00026 <span class="preprocessor"></span><span class="preprocessor">#define __CLARINET_H</span>
|
||||
00027 <span class="preprocessor"></span>
|
||||
00028 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00029 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
00030 <span class="preprocessor">#include "ReedTabl.h"</span>
|
||||
00031 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
00032 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
00033 <span class="preprocessor">#include "Noise.h"</span>
|
||||
00034 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00035
|
||||
<a name="l00036"></a><a class="code" href="classClarinet.html">00036</a> <span class="keyword">class </span><a class="code" href="classClarinet.html">Clarinet</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00037 {
|
||||
00038 <span class="keyword">public</span>:
|
||||
00040 <a class="code" href="classClarinet.html#a0">Clarinet</a>(MY_FLOAT lowestFrequency);
|
||||
00041
|
||||
00043 <a class="code" href="classClarinet.html#a1">~Clarinet</a>();
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classClarinet.html#a2">clear</a>();
|
||||
00047
|
||||
00049 <span class="keywordtype">void</span> <a class="code" href="classClarinet.html#a3">setFrequency</a>(MY_FLOAT frequency);
|
||||
00050
|
||||
00052 <span class="keywordtype">void</span> <a class="code" href="classClarinet.html#a4">startBlowing</a>(MY_FLOAT amplitude, MY_FLOAT rate);
|
||||
00053
|
||||
00055 <span class="keywordtype">void</span> <a class="code" href="classClarinet.html#a5">stopBlowing</a>(MY_FLOAT rate);
|
||||
00056
|
||||
00058 <span class="keywordtype">void</span> <a class="code" href="classClarinet.html#a6">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00059
|
||||
00061 <span class="keywordtype">void</span> <a class="code" href="classClarinet.html#a7">noteOff</a>(MY_FLOAT amplitude);
|
||||
00062
|
||||
00064 MY_FLOAT <a class="code" href="classClarinet.html#a8">tick</a>();
|
||||
00065
|
||||
00067 <span class="keywordtype">void</span> <a class="code" href="classClarinet.html#a9">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00068
|
||||
00069 <span class="keyword">protected</span>:
|
||||
00070 <a class="code" href="classDelayL.html">DelayL</a> *delayLine;
|
||||
00071 <a class="code" href="classReedTabl.html">ReedTabl</a> *reedTable;
|
||||
00072 <a class="code" href="classOneZero.html">OneZero</a> *filter;
|
||||
00073 <a class="code" href="classEnvelope.html">Envelope</a> *envelope;
|
||||
00074 <a class="code" href="classNoise.html">Noise</a> *noise;
|
||||
00075 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00076 <span class="keywordtype">long</span> length;
|
||||
00077 MY_FLOAT outputGain;
|
||||
00078 MY_FLOAT noiseGain;
|
||||
00079 MY_FLOAT vibratoGain;
|
||||
00080
|
||||
00081 };
|
||||
00082
|
||||
00083 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,54 +6,158 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>DelayA.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAYA_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAYA_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1DelayA.html">00028</a> <span class="keyword">class </span><a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00029"></a>00029 {
|
||||
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1DelayA.html#9beb31f924bca961df99c1ea7789c42d" title="Default constructor creates a delay-line with maximum length of 4095 samples and...">DelayA</a>( StkFloat delay = 0.5, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1DelayA.html#b6f2ee45d350b4bb3515fcdaf25a986a" title="Class destructor.">~DelayA</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#e5e59f497eb84280fd94d60257ffae69" title="Clears all internal states of the delay line.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#b10bb5eb8316ce8b3c6667bdf4c98389" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#83ddc9bdf2f5059159160fdac0e25eda" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1DelayA.html#363d9ccc50acbd1f3bb533aa1ab3d9c7">00063</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#363d9ccc50acbd1f3bb533aa1ab3d9c7" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00071"></a>00071 StkFloat <a class="code" href="classstk_1_1DelayA.html#355422e50c1d2e89385f11aafffd064d" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566">00074</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00080"></a>00080 StkFloat <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 StkFloat <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="keyword">protected</span>:
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00111"></a>00111 StkFloat delay_;
|
||||
<a name="l00112"></a>00112 StkFloat alpha_;
|
||||
<a name="l00113"></a>00113 StkFloat coeff_;
|
||||
<a name="l00114"></a>00114 StkFloat apInput_;
|
||||
<a name="l00115"></a>00115 StkFloat nextOutput_;
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00117"></a>00117 };
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a><a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314">00119</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">DelayA :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00120"></a>00120 {
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00122"></a>00122 <span class="comment">// Do allpass interpolation delay.</span>
|
||||
<a name="l00123"></a>00123 nextOutput_ = -coeff_ * lastFrame_[0];
|
||||
<a name="l00124"></a>00124 nextOutput_ += apInput_ + ( coeff_ * inputs_[outPoint_] );
|
||||
<a name="l00125"></a>00125 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a><a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74">00131</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( StkFloat input )
|
||||
<a name="l00132"></a>00132 {
|
||||
<a name="l00133"></a>00133 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00137"></a>00137 inPoint_ = 0;
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 lastFrame_[0] = <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00140"></a>00140 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="comment">// Save the allpass input and increment modulo length.</span>
|
||||
<a name="l00143"></a>00143 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00145"></a>00145 outPoint_ = 0;
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00148"></a>00148 }
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a><a class="code" href="classstk_1_1DelayA.html#57c568d56e5ed35926cfc23f83d48d98">00150</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00151"></a>00151 {
|
||||
<a name="l00152"></a>00152 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00153"></a>00153 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00154"></a>00154 errorString_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00155"></a>00155 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00156"></a>00156 }
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></span>
|
||||
<a name="l00159"></a>00159 StkFloat *samples = &frames[channel];
|
||||
<a name="l00160"></a>00160 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00162"></a>00162 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00163"></a>00163 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00164"></a>00164 *samples = <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00165"></a>00165 lastFrame_[0] = *samples;
|
||||
<a name="l00166"></a>00166 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00167"></a>00167 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00168"></a>00168 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00169"></a>00169 }
|
||||
<a name="l00170"></a>00170
|
||||
<a name="l00171"></a>00171 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00172"></a>00172 }
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a><a class="code" href="classstk_1_1DelayA.html#94a2998c9b2d1697ed9a747973be0a89">00174</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00175"></a>00175 {
|
||||
<a name="l00176"></a>00176 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00177"></a>00177 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00178"></a>00178 errorString_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00179"></a>00179 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00180"></a>00180 }
|
||||
<a name="l00181"></a>00181 <span class="preprocessor">#endif</span>
|
||||
<a name="l00182"></a>00182 <span class="preprocessor"></span>
|
||||
<a name="l00183"></a>00183 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00184"></a>00184 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00185"></a>00185 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00186"></a>00186 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00187"></a>00187 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00189"></a>00189 *oSamples = <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00190"></a>00190 lastFrame_[0] = *oSamples;
|
||||
<a name="l00191"></a>00191 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00192"></a>00192 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00193"></a>00193 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00197"></a>00197 }
|
||||
<a name="l00198"></a>00198
|
||||
<a name="l00199"></a>00199 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00200"></a>00200
|
||||
<a name="l00201"></a>00201 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>DelayA.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00023 <span class="comment">/***************************************************/</span>
|
||||
00024
|
||||
00025 <span class="preprocessor">#if !defined(__DelayA_h)</span>
|
||||
00026 <span class="preprocessor"></span><span class="preprocessor">#define __DelayA_h</span>
|
||||
00027 <span class="preprocessor"></span>
|
||||
00028 <span class="preprocessor">#include "Delay.h"</span>
|
||||
00029
|
||||
<a name="l00030"></a><a class="code" href="classDelayA.html">00030</a> <span class="keyword">class </span><a class="code" href="classDelayA.html">DelayA</a> : <span class="keyword">public</span> <a class="code" href="classDelay.html">Delay</a>
|
||||
00031 {
|
||||
00032 <span class="keyword">public</span>:
|
||||
00033
|
||||
00035 <a class="code" href="classDelayA.html#a0">DelayA</a>();
|
||||
00036
|
||||
00038
|
||||
00039 <a class="code" href="classDelayA.html#a0">DelayA</a>(MY_FLOAT theDelay, <span class="keywordtype">long</span> maxDelay);
|
||||
00040
|
||||
00042 <a class="code" href="classDelayA.html#a2">~DelayA</a>();
|
||||
00043
|
||||
00045 <span class="keywordtype">void</span> <a class="code" href="classDelayA.html#a3">clear</a>();
|
||||
00046
|
||||
00048
|
||||
00051 <span class="keywordtype">void</span> <a class="code" href="classDelayA.html#a4">setDelay</a>(MY_FLOAT theDelay);
|
||||
00052
|
||||
00054 MY_FLOAT <a class="code" href="classDelayA.html#a5">getDelay</a>(<span class="keywordtype">void</span>);
|
||||
00055
|
||||
00057
|
||||
00060 MY_FLOAT <a class="code" href="classDelayA.html#a6">nextOut</a>(<span class="keywordtype">void</span>);
|
||||
00061
|
||||
00063 MY_FLOAT <a class="code" href="classDelayA.html#a7">tick</a>(MY_FLOAT sample);
|
||||
00064
|
||||
00065 <span class="keyword">protected</span>:
|
||||
00066 MY_FLOAT alpha;
|
||||
00067 MY_FLOAT coeff;
|
||||
00068 MY_FLOAT apInput;
|
||||
00069 MY_FLOAT nextOutput;
|
||||
00070 <span class="keywordtype">bool</span> doNextOut;
|
||||
00071 };
|
||||
00072
|
||||
00073 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,51 +6,156 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>DelayL.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAYL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAYL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1DelayL.html">00027</a> <span class="keyword">class </span><a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00028"></a>00028 {
|
||||
<a name="l00029"></a>00029 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1DelayL.html#d60f2222397e19fe524fc3b76b59b846" title="Default constructor creates a delay-line with maximum length of 4095 samples and...">DelayL</a>( StkFloat delay = 0.0, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1DelayL.html#8f9b49c7b098d9e379baf44b0c345457" title="Class destructor.">~DelayL</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#18b40806591654a9c9c32603990fce40" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a><a class="code" href="classstk_1_1DelayL.html#af2d5ef7dba47ff1fb279c327021beb0">00059</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#af2d5ef7dba47ff1fb279c327021beb0" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00067"></a>00067 StkFloat <a class="code" href="classstk_1_1DelayL.html#7a84a3a188f2de7cc05f81ad06e04874" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9">00070</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keyword">protected</span>:
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00107"></a>00107 StkFloat delay_;
|
||||
<a name="l00108"></a>00108 StkFloat alpha_;
|
||||
<a name="l00109"></a>00109 StkFloat omAlpha_;
|
||||
<a name="l00110"></a>00110 StkFloat nextOutput_;
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">DelayL :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00117"></a>00117 <span class="comment">// First 1/2 of interpolation</span>
|
||||
<a name="l00118"></a>00118 nextOutput_ = inputs_[outPoint_] * omAlpha_;
|
||||
<a name="l00119"></a>00119 <span class="comment">// Second 1/2 of interpolation</span>
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">if</span> (outPoint_+1 < inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>())
|
||||
<a name="l00121"></a>00121 nextOutput_ += inputs_[outPoint_+1] * alpha_;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">else</span>
|
||||
<a name="l00123"></a>00123 nextOutput_ += inputs_[0] * alpha_;
|
||||
<a name="l00124"></a>00124 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a><a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f">00130</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( StkFloat input )
|
||||
<a name="l00131"></a>00131 {
|
||||
<a name="l00132"></a>00132 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00136"></a>00136 inPoint_ = 0;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 lastFrame_[0] = <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00139"></a>00139 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Increment output pointer modulo length.</span>
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00143"></a>00143 outPoint_ = 0;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a><a class="code" href="classstk_1_1DelayL.html#cdc5d41de53c53d9d4b39ee8a46fb96c">00148</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00149"></a>00149 {
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00152"></a>00152 errorString_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00153"></a>00153 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155 <span class="preprocessor">#endif</span>
|
||||
<a name="l00156"></a>00156 <span class="preprocessor"></span>
|
||||
<a name="l00157"></a>00157 StkFloat *samples = &frames[channel];
|
||||
<a name="l00158"></a>00158 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00159"></a>00159 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00160"></a>00160 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00162"></a>00162 *samples = <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00163"></a>00163 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00165"></a>00165 }
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a>00167 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00168"></a>00168 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00169"></a>00169 }
|
||||
<a name="l00170"></a>00170
|
||||
<a name="l00171"></a><a class="code" href="classstk_1_1DelayL.html#56ee486fb01fbf45d5a3dbad754a838e">00171</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00172"></a>00172 {
|
||||
<a name="l00173"></a>00173 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00174"></a>00174 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00175"></a>00175 errorString_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00176"></a>00176 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178 <span class="preprocessor">#endif</span>
|
||||
<a name="l00179"></a>00179 <span class="preprocessor"></span>
|
||||
<a name="l00180"></a>00180 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00181"></a>00181 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00182"></a>00182 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00184"></a>00184 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00185"></a>00185 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00186"></a>00186 *oSamples = <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00187"></a>00187 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00189"></a>00189 }
|
||||
<a name="l00190"></a>00190
|
||||
<a name="l00191"></a>00191 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00192"></a>00192 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00193"></a>00193 }
|
||||
<a name="l00194"></a>00194
|
||||
<a name="l00195"></a>00195 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00196"></a>00196
|
||||
<a name="l00197"></a>00197 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>DelayL.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00023 <span class="comment">/***************************************************/</span>
|
||||
00024
|
||||
00025 <span class="preprocessor">#if !defined(__DELAYL_H)</span>
|
||||
00026 <span class="preprocessor"></span><span class="preprocessor">#define __DELAYL_H</span>
|
||||
00027 <span class="preprocessor"></span>
|
||||
00028 <span class="preprocessor">#include "Delay.h"</span>
|
||||
00029
|
||||
<a name="l00030"></a><a class="code" href="classDelayL.html">00030</a> <span class="keyword">class </span><a class="code" href="classDelayL.html">DelayL</a> : <span class="keyword">public</span> <a class="code" href="classDelay.html">Delay</a>
|
||||
00031 {
|
||||
00032 <span class="keyword">public</span>:
|
||||
00033
|
||||
00035 <a class="code" href="classDelayL.html#a0">DelayL</a>();
|
||||
00036
|
||||
00038
|
||||
00039 <a class="code" href="classDelayL.html#a0">DelayL</a>(MY_FLOAT theDelay, <span class="keywordtype">long</span> maxDelay);
|
||||
00040
|
||||
00042 <a class="code" href="classDelayL.html#a2">~DelayL</a>();
|
||||
00043
|
||||
00045
|
||||
00048 <span class="keywordtype">void</span> <a class="code" href="classDelayL.html#a3">setDelay</a>(MY_FLOAT theDelay);
|
||||
00049
|
||||
00051 MY_FLOAT <a class="code" href="classDelayL.html#a4">getDelay</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00052
|
||||
00054
|
||||
00057 MY_FLOAT <a class="code" href="classDelayL.html#a5">nextOut</a>(<span class="keywordtype">void</span>);
|
||||
00058
|
||||
00060 MY_FLOAT <a class="code" href="classDelayL.html#a6">tick</a>(MY_FLOAT sample);
|
||||
00061
|
||||
00062 <span class="keyword">protected</span>:
|
||||
00063 MY_FLOAT alpha;
|
||||
00064 MY_FLOAT omAlpha;
|
||||
00065 MY_FLOAT nextOutput;
|
||||
00066 <span class="keywordtype">bool</span> doNextOut;
|
||||
00067 };
|
||||
00068
|
||||
00069 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,62 +6,135 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Delay.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAY_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAY_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Delay.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1Delay.html#9644532bfea44fae046e54f2509cf1ef" title="The default constructor creates a delay-line with maximum length of 4095 samples...">Delay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Delay.html#24b6ed6c7c5fc6d15935ec2a118b6b4f" title="Class destructor.">~Delay</a>();
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#0cf4c8da14bd4105eef06e35caaf1532" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#5eaeed55ea0c7b30ed66fedd6ef52fc2" title="Set the delay-line length.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Delay.html#7ae307dc997ff07ff986ca5c4d287441">00056</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Delay.html#7ae307dc997ff07ff986ca5c4d287441" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00064"></a>00064 StkFloat <a class="code" href="classstk_1_1Delay.html#7d4c9c21e752f860ba683e9849d14665" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a><a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2">00067</a> StkFloat <a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Delay.html#2433e3246551f4fdf1366884cd2ae426">00073</a> StkFloat <a class="code" href="classstk_1_1Delay.html#2433e3246551f4fdf1366884cd2ae426" title="Return the value that will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_[outPoint_]; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1Delay.html#240830690cd8fa26e0604fd82c65dda1" title="Calculate and return the signal energy in the delay-line.">energy</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span>;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keyword">protected</span>:
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay_;
|
||||
<a name="l00108"></a>00108 };
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a><a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9">00110</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( StkFloat input )
|
||||
<a name="l00111"></a>00111 {
|
||||
<a name="l00112"></a>00112 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00116"></a>00116 inPoint_ = 0;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Read out next value</span>
|
||||
<a name="l00119"></a>00119 lastFrame_[0] = inputs_[outPoint_++];
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00122"></a>00122 outPoint_ = 0;
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a><a class="code" href="classstk_1_1Delay.html#93fe8e45acb933889be812f35810f977">00127</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00128"></a>00128 {
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00130"></a>00130 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00131"></a>00131 errorString_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00132"></a>00132 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#endif</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span>
|
||||
<a name="l00136"></a>00136 StkFloat *samples = &frames[channel];
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00139"></a>00139 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00141"></a>00141 *samples = inputs_[outPoint_++];
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a><a class="code" href="classstk_1_1Delay.html#de0d544e45e535fd792fe70a2a22da6f">00149</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00150"></a>00150 {
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00152"></a>00152 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00153"></a>00153 errorString_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00154"></a>00154 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156 <span class="preprocessor">#endif</span>
|
||||
<a name="l00157"></a>00157 <span class="preprocessor"></span>
|
||||
<a name="l00158"></a>00158 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00159"></a>00159 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00160"></a>00160 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00162"></a>00162 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00163"></a>00163 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00164"></a>00164 *oSamples = inputs_[outPoint_++];
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00169"></a>00169 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00170"></a>00170 }
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a>00172 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a>00174 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Delay.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00019 <span class="comment">/***************************************************/</span>
|
||||
00020
|
||||
00021 <span class="preprocessor">#if !defined(__DELAY_H)</span>
|
||||
00022 <span class="preprocessor"></span><span class="preprocessor">#define __DELAY_H</span>
|
||||
00023 <span class="preprocessor"></span>
|
||||
00024 <span class="preprocessor">#include "Filter.h"</span>
|
||||
00025
|
||||
<a name="l00026"></a><a class="code" href="classDelay.html">00026</a> <span class="keyword">class </span><a class="code" href="classDelay.html">Delay</a> : <span class="keyword">protected</span> <a class="code" href="classFilter.html">Filter</a>
|
||||
00027 {
|
||||
00028 <span class="keyword">public</span>:
|
||||
00029
|
||||
00031 <a class="code" href="classDelay.html#a0">Delay</a>();
|
||||
00032
|
||||
00034 <a class="code" href="classDelay.html#a0">Delay</a>(<span class="keywordtype">long</span> theDelay, <span class="keywordtype">long</span> maxDelay);
|
||||
00035
|
||||
00037 <span class="keyword">virtual</span> <a class="code" href="classDelay.html#a2">~Delay</a>();
|
||||
00038
|
||||
00040 <span class="keywordtype">void</span> <a class="code" href="classDelay.html#a3">clear</a>();
|
||||
00041
|
||||
00043
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classDelay.html#a4">setDelay</a>(<span class="keywordtype">long</span> theDelay);
|
||||
00047
|
||||
00049 <span class="keywordtype">long</span> <a class="code" href="classDelay.html#a5">getDelay</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00050
|
||||
00052 MY_FLOAT <a class="code" href="classDelay.html#a6">energy</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00053
|
||||
00055
|
||||
00060 MY_FLOAT <a class="code" href="classDelay.html#a7">contentsAt</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay) <span class="keyword">const</span>;
|
||||
00061
|
||||
00063 MY_FLOAT <a class="code" href="classDelay.html#a8">lastOut</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00064
|
||||
00066
|
||||
00069 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classDelay.html#a9">nextOut</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00070
|
||||
00072 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classDelay.html#a10">tick</a>(MY_FLOAT sample);
|
||||
00073
|
||||
00075 <span class="keyword">virtual</span> MY_FLOAT *<a class="code" href="classDelay.html#a10">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00076
|
||||
00077 <span class="keyword">protected</span>:
|
||||
00078 <span class="keywordtype">long</span> inPoint;
|
||||
00079 <span class="keywordtype">long</span> outPoint;
|
||||
00080 <span class="keywordtype">long</span> length;
|
||||
00081 MY_FLOAT delay;
|
||||
00082 };
|
||||
00083
|
||||
00084 <span class="preprocessor">#endif</span>
|
||||
00085 <span class="preprocessor"></span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,50 +6,84 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Drummer.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DRUMMER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DRUMMER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a>00027 <span class="keyword">const</span> <span class="keywordtype">int</span> DRUM_NUMWAVES = 11;
|
||||
<a name="l00028"></a>00028 <span class="keyword">const</span> <span class="keywordtype">int</span> DRUM_POLYPHONY = 4;
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Drummer.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Drummer.html" title="STK drum sample player class.">Drummer</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00031"></a>00031 {
|
||||
<a name="l00032"></a>00032 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Drummer.html#f5262dd2b29ae453323c0a514d79d26a" title="Class constructor.">Drummer</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Drummer.html#365fb4b2c501129f2efd6edfad1f5453" title="Class destructor.">~Drummer</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Drummer.html#5ea03a0ef9a3db02942799b5cbca2ea2" title="Start a note with the given drum type and amplitude.">noteOn</a>( StkFloat instrument, StkFloat amplitude );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Drummer.html#a735313fbdf7f1201fcb167874ecc7cc" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1Drummer.html#d65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00057"></a>00057 <span class="keyword">protected</span>:
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a>00059 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> waves_[DRUM_POLYPHONY];
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filters_[DRUM_POLYPHONY];
|
||||
<a name="l00061"></a>00061 std::vector<int> soundOrder_;
|
||||
<a name="l00062"></a>00062 std::vector<int> soundNumber_;
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">int</span> nSounding_;
|
||||
<a name="l00064"></a>00064 };
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a><a class="code" href="classstk_1_1Drummer.html#d65c63bfad0ffac03db7f56cf706e4ba">00066</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Drummer.html#d65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">Drummer :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00067"></a>00067 {
|
||||
<a name="l00068"></a>00068 lastFrame_[0] = 0.0;
|
||||
<a name="l00069"></a>00069 <span class="keywordflow">if</span> ( nSounding_ == 0 ) <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<DRUM_POLYPHONY; i++ ) {
|
||||
<a name="l00072"></a>00072 <span class="keywordflow">if</span> ( soundOrder_[i] >= 0 ) {
|
||||
<a name="l00073"></a>00073 <span class="keywordflow">if</span> ( waves_[i].isFinished() ) {
|
||||
<a name="l00074"></a>00074 <span class="comment">// Re-order the list.</span>
|
||||
<a name="l00075"></a>00075 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j=0; j<DRUM_POLYPHONY; j++ ) {
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">if</span> ( soundOrder_[j] > soundOrder_[i] )
|
||||
<a name="l00077"></a>00077 soundOrder_[j] -= 1;
|
||||
<a name="l00078"></a>00078 }
|
||||
<a name="l00079"></a>00079 soundOrder_[i] = -1;
|
||||
<a name="l00080"></a>00080 nSounding_--;
|
||||
<a name="l00081"></a>00081 }
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">else</span>
|
||||
<a name="l00083"></a>00083 lastFrame_[0] += filters_[i].<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( waves_[i].<a class="code" href="classstk_1_1Drummer.html#d65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Drummer.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00016 <span class="comment">/***************************************************/</span>
|
||||
00017
|
||||
00018 <span class="preprocessor">#if !defined(__DRUMMER_H)</span>
|
||||
00019 <span class="preprocessor"></span><span class="preprocessor">#define __DRUMMER_H</span>
|
||||
00020 <span class="preprocessor"></span>
|
||||
00021 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00022 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
00023 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
00024
|
||||
00025 <span class="preprocessor">#define DRUM_NUMWAVES 11</span>
|
||||
00026 <span class="preprocessor"></span><span class="preprocessor">#define DRUM_POLYPHONY 4</span>
|
||||
00027 <span class="preprocessor"></span>
|
||||
<a name="l00028"></a><a class="code" href="classDrummer.html">00028</a> <span class="keyword">class </span><a class="code" href="classDrummer.html">Drummer</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00029 {
|
||||
00030 <span class="keyword">public</span>:
|
||||
00032 <a class="code" href="classDrummer.html#a0">Drummer</a>();
|
||||
00033
|
||||
00035 <a class="code" href="classDrummer.html#a1">~Drummer</a>();
|
||||
00036
|
||||
00038
|
||||
00043 <span class="keywordtype">void</span> <a class="code" href="classDrummer.html#a2">noteOn</a>(MY_FLOAT instrument, MY_FLOAT amplitude);
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classDrummer.html#a3">noteOff</a>(MY_FLOAT amplitude);
|
||||
00047
|
||||
00049 MY_FLOAT <a class="code" href="classDrummer.html#a4">tick</a>();
|
||||
00050
|
||||
00051 <span class="keyword">protected</span>:
|
||||
00052 <a class="code" href="classWvIn.html">WvIn</a> *waves[DRUM_POLYPHONY];
|
||||
00053 <a class="code" href="classOnePole.html">OnePole</a> *filters[DRUM_POLYPHONY];
|
||||
00054 <span class="keywordtype">int</span> sounding[DRUM_POLYPHONY];
|
||||
00055 <span class="keywordtype">int</span> nSounding;
|
||||
00056
|
||||
00057 };
|
||||
00058
|
||||
00059 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,52 +6,107 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Echo.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ECHO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ECHO_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Echo.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Echo.html" title="STK echo effect class.">Echo</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Echo.html#5f3320986d5c9b02ad10663ff11b6505" title="Class constructor, taking the longest desired delay length (one second default value)...">Echo</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maximumDelay = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>) <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#253e0f8e4c628b431fdfcb6d880548c2" title="Reset and clear all internal state.">clear</a>();
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#421a6f5f06f8e7df09edd179d397da7d" title="Set the maximum delay line length in samples.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#e58ea12a2864481cb7049c10810867ce" title="Set the delay line length in samples.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Echo.html#00a2a5949133a06680b026db7b21cc51">00038</a> StkFloat <a class="code" href="classstk_1_1Echo.html#00a2a5949133a06680b026db7b21cc51" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 StkFloat <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00063"></a>00063 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> delayLine_;
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91">00072</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( StkFloat input )
|
||||
<a name="l00073"></a>00073 {
|
||||
<a name="l00074"></a>00074 lastFrame_[0] = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00075"></a>00075 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00076"></a>00076 }
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1Echo.html#efe863b7aa43d6a94c2a56bd31a30e7d">00078</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00079"></a>00079 {
|
||||
<a name="l00080"></a>00080 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00081"></a>00081 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00082"></a>00082 errorString_ << <span class="stringliteral">"Echo::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 <span class="preprocessor">#endif</span>
|
||||
<a name="l00086"></a>00086 <span class="preprocessor"></span>
|
||||
<a name="l00087"></a>00087 StkFloat *samples = &frames[channel];
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00090"></a>00090 *samples = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00094"></a>00094 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a><a class="code" href="classstk_1_1Echo.html#1778a7da06b222afbe9281c886f678d8">00097</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00098"></a>00098 {
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00101"></a>00101 errorString_ << <span class="stringliteral">"Echo::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#endif</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span>
|
||||
<a name="l00106"></a>00106 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00107"></a>00107 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00110"></a>00110 *oSamples = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#endif</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Echo.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00009 <span class="comment">/***************************************************/</span>
|
||||
00010
|
||||
00011 <span class="preprocessor">#if !defined(__ECHO_H)</span>
|
||||
00012 <span class="preprocessor"></span><span class="preprocessor">#define __ECHO_H</span>
|
||||
00013 <span class="preprocessor"></span>
|
||||
00014 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00015 <span class="preprocessor">#include "Delay.h"</span>
|
||||
00016
|
||||
<a name="l00017"></a><a class="code" href="classEcho.html">00017</a> <span class="keyword">class </span><a class="code" href="classEcho.html">Echo</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00018 {
|
||||
00019 <span class="keyword">public</span>:
|
||||
00021 <a class="code" href="classEcho.html#a0">Echo</a>(MY_FLOAT longestDelay);
|
||||
00022
|
||||
00024 <a class="code" href="classEcho.html#a1">~Echo</a>();
|
||||
00025
|
||||
00027 <span class="keywordtype">void</span> <a class="code" href="classEcho.html#a2">clear</a>();
|
||||
00028
|
||||
00030 <span class="keywordtype">void</span> <a class="code" href="classEcho.html#a3">setDelay</a>(MY_FLOAT delay);
|
||||
00031
|
||||
00033 <span class="keywordtype">void</span> <a class="code" href="classEcho.html#a4">setEffectMix</a>(MY_FLOAT mix);
|
||||
00034
|
||||
00036 MY_FLOAT <a class="code" href="classEcho.html#a5">lastOut</a>() <span class="keyword">const</span>;
|
||||
00037
|
||||
00039 MY_FLOAT <a class="code" href="classEcho.html#a6">tick</a>(MY_FLOAT input);
|
||||
00040
|
||||
00042 MY_FLOAT *<a class="code" href="classEcho.html#a6">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00043
|
||||
00044 <span class="keyword">protected</span>:
|
||||
00045 <a class="code" href="classDelay.html">Delay</a> *delayLine;
|
||||
00046 <span class="keywordtype">long</span> length;
|
||||
00047 MY_FLOAT lastOutput;
|
||||
00048 MY_FLOAT effectMix;
|
||||
00049
|
||||
00050 };
|
||||
00051
|
||||
00052 <span class="preprocessor">#endif</span>
|
||||
00053 <span class="preprocessor"></span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
89
doc/html/Effect_8h-source.html
Normal file
89
doc/html/Effect_8h-source.html
Normal file
@@ -0,0 +1,89 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Effect.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_EFFECT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_EFFECT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Effect.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Effect.html#f6eb27819aed132dd1edf2ce9640893e">00025</a> <a class="code" href="classstk_1_1Effect.html#f6eb27819aed132dd1edf2ce9640893e" title="Class constructor.">Effect</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Effect.html#bfdef9ce644c251607acfd183e3d7f7b">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Effect.html#bfdef9ce644c251607acfd183e3d7f7b" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Effect.html#3d7e2b8942bf7adcc71dfc6dccbb7aa0">00031</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Effect.html#3d7e2b8942bf7adcc71dfc6dccbb7aa0" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#0598128d1edc97729951310cc5df5171" title="Reset and clear all internal state.">clear</a>() = 0;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#b4facbc9b317f18c139577e52fd69c3d" title="Set the mixture of input and &quot;effected&quot; levels in the output (0.0 = input...">setEffectMix</a>( StkFloat mix );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a>00039 <span class="keyword">protected</span>:
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00041"></a>00041 <span class="comment">// Returns true if argument value is prime.</span>
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">bool</span> isPrime( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> number );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00045"></a>00045 StkFloat effectMix_;
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00047"></a>00047 };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Effect.html#b4facbc9b317f18c139577e52fd69c3d">00049</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#b4facbc9b317f18c139577e52fd69c3d" title="Set the mixture of input and &quot;effected&quot; levels in the output (0.0 = input...">Effect :: setEffectMix</a>( StkFloat mix )
|
||||
<a name="l00050"></a>00050 {
|
||||
<a name="l00051"></a>00051 <span class="keywordflow">if</span> ( mix < 0.0 ) {
|
||||
<a name="l00052"></a>00052 errorString_ << <span class="stringliteral">"Effect::setEffectMix: mix parameter is less than zero ... setting to zero!"</span>;
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00054"></a>00054 effectMix_ = 0.0;
|
||||
<a name="l00055"></a>00055 }
|
||||
<a name="l00056"></a>00056 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( mix > 1.0 ) {
|
||||
<a name="l00057"></a>00057 errorString_ << <span class="stringliteral">"Effect::setEffectMix: mix parameter is greater than 1.0 ... setting to one!"</span>;
|
||||
<a name="l00058"></a>00058 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00059"></a>00059 effectMix_ = 1.0;
|
||||
<a name="l00060"></a>00060 }
|
||||
<a name="l00061"></a>00061 <span class="keywordflow">else</span>
|
||||
<a name="l00062"></a>00062 effectMix_ = mix;
|
||||
<a name="l00063"></a>00063 }
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">inline</span> <span class="keywordtype">bool</span> Effect :: isPrime( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> number )
|
||||
<a name="l00066"></a>00066 {
|
||||
<a name="l00067"></a>00067 <span class="keywordflow">if</span> ( number == 2 ) <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
||||
<a name="l00068"></a>00068 <span class="keywordflow">if</span> ( number & 1 ) {
|
||||
<a name="l00069"></a>00069 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=3; i<(int)sqrt((<span class="keywordtype">double</span>)number)+1; i+=2 )
|
||||
<a name="l00070"></a>00070 <span class="keywordflow">if</span> ( (number % i) == 0 ) <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00071"></a>00071 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// prime</span>
|
||||
<a name="l00072"></a>00072 }
|
||||
<a name="l00073"></a>00073 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// even</span>
|
||||
<a name="l00074"></a>00074 }
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="preprocessor">#endif</span>
|
||||
<a name="l00079"></a>00079 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,58 +6,151 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Envelope.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ENVELOPE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ENVELOPE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Envelope.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Envelope.html#86ea29237a8d94c109388654703a0039" title="Default constructor.">Envelope</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1Envelope.html#64365d24b6cdd3ea3bdcaa1abcbcb60a" title="Class destructor.">~Envelope</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a>& <a class="code" href="classstk_1_1Envelope.html#42a1acf6a4606163056ad7d4122d2281" title="Assignment operator.">operator= </a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a>& e );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Envelope.html#18cf8f21ef70227bd5cd17f53752bd0f">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#18cf8f21ef70227bd5cd17f53752bd0f" title="Set target = 1.">keyOn</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 1.0 ); };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Envelope.html#9dbefb15f8d64aac3969f77d38791774">00038</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#9dbefb15f8d64aac3969f77d38791774" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 0.0 ); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#de99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">setRate</a>( StkFloat rate );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#deeb1676f9111980a0c1a48a6780c8f7" title="Set the rate based on a time duration.">setTime</a>( StkFloat time );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#b8164a90c57616dc8bd55a6e5ba02fb6" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a><a class="code" href="classstk_1_1Envelope.html#ddb2084add959a65733805bc2c1c39a9">00053</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Envelope.html#ddb2084add959a65733805bc2c1c39a9" title="Return the current envelope state (0 = at target, 1 otherwise).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Envelope.html#31044eab6eaf668ba7e74ea17bed109d">00056</a> StkFloat <a class="code" href="classstk_1_1Envelope.html#31044eab6eaf668ba7e74ea17bed109d" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 StkFloat <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keyword">protected</span>:
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 StkFloat value_;
|
||||
<a name="l00076"></a>00076 StkFloat target_;
|
||||
<a name="l00077"></a>00077 StkFloat rate_;
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00079"></a>00079 };
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1Envelope.html#de99b5c7cb974f71f1d2919868d774a0">00081</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#de99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">Envelope :: setRate</a>( StkFloat rate )
|
||||
<a name="l00082"></a>00082 {
|
||||
<a name="l00083"></a>00083 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00084"></a>00084 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( rate < 0.0 ) {
|
||||
<a name="l00085"></a>00085 errorString_ << <span class="stringliteral">"Envelope::setRate: negative rates not allowed ... correcting!"</span>;
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00087"></a>00087 rate_ = -rate;
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">else</span>
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#endif</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> rate_ = rate;
|
||||
<a name="l00092"></a>00092 }
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a><a class="code" href="classstk_1_1Envelope.html#deeb1676f9111980a0c1a48a6780c8f7">00094</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#deeb1676f9111980a0c1a48a6780c8f7" title="Set the rate based on a time duration.">Envelope :: setTime</a>( StkFloat time )
|
||||
<a name="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00097"></a>00097 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( time < 0.0 ) {
|
||||
<a name="l00098"></a>00098 errorString_ << <span class="stringliteral">"Envelope::setTime: negative times not allowed ... correcting!"</span>;
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00100"></a>00100 rate_ = 1.0 / ( -time * <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">else</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#endif</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> rate_ = 1.0 / ( time * <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a><a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e">00107</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">Envelope :: setTarget</a>( StkFloat target )
|
||||
<a name="l00108"></a>00108 {
|
||||
<a name="l00109"></a>00109 target_ = target;
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( value_ != target_ ) state_ = 1;
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a><a class="code" href="classstk_1_1Envelope.html#b8164a90c57616dc8bd55a6e5ba02fb6">00113</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#b8164a90c57616dc8bd55a6e5ba02fb6" title="Set current and target values to value.">Envelope :: setValue</a>( StkFloat value )
|
||||
<a name="l00114"></a>00114 {
|
||||
<a name="l00115"></a>00115 state_ = 0;
|
||||
<a name="l00116"></a>00116 target_ = value;
|
||||
<a name="l00117"></a>00117 value_ = value;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a><a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601">00120</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00121"></a>00121 {
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00124"></a>00124 value_ += rate_;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00126"></a>00126 value_ = target_;
|
||||
<a name="l00127"></a>00127 state_ = 0;
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">else</span> {
|
||||
<a name="l00131"></a>00131 value_ -= rate_;
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">if</span> ( value_ <= target_ ) {
|
||||
<a name="l00133"></a>00133 value_ = target_;
|
||||
<a name="l00134"></a>00134 state_ = 0;
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 lastFrame_[0] = value_;
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a><a class="code" href="classstk_1_1Envelope.html#9341c9dea4fd54c360a4a23254319cf7">00143</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00144"></a>00144 {
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00147"></a>00147 errorString_ << <span class="stringliteral">"Envelope::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00148"></a>00148 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#endif</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span>
|
||||
<a name="l00152"></a>00152 StkFloat *samples = &frames[channel];
|
||||
<a name="l00153"></a>00153 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00155"></a>00155 *samples = <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Envelope.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00014 <span class="comment">/***************************************************/</span>
|
||||
00015
|
||||
00016 <span class="preprocessor">#if !defined(__ENVELOPE_H)</span>
|
||||
00017 <span class="preprocessor"></span><span class="preprocessor">#define __ENVELOPE_H</span>
|
||||
00018 <span class="preprocessor"></span>
|
||||
00019 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00020
|
||||
<a name="l00021"></a><a class="code" href="classEnvelope.html">00021</a> <span class="keyword">class </span><a class="code" href="classEnvelope.html">Envelope</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00022 {
|
||||
00023 <span class="keyword">public</span>:
|
||||
00024
|
||||
00026 <a class="code" href="classEnvelope.html#a0">Envelope</a>(<span class="keywordtype">void</span>);
|
||||
00027
|
||||
00029 <span class="keyword">virtual</span> <a class="code" href="classEnvelope.html#a1">~Envelope</a>(<span class="keywordtype">void</span>);
|
||||
00030
|
||||
00032 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEnvelope.html#a2">keyOn</a>(<span class="keywordtype">void</span>);
|
||||
00033
|
||||
00035 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEnvelope.html#a3">keyOff</a>(<span class="keywordtype">void</span>);
|
||||
00036
|
||||
00038 <span class="keywordtype">void</span> <a class="code" href="classEnvelope.html#a4">setRate</a>(MY_FLOAT aRate);
|
||||
00039
|
||||
00041 <span class="keywordtype">void</span> <a class="code" href="classEnvelope.html#a5">setTime</a>(MY_FLOAT aTime);
|
||||
00042
|
||||
00044 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEnvelope.html#a6">setTarget</a>(MY_FLOAT aTarget);
|
||||
00045
|
||||
00047 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEnvelope.html#a7">setValue</a>(MY_FLOAT aValue);
|
||||
00048
|
||||
00050 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classEnvelope.html#a8">getState</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00051
|
||||
00053 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classEnvelope.html#a9">tick</a>(<span class="keywordtype">void</span>);
|
||||
00054
|
||||
00056 <span class="keyword">virtual</span> MY_FLOAT *<a class="code" href="classEnvelope.html#a9">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00057
|
||||
00059 MY_FLOAT <a class="code" href="classEnvelope.html#a11">lastOut</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00060
|
||||
00061 <span class="keyword">protected</span>:
|
||||
00062 MY_FLOAT value;
|
||||
00063 MY_FLOAT target;
|
||||
00064 MY_FLOAT rate;
|
||||
00065 <span class="keywordtype">int</span> state;
|
||||
00066 };
|
||||
00067
|
||||
00068 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,44 +6,79 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FMVoices.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FMVOICES_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FMVOICES_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1FMVoices.html">00040</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FMVoices.html" title="STK singing FM synthesis instrument.">FMVoices</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00041"></a>00041 {
|
||||
<a name="l00042"></a>00042 <span class="keyword">public</span>:
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1FMVoices.html#27d5570c83cad660a53f04d86d01c888" title="Class constructor.">FMVoices</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1FMVoices.html#8ff218d379ec020a38e1bc7203409e37" title="Class destructor.">~FMVoices</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#f47a92f6892f3a5bef5226d4772fc8cb" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#f2fd5dd9af61db94ff1cb556e8e5cf4c" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#24e17888ff4e01edff96d81461d670a8" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 StkFloat <a class="code" href="classstk_1_1FMVoices.html#31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 <span class="keyword">protected</span>:
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">int</span> currentVowel_;
|
||||
<a name="l00067"></a>00067 StkFloat tilt_[3];
|
||||
<a name="l00068"></a>00068 StkFloat mods_[3];
|
||||
<a name="l00069"></a>00069 };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1FMVoices.html#31111029e36d00230586250df7b4d887">00071</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FMVoices.html#31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">FMVoices :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00072"></a>00072 {
|
||||
<a name="l00073"></a>00073 <span class="keyword">register</span> StkFloat temp, temp2;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00076"></a>00076 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.1;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[0]);
|
||||
<a name="l00079"></a>00079 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[1]);
|
||||
<a name="l00080"></a>00080 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[2]);
|
||||
<a name="l00081"></a>00081 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[3]);
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 waves_[0]->addPhaseOffset(temp * mods_[0]);
|
||||
<a name="l00084"></a>00084 waves_[1]->addPhaseOffset(temp * mods_[1]);
|
||||
<a name="l00085"></a>00085 waves_[2]->addPhaseOffset(temp * mods_[2]);
|
||||
<a name="l00086"></a>00086 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00087"></a>00087 twozero_.<a class="code" href="classstk_1_1TwoZero.html#cf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00088"></a>00088 temp = gains_[0] * tilt_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00089"></a>00089 temp += gains_[1] * tilt_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00090"></a>00090 temp += gains_[2] * tilt_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 lastFrame_[0] = temp * 0.33;
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>FMVoices.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00031 <span class="comment">/***************************************************/</span>
|
||||
00032
|
||||
00033 <span class="preprocessor">#if !defined(__FMVOICES_H)</span>
|
||||
00034 <span class="preprocessor"></span><span class="preprocessor">#define __FMVOICES_H</span>
|
||||
00035 <span class="preprocessor"></span>
|
||||
00036 <span class="preprocessor">#include "FM.h"</span>
|
||||
00037
|
||||
<a name="l00038"></a><a class="code" href="classFMVoices.html">00038</a> <span class="keyword">class </span><a class="code" href="classFMVoices.html">FMVoices</a> : <span class="keyword">public</span> <a class="code" href="classFM.html">FM</a>
|
||||
00039 {
|
||||
00040 <span class="keyword">public</span>:
|
||||
00042 <a class="code" href="classFMVoices.html#a0">FMVoices</a>();
|
||||
00043
|
||||
00045 <a class="code" href="classFMVoices.html#a1">~FMVoices</a>();
|
||||
00046
|
||||
00048 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classFMVoices.html#a2">setFrequency</a>(MY_FLOAT frequency);
|
||||
00049
|
||||
00051 <span class="keywordtype">void</span> <a class="code" href="classFMVoices.html#a3">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00052
|
||||
00054 MY_FLOAT <a class="code" href="classFMVoices.html#a4">tick</a>();
|
||||
00055
|
||||
00057 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classFMVoices.html#a5">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00058
|
||||
00059 <span class="keyword">protected</span>:
|
||||
00060 <span class="keywordtype">int</span> currentVowel;
|
||||
00061 MY_FLOAT tilt[3];
|
||||
00062 MY_FLOAT mods[3];
|
||||
00063 };
|
||||
00064
|
||||
00065 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,79 +6,90 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FM.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FM_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FM_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "FileLoop.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "TwoZero.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1FM.html">00037</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00038"></a>00038 {
|
||||
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FM.html#f4732c22ce00743e1f751880fa07aa15" title="Class constructor, taking the number of wave/envelope operators to control.">FM</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> operators = 4 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FM.html#aba7e8bff02d105e146f8b62b20a27b9" title="Class destructor.">~FM</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#c5697f9929afd43379e8720f2f271b2d" title="Reset and clear all wave and envelope states.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#0a32c8327e842bb71ce945024d583941" title="Load the rawwave filenames in waves.">loadWaves</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> **filenames );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#8182c605d51ec623f90f4e07c2b90891" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#58f0898b677750a259036f628ec1a91b" title="Set the frequency ratio for the specified wave.">setRatio</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat ratio );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#65a8c54556f0c288871876ffad4d9eef" title="Set the gain for the specified wave.">setGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat gain );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a><a class="code" href="classstk_1_1FM.html#33e5d60131014a12a435c0ef20d104b6">00065</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#33e5d60131014a12a435c0ef20d104b6" title="Set the modulation speed in Hz.">setModulationSpeed</a>( StkFloat mSpeed ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#1047a43714bc2e40c7e31e8f7e34adbc" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( mSpeed ); };
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a><a class="code" href="classstk_1_1FM.html#11584256f23153551bc13b59518b415a">00068</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#11584256f23153551bc13b59518b415a" title="Set the modulation depth.">setModulationDepth</a>( StkFloat mDepth ) { modDepth_ = mDepth; };
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1FM.html#0425269a8fc0cc6bb7471d65b54b8a1a">00071</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#0425269a8fc0cc6bb7471d65b54b8a1a" title="Set the value of control1.">setControl1</a>( StkFloat cVal ) { control1_ = cVal * 2.0; };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1FM.html#d7e7d7067c8893040ef3bdf8a1fbe9ca">00074</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#d7e7d7067c8893040ef3bdf8a1fbe9ca" title="Set the value of control1.">setControl2</a>( StkFloat cVal ) { control2_ = cVal * 2.0; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#fc46280177d770404919f20ccf88e4ff" title="Start envelopes toward &quot;on&quot; targets.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#7235e94a153df135330a591511269f7c" title="Start envelopes toward &quot;off&quot; targets.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#56cc61b1923dba2ff80859df4904d4f9" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#1db9d177363fb7d8dedb20fa0c9104f1" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FM.html#81f351fd8732fd6e686735b7b45a4241" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ) = 0;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 std::vector<ADSR *> adsr_;
|
||||
<a name="l00094"></a>00094 std::vector<FileLoop *> waves_;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1TwoZero.html" title="STK two-zero filter class.">TwoZero</a> twozero_;
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nOperators_;
|
||||
<a name="l00098"></a>00098 StkFloat baseFrequency_;
|
||||
<a name="l00099"></a>00099 std::vector<StkFloat> ratios_;
|
||||
<a name="l00100"></a>00100 std::vector<StkFloat> gains_;
|
||||
<a name="l00101"></a>00101 StkFloat modDepth_;
|
||||
<a name="l00102"></a>00102 StkFloat control1_;
|
||||
<a name="l00103"></a>00103 StkFloat control2_;
|
||||
<a name="l00104"></a>00104 StkFloat fmGains_[100];
|
||||
<a name="l00105"></a>00105 StkFloat fmSusLevels_[16];
|
||||
<a name="l00106"></a>00106 StkFloat fmAttTimes_[32];
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 };
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>FM.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00024 <span class="comment">/***************************************************/</span>
|
||||
00025
|
||||
00026 <span class="preprocessor">#if !defined(__FM_H)</span>
|
||||
00027 <span class="preprocessor"></span><span class="preprocessor">#define __FM_H</span>
|
||||
00028 <span class="preprocessor"></span>
|
||||
00029 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00030 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
00031 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00032 <span class="preprocessor">#include "TwoZero.h"</span>
|
||||
00033
|
||||
<a name="l00034"></a><a class="code" href="classFM.html">00034</a> <span class="keyword">class </span><a class="code" href="classFM.html">FM</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00035 {
|
||||
00036 <span class="keyword">public</span>:
|
||||
00038 <a class="code" href="classFM.html#a0">FM</a>( <span class="keywordtype">int</span> operators = 4 );
|
||||
00039
|
||||
00041 <span class="keyword">virtual</span> <a class="code" href="classFM.html#a1">~FM</a>();
|
||||
00042
|
||||
00044 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a2">clear</a>();
|
||||
00045
|
||||
00047 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a3">loadWaves</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> **filenames);
|
||||
00048
|
||||
00050 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classFM.html#a4">setFrequency</a>(MY_FLOAT frequency);
|
||||
00051
|
||||
00053 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a5">setRatio</a>(<span class="keywordtype">int</span> waveIndex, MY_FLOAT ratio);
|
||||
00054
|
||||
00056 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a6">setGain</a>(<span class="keywordtype">int</span> waveIndex, MY_FLOAT gain);
|
||||
00057
|
||||
00059 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a7">setModulationSpeed</a>(MY_FLOAT mSpeed);
|
||||
00060
|
||||
00062 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a8">setModulationDepth</a>(MY_FLOAT mDepth);
|
||||
00063
|
||||
00065 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a9">setControl1</a>(MY_FLOAT cVal);
|
||||
00066
|
||||
00068 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a10">setControl2</a>(MY_FLOAT cVal);
|
||||
00069
|
||||
00071 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a11">keyOn</a>();
|
||||
00072
|
||||
00074 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a12">keyOff</a>();
|
||||
00075
|
||||
00077 <span class="keywordtype">void</span> <a class="code" href="classFM.html#a13">noteOff</a>(MY_FLOAT amplitude);
|
||||
00078
|
||||
00080 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classFM.html#a14">tick</a>() = 0;
|
||||
00081
|
||||
00083 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classFM.html#a15">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00084
|
||||
00085 <span class="keyword">protected</span>:
|
||||
00086 <a class="code" href="classADSR.html">ADSR</a> **adsr;
|
||||
00087 <a class="code" href="classWaveLoop.html">WaveLoop</a> **waves;
|
||||
00088 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00089 <a class="code" href="classTwoZero.html">TwoZero</a> *twozero;
|
||||
00090 <span class="keywordtype">int</span> nOperators;
|
||||
00091 MY_FLOAT baseFrequency;
|
||||
00092 MY_FLOAT *ratios;
|
||||
00093 MY_FLOAT *gains;
|
||||
00094 MY_FLOAT modDepth;
|
||||
00095 MY_FLOAT control1;
|
||||
00096 MY_FLOAT control2;
|
||||
00097 MY_FLOAT __FM_gains[100];
|
||||
00098 MY_FLOAT __FM_susLevels[16];
|
||||
00099 MY_FLOAT __FM_attTimes[32];
|
||||
00100
|
||||
00101 };
|
||||
00102
|
||||
00103 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
95
doc/html/FileLoop_8h-source.html
Normal file
95
doc/html/FileLoop_8h-source.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileLoop.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILELOOP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILELOOP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00024"></a>00024 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1FileLoop.html">00026</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileLoop.html" title="STK file looping / oscillator class.">FileLoop</a> : <span class="keyword">protected</span> <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a>
|
||||
<a name="l00027"></a>00027 {
|
||||
<a name="l00028"></a>00028 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030 <a class="code" href="classstk_1_1FileLoop.html#0d977aae11d75d0327057add00fa7f84" title="Default constructor.">FileLoop</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033 <a class="code" href="classstk_1_1FileLoop.html#0d977aae11d75d0327057add00fa7f84" title="Default constructor.">FileLoop</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span>,
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1FileLoop.html#b6f0e0f9a5cc9c99627d0e12db007905" title="Class destructor.">~FileLoop</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#5905940c0dd046a95ca9c2a1d72983de" title="Open the specified file and load its data.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a><a class="code" href="classstk_1_1FileLoop.html#51688a9e84b2f9e5a9c4e62588b65c52">00052</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">FileWvIn::closeFile</a>(); };
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1FileLoop.html#2c539902d697d0b87334ca7dc4f3ce69">00055</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">reset</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">FileWvIn::reset</a>(); };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b">00062</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( 1.0 ); };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00069"></a><a class="code" href="classstk_1_1FileLoop.html#a1ac0c8d19f412f66f5fdb89854e2833">00069</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a1ac0c8d19f412f66f5fdb89854e2833" title="Normalize data to a maximum of +-peak.">normalize</a>( StkFloat peak ) { <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( peak ); };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1FileLoop.html#d86d4f64c44a6f2488779fef24fc1ee7">00072</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileLoop.html#d86d4f64c44a6f2488779fef24fc1ee7" title="Return the file size in sample frames.">getSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1FileLoop.html#a18006c800c7dac1ddd277c987fe0003">00080</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#a18006c800c7dac1ddd277c987fe0003" title="Return the input file sample rate in Hz (not the data read rate).">getFileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00095"></a><a class="code" href="classstk_1_1FileLoop.html#ec8f94d8514b266acd83106ed0f24ead">00095</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#ec8f94d8514b266acd83106ed0f24ead" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( StkFloat frequency ) { this-><a class="code" href="classstk_1_1FileLoop.html#13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( file_.<a class="code" href="classstk_1_1FileRead.html#6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>() * frequency / <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ); };
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#1986db79fd04b93f4d10b8cdf75bca34" title="Increment the read pointer by time samples, modulo file size.">addTime</a>( StkFloat time );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#8e24d6f9292a9443fbc21e4e8797f482" title="Increment current read pointer by angle, relative to a looping frequency.">addPhase</a>( StkFloat angle );
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#fe462794ba202dd879d29c39e76ae111" title="Add a phase offset to the current read pointer.">addPhaseOffset</a>( StkFloat angle );
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00126"></a><a class="code" href="classstk_1_1FileLoop.html#826b6dd0968c5abd1020a9fe629a4ffd">00126</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) { <span class="keywordflow">return</span> <a class="code" href="classstk_1_1FileLoop.html#826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">FileWvIn::lastOut</a>( channel ); };
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00138"></a>00138 StkFloat <a class="code" href="classstk_1_1FileLoop.html#037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00150"></a>00150 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FileLoop.html#037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keyword">protected</span>:
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> firstFrame_;
|
||||
<a name="l00155"></a>00155 StkFloat phaseOffset_;
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 };
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
94
doc/html/FileRead_8h-source.html
Normal file
94
doc/html/FileRead_8h-source.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileRead.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEREAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEREAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1FileRead.html">00039</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00040"></a>00040 {
|
||||
<a name="l00041"></a>00041 <span class="keyword">public</span>:
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1FileRead.html#9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1FileRead.html#9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00053"></a>00053 StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <a class="code" href="classstk_1_1FileRead.html#24802c0e1846ea9f420f40293af4cde4" title="Class destructor.">~FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#cc11b53871e05af1b0342e2cc1fc3157" title="Open the specified file and determine its formatting.">open</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00066"></a>00066 StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#56d09169c0cca8623823579c7f80808a" title="If a file is open, close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileRead.html#3f30ed2a9f45493f0369aa2edbf38f70" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1FileRead.html#6a83d925dd5bd18c4299ea42cc0ea488">00075</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileRead.html#6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileSize_; };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1FileRead.html#4c0c35f1817a4984b325967f1e7bcd81">00078</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileRead.html#4c0c35f1817a4984b325967f1e7bcd81" title="Return the number of audio channels in the file.">channels</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channels_; };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00086"></a><a class="code" href="classstk_1_1FileRead.html#7d6ba525b2f8ae693d953cb7f4b7c199">00086</a> StkFloat <a class="code" href="classstk_1_1FileRead.html#7d6ba525b2f8ae693d953cb7f4b7c199" title="Return the file sample rate in Hz.">fileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileRate_; };
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#8eefe5d1479789c02ac2dfa76ba143f8" title="Read sample frames from the file into an StkFrames object.">read</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startFrame = 0, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keyword">protected</span>:
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Get STK RAW file information.</span>
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">bool</span> getRawInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
||||
<a name="l00107"></a>00107 StkFormat format, StkFloat rate );
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="comment">// Get WAV file header information.</span>
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">bool</span> getWavInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="comment">// Get SND (AU) file header information.</span>
|
||||
<a name="l00113"></a>00113 <span class="keywordtype">bool</span> getSndInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="comment">// Get AIFF file header information.</span>
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">bool</span> getAifInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Get MAT-file header information.</span>
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">bool</span> getMatInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 FILE *fd_;
|
||||
<a name="l00122"></a>00122 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00123"></a>00123 <span class="keywordtype">bool</span> wavFile_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fileSize_;
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dataOffset_;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00127"></a>00127 StkFormat dataType_;
|
||||
<a name="l00128"></a>00128 StkFloat fileRate_;
|
||||
<a name="l00129"></a>00129 };
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
105
doc/html/FileWrite_8h-source.html
Normal file
105
doc/html/FileWrite_8h-source.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWrite.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWRITE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWRITE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FileWrite.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a>00035 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FILE_TYPE;
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1FileWrite.html#c9e286cfc8037327eef493439e78f31e">00037</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#c9e286cfc8037327eef493439e78f31e">FILE_RAW</a>;
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">00038</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>;
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1FileWrite.html#1ae24c549fc9fa2c8ef4a6ff94ccc345">00039</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#1ae24c549fc9fa2c8ef4a6ff94ccc345">FILE_SND</a>;
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1FileWrite.html#678074f8bfa198627ed8ee9f52a42c0e">00040</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#678074f8bfa198627ed8ee9f52a42c0e">FILE_AIF</a>;
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1FileWrite.html#d06e073000f613c43c48707c724d104e">00041</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#d06e073000f613c43c48707c724d104e">FILE_MAT</a>;
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FileWrite.html#b362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1FileWrite.html#b362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWrite.html#c4da2511c8d0640ec5484f88bd704747" title="Class destructor.">~FileWrite</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#7575ddb275c902207b7b6518bb5a4ed9" title="Create a file of the specified type and name and output samples to it in the given...">open</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00060"></a>00060 FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#99a19988a4dd8d608b74421cfb6cbc69" title="If a file is open, write out samples in the queue and then close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWrite.html#636436624aa39eb5ba3401a9279a173e" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#d33ca8e729c14296af6dce457445832e" title="Write sample frames from the StkFrames object to the file.">write</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <span class="keyword">protected</span>:
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="comment">// Write STK RAW file header.</span>
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">bool</span> setRawFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="comment">// Write WAV file header.</span>
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">bool</span> setWavFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="comment">// Close WAV file, updating the header.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordtype">void</span> closeWavFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="comment">// Write SND (AU) file header.</span>
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">bool</span> setSndFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="comment">// Close SND file, updating the header.</span>
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> closeSndFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="comment">// Write AIFF file header.</span>
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">bool</span> setAifFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="comment">// Close AIFF file, updating the header.</span>
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">void</span> closeAifFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Write MAT-file header.</span>
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">bool</span> setMatFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// Close MAT-file, updating the header.</span>
|
||||
<a name="l00103"></a>00103 <span class="keywordtype">void</span> closeMatFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 FILE *fd_;
|
||||
<a name="l00106"></a>00106 FILE_TYPE fileType_;
|
||||
<a name="l00107"></a>00107 StkFormat dataType_;
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frameCounter_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
117
doc/html/FileWvIn_8h-source.html
Normal file
117
doc/html/FileWvIn_8h-source.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileRead.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1FileWvIn.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1FileWvIn.html#0562e85c4cb0d1565d9697da966add94" title="Default constructor.">FileWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1FileWvIn.html#0562e85c4cb0d1565d9697da966add94" title="Default constructor.">FileWvIn</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span>,
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1FileWvIn.html#d63f10df8795ce5cb6348b0bb1ad884e" title="Class destructor.">~FileWvIn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00069"></a>00069 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#7986664cd986cbacf4fb19e5c77deda1" title="Open the specified file and load its data.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#e586a93b45a979881d9bd6fc1cb364cb" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#c7dfd47e46a083d434e63c9d1b8c3d28" title="Clear outputs and reset time (file) pointer to zero.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00082"></a>00082 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aecd1950fca3a5513e0efe4e86754b11" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00089"></a>00089 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aecd1950fca3a5513e0efe4e86754b11" title="Normalize data to a maximum of +-1.0.">normalize</a>( StkFloat peak );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1FileWvIn.html#a8ef94c3ed01af0efc9e968f09207a26">00092</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileWvIn.html#a8ef94c3ed01af0efc9e968f09207a26" title="Return the file size in sample frames.">getSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1FileWvIn.html#867b7b7fdb60e5194e25d7a85a26ec0b">00100</a> <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#867b7b7fdb60e5194e25d7a85a26ec0b" title="Return the input file sample rate in Hz (not the data read rate).">getFileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00103"></a><a class="code" href="classstk_1_1FileWvIn.html#ca9ad0c12af3323e7bbf877513b0d10b">00103</a> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWvIn.html#ca9ad0c12af3323e7bbf877513b0d10b" title="Query whether reading is complete.">isFinished</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> finished_; };
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00109"></a>00109 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#acd97ad5f30f9cdc8201b4244aa69901" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00115"></a>00115 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#b2ccf7cc65c36a1ecfbb3b7d5707ea48" title="Increment the read pointer by time samples.">addTime</a>( StkFloat time );
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1FileWvIn.html#129c1e0b51497e6b09ad6aa37ad4d969">00124</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#129c1e0b51497e6b09ad6aa37ad4d969" title="Turn linear interpolation on/off.">setInterpolate</a>( <span class="keywordtype">bool</span> doInterpolate ) { interpolate_ = doInterpolate; };
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00136"></a>00136 StkFloat <a class="code" href="classstk_1_1FileWvIn.html#d17c12e8d51f90f59f0d0c9f6d626608" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00148"></a>00148 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#da668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00159"></a>00159 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FileWvIn.html#da668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="keyword">protected</span>:
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> file_;
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">bool</span> finished_;
|
||||
<a name="l00167"></a>00167 <span class="keywordtype">bool</span> interpolate_;
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">bool</span> normalizing_;
|
||||
<a name="l00169"></a>00169 <span class="keywordtype">bool</span> chunking_;
|
||||
<a name="l00170"></a>00170 StkFloat time_;
|
||||
<a name="l00171"></a>00171 StkFloat rate_;
|
||||
<a name="l00172"></a>00172 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold_;
|
||||
<a name="l00173"></a>00173 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize_;
|
||||
<a name="l00174"></a>00174 <span class="keywordtype">long</span> chunkPointer_;
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 };
|
||||
<a name="l00177"></a>00177
|
||||
<a name="l00178"></a><a class="code" href="classstk_1_1FileWvIn.html#d17c12e8d51f90f59f0d0c9f6d626608">00178</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#d17c12e8d51f90f59f0d0c9f6d626608" title="Return the specified channel value of the last computed frame.">FileWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00179"></a>00179 {
|
||||
<a name="l00180"></a>00180 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00181"></a>00181 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00182"></a>00182 errorString_ << <span class="stringliteral">"FileWvIn::lastOut(): channel argument and soundfile data are incompatible!"</span>;
|
||||
<a name="l00183"></a>00183 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185 <span class="preprocessor">#endif</span>
|
||||
<a name="l00186"></a>00186 <span class="preprocessor"></span>
|
||||
<a name="l00187"></a>00187 <span class="keywordflow">if</span> ( finished_ ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00189"></a>00189 }
|
||||
<a name="l00190"></a>00190
|
||||
<a name="l00191"></a>00191 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00192"></a>00192
|
||||
<a name="l00193"></a>00193 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
80
doc/html/FileWvOut_8h-source.html
Normal file
80
doc/html/FileWvOut_8h-source.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWrite.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1FileWvOut.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWvOut.html" title="STK audio file output class.">FileWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1FileWvOut.html#6f0168fca20a3c9d6d5f2baedf03ec1b" title="Default constructor with optional output buffer size argument.">FileWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames = 1024 );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1FileWvOut.html#6f0168fca20a3c9d6d5f2baedf03ec1b" title="Default constructor with optional output buffer size argument.">FileWvOut</a>( std::string fileName,
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00049"></a>00049 FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">FileWrite::FILE_WAV</a>,
|
||||
<a name="l00050"></a>00050 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames = 1024 );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWvOut.html#dd13d21d51f639961977b63cb481c36e" title="Class destructor.">~FileWvOut</a>();
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#31dde577d41a65018c3e03001de8d645" title="Open a new file with the specified parameters.">openFile</a>( std::string fileName,
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
||||
<a name="l00064"></a>00064 FileWrite::FILE_TYPE type,
|
||||
<a name="l00065"></a>00065 Stk::StkFormat format );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#54cbced5ce278b0d16fa800e8445103c" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#9d3505aea3cd3c4d6822f05a2679dc41" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#9d3505aea3cd3c4d6822f05a2679dc41" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="keyword">protected</span>:
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> incrementFrame( <span class="keywordtype">void</span> );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> file_;
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames_;
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferIndex_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iData_;
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,66 +6,77 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Filter.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILTER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILTER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Filter.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Filter.html#fc70117c0133d4a5d9a651ceb691d7c0">00025</a> <a class="code" href="classstk_1_1Filter.html#fc70117c0133d4a5d9a651ceb691d7c0" title="Class constructor.">Filter</a>( <span class="keywordtype">void</span> ) { gain_ = 1.0; channelsIn_ = 1; lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Filter.html#48f23ab6613be35e3be8aceaf5adfdd7">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#48f23ab6613be35e3be8aceaf5adfdd7" title="Return the number of input channels for the class.">channelsIn</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channelsIn_; };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Filter.html#4f1ed97c9ad8aef32e54b48da03f5275">00031</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#4f1ed97c9ad8aef32e54b48da03f5275" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1Filter.html#827b1bd3a99fa9af408cbd4eb559d212">00041</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#827b1bd3a99fa9af408cbd4eb559d212" title="Set the filter gain.">setGain</a>( StkFloat gain ) { gain_ = gain; };
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a><a class="code" href="classstk_1_1Filter.html#f21e11b72ea59af4585c59600a0980c2">00044</a> StkFloat <a class="code" href="classstk_1_1Filter.html#f21e11b72ea59af4585c59600a0980c2" title="Return the current filter gain.">getGain</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> gain_; };
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a><a class="code" href="classstk_1_1Filter.html#b2d944f649693511dced1df249f0abe6">00047</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Filter.html#b2d944f649693511dced1df249f0abe6" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00058"></a>00058 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Filter.html#3260a238824c4a748ac057b84b7d3f21" title="Take a channel of the StkFrames object as inputs to the filter and replace with corresponding...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a>00060 <span class="keyword">protected</span>:
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channelsIn_;
|
||||
<a name="l00063"></a>00063 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 StkFloat gain_;
|
||||
<a name="l00066"></a>00066 std::vector<StkFloat> b_;
|
||||
<a name="l00067"></a>00067 std::vector<StkFloat> a_;
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> outputs_;
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> inputs_;
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Filter.html#670b9cc23ac798d3239cb819e801363c">00073</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">Filter :: clear</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">for</span> ( i=0; i<inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00077"></a>00077 inputs_[i] = 0.0;
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">for</span> ( i=0; i<outputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00079"></a>00079 outputs_[i] = 0.0;
|
||||
<a name="l00080"></a>00080 <span class="keywordflow">for</span> ( i=0; i<lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00081"></a>00081 lastFrame_[i] = 0.0;
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Filter.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00028 <span class="comment">/***************************************************/</span>
|
||||
00029
|
||||
00030 <span class="preprocessor">#if !defined(__FILTER_H)</span>
|
||||
00031 <span class="preprocessor"></span><span class="preprocessor">#define __FILTER_H</span>
|
||||
00032 <span class="preprocessor"></span>
|
||||
00033 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00034
|
||||
<a name="l00035"></a><a class="code" href="classFilter.html">00035</a> <span class="keyword">class </span><a class="code" href="classFilter.html">Filter</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00036 {
|
||||
00037 <span class="keyword">public</span>:
|
||||
00039 <a class="code" href="classFilter.html#a0">Filter</a>(<span class="keywordtype">void</span>);
|
||||
00040
|
||||
00042
|
||||
00046 <a class="code" href="classFilter.html#a0">Filter</a>(<span class="keywordtype">int</span> nb, MY_FLOAT *bCoefficients, <span class="keywordtype">int</span> na, MY_FLOAT *aCoefficients);
|
||||
00047
|
||||
00049 <span class="keyword">virtual</span> <a class="code" href="classFilter.html#a2">~Filter</a>(<span class="keywordtype">void</span>);
|
||||
00050
|
||||
00052 <span class="keywordtype">void</span> <a class="code" href="classFilter.html#a3">clear</a>(<span class="keywordtype">void</span>);
|
||||
00053
|
||||
00055
|
||||
00060 <span class="keywordtype">void</span> <a class="code" href="classFilter.html#a4">setCoefficients</a>(<span class="keywordtype">int</span> nb, MY_FLOAT *bCoefficients, <span class="keywordtype">int</span> na, MY_FLOAT *aCoefficients);
|
||||
00061
|
||||
00063
|
||||
00069 <span class="keywordtype">void</span> <a class="code" href="classFilter.html#a5">setNumerator</a>(<span class="keywordtype">int</span> nb, MY_FLOAT *bCoefficients);
|
||||
00070
|
||||
00072
|
||||
00080 <span class="keywordtype">void</span> <a class="code" href="classFilter.html#a6">setDenominator</a>(<span class="keywordtype">int</span> na, MY_FLOAT *aCoefficients);
|
||||
00081
|
||||
00083
|
||||
00087 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classFilter.html#a7">setGain</a>(MY_FLOAT theGain);
|
||||
00088
|
||||
00090 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classFilter.html#a8">getGain</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00091
|
||||
00093 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classFilter.html#a9">lastOut</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00094
|
||||
00096 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classFilter.html#a10">tick</a>(MY_FLOAT sample);
|
||||
00097
|
||||
00099 <span class="keyword">virtual</span> MY_FLOAT *<a class="code" href="classFilter.html#a10">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00100
|
||||
00101 <span class="keyword">protected</span>:
|
||||
00102 MY_FLOAT gain;
|
||||
00103 <span class="keywordtype">int</span> nB;
|
||||
00104 <span class="keywordtype">int</span> nA;
|
||||
00105 MY_FLOAT *b;
|
||||
00106 MY_FLOAT *a;
|
||||
00107 MY_FLOAT *outputs;
|
||||
00108 MY_FLOAT *inputs;
|
||||
00109
|
||||
00110 };
|
||||
00111
|
||||
00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
131
doc/html/Fir_8h-source.html
Normal file
131
doc/html/Fir_8h-source.html
Normal file
@@ -0,0 +1,131 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Fir.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FIR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FIR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00028"></a>00028 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Fir.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Fir.html" title="STK general finite impulse response filter class.">Fir</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00031"></a>00031 {
|
||||
<a name="l00032"></a>00032 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1Fir.html#4ad986b7f644d3e22e75b0744b2f948a" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Fir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Fir.html#4ad986b7f644d3e22e75b0744b2f948a" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Fir</a>( std::vector<StkFloat> &coefficients );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Fir.html#2a9db698672fcac97a77d95f3891b68f" title="Class destructor.">~Fir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Fir.html#a3f72042fb8b13e9dcc31acbff4e1672" title="Set filter coefficients.">setCoefficients</a>( std::vector<StkFloat> &coefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Fir.html#5182288d564977bf172439f6ecaf2377">00055</a> StkFloat <a class="code" href="classstk_1_1Fir.html#5182288d564977bf172439f6ecaf2377" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keyword">protected</span>:
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 };
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a><a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793">00086</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( StkFloat input )
|
||||
<a name="l00087"></a>00087 {
|
||||
<a name="l00088"></a>00088 lastFrame_[0] = 0.0;
|
||||
<a name="l00089"></a>00089 inputs_[0] = gain_ * input;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00092"></a>00092 lastFrame_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00093"></a>00093 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 lastFrame_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1Fir.html#602e5ce0cd93f5103796ffd50ed8c988">00100</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00104"></a>00104 errorString_ << <span class="stringliteral">"Fir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00109"></a>00109 StkFloat *samples = &frames[channel];
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, samples += hop ) {
|
||||
<a name="l00112"></a>00112 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00113"></a>00113 *samples = 0.0;
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00116"></a>00116 *samples += b_[i] * inputs_[i];
|
||||
<a name="l00117"></a>00117 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 *samples += b_[0] * inputs_[0];
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00124"></a>00124 }
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a><a class="code" href="classstk_1_1Fir.html#53bcdfc2e9ad757d2ec549529b7a9738">00126</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00127"></a>00127 {
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00130"></a>00130 errorString_ << <span class="stringliteral">"Fir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00131"></a>00131 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
<a name="l00134"></a>00134 <span class="preprocessor"></span>
|
||||
<a name="l00135"></a>00135 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00136"></a>00136 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00139"></a>00139 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00140"></a>00140 *oSamples = 0.0;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00143"></a>00143 *oSamples += b_[i] * inputs_[i];
|
||||
<a name="l00144"></a>00144 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146 *oSamples += b_[0] * inputs_[0];
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,80 +6,111 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Flute.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FLUTE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FLUTE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "JetTable.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Flute.html">00039</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Flute.html" title="STK flute physical model class.">Flute</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00040"></a>00040 {
|
||||
<a name="l00041"></a>00041 <span class="keyword">public</span>:
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1Flute.html#9769eef3340651acc31b4997e9985e57" title="Class constructor, taking the lowest desired playing frequency.">Flute</a>( StkFloat lowestFrequency );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1Flute.html#76120aedfc0bab94416917d173f8a74e" title="Class destructor.">~Flute</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#4554fc4feffd469b83d02dd4e5471ffa" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#ea66780681552de9d12af6bb91f297da" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#0732403c66b3667f5f6a8c80e90046e0" title="Set the reflection coefficient for the jet delay (-1.0 - 1.0).">setJetReflection</a>( StkFloat coefficient );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#7c0ef95a3170dafde08b65ee47102969" title="Set the reflection coefficient for the air column delay (-1.0 - 1.0).">setEndReflection</a>( StkFloat coefficient );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#d37a862df945987f91e3164813ce911b" title="Set the length of the jet delay in terms of a ratio of jet delay to air column delay...">setJetDelay</a>( StkFloat aRatio );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#33b58e80c6ebbd5bd45f90a7a1c6a025" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#65b8e74b1a99bc8bada4e80ebd512058" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#f76a46645fd6ed5d3c15dc4bcde3d928" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#e371e0d2366ef9fae8d12898204e7b31" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#968b3799338e39df35dcf94fe7ee90a2" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 StkFloat <a class="code" href="classstk_1_1Flute.html#b8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> jetDelay_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> boreDelay_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00095"></a>00095 StkFloat lastFrequency_;
|
||||
<a name="l00096"></a>00096 StkFloat maxPressure_;
|
||||
<a name="l00097"></a>00097 StkFloat jetReflection_;
|
||||
<a name="l00098"></a>00098 StkFloat endReflection_;
|
||||
<a name="l00099"></a>00099 StkFloat noiseGain_;
|
||||
<a name="l00100"></a>00100 StkFloat vibratoGain_;
|
||||
<a name="l00101"></a>00101 StkFloat outputGain_;
|
||||
<a name="l00102"></a>00102 StkFloat jetRatio_;
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 };
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1Flute.html#b8f307f9a26ef2756ec4c0ea05f3acbe">00106</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Flute.html#b8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">Flute :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 StkFloat pressureDiff;
|
||||
<a name="l00109"></a>00109 StkFloat breathPressure;
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00112"></a>00112 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113 breathPressure += breathPressure * ( noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>() + vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 StkFloat temp = filter_.<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( boreDelay_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00116"></a>00116 temp = dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( temp ); <span class="comment">// Block DC on reflection.</span>
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 pressureDiff = breathPressure - (jetReflection_ * temp);
|
||||
<a name="l00119"></a>00119 pressureDiff = jetDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00120"></a>00120 pressureDiff = jetTable_.<a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) + (endReflection_ * temp);
|
||||
<a name="l00121"></a>00121 lastFrame_[0] = (StkFloat) 0.3 * boreDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Flute.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00023 <span class="comment">/***************************************************/</span>
|
||||
00024
|
||||
00025 <span class="preprocessor">#if !defined(__FLUTE_H)</span>
|
||||
00026 <span class="preprocessor"></span><span class="preprocessor">#define __FLUTE_H</span>
|
||||
00027 <span class="preprocessor"></span>
|
||||
00028 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00029 <span class="preprocessor">#include "JetTabl.h"</span>
|
||||
00030 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
00031 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
00032 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
00033 <span class="preprocessor">#include "Noise.h"</span>
|
||||
00034 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
00035 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00036
|
||||
<a name="l00037"></a><a class="code" href="classFlute.html">00037</a> <span class="keyword">class </span><a class="code" href="classFlute.html">Flute</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00038 {
|
||||
00039 <span class="keyword">public</span>:
|
||||
00041 <a class="code" href="classFlute.html#a0">Flute</a>(MY_FLOAT lowestFrequency);
|
||||
00042
|
||||
00044 <a class="code" href="classFlute.html#a1">~Flute</a>();
|
||||
00045
|
||||
00047 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a2">clear</a>();
|
||||
00048
|
||||
00050 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a3">setFrequency</a>(MY_FLOAT frequency);
|
||||
00051
|
||||
00053 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a4">setJetReflection</a>(MY_FLOAT coefficient);
|
||||
00054
|
||||
00056 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a5">setEndReflection</a>(MY_FLOAT coefficient);
|
||||
00057
|
||||
00059 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a6">setJetDelay</a>(MY_FLOAT aRatio);
|
||||
00060
|
||||
00062 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a7">startBlowing</a>(MY_FLOAT amplitude, MY_FLOAT rate);
|
||||
00063
|
||||
00065 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a8">stopBlowing</a>(MY_FLOAT rate);
|
||||
00066
|
||||
00068 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a9">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00069
|
||||
00071 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a10">noteOff</a>(MY_FLOAT amplitude);
|
||||
00072
|
||||
00074 MY_FLOAT <a class="code" href="classFlute.html#a11">tick</a>();
|
||||
00075
|
||||
00077 <span class="keywordtype">void</span> <a class="code" href="classFlute.html#a12">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00078
|
||||
00079 <span class="keyword">protected</span>:
|
||||
00080 <a class="code" href="classDelayL.html">DelayL</a> *jetDelay;
|
||||
00081 <a class="code" href="classDelayL.html">DelayL</a> *boreDelay;
|
||||
00082 <a class="code" href="classJetTabl.html">JetTabl</a> *jetTable;
|
||||
00083 <a class="code" href="classOnePole.html">OnePole</a> *filter;
|
||||
00084 <a class="code" href="classPoleZero.html">PoleZero</a> *dcBlock;
|
||||
00085 <a class="code" href="classNoise.html">Noise</a> *noise;
|
||||
00086 <a class="code" href="classADSR.html">ADSR</a> *adsr;
|
||||
00087 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00088 <span class="keywordtype">long</span> length;
|
||||
00089 MY_FLOAT lastFrequency;
|
||||
00090 MY_FLOAT maxPressure;
|
||||
00091 MY_FLOAT jetReflection;
|
||||
00092 MY_FLOAT endReflection;
|
||||
00093 MY_FLOAT noiseGain;
|
||||
00094 MY_FLOAT vibratoGain;
|
||||
00095 MY_FLOAT outputGain;
|
||||
00096 MY_FLOAT jetRatio;
|
||||
00097
|
||||
00098 };
|
||||
00099
|
||||
00100 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,66 +6,150 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FormSwep.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FORMSWEP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FORMSWEP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1FormSwep.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FormSwep.html" title="STK sweepable formant filter class.">FormSwep</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1FormSwep.html#eb0093d5962acf4b5d582730e8c8bab9" title="Default constructor creates a second-order pass-through filter.">FormSwep</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1FormSwep.html#c02cd2882f67e8ed9c315dfbf10b05a9" title="Class destructor.">~FormSwep</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FormSwep.html#91096ebd684df25fc36a759f642b2200">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#91096ebd684df25fc36a759f642b2200" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#3aede7b088dbe2ca98b3398a5f953ae7" title="Set both the current and target resonance parameters.">setStates</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#2f00d2edf80fbf8f74a284c68caf07d6" title="Set target resonance parameters.">setTargets</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#27ba31acdbe8334da1830e14872fd226" title="Set the sweep rate (between 0.0 - 1.0).">setSweepRate</a>( StkFloat rate );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#242edcbe2a6f88393357b5a5ccec43e8" title="Set the sweep rate in terms of a time value in seconds.">setSweepTime</a>( StkFloat time );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1FormSwep.html#3d8405c24e8539b389daf86fccfe5d70">00073</a> StkFloat <a class="code" href="classstk_1_1FormSwep.html#3d8405c24e8539b389daf86fccfe5d70" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">bool</span> dirty_;
|
||||
<a name="l00105"></a>00105 StkFloat frequency_;
|
||||
<a name="l00106"></a>00106 StkFloat radius_;
|
||||
<a name="l00107"></a>00107 StkFloat startFrequency_;
|
||||
<a name="l00108"></a>00108 StkFloat startRadius_;
|
||||
<a name="l00109"></a>00109 StkFloat startGain_;
|
||||
<a name="l00110"></a>00110 StkFloat targetFrequency_;
|
||||
<a name="l00111"></a>00111 StkFloat targetRadius_;
|
||||
<a name="l00112"></a>00112 StkFloat targetGain_;
|
||||
<a name="l00113"></a>00113 StkFloat deltaFrequency_;
|
||||
<a name="l00114"></a>00114 StkFloat deltaRadius_;
|
||||
<a name="l00115"></a>00115 StkFloat deltaGain_;
|
||||
<a name="l00116"></a>00116 StkFloat sweepState_;
|
||||
<a name="l00117"></a>00117 StkFloat sweepRate_;
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 };
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774">00121</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( StkFloat input )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">if</span> ( dirty_ ) {
|
||||
<a name="l00124"></a>00124 sweepState_ += sweepRate_;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( sweepState_ >= 1.0 ) {
|
||||
<a name="l00126"></a>00126 sweepState_ = 1.0;
|
||||
<a name="l00127"></a>00127 dirty_ = <span class="keyword">false</span>;
|
||||
<a name="l00128"></a>00128 radius_ = targetRadius_;
|
||||
<a name="l00129"></a>00129 frequency_ = targetFrequency_;
|
||||
<a name="l00130"></a>00130 gain_ = targetGain_;
|
||||
<a name="l00131"></a>00131 }
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">else</span> {
|
||||
<a name="l00133"></a>00133 radius_ = startRadius_ + (deltaRadius_ * sweepState_);
|
||||
<a name="l00134"></a>00134 frequency_ = startFrequency_ + (deltaFrequency_ * sweepState_);
|
||||
<a name="l00135"></a>00135 gain_ = startGain_ + (deltaGain_ * sweepState_);
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 this-><a class="code" href="classstk_1_1FormSwep.html#a6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( frequency_, radius_ );
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 inputs_[0] = gain_ * input;
|
||||
<a name="l00141"></a>00141 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00142"></a>00142 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00143"></a>00143 inputs_[2] = inputs_[1];
|
||||
<a name="l00144"></a>00144 inputs_[1] = inputs_[0];
|
||||
<a name="l00145"></a>00145 outputs_[2] = outputs_[1];
|
||||
<a name="l00146"></a>00146 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a><a class="code" href="classstk_1_1FormSwep.html#27f68dc2bb3fa41322ae49cf59cc9884">00151</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00152"></a>00152 {
|
||||
<a name="l00153"></a>00153 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00155"></a>00155 errorString_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span>
|
||||
<a name="l00160"></a>00160 StkFloat *samples = &frames[channel];
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00163"></a>00163 *samples = <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *samples );
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a><a class="code" href="classstk_1_1FormSwep.html#8a16af2b4e169946cedb8fec2bb1417a">00168</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00169"></a>00169 {
|
||||
<a name="l00170"></a>00170 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00171"></a>00171 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00172"></a>00172 errorString_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00173"></a>00173 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00174"></a>00174 }
|
||||
<a name="l00175"></a>00175 <span class="preprocessor">#endif</span>
|
||||
<a name="l00176"></a>00176 <span class="preprocessor"></span>
|
||||
<a name="l00177"></a>00177 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00178"></a>00178 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00179"></a>00179 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00180"></a>00180 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00181"></a>00181 *oSamples = <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *iSamples );
|
||||
<a name="l00182"></a>00182
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a>00186 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>FormSwep.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00013 <span class="comment">/***************************************************/</span>
|
||||
00014
|
||||
00015 <span class="preprocessor">#if !defined(__FORMSWEP_H)</span>
|
||||
00016 <span class="preprocessor"></span><span class="preprocessor">#define __FORMSWEP_H</span>
|
||||
00017 <span class="preprocessor"></span>
|
||||
00018 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
00019
|
||||
<a name="l00020"></a><a class="code" href="classFormSwep.html">00020</a> <span class="keyword">class </span><a class="code" href="classFormSwep.html">FormSwep</a> : <span class="keyword">public</span> <a class="code" href="classBiQuad.html">BiQuad</a>
|
||||
00021 {
|
||||
00022 <span class="keyword">public</span>:
|
||||
00023
|
||||
00025 <a class="code" href="classFormSwep.html#a0">FormSwep</a>();
|
||||
00026
|
||||
00028 <a class="code" href="classFormSwep.html#a1">~FormSwep</a>();
|
||||
00029
|
||||
00031
|
||||
00042 <span class="keywordtype">void</span> <a class="code" href="classFormSwep.html#a2">setResonance</a>(MY_FLOAT aFrequency, MY_FLOAT aRadius);
|
||||
00043
|
||||
00045 <span class="keywordtype">void</span> <a class="code" href="classFormSwep.html#a3">setStates</a>(MY_FLOAT aFrequency, MY_FLOAT aRadius, MY_FLOAT aGain = 1.0);
|
||||
00046
|
||||
00048 <span class="keywordtype">void</span> <a class="code" href="classFormSwep.html#a4">setTargets</a>(MY_FLOAT aFrequency, MY_FLOAT aRadius, MY_FLOAT aGain = 1.0);
|
||||
00049
|
||||
00051
|
||||
00059 <span class="keywordtype">void</span> <a class="code" href="classFormSwep.html#a5">setSweepRate</a>(MY_FLOAT aRate);
|
||||
00060
|
||||
00062
|
||||
00067 <span class="keywordtype">void</span> <a class="code" href="classFormSwep.html#a6">setSweepTime</a>(MY_FLOAT aTime);
|
||||
00068
|
||||
00070 MY_FLOAT <a class="code" href="classFormSwep.html#a7">tick</a>(MY_FLOAT sample);
|
||||
00071
|
||||
00073 MY_FLOAT *<a class="code" href="classFormSwep.html#a7">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00074
|
||||
00075 <span class="keyword">protected</span>:
|
||||
00076 <span class="keywordtype">bool</span> dirty;
|
||||
00077 MY_FLOAT frequency;
|
||||
00078 MY_FLOAT radius;
|
||||
00079 MY_FLOAT startFrequency;
|
||||
00080 MY_FLOAT startRadius;
|
||||
00081 MY_FLOAT startGain;
|
||||
00082 MY_FLOAT targetFrequency;
|
||||
00083 MY_FLOAT targetRadius;
|
||||
00084 MY_FLOAT targetGain;
|
||||
00085 MY_FLOAT deltaFrequency;
|
||||
00086 MY_FLOAT deltaRadius;
|
||||
00087 MY_FLOAT deltaGain;
|
||||
00088 MY_FLOAT sweepState;
|
||||
00089 MY_FLOAT sweepRate;
|
||||
00090
|
||||
00091 };
|
||||
00092
|
||||
00093 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
53
doc/html/Function_8h-source.html
Normal file
53
doc/html/Function_8h-source.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Function.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FUNCTION_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FUNCTION_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Function.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Function.html#21648ab236a66f3f0155bdb911f9f3c3">00024</a> <a class="code" href="classstk_1_1Function.html#21648ab236a66f3f0155bdb911f9f3c3" title="Class constructor.">Function</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1Function.html#e79bd6d0c9f53693b4ca28948d94fc25">00027</a> StkFloat <a class="code" href="classstk_1_1Function.html#e79bd6d0c9f53693b4ca28948d94fc25" title="Return the last computed output sample.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00030"></a>00030 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Function.html#2545fede83a8afcbe11b3bcf3e4d9f42" title="Take one sample input and compute one sample of output.">tick</a>( StkFloat input ) = 0;
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a>00032 <span class="keyword">protected</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00036"></a>00036 };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a>00040 <span class="preprocessor">#endif</span>
|
||||
<a name="l00041"></a>00041 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
55
doc/html/Generator_8h-source.html
Normal file
55
doc/html/Generator_8h-source.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Generator.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GENERATOR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GENERATOR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Generator.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Generator.html#c7f11d287fb903b04985c2f81dbf9a5d">00025</a> <a class="code" href="classstk_1_1Generator.html#c7f11d287fb903b04985c2f81dbf9a5d" title="Class constructor.">Generator</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Generator.html#9f9de4c495217ef8490a9d2d1fdabe11">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Generator.html#9f9de4c495217ef8490a9d2d1fdabe11" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Generator.html#499ad65aa6d939983863ffb922008654">00031</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Generator.html#499ad65aa6d939983863ffb922008654" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00041"></a>00041 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Generator.html#86bb0421223cf27e25704d5f27b97425" title="Fill the StkFrames object with computed sample frames, starting at the specified...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a>00043 <span class="keyword">protected</span>:
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00046"></a>00046 };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00048"></a>00048 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a>00050 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/Granulate_8h-source.html
Normal file
156
doc/html/Granulate_8h-source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Granulate.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GRANULATE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GRANULATE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00010"></a>00010
|
||||
<a name="l00011"></a>00011 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Granulate.html">00028</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Granulate.html" title="STK granular synthesis class.">Granulate</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00029"></a>00029 {
|
||||
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1Granulate.html#78af615a331de9b643dfabb8e106883f" title="Default constructor.">Granulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1Granulate.html#78af615a331de9b643dfabb8e106883f" title="Default constructor.">Granulate</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nVoices, std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Granulate.html#42eb1f39bd88eb8d4ca55972e7711313" title="Class destructor.">~Granulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#6227f127a77b4fc581028033cd7658d8" title="Load a monophonic soundfile to be &quot;granulated&quot;.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#9b7b17ae856f3a9ece6ec462285f456c" title="Reset the file pointer and all existing grains to the file start.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#735f3ebe8fa2cacfba2c4722a56fd417" title="Set the number of simultaneous grain &quot;voices&quot; to use.">setVoices</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nVoices = 1 );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#abd711f2b71bbcd28412d5cb73c085d6" title="Set the stretch factor used for grain playback (1 - 1000).">setStretch</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchFactor = 1 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#9b7c15080256f920646d36bfa0ed3734" title="Set global grain parameters used to determine individual grain settings.">setGrainParameters</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> duration = 30, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rampPercent = 50,
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">int</span> offset = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> delay = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#02b7b85f21999d4b350beff6a925bd25" title="This factor is used when setting individual grain parameters (0.0 - 1.0).">setRandomFactor</a>( StkFloat randomness = 0.1 );
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00110"></a>00110 StkFloat <a class="code" href="classstk_1_1Granulate.html#60db060a365fc32fe789cb9bcd042dd3" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00113"></a>00113 StkFloat <a class="code" href="classstk_1_1Granulate.html#0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00123"></a>00123 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Granulate.html#0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <span class="keyword">enum</span> GrainState {
|
||||
<a name="l00126"></a>00126 GRAIN_STOPPED,
|
||||
<a name="l00127"></a>00127 GRAIN_FADEIN,
|
||||
<a name="l00128"></a>00128 GRAIN_SUSTAIN,
|
||||
<a name="l00129"></a>00129 GRAIN_FADEOUT
|
||||
<a name="l00130"></a>00130 };
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="keyword">protected</span>:
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keyword">struct </span>Grain {
|
||||
<a name="l00135"></a>00135 StkFloat eScaler;
|
||||
<a name="l00136"></a>00136 StkFloat eRate;
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> attackCount;
|
||||
<a name="l00138"></a>00138 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> sustainCount;
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> decayCount;
|
||||
<a name="l00140"></a>00140 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delayCount;
|
||||
<a name="l00141"></a>00141 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> counter;
|
||||
<a name="l00142"></a>00142 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> pointer;
|
||||
<a name="l00143"></a>00143 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startPointer;
|
||||
<a name="l00144"></a>00144 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> repeats;
|
||||
<a name="l00145"></a>00145 GrainState state;
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00148"></a>00148 Grain()
|
||||
<a name="l00149"></a>00149 :eScaler(0.0), eRate(0.0), attackCount(0), sustainCount(0), decayCount(0),
|
||||
<a name="l00150"></a>00150 delayCount(0), counter(0), pointer(0), startPointer(0), repeats(0), state(GRAIN_STOPPED) {}
|
||||
<a name="l00151"></a>00151 };
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <span class="keywordtype">void</span> calculateGrain( Granulate::Grain& grain );
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data_;
|
||||
<a name="l00156"></a>00156 std::vector<Grain> grains_;
|
||||
<a name="l00157"></a>00157 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise;
|
||||
<a name="l00158"></a>00158 <span class="keywordtype">long</span> gPointer_;
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 <span class="comment">// Global grain parameters.</span>
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDuration_;
|
||||
<a name="l00162"></a>00162 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gRampPercent_;
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDelay_;
|
||||
<a name="l00164"></a>00164 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gStretch_;
|
||||
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchCounter_;
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">int</span> gOffset_;
|
||||
<a name="l00167"></a>00167 StkFloat gRandomFactor_;
|
||||
<a name="l00168"></a>00168 StkFloat gain_;
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 };
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a><a class="code" href="classstk_1_1Granulate.html#60db060a365fc32fe789cb9bcd042dd3">00172</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Granulate.html#60db060a365fc32fe789cb9bcd042dd3" title="Return the specified channel value of the last computed frame.">Granulate :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00173"></a>00173 {
|
||||
<a name="l00174"></a>00174 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00175"></a>00175 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00176"></a>00176 errorString_ << <span class="stringliteral">"Granulate::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00177"></a>00177 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179 <span class="preprocessor">#endif</span>
|
||||
<a name="l00180"></a>00180 <span class="preprocessor"></span>
|
||||
<a name="l00181"></a>00181 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00182"></a>00182 }
|
||||
<a name="l00183"></a>00183
|
||||
<a name="l00184"></a><a class="code" href="classstk_1_1Granulate.html#a9cc119b1515c5596a95d72f4b65b0c0">00184</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Granulate.html#0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">Granulate :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00185"></a>00185 {
|
||||
<a name="l00186"></a>00186 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00187"></a>00187 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00188"></a>00188 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00189"></a>00189 errorString_ << <span class="stringliteral">"Granulate::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00190"></a>00190 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00191"></a>00191 }
|
||||
<a name="l00192"></a>00192 <span class="preprocessor">#endif</span>
|
||||
<a name="l00193"></a>00193 <span class="preprocessor"></span>
|
||||
<a name="l00194"></a>00194 StkFloat *samples = &frames[channel];
|
||||
<a name="l00195"></a>00195 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00196"></a>00196 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00197"></a>00197 *samples++ = <a class="code" href="classstk_1_1Granulate.html#0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00198"></a>00198 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00199"></a>00199 *samples++ = lastFrame_[j];
|
||||
<a name="l00200"></a>00200 }
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00203"></a>00203 }
|
||||
<a name="l00204"></a>00204
|
||||
<a name="l00205"></a>00205 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00206"></a>00206
|
||||
<a name="l00207"></a>00207 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,35 +6,74 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>HevyMetl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_HEVYMETL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_HEVYMETL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1HevyMetl.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1HevyMetl.html" title="STK heavy metal FM synthesis instrument.">HevyMetl</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1HevyMetl.html#61e000b4c2a8ba021e43e8074be44390" title="Class constructor.">HevyMetl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1HevyMetl.html#03b76a27541928bf9e7d156f9709a8f0" title="Class destructor.">~HevyMetl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1HevyMetl.html#a7401a5cb44a69edaad304aac41b6eda" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 StkFloat <a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00056"></a>00056 <span class="keyword">protected</span>:
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00058"></a>00058 };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a><a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7">00060</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">HevyMetl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00061"></a>00061 {
|
||||
<a name="l00062"></a>00062 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 temp = vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.2;
|
||||
<a name="l00065"></a>00065 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
||||
<a name="l00066"></a>00066 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
||||
<a name="l00067"></a>00067 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
||||
<a name="l00068"></a>00068 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 temp = gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00071"></a>00071 waves_[1]->addPhaseOffset( temp );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00074"></a>00074 temp = (1.0 - (control2_ * 0.5)) * gains_[3] * adsr_[3]-><a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>() * waves_[3]->tick();
|
||||
<a name="l00075"></a>00075 twozero_.<a class="code" href="classstk_1_1TwoZero.html#cf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00078"></a>00078 temp = temp * control1_;
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 waves_[0]->addPhaseOffset( temp );
|
||||
<a name="l00081"></a>00081 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00084"></a>00084 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>HevyMetl.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00029 <span class="comment">/***************************************************/</span>
|
||||
00030
|
||||
00031 <span class="preprocessor">#if !defined(__HEVYMETL_H)</span>
|
||||
00032 <span class="preprocessor"></span><span class="preprocessor">#define __HEVYMETL_H</span>
|
||||
00033 <span class="preprocessor"></span>
|
||||
00034 <span class="preprocessor">#include "FM.h"</span>
|
||||
00035
|
||||
<a name="l00036"></a><a class="code" href="classHevyMetl.html">00036</a> <span class="keyword">class </span><a class="code" href="classHevyMetl.html">HevyMetl</a> : <span class="keyword">public</span> <a class="code" href="classFM.html">FM</a>
|
||||
00037 {
|
||||
00038 <span class="keyword">public</span>:
|
||||
00040 <a class="code" href="classHevyMetl.html#a0">HevyMetl</a>();
|
||||
00041
|
||||
00043 <a class="code" href="classHevyMetl.html#a1">~HevyMetl</a>();
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classHevyMetl.html#a2">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00047
|
||||
00049 MY_FLOAT <a class="code" href="classHevyMetl.html#a3">tick</a>();
|
||||
00050 };
|
||||
00051
|
||||
00052 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
156
doc/html/Iir_8h-source.html
Normal file
156
doc/html/Iir_8h-source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Iir.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_IIR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_IIR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Iir.html">00034</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Iir.html" title="STK general infinite impulse response filter class.">Iir</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00035"></a>00035 {
|
||||
<a name="l00036"></a>00036 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Iir.html#1d63797b4caf775de8d351ec0c15a4c0" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Iir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Iir.html#1d63797b4caf775de8d351ec0c15a4c0" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Iir</a>( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Iir.html#c15361cbfa19e6e4f73a155abc1459a8" title="Class destructor.">~Iir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#a0249b92dcec86ae83688debedb8d95b" title="Set filter coefficients.">setCoefficients</a>( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#7a1473446857a14cdbb33cb5afde076c" title="Set numerator coefficients.">setNumerator</a>( std::vector<StkFloat> &bCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#e67cc04a452edfbd80f1a27097ea0187" title="Set denominator coefficients.">setDenominator</a>( std::vector<StkFloat> &aCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1Iir.html#5dcae9330f2c52d2bfa1647e6b250a14">00083</a> StkFloat <a class="code" href="classstk_1_1Iir.html#5dcae9330f2c52d2bfa1647e6b250a14" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 StkFloat <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00108"></a>00108 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="keyword">protected</span>:
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( StkFloat input )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 outputs_[0] = 0.0;
|
||||
<a name="l00119"></a>00119 inputs_[0] = gain_ * input;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00121"></a>00121 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00122"></a>00122 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00127"></a>00127 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00128"></a>00128 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = outputs_[0];
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a><a class="code" href="classstk_1_1Iir.html#d03f40e022b2adfe942d30908ec34793">00135</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00136"></a>00136 {
|
||||
<a name="l00137"></a>00137 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00138"></a>00138 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00139"></a>00139 errorString_ << <span class="stringliteral">"Iir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00140"></a>00140 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#endif</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span>
|
||||
<a name="l00144"></a>00144 StkFloat *samples = &frames[channel];
|
||||
<a name="l00145"></a>00145 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, samples += hop ) {
|
||||
<a name="l00147"></a>00147 outputs_[0] = 0.0;
|
||||
<a name="l00148"></a>00148 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00150"></a>00150 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00151"></a>00151 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00156"></a>00156 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00157"></a>00157 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 *samples = outputs_[0];
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00165"></a>00165 }
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a><a class="code" href="classstk_1_1Iir.html#60919d8e000bf83613bdd5e002d750f1">00167</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00168"></a>00168 {
|
||||
<a name="l00169"></a>00169 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00170"></a>00170 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00171"></a>00171 errorString_ << <span class="stringliteral">"Iir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00172"></a>00172 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00173"></a>00173 }
|
||||
<a name="l00174"></a>00174 <span class="preprocessor">#endif</span>
|
||||
<a name="l00175"></a>00175 <span class="preprocessor"></span>
|
||||
<a name="l00176"></a>00176 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00177"></a>00177 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00178"></a>00178 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00179"></a>00179 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00180"></a>00180 outputs_[0] = 0.0;
|
||||
<a name="l00181"></a>00181 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00182"></a>00182 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00183"></a>00183 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00184"></a>00184 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00185"></a>00185 }
|
||||
<a name="l00186"></a>00186 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00189"></a>00189 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00190"></a>00190 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00191"></a>00191 }
|
||||
<a name="l00192"></a>00192
|
||||
<a name="l00193"></a>00193 *oSamples = outputs_[0];
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00197"></a>00197 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00198"></a>00198 }
|
||||
<a name="l00199"></a>00199
|
||||
<a name="l00200"></a>00200 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
115
doc/html/InetWvIn_8h-source.html
Normal file
115
doc/html/InetWvIn_8h-source.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>InetWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INETWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INETWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "TcpServer.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "UdpSocket.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Thread.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Mutex.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
|
||||
<a name="l00039"></a>00039 <span class="keywordtype">bool</span> finished;
|
||||
<a name="l00040"></a>00040 <span class="keywordtype">void</span> *object;
|
||||
<a name="l00041"></a>00041 } ThreadInfo;
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1InetWvIn.html">00043</a> <span class="keyword">class </span><a class="code" href="classstk_1_1InetWvIn.html" title="STK internet streaming input class.">InetWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00044"></a>00044 {
|
||||
<a name="l00045"></a>00045 <span class="keyword">public</span>:
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1InetWvIn.html#d97edafdfb9db2aee77b11d3086113a4" title="Default constructor.">InetWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames = 1024, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers = 8 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1InetWvIn.html#760628dfbbca0a11142d28ff5cabd8b5" title="Class destructor.">~InetWvIn</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvIn.html#f36ff382737f0fb84bc38046c01b4ce8" title="Wait for a (new) socket connection with specified protocol, port, data channels and...">listen</a>( <span class="keywordtype">int</span> port = 2006, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00064"></a>00064 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00065"></a>00065 Socket::ProtocolType protocol = Socket::PROTO_TCP );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1InetWvIn.html#8b54226eabcd0c58d93fcc0792fa7e02" title="Returns true is an input connection exists or input data remains in the queue.">isConnected</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00084"></a>00084 StkFloat <a class="code" href="classstk_1_1InetWvIn.html#cfd578027b2bbcbe4ceefa11e49e8cd2" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00097"></a>00097 StkFloat <a class="code" href="classstk_1_1InetWvIn.html#2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1InetWvIn.html#2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Called by the thread routine to receive data via the socket connection</span>
|
||||
<a name="l00112"></a>00112 <span class="comment">// and fill the socket buffer. This is not intended for general use but</span>
|
||||
<a name="l00113"></a>00113 <span class="comment">// must be public for access from the thread.</span>
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">void</span> receive( <span class="keywordtype">void</span> );
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="keyword">protected</span>:
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Read buffered socket data into the data buffer ... will block if none available.</span>
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">int</span> readData( <span class="keywordtype">void</span> );
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> *soket_;
|
||||
<a name="l00122"></a>00122 <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> thread_;
|
||||
<a name="l00123"></a>00123 <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">char</span> *buffer_;
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames_;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferBytes_;
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bytesFilled_;
|
||||
<a name="l00128"></a>00128 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers_;
|
||||
<a name="l00129"></a>00129 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> writePoint_;
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> readPoint_;
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">long</span> bufferCounter_;
|
||||
<a name="l00132"></a>00132 <span class="keywordtype">int</span> dataBytes_;
|
||||
<a name="l00133"></a>00133 <span class="keywordtype">bool</span> connected_;
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">int</span> fd_;
|
||||
<a name="l00135"></a>00135 ThreadInfo threadInfo_;
|
||||
<a name="l00136"></a>00136 Stk::StkFormat dataType_;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 };
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a><a class="code" href="classstk_1_1InetWvIn.html#cfd578027b2bbcbe4ceefa11e49e8cd2">00140</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1InetWvIn.html#cfd578027b2bbcbe4ceefa11e49e8cd2" title="Return the specified channel value of the last computed frame.">InetWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00141"></a>00141 {
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00144"></a>00144 errorString_ << <span class="stringliteral">"InetWvIn::lastOut(): channel argument and data stream are incompatible!"</span>;
|
||||
<a name="l00145"></a>00145 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147 <span class="preprocessor">#endif</span>
|
||||
<a name="l00148"></a>00148 <span class="preprocessor"></span>
|
||||
<a name="l00149"></a>00149 <span class="comment">// If no connection and we've output all samples in the queue, return.</span>
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">if</span> ( !connected_ && bytesFilled_ == 0 && bufferCounter_ == 0 ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
79
doc/html/InetWvOut_8h-source.html
Normal file
79
doc/html/InetWvOut_8h-source.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>InetWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INETWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INETWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Socket.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1InetWvOut.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1InetWvOut.html" title="STK internet streaming output class.">InetWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1InetWvOut.html#cc7c0b00c68cb76d1b15e7187d67a966" title="Default constructor ... the socket is not instantiated.">InetWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> packetFrames = 1024 );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1InetWvOut.html#cc7c0b00c68cb76d1b15e7187d67a966" title="Default constructor ... the socket is not instantiated.">InetWvOut</a>( <span class="keywordtype">int</span> port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||
<a name="l00043"></a>00043 std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> packetFrames = 1024 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1InetWvOut.html#e58f286de491788df700479f88b3c625" title="Class destructor.">~InetWvOut</a>();
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#4c8b6fb25c6d751b7929bec9a2d04a53" title="Connect to the specified host and port and prepare to stream nChannels of data in...">connect</a>( <span class="keywordtype">int</span> port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||
<a name="l00054"></a>00054 std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#2314d2e2d005c5b08aa24d21075af638" title="If a connection is open, write out remaining samples in the queue and then disconnect...">disconnect</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#800f77228d851a2d276fae6a24bcdc9a" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#800f77228d851a2d276fae6a24bcdc9a" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keyword">protected</span>:
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> incrementFrame( <span class="keywordtype">void</span> );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <span class="comment">// Write a buffer of length frames via the socket connection.</span>
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> writeData( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frames );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">char</span> *buffer_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> *soket_;
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames_;
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferBytes_;
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferIndex_;
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> iData_;
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dataBytes_;
|
||||
<a name="l00093"></a>00093 Stk::StkFormat dataType_;
|
||||
<a name="l00094"></a>00094 };
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,54 +6,114 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Instrmnt.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INSTRMNT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INSTRMNT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Instrmnt.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1Instrmnt.html#6f3c4dc01e0484f0ca4a3b14f1b7caf0">00023</a> <a class="code" href="classstk_1_1Instrmnt.html#6f3c4dc01e0484f0ca4a3b14f1b7caf0" title="Class constructor.">Instrmnt</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#0736ccd253b446660938d51909a32f44" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude ) = 0;
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#582c77e71cd2c5cb46ba6f78fa0ac6a2" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude ) = 0;
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#5aecf9f4d4dcecdbef8271c7fe62b2cf" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>(<span class="keywordtype">int</span> number, StkFloat value);
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Instrmnt.html#32564b611598653fce5e708821b3fcb4">00038</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Instrmnt.html#32564b611598653fce5e708821b3fcb4" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1Instrmnt.html#277ac5149ec22c33d794dfd462a82d2b">00041</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#277ac5149ec22c33d794dfd462a82d2b" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a>00058 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <span class="keyword">protected</span>:
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Instrmnt.html#597efc508ad367a308fa11b8cbdc96a7">00076</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">Instrmnt :: setFrequency</a>(StkFloat frequency)
|
||||
<a name="l00077"></a>00077 {
|
||||
<a name="l00078"></a>00078 errorString_ << <span class="stringliteral">"Instrmnt::setFrequency: virtual setFrequency function call!"</span>;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00080"></a>00080 }
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a><a class="code" href="classstk_1_1Instrmnt.html#aa6bd5e4a5be7f9b0be967daf012872e">00082</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">Instrmnt :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00083"></a>00083 {
|
||||
<a name="l00084"></a>00084 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00085"></a>00085 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00086"></a>00086 errorString_ << <span class="stringliteral">"Instrmnt::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 <span class="preprocessor">#endif</span>
|
||||
<a name="l00090"></a>00090 <span class="preprocessor"></span>
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00092"></a>00092 }
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a><a class="code" href="classstk_1_1Instrmnt.html#4abfe94b5fc8d87b47729fe317222eb9">00094</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">Instrmnt :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00097"></a>00097 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00098"></a>00098 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00099"></a>00099 errorString_ << <span class="stringliteral">"Instrmnt::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#endif</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span>
|
||||
<a name="l00104"></a>00104 StkFloat *samples = &frames[channel];
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00108"></a>00108 *samples++ = <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">else</span> {
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00112"></a>00112 *samples++ = <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00114"></a>00114 *samples++ = lastFrame_[j];
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1Instrmnt.html#5aecf9f4d4dcecdbef8271c7fe62b2cf">00121</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#5aecf9f4d4dcecdbef8271c7fe62b2cf" title="Perform the control change specified by number and value (0.0 - 128.0).">Instrmnt :: controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 errorString_ << <span class="stringliteral">"Instrmnt::controlChange: virtual function call!"</span>;
|
||||
<a name="l00124"></a>00124 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Instrmnt.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00010 <span class="comment">/***************************************************/</span>
|
||||
00011
|
||||
00012 <span class="preprocessor">#if !defined(__INSTRMNT_H)</span>
|
||||
00013 <span class="preprocessor"></span><span class="preprocessor">#define __INSTRMNT_H</span>
|
||||
00014 <span class="preprocessor"></span>
|
||||
00015 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00016 <span class="preprocessor">#include <iostream></span>
|
||||
00017
|
||||
<a name="l00018"></a><a class="code" href="classInstrmnt.html">00018</a> <span class="keyword">class </span><a class="code" href="classInstrmnt.html">Instrmnt</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00019 {
|
||||
00020 <span class="keyword">public</span>:
|
||||
00022 <a class="code" href="classInstrmnt.html#a0">Instrmnt</a>();
|
||||
00023
|
||||
00025 <span class="keyword">virtual</span> <a class="code" href="classInstrmnt.html#a1">~Instrmnt</a>();
|
||||
00026
|
||||
00028 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInstrmnt.html#a2">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude) = 0;
|
||||
00029
|
||||
00031 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInstrmnt.html#a3">noteOff</a>(MY_FLOAT amplitude) = 0;
|
||||
00032
|
||||
00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInstrmnt.html#a4">setFrequency</a>(MY_FLOAT frequency);
|
||||
00035
|
||||
00037 MY_FLOAT <a class="code" href="classInstrmnt.html#a5">lastOut</a>() <span class="keyword">const</span>;
|
||||
00038
|
||||
00040 MY_FLOAT <a class="code" href="classInstrmnt.html#a6">lastOutLeft</a>() <span class="keyword">const</span>;
|
||||
00041
|
||||
00043 MY_FLOAT <a class="code" href="classInstrmnt.html#a7">lastOutRight</a>() <span class="keyword">const</span>;
|
||||
00044
|
||||
00046 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classInstrmnt.html#a8">tick</a>() = 0;
|
||||
00047
|
||||
00049 <span class="keyword">virtual</span> MY_FLOAT *<a class="code" href="classInstrmnt.html#a8">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00050
|
||||
00052 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInstrmnt.html#a10">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00053
|
||||
00054 <span class="keyword">protected</span>:
|
||||
00055 MY_FLOAT lastOutput;
|
||||
00056
|
||||
00057 };
|
||||
00058
|
||||
00059 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,46 +6,128 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>JCRev.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_JCREV_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_JCREV_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1JCRev.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1JCRev.html" title="John Chowning&#39;s reverberator class.">JCRev</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1JCRev.html#5b9f0e2b7acc1fcb94a663353f1253dd" title="Class constructor taking a T60 decay time argument (one second default value).">JCRev</a>( StkFloat T60 = 1.0 );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#bf92e9783e4a738b6d3a3350bfae986e" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#8f4caa6de1e662c76b853ebab814a2eb" title="Set the reverberation T60 decay time.">setT60</a>( StkFloat T60 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00045"></a>00045 StkFloat <a class="code" href="classstk_1_1JCRev.html#599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keyword">protected</span>:
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allpassDelays_[3];
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[4];
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outLeftDelay_;
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outRightDelay_;
|
||||
<a name="l00087"></a>00087 StkFloat allpassCoefficient_;
|
||||
<a name="l00088"></a>00088 StkFloat combCoefficient_[4];
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1JCRev.html#599e46bcfbc2b4b9a30a30d67580412b">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">JCRev :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00095"></a>00095 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00096"></a>00096 errorString_ << <span class="stringliteral">"JCRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#endif</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span>
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">JCRev :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00108"></a>00108 errorString_ << <span class="stringliteral">"JCRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111 <span class="preprocessor">#endif</span>
|
||||
<a name="l00112"></a>00112 <span class="preprocessor"></span>
|
||||
<a name="l00113"></a>00113 StkFloat temp, temp0, temp1, temp2, temp3, temp4, temp5, temp6;
|
||||
<a name="l00114"></a>00114 StkFloat filtout;
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 temp = allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00117"></a>00117 temp0 = allpassCoefficient_ * temp;
|
||||
<a name="l00118"></a>00118 temp0 += input;
|
||||
<a name="l00119"></a>00119 allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp0);
|
||||
<a name="l00120"></a>00120 temp0 = -(allpassCoefficient_ * temp0) + temp;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 temp = allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00123"></a>00123 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00124"></a>00124 temp1 += temp0;
|
||||
<a name="l00125"></a>00125 allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00126"></a>00126 temp1 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 temp = allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00129"></a>00129 temp2 = allpassCoefficient_ * temp;
|
||||
<a name="l00130"></a>00130 temp2 += temp1;
|
||||
<a name="l00131"></a>00131 allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp2);
|
||||
<a name="l00132"></a>00132 temp2 = -(allpassCoefficient_ * temp2) + temp;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 temp3 = temp2 + (combCoefficient_[0] * combDelays_[0].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00135"></a>00135 temp4 = temp2 + (combCoefficient_[1] * combDelays_[1].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00136"></a>00136 temp5 = temp2 + (combCoefficient_[2] * combDelays_[2].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00137"></a>00137 temp6 = temp2 + (combCoefficient_[3] * combDelays_[3].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 combDelays_[0].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp3);
|
||||
<a name="l00140"></a>00140 combDelays_[1].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp4);
|
||||
<a name="l00141"></a>00141 combDelays_[2].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp5);
|
||||
<a name="l00142"></a>00142 combDelays_[3].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp6);
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 filtout = temp3 + temp4 + temp5 + temp6;
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 lastFrame_[0] = effectMix_ * (outLeftDelay_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00147"></a>00147 lastFrame_[1] = effectMix_ * (outRightDelay_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00148"></a>00148 temp = (1.0 - effectMix_) * input;
|
||||
<a name="l00149"></a>00149 lastFrame_[0] += temp;
|
||||
<a name="l00150"></a>00150 lastFrame_[1] += temp;
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>JCRev.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00015 <span class="comment">/***************************************************/</span>
|
||||
00016
|
||||
00017 <span class="preprocessor">#if !defined(__JCREV_H)</span>
|
||||
00018 <span class="preprocessor"></span><span class="preprocessor">#define __JCREV_H</span>
|
||||
00019 <span class="preprocessor"></span>
|
||||
00020 <span class="preprocessor">#include "Reverb.h"</span>
|
||||
00021 <span class="preprocessor">#include "Delay.h"</span>
|
||||
00022
|
||||
<a name="l00023"></a><a class="code" href="classJCRev.html">00023</a> <span class="keyword">class </span><a class="code" href="classJCRev.html">JCRev</a> : <span class="keyword">public</span> <a class="code" href="classReverb.html">Reverb</a>
|
||||
00024 {
|
||||
00025 <span class="keyword">public</span>:
|
||||
00027 <a class="code" href="classJCRev.html#a0">JCRev</a>(MY_FLOAT T60);
|
||||
00028
|
||||
00030 <a class="code" href="classJCRev.html#a1">~JCRev</a>();
|
||||
00031
|
||||
00033 <span class="keywordtype">void</span> <a class="code" href="classJCRev.html#a2">clear</a>();
|
||||
00034
|
||||
00036 MY_FLOAT <a class="code" href="classJCRev.html#a3">tick</a>(MY_FLOAT input);
|
||||
00037
|
||||
00038 <span class="keyword">protected</span>:
|
||||
00039 <a class="code" href="classDelay.html">Delay</a> *allpassDelays[3];
|
||||
00040 <a class="code" href="classDelay.html">Delay</a> *combDelays[4];
|
||||
00041 <a class="code" href="classDelay.html">Delay</a> *outLeftDelay;
|
||||
00042 <a class="code" href="classDelay.html">Delay</a> *outRightDelay;
|
||||
00043 MY_FLOAT allpassCoefficient;
|
||||
00044 MY_FLOAT combCoefficient[4];
|
||||
00045
|
||||
00046 };
|
||||
00047
|
||||
00048 <span class="preprocessor">#endif</span>
|
||||
00049 <span class="preprocessor"></span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>JetTabl.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00014 <span class="comment">/***************************************************/</span>
|
||||
00015
|
||||
00016 <span class="preprocessor">#if !defined(__JETTABL_H)</span>
|
||||
00017 <span class="preprocessor"></span><span class="preprocessor">#define __JETTABL_H</span>
|
||||
00018 <span class="preprocessor"></span>
|
||||
00019 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00020
|
||||
<a name="l00021"></a><a class="code" href="classJetTabl.html">00021</a> <span class="keyword">class </span><a class="code" href="classJetTabl.html">JetTabl</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00022 {
|
||||
00023 <span class="keyword">public</span>:
|
||||
00025 <a class="code" href="classJetTabl.html#a0">JetTabl</a>();
|
||||
00026
|
||||
00028 <a class="code" href="classJetTabl.html#a1">~JetTabl</a>();
|
||||
00029
|
||||
00031 MY_FLOAT <a class="code" href="classJetTabl.html#a2">lastOut</a>() <span class="keyword">const</span>;
|
||||
00032
|
||||
00034 MY_FLOAT <a class="code" href="classJetTabl.html#a3">tick</a>(MY_FLOAT input);
|
||||
00035
|
||||
00037 MY_FLOAT *<a class="code" href="classJetTabl.html#a3">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00038
|
||||
00039 <span class="keyword">protected</span>:
|
||||
00040 MY_FLOAT lastOutput;
|
||||
00041
|
||||
00042 };
|
||||
00043
|
||||
00044 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/JetTable_8h-source.html
Normal file
107
doc/html/JetTable_8h-source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>JetTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_JETTABL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_JETTABL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1JetTable.html">00023</a> <span class="keyword">class </span><a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00024"></a>00024 {
|
||||
<a name="l00025"></a>00025 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 StkFloat <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00052"></a>00052 };
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00054"></a><a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6">00054</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( StkFloat input )
|
||||
<a name="l00055"></a>00055 {
|
||||
<a name="l00056"></a>00056 <span class="comment">// Perform "table lookup" using a polynomial</span>
|
||||
<a name="l00057"></a>00057 <span class="comment">// calculation (x^3 - x), which approximates</span>
|
||||
<a name="l00058"></a>00058 <span class="comment">// the jet sigmoid behavior.</span>
|
||||
<a name="l00059"></a>00059 lastFrame_[0] = input * (input * input - 1.0);
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00061"></a>00061 <span class="comment">// Saturate at +/- 1.0.</span>
|
||||
<a name="l00062"></a>00062 <span class="keywordflow">if</span> ( lastFrame_[0] > 1.0 ) lastFrame_[0] = 1.0;
|
||||
<a name="l00063"></a>00063 <span class="keywordflow">if</span> ( lastFrame_[0] < -1.0 ) lastFrame_[0] = -1.0;
|
||||
<a name="l00064"></a>00064 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00065"></a>00065 }
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a><a class="code" href="classstk_1_1JetTable.html#e17ee82b1ed7b185713b4ae0b7c2b0cd">00067</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00068"></a>00068 {
|
||||
<a name="l00069"></a>00069 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00070"></a>00070 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00071"></a>00071 errorString_ << <span class="stringliteral">"JetTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00073"></a>00073 }
|
||||
<a name="l00074"></a>00074 <span class="preprocessor">#endif</span>
|
||||
<a name="l00075"></a>00075 <span class="preprocessor"></span>
|
||||
<a name="l00076"></a>00076 StkFloat *samples = &frames[channel];
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00079"></a>00079 *samples = *samples * (*samples * *samples - 1.0);
|
||||
<a name="l00080"></a>00080 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00081"></a>00081 <span class="keywordflow">if</span> ( *samples < -1.0) *samples = -1.0;
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00086"></a>00086 }
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a><a class="code" href="classstk_1_1JetTable.html#7b261fd07b2325348ef14e3f0ebf8429">00088</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00089"></a>00089 {
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00092"></a>00092 errorString_ << <span class="stringliteral">"JetTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span>
|
||||
<a name="l00097"></a>00097 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00098"></a>00098 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00101"></a>00101 *oSamples = *oSamples * (*oSamples * *oSamples - 1.0);
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">if</span> ( *oSamples < -1.0) *oSamples = -1.0;
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,51 +6,89 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Mandolin.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MANDOLIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MANDOLIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "PluckTwo.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Mandolin.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mandolin.html" title="STK mandolin instrument model class.">Mandolin</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1PluckTwo.html" title="STK enhanced plucked string model class.">PluckTwo</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Mandolin.html#5b2aaaf5697cbe57df62b568982f6300" title="Class constructor, taking the lowest desired playing frequency.">Mandolin</a>( StkFloat lowestFrequency );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Mandolin.html#92d50a0f0c1c974683bf4685cfc6ff86" title="Class destructor.">~Mandolin</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude,StkFloat position );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#8b60733652e54f1d6c93d63c915c9ca7" title="Start a note with the given frequency and amplitude (0.0 - 1.0).">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#21a5b0669b013cfd9c7142174530f629" title="Set the body size (a value of 1.0 produces the &quot;default&quot; size).">setBodySize</a>( StkFloat size );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#bf341aa5e7d751012178ff7b853b73a1" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 StkFloat <a class="code" href="classstk_1_1Mandolin.html#99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> *soundfile_[12];
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">int</span> mic_;
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">long</span> dampTime_;
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">bool</span> waveDone_;
|
||||
<a name="l00071"></a>00071 };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Mandolin.html#99f5b51e76c97299dd8c58f27a6d0e62">00073</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Mandolin.html#99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">Mandolin :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 StkFloat temp = 0.0;
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">if</span> ( !waveDone_ ) {
|
||||
<a name="l00077"></a>00077 <span class="comment">// Scale the pluck excitation with comb</span>
|
||||
<a name="l00078"></a>00078 <span class="comment">// filtering for the duration of the file.</span>
|
||||
<a name="l00079"></a>00079 temp = soundfile_[mic_]-><a class="code" href="classstk_1_1FileWvIn.html#da668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * pluckAmplitude_;
|
||||
<a name="l00080"></a>00080 temp = temp - combDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00081"></a>00081 waveDone_ = soundfile_[mic_]-><a class="code" href="classstk_1_1FileWvIn.html#ca9ad0c12af3323e7bbf877513b0d10b" title="Query whether reading is complete.">isFinished</a>();
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="comment">// Damping hack to help avoid overflow on re-plucking.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">if</span> ( dampTime_ >=0 ) {
|
||||
<a name="l00086"></a>00086 dampTime_ -= 1;
|
||||
<a name="l00087"></a>00087 <span class="comment">// Calculate 1st delay filtered reflection plus pluck excitation.</span>
|
||||
<a name="l00088"></a>00088 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * 0.7) ) );
|
||||
<a name="l00089"></a>00089 <span class="comment">// Calculate 2nd delay just like the 1st.</span>
|
||||
<a name="l00090"></a>00090 lastFrame_[0] += delayLine2_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter2_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine2_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * 0.7) ) );
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092 <span class="keywordflow">else</span> { <span class="comment">// No damping hack after 1 period.</span>
|
||||
<a name="l00093"></a>00093 <span class="comment">// Calculate 1st delay filtered reflection plus pluck excitation.</span>
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_) ) );
|
||||
<a name="l00095"></a>00095 <span class="comment">// Calculate 2nd delay just like the 1st.</span>
|
||||
<a name="l00096"></a>00096 lastFrame_[0] += delayLine2_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter2_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine2_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_) ) );
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 lastFrame_[0] *= 0.3;
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Mandolin.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00028 <span class="comment">/***************************************************/</span>
|
||||
00029
|
||||
00030 <span class="preprocessor">#if !defined(__MANDOLIN_H)</span>
|
||||
00031 <span class="preprocessor"></span><span class="preprocessor">#define __MANDOLIN_H</span>
|
||||
00032 <span class="preprocessor"></span>
|
||||
00033 <span class="preprocessor">#include "PluckTwo.h"</span>
|
||||
00034 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
00035
|
||||
<a name="l00036"></a><a class="code" href="classMandolin.html">00036</a> <span class="keyword">class </span><a class="code" href="classMandolin.html">Mandolin</a> : <span class="keyword">public</span> <a class="code" href="classPluckTwo.html">PluckTwo</a>
|
||||
00037 {
|
||||
00038 <span class="keyword">public</span>:
|
||||
00040 <a class="code" href="classMandolin.html#a0">Mandolin</a>(MY_FLOAT lowestFrequency);
|
||||
00041
|
||||
00043 <span class="keyword">virtual</span> <a class="code" href="classMandolin.html#a1">~Mandolin</a>();
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classMandolin.html#a2">pluck</a>(MY_FLOAT amplitude);
|
||||
00047
|
||||
00049 <span class="keywordtype">void</span> <a class="code" href="classMandolin.html#a2">pluck</a>(MY_FLOAT amplitude,MY_FLOAT position);
|
||||
00050
|
||||
00052 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMandolin.html#a4">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00053
|
||||
00055 <span class="keywordtype">void</span> <a class="code" href="classMandolin.html#a5">setBodySize</a>(MY_FLOAT size);
|
||||
00056
|
||||
00058 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classMandolin.html#a6">tick</a>();
|
||||
00059
|
||||
00061 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMandolin.html#a7">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00062
|
||||
00063 <span class="keyword">protected</span>:
|
||||
00064 <a class="code" href="classWvIn.html">WvIn</a> *soundfile[12];
|
||||
00065 MY_FLOAT directBody;
|
||||
00066 <span class="keywordtype">int</span> mic;
|
||||
00067 <span class="keywordtype">long</span> dampTime;
|
||||
00068 <span class="keywordtype">bool</span> waveDone;
|
||||
00069 };
|
||||
00070
|
||||
00071 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,83 +6,89 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Mesh2D.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MESH2D_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MESH2D_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a>00035 <span class="keyword">const</span> <span class="keywordtype">short</span> NXMAX = 12;
|
||||
<a name="l00036"></a>00036 <span class="keyword">const</span> <span class="keywordtype">short</span> NYMAX = 12;
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Mesh2D.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mesh2D.html" title="Two-dimensional rectilinear waveguide mesh class.">Mesh2D</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Mesh2D.html#156fdff6515dbcd4b493ce0ef051a174" title="Class constructor, taking the x and y dimensions in samples.">Mesh2D</a>( <span class="keywordtype">short</span> nX, <span class="keywordtype">short</span> nY );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Mesh2D.html#c4abd6b5190587d69c7c2b13870fb646" title="Class destructor.">~Mesh2D</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#49f56b4865dc041ae874fbc1b80e967b" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#ccbad29fd6364f7c2d439bcf837590ec" title="Set the x dimension size in samples.">setNX</a>( <span class="keywordtype">short</span> lenX );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#4c4c54ad29fcee5654bd2ebaed29d916" title="Set the y dimension size in samples.">setNY</a>( <span class="keywordtype">short</span> lenY );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#9cdfa80ecccf3f12dc184003458ba3a3" title="Set the x, y input position on a 0.0 - 1.0 scale.">setInputPosition</a>( StkFloat xFactor, StkFloat yFactor );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#b7b3d950e40308e7060e5ff9a62a8b8d" title="Set the loss filters gains (0.0 - 1.0).">setDecay</a>( StkFloat decayFactor );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#7915dae1032ace5960c85790a7b93e0f" title="Impulse the mesh with the given amplitude (frequency ignored).">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#0580962b3cc0dbac092581d0fc15127b" title="Stop a note with the given amplitude (speed of decay) ... currently ignored.">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 StkFloat <a class="code" href="classstk_1_1Mesh2D.html#52d9552b67edea0fc6ff3e949d6331a0" title="Calculate and return the signal energy stored in the mesh.">energy</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Mesh2D.html#688bed8725ef2d8bf4c6465251bd8b86" title="Input a sample to the mesh and compute one output sample.">inputTick</a>( StkFloat input );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#cc618a91b288305785644d852cfdaf83" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 StkFloat <a class="code" href="classstk_1_1Mesh2D.html#e8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <span class="keyword">protected</span>:
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 StkFloat tick0();
|
||||
<a name="l00083"></a>00083 StkFloat tick1();
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> clearMesh();
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">short</span> NX_, NY_;
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">short</span> xInput_, yInput_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filterX_[NXMAX];
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filterY_[NYMAX];
|
||||
<a name="l00090"></a>00090 StkFloat v_[NXMAX-1][NYMAX-1]; <span class="comment">// junction velocities</span>
|
||||
<a name="l00091"></a>00091 StkFloat vxp_[NXMAX][NYMAX]; <span class="comment">// positive-x velocity wave</span>
|
||||
<a name="l00092"></a>00092 StkFloat vxm_[NXMAX][NYMAX]; <span class="comment">// negative-x velocity wave</span>
|
||||
<a name="l00093"></a>00093 StkFloat vyp_[NXMAX][NYMAX]; <span class="comment">// positive-y velocity wave</span>
|
||||
<a name="l00094"></a>00094 StkFloat vym_[NXMAX][NYMAX]; <span class="comment">// negative-y velocity wave</span>
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="comment">// Alternate buffers</span>
|
||||
<a name="l00097"></a>00097 StkFloat vxp1_[NXMAX][NYMAX]; <span class="comment">// positive-x velocity wave</span>
|
||||
<a name="l00098"></a>00098 StkFloat vxm1_[NXMAX][NYMAX]; <span class="comment">// negative-x velocity wave</span>
|
||||
<a name="l00099"></a>00099 StkFloat vyp1_[NXMAX][NYMAX]; <span class="comment">// positive-y velocity wave</span>
|
||||
<a name="l00100"></a>00100 StkFloat vym1_[NXMAX][NYMAX]; <span class="comment">// negative-y velocity wave</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">int</span> counter_; <span class="comment">// time in samples</span>
|
||||
<a name="l00103"></a>00103 };
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Mesh2D.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00025 <span class="comment">/***************************************************/</span>
|
||||
00026
|
||||
00027 <span class="preprocessor">#if !defined(__MESH2D_H)</span>
|
||||
00028 <span class="preprocessor"></span><span class="preprocessor">#define __MESH2D_H</span>
|
||||
00029 <span class="preprocessor"></span>
|
||||
00030 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00031 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
00032
|
||||
00033 <span class="preprocessor">#define NXMAX ((short)(12))</span>
|
||||
00034 <span class="preprocessor"></span><span class="preprocessor">#define NYMAX ((short)(12))</span>
|
||||
00035 <span class="preprocessor"></span>
|
||||
<a name="l00036"></a><a class="code" href="classMesh2D.html">00036</a> <span class="keyword">class </span><a class="code" href="classMesh2D.html">Mesh2D</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00037 {
|
||||
00038 <span class="keyword">public</span>:
|
||||
00040 <a class="code" href="classMesh2D.html#a0">Mesh2D</a>(<span class="keywordtype">short</span> nX, <span class="keywordtype">short</span> nY);
|
||||
00041
|
||||
00043 <a class="code" href="classMesh2D.html#a1">~Mesh2D</a>();
|
||||
00044
|
||||
00046 <span class="keywordtype">void</span> <a class="code" href="classMesh2D.html#a2">clear</a>();
|
||||
00047
|
||||
00049 <span class="keywordtype">void</span> <a class="code" href="classMesh2D.html#a3">setNX</a>(<span class="keywordtype">short</span> lenX);
|
||||
00050
|
||||
00052 <span class="keywordtype">void</span> <a class="code" href="classMesh2D.html#a4">setNY</a>(<span class="keywordtype">short</span> lenY);
|
||||
00053
|
||||
00055 <span class="keywordtype">void</span> <a class="code" href="classMesh2D.html#a5">setInputPosition</a>(MY_FLOAT xFactor, MY_FLOAT yFactor);
|
||||
00056
|
||||
00058 <span class="keywordtype">void</span> <a class="code" href="classMesh2D.html#a6">setDecay</a>(MY_FLOAT decayFactor);
|
||||
00059
|
||||
00061 <span class="keywordtype">void</span> <a class="code" href="classMesh2D.html#a7">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00062
|
||||
00064 <span class="keywordtype">void</span> <a class="code" href="classMesh2D.html#a8">noteOff</a>(MY_FLOAT amplitude);
|
||||
00065
|
||||
00067 MY_FLOAT <a class="code" href="classMesh2D.html#a9">energy</a>();
|
||||
00068
|
||||
00070 MY_FLOAT <a class="code" href="classMesh2D.html#a10">tick</a>();
|
||||
00071
|
||||
00073 MY_FLOAT <a class="code" href="classMesh2D.html#a10">tick</a>(MY_FLOAT input);
|
||||
00074
|
||||
00076 <span class="keywordtype">void</span> <a class="code" href="classMesh2D.html#a12">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00077
|
||||
00078 <span class="keyword">protected</span>:
|
||||
00079
|
||||
00080 MY_FLOAT tick0();
|
||||
00081 MY_FLOAT tick1();
|
||||
00082 <span class="keywordtype">void</span> clearMesh();
|
||||
00083
|
||||
00084 <span class="keywordtype">short</span> NX, NY;
|
||||
00085 <span class="keywordtype">short</span> xInput, yInput;
|
||||
00086 <a class="code" href="classOnePole.html">OnePole</a> *filterX[NXMAX];
|
||||
00087 <a class="code" href="classOnePole.html">OnePole</a> *filterY[NYMAX];
|
||||
00088 MY_FLOAT v[NXMAX-1][NYMAX-1]; <span class="comment">// junction velocities</span>
|
||||
00089 MY_FLOAT vxp[NXMAX][NYMAX]; <span class="comment">// positive-x velocity wave</span>
|
||||
00090 MY_FLOAT vxm[NXMAX][NYMAX]; <span class="comment">// negative-x velocity wave</span>
|
||||
00091 MY_FLOAT vyp[NXMAX][NYMAX]; <span class="comment">// positive-y velocity wave</span>
|
||||
00092 MY_FLOAT vym[NXMAX][NYMAX]; <span class="comment">// negative-y velocity wave</span>
|
||||
00093
|
||||
00094 <span class="comment">// Alternate buffers</span>
|
||||
00095 MY_FLOAT vxp1[NXMAX][NYMAX]; <span class="comment">// positive-x velocity wave</span>
|
||||
00096 MY_FLOAT vxm1[NXMAX][NYMAX]; <span class="comment">// negative-x velocity wave</span>
|
||||
00097 MY_FLOAT vyp1[NXMAX][NYMAX]; <span class="comment">// positive-y velocity wave</span>
|
||||
00098 MY_FLOAT vym1[NXMAX][NYMAX]; <span class="comment">// negative-y velocity wave</span>
|
||||
00099
|
||||
00100 <span class="keywordtype">int</span> counter; <span class="comment">// time in samples</span>
|
||||
00101
|
||||
00102
|
||||
00103 };
|
||||
00104
|
||||
00105 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,108 +6,104 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Messager.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MESSAGER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MESSAGER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Skini.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <queue></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor"></span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "Mutex.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "Thread.h"</span>
|
||||
<a name="l00012"></a>00012 <span class="preprocessor">#include "TcpServer.h"</span>
|
||||
<a name="l00013"></a>00013 <span class="preprocessor">#include "RtMidi.h"</span>
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="preprocessor">#endif // __STK_REALTIME__</span>
|
||||
<a name="l00016"></a>00016 <span class="preprocessor"></span>
|
||||
<a name="l00017"></a>00017 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00051"></a>00051 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00053"></a>00053 <span class="keyword">const</span> <span class="keywordtype">int</span> DEFAULT_QUEUE_LIMIT = 200;
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Messager.html">00055</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Messager.html" title="STK input control message parser.">Messager</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00056"></a>00056 {
|
||||
<a name="l00057"></a>00057 <span class="keyword">public</span>:
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a>00059 <span class="comment">// This structure is used to share data among the various realtime</span>
|
||||
<a name="l00060"></a>00060 <span class="comment">// messager threads. It must be public.</span>
|
||||
<a name="l00061"></a>00061 <span class="keyword">struct </span>MessagerData {
|
||||
<a name="l00062"></a>00062 <a class="code" href="classstk_1_1Skini.html" title="STK SKINI parsing class.">Skini</a> skini;
|
||||
<a name="l00063"></a>00063 std::queue<Skini::Message> queue;
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> queueLimit;
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">int</span> sources;
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
<a name="l00068"></a>00068 <span class="preprocessor"></span> <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex;
|
||||
<a name="l00069"></a>00069 <a class="code" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a> *midi;
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1TcpServer.html" title="STK TCP socket server class.">TcpServer</a> *socket;
|
||||
<a name="l00071"></a>00071 std::vector<int> fd;
|
||||
<a name="l00072"></a>00072 fd_set mask;
|
||||
<a name="l00073"></a>00073 <span class="preprocessor">#endif</span>
|
||||
<a name="l00074"></a>00074 <span class="preprocessor"></span>
|
||||
<a name="l00075"></a>00075 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00076"></a>00076 MessagerData()
|
||||
<a name="l00077"></a>00077 :queueLimit(0), sources(0) {}
|
||||
<a name="l00078"></a>00078 };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1Messager.html#a4c8f3396345157ccd19395258a253a9" title="Default constructor.">Messager</a>();
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Messager.html#8300dba83620cc86388780b5fa4080e0" title="Class destructor.">~Messager</a>();
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Messager.html#18525952880382c25322e57353a34372" title="Pop the next message from the queue and write it to the referenced message structure...">popMessage</a>( <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Skini::Message</a>& message );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Messager.html#e8b09328c103bffd180456bf57ee64b3" title="Push the referenced message onto the message stack.">pushMessage</a>( <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Skini::Message</a>& message );
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#172cf26bfebc8b4b12943e2bd76d5f72" title="Specify a SKINI formatted scorefile from which messages should be read.">setScoreFile</a>( <span class="keyword">const</span> <span class="keywordtype">char</span>* filename );
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
<a name="l00111"></a>00111 <span class="preprocessor"></span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"> bool startStdInput();</span>
|
||||
<a name="l00121"></a>00121 <span class="preprocessor"></span>
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#180fd45d109a2058ecbd6a629b979cb7" title="Start a socket server, accept connections, and read &quot;realtime&quot; control...">startSocketInput</a>( <span class="keywordtype">int</span> port=2001 );
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00149"></a>00149 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#49877209a4ee08e684de82a73f2d9df9" title="Start MIDI input, with optional device and port identifiers.">startMidiInput</a>( <span class="keywordtype">int</span> port=0 );
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
||||
<a name="l00152"></a>00152 <span class="preprocessor"></span>
|
||||
<a name="l00153"></a>00153 <span class="keyword">protected</span>:
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 MessagerData data_;
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></span> <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> stdinThread_;
|
||||
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> socketThread_;
|
||||
<a name="l00160"></a>00160 <span class="preprocessor">#endif</span>
|
||||
<a name="l00161"></a>00161 <span class="preprocessor"></span>
|
||||
<a name="l00162"></a>00162 };
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Messager.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00034 <span class="comment">/***************************************************/</span>
|
||||
00035
|
||||
00036 <span class="preprocessor">#if !defined(__MESSAGER_H)</span>
|
||||
00037 <span class="preprocessor"></span><span class="preprocessor">#define __MESSSAGER_H</span>
|
||||
00038 <span class="preprocessor"></span>
|
||||
00039 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00040 <span class="preprocessor">#include "SKINI.h"</span>
|
||||
00041
|
||||
00042 <span class="preprocessor">#define MESSAGE_LENGTH 128</span>
|
||||
00043 <span class="preprocessor"></span><span class="preprocessor">#define MAX_MESSAGES 25</span>
|
||||
00044 <span class="preprocessor"></span><span class="preprocessor">#define STK_MIDI 0x0001</span>
|
||||
00045 <span class="preprocessor"></span><span class="preprocessor">#define STK_PIPE 0x0002</span>
|
||||
00046 <span class="preprocessor"></span><span class="preprocessor">#define STK_SOCKET 0x0004</span>
|
||||
00047 <span class="preprocessor"></span>
|
||||
00048 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
00049 <span class="preprocessor"></span>
|
||||
00050 <span class="preprocessor">#include "Thread.h"</span>
|
||||
00051 <span class="preprocessor">#include "Socket.h"</span>
|
||||
00052 <span class="preprocessor">#include "RtMidi.h"</span>
|
||||
00053
|
||||
00054 <span class="keyword">extern</span> <span class="stringliteral">"C"</span> THREAD_RETURN THREAD_TYPE stdinHandler(<span class="keywordtype">void</span> * ptr);
|
||||
00055
|
||||
00056 <span class="preprocessor">#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))</span>
|
||||
00057 <span class="preprocessor"></span><span class="preprocessor"> #include <sys/types.h></span>
|
||||
00058 <span class="preprocessor"> #include <sys/time.h></span>
|
||||
00059 <span class="preprocessor">#endif</span>
|
||||
00060 <span class="preprocessor"></span>
|
||||
00061 <span class="preprocessor">#endif // __STK_REALTIME__</span>
|
||||
00062 <span class="preprocessor"></span>
|
||||
<a name="l00063"></a><a class="code" href="classMessager.html">00063</a> <span class="keyword">class </span><a class="code" href="classMessager.html">Messager</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00064 {
|
||||
00065 <span class="keyword">public</span>:
|
||||
00067
|
||||
00075 <a class="code" href="classMessager.html#a0">Messager</a>(<span class="keywordtype">int</span> inputMask = 0, <span class="keywordtype">int</span> port = 2001);
|
||||
00076
|
||||
00078 <a class="code" href="classMessager.html#a1">~Messager</a>();
|
||||
00079
|
||||
00081
|
||||
00087 <span class="keywordtype">long</span> <a class="code" href="classMessager.html#a2">nextMessage</a>(<span class="keywordtype">void</span>);
|
||||
00088
|
||||
00090 <span class="keywordtype">void</span> <a class="code" href="classMessager.html#a3">setRtDelta</a>(<span class="keywordtype">long</span> nSamples);
|
||||
00091
|
||||
00093 <span class="keywordtype">long</span> <a class="code" href="classMessager.html#a4">getDelta</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
|
||||
00094
|
||||
00096 <span class="keywordtype">long</span> <a class="code" href="classMessager.html#a5">getType</a>() <span class="keyword">const</span>;
|
||||
00097
|
||||
00099 MY_FLOAT <a class="code" href="classMessager.html#a6">getByteTwo</a>() <span class="keyword">const</span>;
|
||||
00100
|
||||
00102 MY_FLOAT <a class="code" href="classMessager.html#a7">getByteThree</a>() <span class="keyword">const</span>;
|
||||
00103
|
||||
00105 <span class="keywordtype">long</span> <a class="code" href="classMessager.html#a8">getChannel</a>() <span class="keyword">const</span>;
|
||||
00106
|
||||
00107 <span class="keyword">protected</span>:
|
||||
00108
|
||||
00109 <a class="code" href="classSKINI.html">SKINI</a> *skini;
|
||||
00110 <span class="keywordtype">long</span> type;
|
||||
00111 <span class="keywordtype">long</span> channel;
|
||||
00112 MY_FLOAT byte2;
|
||||
00113 MY_FLOAT byte3;
|
||||
00114 <span class="keywordtype">int</span> sources;
|
||||
00115 <span class="keywordtype">long</span> delta;
|
||||
00116 <span class="keywordtype">long</span> rtDelta;
|
||||
00117 <span class="keywordtype">char</span> message[MAX_MESSAGES][MESSAGE_LENGTH];
|
||||
00118 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> messageIndex;
|
||||
00119 <span class="keywordtype">int</span> nMessages;
|
||||
00120
|
||||
00121 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
00122 <span class="preprocessor"></span>
|
||||
00123 <span class="comment">// Check MIDI source for new messages.</span>
|
||||
00124 <span class="keywordtype">bool</span> midiMessage(<span class="keywordtype">void</span>);
|
||||
00125
|
||||
00126 <span class="comment">// Check socket sources for new messages.</span>
|
||||
00127 <span class="keywordtype">bool</span> socketMessage(<span class="keywordtype">void</span>);
|
||||
00128
|
||||
00129 <span class="comment">// Receive and parse socket data.</span>
|
||||
00130 <span class="keywordtype">bool</span> readSocket(<span class="keywordtype">int</span> fd);
|
||||
00131
|
||||
00132 <a class="code" href="classRtMidi.html">RtMidi</a> *midi;
|
||||
00133 <a class="code" href="classThread.html">Thread</a> *thread;
|
||||
00134 <a class="code" href="classSocket.html">Socket</a> *soket;
|
||||
00135
|
||||
00136 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nSockets;
|
||||
00137 fd_set mask;
|
||||
00138 <span class="keywordtype">int</span> maxfd;
|
||||
00139 <span class="keywordtype">int</span> pipefd;
|
||||
00140 <span class="keywordtype">int</span> fd[16];
|
||||
00141 <span class="keywordtype">char</span> error[256];
|
||||
00142
|
||||
00143 <span class="preprocessor">#endif // __STK_REALTIME__</span>
|
||||
00144 <span class="preprocessor"></span>
|
||||
00145 };
|
||||
00146
|
||||
00147 <span class="preprocessor">#endif // defined(__MESSAGER_H)</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
100
doc/html/MidiFileIn_8h-source.html
Normal file
100
doc/html/MidiFileIn_8h-source.html
Normal file
@@ -0,0 +1,100 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>MidiFileIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MIDIFILEIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MIDIFILEIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <string></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include <fstream></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include <sstream></span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00027"></a>00027 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1MidiFileIn.html">00029</a> <span class="keyword">class </span><a class="code" href="classstk_1_1MidiFileIn.html" title="A standard MIDI file reading/parsing class.">MidiFileIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00030"></a>00030 {
|
||||
<a name="l00031"></a>00031 <span class="keyword">public</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1MidiFileIn.html#d273dc7c13d4c4a4ced893af93d9176e" title="Default constructor.">MidiFileIn</a>( std::string fileName );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1MidiFileIn.html#857246dbaf234cc9d68709afea6d0141" title="Class destructor.">~MidiFileIn</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#c93b16c4de0ed3d98d31a2edb92bc105" title="Return the MIDI file format (0, 1, or 2).">getFileFormat</a>() <span class="keyword">const</span>;
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#7db7e6b2f6c1aedfbb78045106d36b17" title="Return the number of tracks in the MIDI file.">getNumberOfTracks</a>() <span class="keyword">const</span>;
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#43bc34a26e72f3311b855139a1408f78" title="Return the MIDI file division value from the file header.">getDivision</a>() <span class="keyword">const</span>;
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1MidiFileIn.html#3bd547e3ee5bb8ad780274d7a09f12ff" title="Move the specified track event reader to the beginning of its track.">rewindTrack</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">double</span> <a class="code" href="classstk_1_1MidiFileIn.html#92508a5847e45a05a3ff05de3e5d3efe" title="Get the current value, in seconds, of delta-time ticks for the specified track.">getTickSeconds</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1MidiFileIn.html#117dd19afbc42d6c769d959588f9176b" title="Fill the user-provided vector with the next event in the specified track and return...">getNextEvent</a>( std::vector<unsigned char> *event, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1MidiFileIn.html#b10ea0e225484fa2d31796f505d4e582" title="Fill the user-provided vector with the next MIDI channel event in the specified track...">getNextMidiEvent</a>( std::vector<unsigned char> *midiEvent, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="keyword">protected</span>:
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="comment">// This protected class function is used for reading variable-length</span>
|
||||
<a name="l00104"></a>00104 <span class="comment">// MIDI file values. It is assumed that this function is called with</span>
|
||||
<a name="l00105"></a>00105 <span class="comment">// the file read pointer positioned at the start of a</span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// variable-length value. The function returns true if the value is</span>
|
||||
<a name="l00107"></a>00107 <span class="comment">// successfully parsed. Otherwise, it returns false.</span>
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">bool</span> readVariableLength( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *value );
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 std::ifstream file_;
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks_;
|
||||
<a name="l00112"></a>00112 <span class="keywordtype">int</span> format_;
|
||||
<a name="l00113"></a>00113 <span class="keywordtype">int</span> division_;
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">bool</span> usingTimeCode_;
|
||||
<a name="l00115"></a>00115 std::vector<double> tickSeconds_;
|
||||
<a name="l00116"></a>00116 std::vector<long> trackPointers_;
|
||||
<a name="l00117"></a>00117 std::vector<long> trackOffsets_;
|
||||
<a name="l00118"></a>00118 std::vector<long> trackLengths_;
|
||||
<a name="l00119"></a>00119 std::vector<char> trackStatus_;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="comment">// This structure and the following variables are used to save and</span>
|
||||
<a name="l00122"></a>00122 <span class="comment">// keep track of a format 1 tempo map (and the initial tickSeconds</span>
|
||||
<a name="l00123"></a>00123 <span class="comment">// parameter for formats 0 and 2).</span>
|
||||
<a name="l00124"></a>00124 <span class="keyword">struct </span>TempoChange {
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> count;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">double</span> tickSeconds;
|
||||
<a name="l00127"></a>00127 };
|
||||
<a name="l00128"></a>00128 std::vector<TempoChange> tempoEvents_;
|
||||
<a name="l00129"></a>00129 std::vector<unsigned long> trackCounters_;
|
||||
<a name="l00130"></a>00130 std::vector<unsigned int> trackTempoIndex_;
|
||||
<a name="l00131"></a>00131 };
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -6,41 +6,49 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>ModalBar.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MODALBAR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MODALBAR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Modal.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1ModalBar.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1ModalBar.html" title="STK resonant bar instrument class.">ModalBar</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Modal.html" title="STK resonance model abstract base class.">Modal</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1ModalBar.html#28577ea9c8c474eca560134d7991855d" title="Class constructor.">ModalBar</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1ModalBar.html#b804e801a2d0b8e8c3552162152d6f3b" title="Class destructor.">~ModalBar</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#d4fbd1f97cd8c8c0782827969b0b4acf" title="Set stick hardness (0.0 - 1.0).">setStickHardness</a>( StkFloat hardness );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#5f0c4d254cb7efb87603a9732a072b38" title="Set stick position (0.0 - 1.0).">setStrikePosition</a>( StkFloat position );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#3a09a114ccd420ab549b8565eb4928af" title="Select a bar preset (currently modulo 9).">setPreset</a>( <span class="keywordtype">int</span> preset );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#e67fe1187b2e2018fd147c7e6293cde2" title="Set the modulation (vibrato) depth.">setModulationDepth</a>( StkFloat mDepth );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#84e5b9963b74f0e4657f79d5dea013cb" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00061"></a>00061 };
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00063"></a>00063 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>ModalBar.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00028 <span class="comment">/***************************************************/</span>
|
||||
00029
|
||||
00030 <span class="preprocessor">#if !defined(__MODALBAR_H)</span>
|
||||
00031 <span class="preprocessor"></span><span class="preprocessor">#define __MODALBAR_H</span>
|
||||
00032 <span class="preprocessor"></span>
|
||||
00033 <span class="preprocessor">#include "Modal.h"</span>
|
||||
00034
|
||||
<a name="l00035"></a><a class="code" href="classModalBar.html">00035</a> <span class="keyword">class </span><a class="code" href="classModalBar.html">ModalBar</a> : <span class="keyword">public</span> <a class="code" href="classModal.html">Modal</a>
|
||||
00036 {
|
||||
00037 <span class="keyword">public</span>:
|
||||
00039 <a class="code" href="classModalBar.html#a0">ModalBar</a>();
|
||||
00040
|
||||
00042 <a class="code" href="classModalBar.html#a1">~ModalBar</a>();
|
||||
00043
|
||||
00045 <span class="keywordtype">void</span> <a class="code" href="classModalBar.html#a2">setStickHardness</a>(MY_FLOAT hardness);
|
||||
00046
|
||||
00048 <span class="keywordtype">void</span> <a class="code" href="classModalBar.html#a3">setStrikePosition</a>(MY_FLOAT position);
|
||||
00049
|
||||
00051 <span class="keywordtype">void</span> <a class="code" href="classModalBar.html#a4">setPreset</a>(<span class="keywordtype">int</span> preset);
|
||||
00052
|
||||
00054 <span class="keywordtype">void</span> <a class="code" href="classModalBar.html#a5">setModulationDepth</a>(MY_FLOAT mDepth);
|
||||
00055
|
||||
00057 <span class="keywordtype">void</span> <a class="code" href="classModalBar.html#a6">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value);
|
||||
00058 };
|
||||
00059
|
||||
00060 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,76 +6,109 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Modal.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MODAL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MODAL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "FileLoop.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00010"></a>00010
|
||||
<a name="l00011"></a>00011 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00024"></a>00024 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1Modal.html">00026</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Modal.html" title="STK resonance model abstract base class.">Modal</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00027"></a>00027 {
|
||||
<a name="l00028"></a>00028 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00033"></a>00033 <a class="code" href="classstk_1_1Modal.html#f6bfea135e80abb5537e62cf099c989a" title="Class constructor, taking the desired number of modes to create.">Modal</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modes = 4 );
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a>00036 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1Modal.html#7f45379ae10495b7a864cade0063705a" title="Class destructor.">~Modal</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#f064dc6ee4290fd51b4a6dc8a1f0909d" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#503092926e66667227bb46312a82a264" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#7e4f9a875e60485d07d50386ff63117f" title="Set the ratio and radius for a specified mode filter.">setRatioAndRadius</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modeIndex, StkFloat ratio, StkFloat radius );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1Modal.html#6e8d79358a5024b2e9a6c6f7c69a43c1">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#6e8d79358a5024b2e9a6c6f7c69a43c1" title="Set the master gain.">setMasterGain</a>( StkFloat aGain ) { masterGain_ = aGain; };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a><a class="code" href="classstk_1_1Modal.html#70006135da2ecdc46eff4156504d94e1">00051</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#70006135da2ecdc46eff4156504d94e1" title="Set the direct gain.">setDirectGain</a>( StkFloat aGain ) { directGain_ = aGain; };
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#08bdfedf10d00dcf19e82809926eab2f" title="Set the gain for a specified mode filter.">setModeGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modeIndex, StkFloat gain );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#b3bac00a47fa6fef70cf3ea442e9b121" title="Initiate a strike with the given amplitude (0.0 - 1.0).">strike</a>( StkFloat amplitude );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#1884c49b76ec8b902f22d50e26a7e365" title="Damp modes with a given decay factor (0.0 - 1.0).">damp</a>( StkFloat amplitude );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#44ce41e8e24e591f382914d00a259c7f" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#3483dafe33fa37e98781279810ea808f" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#9fab49ec164852c381758f5d333f8891" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value ) = 0;
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Modal.html#c1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> *wave_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> **filters_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> onepole_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nModes_;
|
||||
<a name="l00083"></a>00083 std::vector<StkFloat> ratios_;
|
||||
<a name="l00084"></a>00084 std::vector<StkFloat> radii_;
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 StkFloat vibratoGain_;
|
||||
<a name="l00087"></a>00087 StkFloat masterGain_;
|
||||
<a name="l00088"></a>00088 StkFloat directGain_;
|
||||
<a name="l00089"></a>00089 StkFloat stickHardness_;
|
||||
<a name="l00090"></a>00090 StkFloat strikePosition_;
|
||||
<a name="l00091"></a>00091 StkFloat baseFrequency_;
|
||||
<a name="l00092"></a>00092 };
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a><a class="code" href="classstk_1_1Modal.html#c1fd3f5dcb9b5cbb8bed0bff330c3890">00094</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Modal.html#c1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">Modal :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 StkFloat temp = masterGain_ * onepole_.<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( wave_-><a class="code" href="classstk_1_1FileWvIn.html#da668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * envelope_.<a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 StkFloat temp2 = 0.0;
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<nModes_; i++ )
|
||||
<a name="l00100"></a>00100 temp2 += filters_[i]-><a class="code" href="classstk_1_1Modal.html#c1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>(temp);
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 temp2 -= temp2 * directGain_;
|
||||
<a name="l00103"></a>00103 temp2 += directGain_ * temp;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordflow">if</span> ( vibratoGain_ != 0.0 ) {
|
||||
<a name="l00106"></a>00106 <span class="comment">// Calculate AM and apply to master out</span>
|
||||
<a name="l00107"></a>00107 temp = 1.0 + ( vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * vibratoGain_ );
|
||||
<a name="l00108"></a>00108 temp2 = temp * temp2;
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 lastFrame_[0] = temp2;
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Modal.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00012 <span class="comment">/***************************************************/</span>
|
||||
00013
|
||||
00014 <span class="preprocessor">#if !defined(__MODAL_H)</span>
|
||||
00015 <span class="preprocessor"></span><span class="preprocessor">#define __MODAL_H</span>
|
||||
00016 <span class="preprocessor"></span>
|
||||
00017 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
00018 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
00019 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00020 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
00021 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
00022
|
||||
<a name="l00023"></a><a class="code" href="classModal.html">00023</a> <span class="keyword">class </span><a class="code" href="classModal.html">Modal</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
|
||||
00024 {
|
||||
00025 <span class="keyword">public</span>:
|
||||
00027 <a class="code" href="classModal.html#a0">Modal</a>( <span class="keywordtype">int</span> modes = 4 );
|
||||
00028
|
||||
00030 <span class="keyword">virtual</span> <a class="code" href="classModal.html#a1">~Modal</a>();
|
||||
00031
|
||||
00033 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a2">clear</a>();
|
||||
00034
|
||||
00036 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModal.html#a3">setFrequency</a>(MY_FLOAT frequency);
|
||||
00037
|
||||
00039 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a4">setRatioAndRadius</a>(<span class="keywordtype">int</span> modeIndex, MY_FLOAT ratio, MY_FLOAT radius);
|
||||
00040
|
||||
00042 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a5">setMasterGain</a>(MY_FLOAT aGain);
|
||||
00043
|
||||
00045 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a6">setDirectGain</a>(MY_FLOAT aGain);
|
||||
00046
|
||||
00048 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a7">setModeGain</a>(<span class="keywordtype">int</span> modeIndex, MY_FLOAT gain);
|
||||
00049
|
||||
00051 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModal.html#a8">strike</a>(MY_FLOAT amplitude);
|
||||
00052
|
||||
00054 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a9">damp</a>(MY_FLOAT amplitude);
|
||||
00055
|
||||
00057 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a10">noteOn</a>(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
00058
|
||||
00060 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a11">noteOff</a>(MY_FLOAT amplitude);
|
||||
00061
|
||||
00063 <span class="keyword">virtual</span> MY_FLOAT <a class="code" href="classModal.html#a12">tick</a>();
|
||||
00064
|
||||
00066 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModal.html#a13">controlChange</a>(<span class="keywordtype">int</span> number, MY_FLOAT value) = 0;
|
||||
00067
|
||||
00068 <span class="keyword">protected</span>:
|
||||
00069 <a class="code" href="classEnvelope.html">Envelope</a> *envelope;
|
||||
00070 <a class="code" href="classWvIn.html">WvIn</a> *wave;
|
||||
00071 <a class="code" href="classBiQuad.html">BiQuad</a> **filters;
|
||||
00072 <a class="code" href="classOnePole.html">OnePole</a> *onepole;
|
||||
00073 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00074 <span class="keywordtype">int</span> nModes;
|
||||
00075 MY_FLOAT vibratoGain;
|
||||
00076 MY_FLOAT masterGain;
|
||||
00077 MY_FLOAT directGain;
|
||||
00078 MY_FLOAT stickHardness;
|
||||
00079 MY_FLOAT strikePosition;
|
||||
00080 MY_FLOAT baseFrequency;
|
||||
00081 MY_FLOAT *ratios;
|
||||
00082 MY_FLOAT *radii;
|
||||
00083
|
||||
00084 };
|
||||
00085
|
||||
00086 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -6,57 +6,100 @@
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Modulate.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MODULATE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MODULATE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00010"></a>00010
|
||||
<a name="l00011"></a>00011 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1Modulate.html">00023</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Modulate.html" title="STK periodic/random modulator.">Modulate</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00024"></a>00024 {
|
||||
<a name="l00025"></a>00025 <span class="keyword">public</span>:
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00030"></a>00030 <a class="code" href="classstk_1_1Modulate.html#96812173415bfb086f5d8d738f4d0c2e" title="Class constructor.">Modulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033 <a class="code" href="classstk_1_1Modulate.html#dd541ec0d037a21bd236b5790878d060" title="Class destructor.">~Modulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1Modulate.html#6cb78fe2dec3bebf2586764421556706">00036</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#6cb78fe2dec3bebf2586764421556706" title="Reset internal state.">reset</a>( <span class="keywordtype">void</span> ) { lastFrame_[0] = 0.0; };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Modulate.html#298b25f4b7cc56f2dffae5474a05999d">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#298b25f4b7cc56f2dffae5474a05999d" title="Set the periodic (vibrato) rate or frequency in Hz.">setVibratoRate</a>( StkFloat rate ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#1047a43714bc2e40c7e31e8f7e34adbc" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( rate ); };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1Modulate.html#08f2d489a3fba3a10d1f301aed869ed4">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#08f2d489a3fba3a10d1f301aed869ed4" title="Set the periodic (vibrato) gain.">setVibratoGain</a>( StkFloat gain ) { vibratoGain_ = gain; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#c6e7a02378facf59916f2460ed5c2fa5" title="Set the random modulation gain.">setRandomGain</a>( StkFloat gain );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1Modulate.html#ddf73f58590ab082f106c9745c5bedc9">00048</a> StkFloat <a class="code" href="classstk_1_1Modulate.html#ddf73f58590ab082f106c9745c5bedc9" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 StkFloat <a class="code" href="classstk_1_1Modulate.html#237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00061"></a>00061 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Modulate.html#237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00063"></a>00063 <span class="keyword">protected</span>:
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00070"></a>00070 StkFloat vibratoGain_;
|
||||
<a name="l00071"></a>00071 StkFloat randomGain_;
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> noiseRate_;
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> noiseCounter_;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a><a class="code" href="classstk_1_1Modulate.html#237b96dd553d65253abbf00a186e293d">00077</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Modulate.html#237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">Modulate :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00078"></a>00078 {
|
||||
<a name="l00079"></a>00079 <span class="comment">// Compute periodic and random modulations.</span>
|
||||
<a name="l00080"></a>00080 lastFrame_[0] = vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00081"></a>00081 <span class="keywordflow">if</span> ( noiseCounter_++ >= noiseRate_ ) {
|
||||
<a name="l00082"></a>00082 noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00083"></a>00083 noiseCounter_ = 0;
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 lastFrame_[0] += filter_.<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( noise_.<a class="code" href="classstk_1_1Noise.html#1d6c8ed80425cd0cea014bd2e328c823" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00087"></a>00087 }
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Modulate.html#942eee1bb78318e1b59afeb311748b2d">00089</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Modulate.html#237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">Modulate :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00092"></a>00092 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00093"></a>00093 errorString_ << <span class="stringliteral">"Modulate::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096 <span class="preprocessor">#endif</span>
|
||||
<a name="l00097"></a>00097 <span class="preprocessor"></span>
|
||||
<a name="l00098"></a>00098 StkFloat *samples = &frames[channel];
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00101"></a>00101 *samples = <a class="code" href="classstk_1_1Modulate.html#237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">Modulate::tick</a>();
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<h1>Modulate.h</h1><div class="fragment"><pre>00001 <span class="comment">/***************************************************/</span>
|
||||
00011 <span class="comment">/***************************************************/</span>
|
||||
00012
|
||||
00013 <span class="preprocessor">#if !defined(__MODULATE_H)</span>
|
||||
00014 <span class="preprocessor"></span><span class="preprocessor">#define __MODULATE_H</span>
|
||||
00015 <span class="preprocessor"></span>
|
||||
00016 <span class="preprocessor">#include "Stk.h"</span>
|
||||
00017 <span class="preprocessor">#include "WaveLoop.h"</span>
|
||||
00018 <span class="preprocessor">#include "SubNoise.h"</span>
|
||||
00019 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
00020
|
||||
<a name="l00021"></a><a class="code" href="classModulate.html">00021</a> <span class="keyword">class </span><a class="code" href="classModulate.html">Modulate</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
||||
00022 {
|
||||
00023 <span class="keyword">public</span>:
|
||||
00025 <a class="code" href="classModulate.html#a0">Modulate</a>();
|
||||
00026
|
||||
00028 <a class="code" href="classModulate.html#a1">~Modulate</a>();
|
||||
00029
|
||||
00031 <span class="keywordtype">void</span> <a class="code" href="classModulate.html#a2">reset</a>();
|
||||
00032
|
||||
00034 <span class="keywordtype">void</span> <a class="code" href="classModulate.html#a3">setVibratoRate</a>(MY_FLOAT aRate);
|
||||
00035
|
||||
00037 <span class="keywordtype">void</span> <a class="code" href="classModulate.html#a4">setVibratoGain</a>(MY_FLOAT aGain);
|
||||
00038
|
||||
00040 <span class="keywordtype">void</span> <a class="code" href="classModulate.html#a5">setRandomGain</a>(MY_FLOAT aGain);
|
||||
00041
|
||||
00043 MY_FLOAT <a class="code" href="classModulate.html#a6">tick</a>();
|
||||
00044
|
||||
00046 <span class="keyword">virtual</span> MY_FLOAT *<a class="code" href="classModulate.html#a6">tick</a>(MY_FLOAT *vector, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vectorSize);
|
||||
00047
|
||||
00049 MY_FLOAT <a class="code" href="classModulate.html#a8">lastOut</a>() <span class="keyword">const</span>;
|
||||
00050
|
||||
00051 <span class="keyword">protected</span>:
|
||||
00052 <a class="code" href="classWaveLoop.html">WaveLoop</a> *vibrato;
|
||||
00053 <a class="code" href="classSubNoise.html">SubNoise</a> *noise;
|
||||
00054 <a class="code" href="classOnePole.html">OnePole</a> *filter;
|
||||
00055 MY_FLOAT vibratoGain;
|
||||
00056 MY_FLOAT randomGain;
|
||||
00057 MY_FLOAT lastOutput;
|
||||
00058
|
||||
00059 };
|
||||
00060
|
||||
00061 <span class="preprocessor">#endif</span>
|
||||
</pre></div><HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user