mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18730391e8 | ||
|
|
899303d7c4 | ||
|
|
f13d5bb3cd | ||
|
|
cfdfe7736a | ||
|
|
7fcf920d3e | ||
|
|
c37de52787 | ||
|
|
5a8a65870f | ||
|
|
9af41126cb | ||
|
|
d2ed001eb5 | ||
|
|
3706458166 | ||
|
|
c92cf7468d | ||
|
|
e54b0cefab | ||
|
|
1a8403e203 | ||
|
|
554a74374b | ||
|
|
21b93795e7 | ||
|
|
11cf5faa0a | ||
|
|
de344668dd | ||
|
|
fe20fe92a2 | ||
|
|
e11bff2fe8 | ||
|
|
503ed3cc9f | ||
|
|
5d63b50e85 | ||
|
|
d12ef806ac | ||
|
|
ffce5357c6 | ||
|
|
b39c0bb101 | ||
|
|
f25eb5c3d7 | ||
|
|
71e5c027fb | ||
|
|
43dcd5775a |
199
.gitignore
vendored
199
.gitignore
vendored
@@ -1,199 +0,0 @@
|
||||
#####
|
||||
# OS X temporary files that should never be committed
|
||||
#
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
.DS_Store
|
||||
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
.Trashes
|
||||
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
*.swp
|
||||
|
||||
# *.lock - this is used and abused by many editors for many different things.
|
||||
# For the main ones I use (e.g. Eclipse), it should be excluded
|
||||
# from source-control, but YMMV
|
||||
|
||||
*.lock
|
||||
|
||||
#
|
||||
# profile - REMOVED temporarily (on double-checking, this seems incorrect; I can't find it in OS X docs?)
|
||||
#profile
|
||||
|
||||
|
||||
####
|
||||
# Xcode temporary files that should never be committed
|
||||
#
|
||||
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...
|
||||
|
||||
*~.nib
|
||||
|
||||
|
||||
####
|
||||
# Xcode build files -
|
||||
#
|
||||
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"
|
||||
|
||||
DerivedData/
|
||||
|
||||
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"
|
||||
|
||||
build/
|
||||
|
||||
|
||||
#####
|
||||
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
|
||||
#
|
||||
# This is complicated:
|
||||
#
|
||||
# SOMETIMES you need to put this file in version control.
|
||||
# Apple designed it poorly - if you use "custom executables", they are
|
||||
# saved in this file.
|
||||
# 99% of projects do NOT use those, so they do NOT want to version control this file.
|
||||
# ..but if you're in the 1%, comment out the line "*.pbxuser"
|
||||
|
||||
# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html
|
||||
|
||||
*.pbxuser
|
||||
|
||||
# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
|
||||
|
||||
*.mode1v3
|
||||
|
||||
# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
|
||||
|
||||
*.mode2v3
|
||||
|
||||
# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file
|
||||
|
||||
*.perspectivev3
|
||||
|
||||
# NB: also, whitelist the default ones, some projects need to use these
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
|
||||
####
|
||||
# Xcode 4 - semi-personal settings
|
||||
#
|
||||
#
|
||||
# OPTION 1: ---------------------------------
|
||||
# throw away ALL personal settings (including custom schemes!
|
||||
# - unless they are "shared")
|
||||
#
|
||||
# NB: this is exclusive with OPTION 2 below
|
||||
xcuserdata
|
||||
|
||||
# OPTION 2: ---------------------------------
|
||||
# get rid of ALL personal settings, but KEEP SOME OF THEM
|
||||
# - NB: you must manually uncomment the bits you want to keep
|
||||
#
|
||||
# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X,
|
||||
# or manually install git over the top of the OS X version
|
||||
# NB: this is exclusive with OPTION 1 above
|
||||
#
|
||||
#xcuserdata/**/*
|
||||
|
||||
# (requires option 2 above): Personal Schemes
|
||||
#
|
||||
#!xcuserdata/**/xcschemes/*
|
||||
|
||||
####
|
||||
# Xcode 4 workspaces - more detailed
|
||||
#
|
||||
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
|
||||
#
|
||||
# Workspace layout is quite spammy. For reference:
|
||||
#
|
||||
# /(root)/
|
||||
# /(project-name).xcodeproj/
|
||||
# project.pbxproj
|
||||
# /project.xcworkspace/
|
||||
# contents.xcworkspacedata
|
||||
# /xcuserdata/
|
||||
# /(your name)/xcuserdatad/
|
||||
# UserInterfaceState.xcuserstate
|
||||
# /xcsshareddata/
|
||||
# /xcschemes/
|
||||
# (shared scheme name).xcscheme
|
||||
# /xcuserdata/
|
||||
# /(your name)/xcuserdatad/
|
||||
# (private scheme).xcscheme
|
||||
# xcschememanagement.plist
|
||||
#
|
||||
#
|
||||
|
||||
####
|
||||
# Xcode 4 - Deprecated classes
|
||||
#
|
||||
# Allegedly, if you manually "deprecate" your classes, they get moved here.
|
||||
#
|
||||
# We're using source-control, so this is a "feature" that we do not want!
|
||||
|
||||
*.moved-aside
|
||||
|
||||
####
|
||||
# Files generated by automake
|
||||
|
||||
Makefile
|
||||
autom4te.cache
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
projects/demo/Makefile
|
||||
projects/demo/stk-demo
|
||||
projects/demo/Release
|
||||
projects/demo/Debug
|
||||
projects/effects/Makefile
|
||||
projects/effects/effects
|
||||
projects/effects/Release
|
||||
projects/effects/Debug
|
||||
projects/eguitar/Makefile
|
||||
projects/eguitar/eguitar
|
||||
projects/eguitar/Release
|
||||
projects/eguitar/Debug
|
||||
projects/examples/Makefile
|
||||
projects/examples/audioprobe
|
||||
projects/examples/bethree
|
||||
projects/examples/controlbee
|
||||
projects/examples/crtsine
|
||||
projects/examples/duplex
|
||||
projects/examples/foursine
|
||||
projects/examples/grains
|
||||
projects/examples/inetIn
|
||||
projects/examples/inetOut
|
||||
projects/examples/libMakefile
|
||||
projects/examples/midiprobe
|
||||
projects/examples/play
|
||||
projects/examples/playsmf
|
||||
projects/examples/record
|
||||
projects/examples/rtsine
|
||||
projects/examples/sine
|
||||
projects/examples/sineosc
|
||||
projects/examples/threebees
|
||||
projects/examples/Release
|
||||
projects/examples/Debug
|
||||
projects/ragamatic/Makefile
|
||||
projects/ragamatic/ragamat
|
||||
projects/ragamatic/Release
|
||||
projects/ragamatic/Debug
|
||||
src/libstk.a
|
||||
src/Release
|
||||
src/Debug
|
||||
src/Makefile
|
||||
|
||||
####
|
||||
# Files generated by Visual Studio
|
||||
|
||||
projects/*/.vs/
|
||||
projects/*/*.exe
|
||||
projects/*/*.ilk
|
||||
projects/*/*.pdb
|
||||
projects/*/*.vcxproj.user
|
||||
projects/*/Release/
|
||||
projects/*/Debug/
|
||||
138
CMakeLists.txt
138
CMakeLists.txt
@@ -1,138 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.1) ##TODO: which version is better
|
||||
|
||||
project(STK VERSION 4.6.1)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
||||
endif()
|
||||
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo" "MinSizeRel")
|
||||
message("Build type: " ${CMAKE_BUILD_TYPE})
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -D_STK_DEBUG_ -D__RTAUDIO_DEBUG__ -D__RTMIDI_DEBUG__")
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||
message("GCC.")
|
||||
set(CMAKE_CXX_FLAGS "-Wall")
|
||||
endif()
|
||||
|
||||
option(BUILD_SHARED "Whether to build the shared library" ON)
|
||||
option(BUILD_STATIC "Whether to build the static library" ON)
|
||||
option(REALTIME "Realtime support" ON)
|
||||
option(ENABLE_JACK "Enable JACK" ON)
|
||||
option(ENABLE_ALSA "Enable ALSA API support (linux only)" ON)
|
||||
# option(ENABLE_OSS "Enable OSS API Support (unixes only)" ON)
|
||||
option(ENABLE_ASIO "Enable ASIO API support (windows only)" OFF)
|
||||
option(ENABLE_DS "Enable DirectSound API support (windows only)" ON)
|
||||
option(ENABLE_WASAPI "Enable Windows Audio Session API support (windows only)" OFF)
|
||||
# option(ENABLE_CORE "Enable CoreAudio API support (mac only)" ON)
|
||||
option(COMPILE_PROJECTS "Compile all the example projects" ON)
|
||||
|
||||
include_directories("./include")
|
||||
file(GLOB STK_SRC "./src/*.cpp") # GLOB instead of GLOB_RECURSE as the asio depends on system
|
||||
|
||||
#========================================#
|
||||
#========== Realtime Support ============#
|
||||
#========================================#
|
||||
if(REALTIME)
|
||||
if(ENABLE_JACK)
|
||||
find_library(JACK_LIBRARY jack) # find_package(JACK) # TODO: NEED FindJACK.cmake
|
||||
if(JACK_LIBRARY)
|
||||
message("Jack API found: ${JACK_LIBRARY}")
|
||||
link_libraries(${JACK_LIBRARY})
|
||||
add_definitions(-D__UNIX_JACK__)
|
||||
else()
|
||||
message(WARNING "JACK support requires the jack library!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message("${CMAKE_SYSTEM_NAME}")
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
link_libraries(Threads::Threads)
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
||||
# TODO: Finish Linux configuration, include different audio API supports
|
||||
#============== LINUX ================#
|
||||
message("Linux DETECTED!")
|
||||
if(ENABLE_ALSA)
|
||||
find_package(ALSA REQUIRED)
|
||||
if(ALSA_FOUND)
|
||||
include_directories(${ALSA_INCLUDE_DIRS})
|
||||
link_libraries(${ALSA_LIBRARIES})
|
||||
add_definitions(-D__LINUX_ALSA__)
|
||||
endif()
|
||||
endif()
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
|
||||
#============== MAC OS ================#
|
||||
message("Machintosh DETECTED!")
|
||||
find_package(CoreAudio REQUIRED)
|
||||
include_directories(${COREAUDIO_INCLUDE_DIRS})
|
||||
add_definitions(-D__MACOSX_CORE__)
|
||||
link_libraries(${COREAUDIO_LIBRARY} ${COREAUDIO_FOUNDATION} ${COREAUDIO_MIDI})
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
|
||||
# TODO: MORE SUPPORT (e.g., MSYS)?
|
||||
# Tested under MSYS2 with Mingw64 toolchain
|
||||
#============== WINDOWS ================#
|
||||
message("Windows DETECTED!")
|
||||
|
||||
link_libraries(winmm ole32 wsock32)
|
||||
add_definitions(-D__WINDOWS_MM__)
|
||||
|
||||
# TODO: ASIO NOT WORKING YET
|
||||
if(ENABLE_ASIO)
|
||||
message("ENALBING ASIO")
|
||||
include_directories("./src/include")
|
||||
# target_sources(stk PUBLIC "${CMAKE_SOURCE_DIR}/src/include/asio.cpp" "${CMAKE_SOURCE_DIR}/src/include/asiodrivers.cpp"
|
||||
# "${CMAKE_SOURCE_DIR}/src/include/asiolist.cpp" "${CMAKE_SOURCE_DIR}/src/include/iasiothiscallresolver.cpp")
|
||||
add_definitions(-D__WINDOWS_ASIO__)
|
||||
endif()
|
||||
|
||||
if(ENABLE_WASAPI)
|
||||
message("ENALBING WASAPI")
|
||||
link_libraries(mfuuid mfplat wmcodecdspuuid ksuser)
|
||||
add_definitions(-D__WINDOWS_WASAPI__)
|
||||
endif()
|
||||
|
||||
if(ENABLE_DS)
|
||||
message("ENALBING Directsound")
|
||||
link_libraries(dsound)
|
||||
add_definitions(-D__WINDOWS_DS__)
|
||||
endif()
|
||||
else()
|
||||
message("CMAKE_SYSTEM_NAME:" ${CMAKE_SYSTEM_NAME})
|
||||
message(FATAL_ERROR "Unknown system type for realtime support.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(TestBigEndian)
|
||||
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
|
||||
if(NOT IS_BIG_ENDIAN)
|
||||
add_definitions(-D__LITTLE_ENDIAN__)
|
||||
endif()
|
||||
|
||||
#========================================#
|
||||
#========== Build the Library ===========#
|
||||
#========================================#
|
||||
if(BUILD_STATIC)
|
||||
add_library(stk STATIC ${STK_SRC} )
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED)
|
||||
add_library(stk_SHARED SHARED ${STK_SRC})
|
||||
set_target_properties(stk_SHARED PROPERTIES OUTPUT_NAME stk) # rename the shared library name
|
||||
endif()
|
||||
|
||||
#========================================#
|
||||
#========= Build the examples ===========#
|
||||
#========================================#
|
||||
if(COMPILE_PROJECTS)
|
||||
message("COMPILE PROJECTS!")
|
||||
add_subdirectory(projects/examples)
|
||||
add_subdirectory(projects/eguitar)
|
||||
add_subdirectory(projects/demo)
|
||||
add_subdirectory(projects/effects)
|
||||
add_subdirectory(projects/ragamatic)
|
||||
endif()
|
||||
42
INSTALL
Normal file
42
INSTALL
Normal file
@@ -0,0 +1,42 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people simmply choose the classes they need for a particular project and copy those to their project directory. Others like to compile and link to a library of object files. STK was not designed with one particular style of use in mind.
|
||||
|
||||
To configure and compile (on Unix systems and MinGW):
|
||||
|
||||
1. Unpack the STK distribution (tar -xzf stk-4.x.x.tar.gz).
|
||||
2. From within the directory containing this file, run configure:
|
||||
|
||||
./configure
|
||||
|
||||
3. From within each project directory, type "make".
|
||||
4. To compile a library of objects, type "make" from within the src directory.
|
||||
|
||||
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 (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)
|
||||
|
||||
It is now possible to specify more than one audio and MIDI API where supported. Note, however, that the ALSA library is required in order to compile the RtMidi class in Linux if the "--with-oss" option is provided (only the OSS audio API will be used, not the OSS MIDI API). Typing "./configure --help" will display all the available options. In addition, it is possible to specify the RAWWAVES and INCLUDE paths to configure as (ex. to set to /home/me/rawwaves and /home/me/include):
|
||||
|
||||
./configure RAWWAVE_PATH='$(HOME)/rawwaves/'
|
||||
./configure INCLUDE_PATH='$(HOME)/include/'
|
||||
|
||||
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.
|
||||
|
||||
If you wish to use a different compiler than that selected by configure, specify that compiler in the command line (ex. to use CC):
|
||||
|
||||
./configure CXX=CC
|
||||
|
||||
|
||||
For Windows Users:
|
||||
|
||||
MinGW support is provided in the configure script. In addition, Visual C++ 6.0 project files are included for each of the example STK projects, though these may not work with more recent versions of Visual Studio.
|
||||
54
INSTALL.md
54
INSTALL.md
@@ -1,54 +0,0 @@
|
||||
# The Synthesis ToolKit in C++ (STK)
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2021.
|
||||
|
||||
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people simply choose the classes they need for a particular project and copy those to their project directory. Others like to compile and link to a library of object files. STK was not designed with one particular style of use in mind.
|
||||
|
||||
## Unix systems and MinGW
|
||||
|
||||
1. If you downloaded the software from the git repository, first run autoconf,
|
||||
|
||||
autoconf
|
||||
|
||||
otherwise, if you downloaded the software from the STK source distribution, unpack the tar file,
|
||||
|
||||
tar -xzf stk-4.x.x.tar.gz
|
||||
|
||||
2. From within the directory containing this file, run configure:
|
||||
|
||||
./configure
|
||||
|
||||
3. From within each project directory, type `make`.
|
||||
|
||||
4. To compile a library of objects, type `make` from within the `src` directory.
|
||||
|
||||
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 (default, linux only)
|
||||
--with-oss = choose native OSS API support (unixes only)
|
||||
--with-jack = choose native JACK server API support (linux and macintosh OS-X)
|
||||
--with-core = choose OS-X CoreAudio API (macintosh OS-X only)
|
||||
--with-asio = choose ASIO API support (windows only)
|
||||
--with-ds = choose DirectSound API support (windows only)
|
||||
--with-wasapi = choose Windows Audio Session API support (windows only)
|
||||
|
||||
It is now possible to specify more than one audio and MIDI API where supported. Note, however, that the ALSA library is required in order to compile the RtMidi class in Linux if the `--with-oss` option is provided (only the OSS audio API will be used, not the OSS MIDI API). Typing `./configure --help` will display all the available options. In addition, it is possible to specify the RAWWAVES and INCLUDE paths to configure as (e.g. to set to /home/me/rawwaves and /home/me/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.
|
||||
|
||||
If you wish to use a different compiler than that selected by configure, specify that compiler in the command line (e.g. to use CC):
|
||||
|
||||
./configure CXX=CC
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
MinGW support is provided in the configure script. In addition, Visual Studio 2017 project files are included for each of the example STK projects.
|
||||
|
||||
## iOS
|
||||
|
||||
You can integrate the STK in iOS projects either by using its iOS static library or CocoaPods. See the [iOS README file](iOS/README-iOS.md) for instructions.
|
||||
27
LICENSE
27
LICENSE
@@ -1,27 +0,0 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
Copyright (c) 1995-2021 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.
|
||||
11
Makefile.in
11
Makefile.in
@@ -2,40 +2,29 @@
|
||||
|
||||
RM = /bin/rm
|
||||
|
||||
REALTIME = @realtime@
|
||||
|
||||
all :
|
||||
cd src && $(MAKE)
|
||||
cd projects/demo && $(MAKE) libdemo
|
||||
ifeq ($(REALTIME),yes)
|
||||
cd projects/effects && $(MAKE) libeffects
|
||||
cd projects/ragamatic && $(MAKE) libragamat
|
||||
cd projects/eguitar && $(MAKE) libeguitar
|
||||
endif
|
||||
cd projects/examples && $(MAKE) -f libMakefile
|
||||
|
||||
clean :
|
||||
$(RM) -f *~
|
||||
cd src && $(MAKE) clean
|
||||
cd projects/demo && $(MAKE) clean
|
||||
ifeq ($(REALTIME),yes)
|
||||
cd projects/effects && $(MAKE) clean
|
||||
cd projects/ragamatic && $(MAKE) clean
|
||||
cd projects/eguitar && $(MAKE) clean
|
||||
endif
|
||||
cd projects/examples && $(MAKE) clean
|
||||
|
||||
distclean: clean
|
||||
$(RM) -rf config.log config.status autom4te.cache Makefile
|
||||
cd src && $(MAKE) distclean
|
||||
cd projects/demo && $(MAKE) distclean
|
||||
ifeq ($(REALTIME),yes)
|
||||
cd projects/effects && $(MAKE) distclean
|
||||
cd projects/ragamatic && $(MAKE) distclean
|
||||
cd projects/eguitar && $(MAKE) distclean
|
||||
endif
|
||||
cd projects/examples && $(MAKE) distclean
|
||||
|
||||
install:
|
||||
$(MAKE) -C src install
|
||||
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
# The Synthesis ToolKit in C++ (STK)
|
||||
By Perry R. Cook and Gary P. Scavone, 1995--2021.
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
This distribution of the Synthesis ToolKit in C++ (STK) contains the following:
|
||||
|
||||
* [`include`](include/): STK class header files
|
||||
* [`src`](src/): STK class source files
|
||||
* [`rawwaves`](rawwaves): STK audio files (1-channel, 16-bit, big-endian)
|
||||
* [`doc`](doc): STK documentation
|
||||
* [`projects`](projects): example STK projects and programs
|
||||
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 projects and programs
|
||||
|
||||
Please read the [Legal and Ethical notes](#legal-and-ethical) near the bottom of this document and the [License](LICENSE).
|
||||
Please read the Legal and Ethical notes near the bottom of this document.
|
||||
|
||||
For compiling and installing STK, see the [INSTALL.md](INSTALL.md) file in this directory.
|
||||
For compiling and installing STK, see the INSTALL file in this directory.
|
||||
|
||||
## Contents
|
||||
|
||||
* [Overview](#overview)
|
||||
* [System Requirements](#system-requirements)
|
||||
* [What's New (and not so new)](#whats-new-and-not-so-new)
|
||||
* [Disclaimer](#disclaimer)
|
||||
* [Legal and Ethical](#legal-and-ethical)
|
||||
* [Further Reading](#further-reading)
|
||||
* [Perry's Notes From the Original Distribution](#perrys-notes-from-the-original-distribution)
|
||||
|
||||
# OVERVIEW
|
||||
OVERVIEW:
|
||||
|
||||
The Synthesis ToolKit in C++ (STK) is a set of open source audio
|
||||
signal processing and algorithmic synthesis classes written in the C++
|
||||
@@ -63,7 +55,7 @@ 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 (https://www.tcl.tk/) which is freely
|
||||
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),
|
||||
@@ -71,17 +63,17 @@ and SKINI (Synthesis ToolKit Instrument Network Interface, a MIDI-like
|
||||
text message synthesis control format).
|
||||
|
||||
|
||||
# SYSTEM REQUIREMENTS
|
||||
SYSTEM REQUIREMENTS:
|
||||
|
||||
See the individual README's (e.g. README-linux) in the /doc directory
|
||||
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 VS2017 workspace files to compile the
|
||||
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 (AND NOT SO 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. We attempt to maintain backward
|
||||
@@ -104,10 +96,10 @@ Md2Skini program.
|
||||
Realtime audio input capabilities were added to STK with release 3.0,
|
||||
though the behavior of such is very hardware dependent. Under Linux
|
||||
and Macintosh OS-X, audio input and output are possible with very low
|
||||
latency. Using the Windows DirectSound API, minimum dependable output
|
||||
latency. Using the Windoze DirectSound API, minimum dependable output
|
||||
sound latency seems to be around 20 milliseconds or so, while input
|
||||
sound latency is generally higher. Performance with the ASIO audio
|
||||
API on Windows provides much better performance.
|
||||
API on Windoze provides much better performance.
|
||||
|
||||
As mentioned above, it is possible to record the audio ouput of an STK
|
||||
program to .snd, .wav, .raw, .aif, and .mat (Matlab MAT-file) output
|
||||
@@ -121,7 +113,7 @@ configure script generates a Makefile in the src directory that will
|
||||
accomplish that.
|
||||
|
||||
|
||||
# DISCLAIMER
|
||||
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
|
||||
@@ -130,7 +122,7 @@ can also make suggestions, but again, no guarantees. Send email to
|
||||
the mail list.
|
||||
|
||||
|
||||
# LEGAL AND ETHICAL
|
||||
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
|
||||
@@ -148,8 +140,39 @@ 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:
|
||||
|
||||
# FURTHER READING
|
||||
STK WWW site: http://ccrma.stanford.edu/software/stk/
|
||||
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
Copyright (c) 1995-2012 Perry R. Cook and Gary P. Scavone
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"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
|
||||
@@ -157,7 +180,7 @@ http://ccrma.stanford.edu/software/stk/. Also check the platform
|
||||
specific README's for specific system requirements.
|
||||
|
||||
|
||||
# PERRY'S NOTES FROM THE ORIGINAL DISTRIBUTION
|
||||
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
|
||||
@@ -180,11 +203,11 @@ The answers lie below.
|
||||
|
||||
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.
|
||||
|
||||
55
STK.podspec
55
STK.podspec
@@ -1,55 +0,0 @@
|
||||
# To lint the spec:
|
||||
# pod spec lint --skip-import-validation --allow-warnings
|
||||
# To publish:
|
||||
# pod trunk push STK.podspec --skip-import-validation --allow-warnings
|
||||
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'STK'
|
||||
spec.version = '4.6.2'
|
||||
spec.summary = 'The Synthesis ToolKit in C++ is a set of open source audio signal processing and algorithmic synthesis classes.'
|
||||
spec.homepage = 'https://ccrma.stanford.edu/software/stk/'
|
||||
spec.source = { :git => 'https://github.com/thestk/stk.git', :tag => spec.version }
|
||||
spec.license = { :type => 'MIT' }
|
||||
spec.author = { "Ariel Elkin" => "ariel@arivibes.com" }
|
||||
spec.platform = :ios
|
||||
spec.ios.deployment_target = "10.0"
|
||||
spec.source_files = [
|
||||
"src/*.cpp",
|
||||
"include/*.h"
|
||||
]
|
||||
spec.public_header_files = [
|
||||
"include/*.h",
|
||||
"include/SKINImsg.h",
|
||||
"include/SKINItbl.h"
|
||||
]
|
||||
spec.exclude_files = [
|
||||
"include/Thread.h",
|
||||
"src/Thread.cpp",
|
||||
"include/Mutex.h",
|
||||
"src/Mutex.cpp",
|
||||
"include/UdpSocket.h",
|
||||
"src/UdpSocket.cpp",
|
||||
"include/Socket.h",
|
||||
"src/Socket.cpp",
|
||||
"include/TcpClient.h",
|
||||
"src/TcpClient.cpp",
|
||||
"include/TcpServer.h",
|
||||
"src/TcpServer.cpp",
|
||||
"include/InetWvIn.h",
|
||||
"src/InetWvIn.cpp",
|
||||
"include/InetWvOut.h",
|
||||
"src/InetWvOut.cpp",
|
||||
"include/RtAudio.h",
|
||||
"src/RtAudio.cpp",
|
||||
"include/RtMidi.h",
|
||||
"src/RtMidi.cpp",
|
||||
"include/RtWvIn.h",
|
||||
"src/RtWvIn.cpp",
|
||||
"include/RtWvOut.h",
|
||||
"src/RtWvOut.cpp",
|
||||
"include/RtError.h"
|
||||
]
|
||||
spec.preserve_paths = "README.MD"
|
||||
spec.resource_bundles = { "rawwaves": "rawwaves/*.raw" }
|
||||
spec.libraries = 'c++'
|
||||
end
|
||||
@@ -1,21 +0,0 @@
|
||||
find_library(COREAUDIO_LIBRARY CoreAudio)
|
||||
find_library(COREAUDIO_FOUNDATION CoreFoundation)
|
||||
find_library(COREAUDIO_MIDI CoreMIDI)
|
||||
find_path(COREAUDIO_INCLUDE_DIRS CoreAudio/CoreAudio.h)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
CoreAudio
|
||||
DEFAULT_MSG
|
||||
COREAUDIO_LIBRARY
|
||||
COREAUDIO_FOUNDATION
|
||||
COREAUDIO_MIDI
|
||||
COREAUDIO_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(
|
||||
COREAUDIO_LIBRARY
|
||||
COREAUDIO_FOUNDATION
|
||||
COREAUDIO_MIDI
|
||||
COREAUDIO_INCLUDE_DIRS)
|
||||
|
||||
|
||||
1586
config/config.guess
vendored
1586
config/config.guess
vendored
File diff suppressed because it is too large
Load Diff
771
config/config.sub
vendored
771
config/config.sub
vendored
File diff suppressed because it is too large
Load Diff
120
configure.ac
120
configure.ac
@@ -1,5 +1,5 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(STK, 4.6.2, gary.scavone@mcgill.ca, stk)
|
||||
AC_INIT(STK, 4.4, gary@music.mcgill.ca, stk)
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AC_CONFIG_SRCDIR(src/Stk.cpp)
|
||||
AC_CONFIG_FILES(Makefile src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile projects/eguitar/Makefile)
|
||||
@@ -7,10 +7,6 @@ AC_CONFIG_FILES(Makefile src/Makefile projects/demo/Makefile projects/effects/Ma
|
||||
# Fill GXX with something before test.
|
||||
AC_SUBST( GXX, ["no"] )
|
||||
|
||||
# standards version
|
||||
m4_include([m4/ax_cxx_compile_stdcxx.m4])
|
||||
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CXX(g++ CC c++ cxx)
|
||||
AC_PROG_RANLIB
|
||||
@@ -54,26 +50,6 @@ else
|
||||
fi
|
||||
AC_MSG_RESULT($realtime)
|
||||
|
||||
AC_MSG_CHECKING(whether to build the static library)
|
||||
AC_ARG_ENABLE(static,
|
||||
[ --disable-static = do not compile static library ],
|
||||
build_static=$enableval,
|
||||
build_static=yes)
|
||||
AC_SUBST(build_static)
|
||||
AC_MSG_RESULT($build_static)
|
||||
|
||||
AC_MSG_CHECKING(whether to build the shared library)
|
||||
AC_ARG_ENABLE(shared,
|
||||
[ --enable-shared = compile the shared library ],
|
||||
build_shared=$enableval,
|
||||
build_shared=no)
|
||||
AC_SUBST(build_shared)
|
||||
AC_MSG_RESULT($build_shared)
|
||||
|
||||
if test x$build_static = xno -a x$build_shared = xno ; then
|
||||
AC_MSG_ERROR([ both static and shared libraries are disabled], 1)
|
||||
fi
|
||||
|
||||
# Check for math library
|
||||
AC_CHECK_LIB(m, cos, , AC_MSG_ERROR(math library is needed!))
|
||||
|
||||
@@ -104,6 +80,7 @@ fi
|
||||
CPPFLAGS="$CPPFLAGS $cppflag"
|
||||
|
||||
# For debugging and optimization ... overwrite default because it has both -g and -O2
|
||||
echo "$CXXFLAGS"
|
||||
CXXFLAGS="$cxxflag"
|
||||
|
||||
# Check compiler and use -Wall if gnu.
|
||||
@@ -115,122 +92,95 @@ CXXFLAGS="$CXXFLAGS $cxxflag"
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
basesharedname="libstk-\$(RELEASE)"
|
||||
|
||||
AC_SUBST( sharedlib, ["libstk.so"] )
|
||||
AC_SUBST( sharedname, [${basesharedname}.so] )
|
||||
AC_SUBST( libflags, ["-shared -Wl,-soname,${basesharedname}.so -o $sharedname"] )
|
||||
AC_SUBST( sharedname, ["libstk.so.\$(RELEASE)"] )
|
||||
AC_SUBST( libflags, ["-shared -Wl,-soname,\$(SHAREDLIB).\$(MAJOR) -o \$(SHAREDLIB).\$(RELEASE)"] )
|
||||
case $host in
|
||||
*-apple*)
|
||||
AC_SUBST( sharedlib, ["libstk.dylib"] )
|
||||
AC_SUBST( sharedname, ["${basesharedname}.dylib"] )
|
||||
AC_SUBST( libflags, ["-dynamiclib -install_name \$(libdir)/${basesharedname}.dylib -o ${basesharedname}.dylib"] )
|
||||
AC_SUBST( sharedname, ["libstk.\$(RELEASE).dylib"] )
|
||||
AC_SUBST( libflags, ["-dynamiclib -o libstk.\$(RELEASE).dylib"] )
|
||||
esac
|
||||
|
||||
if test $realtime = yes; then
|
||||
# Checks for package options and external software
|
||||
AC_MSG_CHECKING(for audio API)
|
||||
|
||||
AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)])
|
||||
AS_IF([test "x$with_jack" == "xyes"], [
|
||||
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!))])
|
||||
|
||||
case $host in
|
||||
*-*-netbsd*)
|
||||
AS_IF([test "$api" == ""], [
|
||||
AC_MSG_RESULT(using OSS)
|
||||
api="$api -D__LINUX_OSS__"
|
||||
LIBS="$LIBS -lossaudio"
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))])
|
||||
;;
|
||||
|
||||
*-*-freebsd*)
|
||||
AS_IF([test "$api" == ""], [
|
||||
AC_MSG_RESULT(using OSS)
|
||||
api="$api -D__LINUX_OSS__"
|
||||
LIBS="$LIBS -lossaudio"
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))])
|
||||
;;
|
||||
|
||||
*-*-linux*)
|
||||
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 ALSA flag
|
||||
AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)])
|
||||
AS_IF([test "x$with_alsa" == "xyes"], [
|
||||
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!))])
|
||||
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 (unixes only)])
|
||||
AS_IF([test "x$with_oss" == "xyes"], [
|
||||
AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [
|
||||
api="$api -D__LINUX_OSS__ -D__LINUX_ALSA__"
|
||||
AC_MSG_RESULT(using OSS)
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(OSS support requires ALSA for RtMidi!))])
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(OSS support requires ALSA for RtMidi!))], )
|
||||
|
||||
# If no audio api flags specified, use ALSA
|
||||
AS_IF([test "$api" == ""], [
|
||||
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
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
|
||||
;;
|
||||
|
||||
*-apple*)
|
||||
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)])
|
||||
AS_IF([test "x$with_core" == "xyes"], [
|
||||
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" ])
|
||||
LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework CoreMidi" ], )
|
||||
|
||||
# If no audio api flags specified, use CoreAudio
|
||||
AS_IF([test "$api" == ""], [
|
||||
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"] )
|
||||
])
|
||||
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)])
|
||||
AS_IF([test "x$with_asio" == "xyes"], [
|
||||
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"] ) ])
|
||||
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)])
|
||||
AS_IF([test "x$with_ds" == "xyes"], [
|
||||
AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [
|
||||
api="$api -D__WINDOWS_DS__"
|
||||
AC_MSG_RESULT(using DirectSound)
|
||||
LIBS="-ldsound $LIBS" ])
|
||||
|
||||
# Look for WASAPI flag
|
||||
AC_ARG_WITH(wasapi, [ --with-wasapi = choose Windows Audio Session API support (windoze only)])
|
||||
AS_IF([test "x$with_wasapi" == "xyes"], [
|
||||
api="$api -D__WINDOWS_WASAPI__"
|
||||
AC_MSG_RESULT(using WASAPI)
|
||||
LIBS="-luuid -lksuser $LIBS" ])
|
||||
LIBS="-ldsound -lwinmm $LIBS" ], )
|
||||
|
||||
# If no audio api flags specified, use DirectSound
|
||||
AS_IF([test "$api" == ""], [
|
||||
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"
|
||||
LIBS="-lole32 -lwinmm -lWsock32 $LIBS"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995--2021.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995--2021.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
@@ -10,7 +10,7 @@ It is necessary to install the OS X developer kit (or the command line tools) in
|
||||
|
||||
Tcl/Tk on OS X:
|
||||
|
||||
I think that Tcl/Tk interpreter is now included in the Xcode package, since I haven't had to download it for several years now.
|
||||
I think that tcl/tk interpreter is now included in the XCode package, since I haven't had to download it for several years now.
|
||||
|
||||
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 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.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995--2021.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
|
||||
@@ -1,26 +1,35 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995--2021.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
Please read the file README.md for more general STK information.
|
||||
Please read the file README for more general STK information.
|
||||
|
||||
The configure script supports MinGW.
|
||||
The configure script supports MinGW. As well, STK is distributed with Visual C++ .NET project and workspace files (though these may no longer work with current versions of Visual Studio). It no longer compiles with Visual C++ 6.0.
|
||||
|
||||
STK has been built and tested on Windows platforms using Visual Studio. It is assumed here that you're familiar with Visual C++ and its particular idiosyncrasies. The currently supported version is VS2017. You can download the free non-commercial community edition from the Microsoft website. The folders in the projects directory contain VS2017 solution files.
|
||||
If you are creating a new stk application, it's easiest to use the supplied template:
|
||||
- Copy stk\projects\stk-template.zip to C:\Users\<user>\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C++ Project\
|
||||
- Start VS2017.
|
||||
- Select create new project...
|
||||
- Select Visual C++.
|
||||
- Select stk-template and enter your preferred project name and location. Note that if you do not put the project at the same level as stk\projects you will have to fix all paths in the project properties to match.
|
||||
- The template is based on one of the projects in the examples directory. Add/remove files as needed and edit main.cpp to taste.
|
||||
With Windows XP/7, piping works as under unix. Simply fire up the script files (ex. StkDemo.bat) by either double-clicking on them or from within a shell.
|
||||
|
||||
To use the Tcl/Tk GUIs, you will have to install Tcl/Tk and build using 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.
|
||||
|
||||
With Windows XP and later, piping works as under unix. Simply fire up the script files (e.g. StkDemo.bat) by either double-clicking on them or from within a shell.
|
||||
|
||||
The DirectSound, WASAPI and Steinberg ASIO audio APIs are supported for realtime audio input/output. The VS2017 project files included with this distribution are configured to use all supported APIs. The default (as in stk-template) is the DirectSound API (preprocessor definition __WINDOWS_DS__). In order to use the ASIO API, it is necessary to use the preprocessor definition __WINDOWS_ASIO__, as well as include most of 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.
|
||||
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 can be high. If you experience realtime audio "stuttering", you should experiment with different "buffer size" and "number of buffers" values.
|
||||
|
||||
Realtime MIDI input/output is supported by RtMidi using the winmm.lib API and requires the __WINDOWS_MM__ preprocessor definition.
|
||||
|
||||
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.
|
||||
|
||||
2. Under C/C++ > Code Generation: Set "Use run-time library:" to Multithreaded (use "debug" versions for the debug configuration).
|
||||
|
||||
3. Under Link > General: Add winmm.lib, dsound.lib, and Wsock32.lib to the end of the Object/library modules list.
|
||||
|
||||
4. Under C/C++ > Preprocessor: Add "../../include" directory to the "extra include" 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.
|
||||
|
||||
Remember that items 1-5 above need to be done for each project and for each configuration. There might be an easy way to make global changes, but I couldn't figure it out.
|
||||
|
||||
To use the Tcl/Tk GUIs, you will have to install Tcl/Tk.
|
||||
|
||||
@@ -1,44 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995--2021.
|
||||
|
||||
v.4.6.2 (17 November 2021)
|
||||
- see github site for complete details (github.com/thestk/stk)
|
||||
- bug fixes in LentPitShift and Granulate classes
|
||||
- Makefile fixes
|
||||
- miscellaneous bug fixes
|
||||
|
||||
v.4.6.1 (18 April 2019)
|
||||
- see github site for complete details (github.com/thestk/stk)
|
||||
- various documentation updates
|
||||
- new Recorder (flute a la Verge) class (thanks to Mathias Bredholt)
|
||||
- updated Modulate class to allow noise rate control
|
||||
- new VS2017 project files
|
||||
- fix in FileLoop::getSize() to return file size (not chunk size)
|
||||
|
||||
v.4.6.0 (31 August 2017)
|
||||
- see github site for complete details
|
||||
- various build system updates
|
||||
- fixes in FileWvIn / FileLoop for normalisation and scaling, as well as file opening
|
||||
- bug fix for MAT-files in FileWrite
|
||||
- bug fix in MidiFileIn.cpp for timing and time-code formats
|
||||
- updated versions of RtAudio and RtMidi
|
||||
|
||||
v4.5.1 (22 February 2017)
|
||||
- fix for FileWvIn / FileLoop classes to avoid keeping files open if not necessary
|
||||
- miscellaneous bug fixes, documented on GitHub site (github.com/thestk/stk)
|
||||
- update to play.cpp example to play mono files as stereo
|
||||
- bug fix in DelayL::setDelay() function
|
||||
- miscellanous build bug fixes
|
||||
|
||||
v4.5.0: (26 April 2014)
|
||||
- updated versions of RtAudio and RtMidi, with associated renaming of RtError class to either RtAudioError or RtMidiError and addition of WASAPI support in Windows
|
||||
- added support in FileRead for little-endian AIFC file format
|
||||
- new iOS project files (thanks to Ariel Elkin)
|
||||
- bug fix in FreeVerb that could cause crackling for stereo input
|
||||
- various bug fixes and updates to minimize compiler warnings
|
||||
- ADSR fix for decay/release time calculations
|
||||
- various updates to build system
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
v4.4.4: (24 August 2012)
|
||||
- new FreeVerb class (thanks to Greg Burlet)
|
||||
@@ -169,7 +131,7 @@ v4.1.3: (22 March 2004)
|
||||
v4.1.2: (15 March 2004)
|
||||
- added Linux JACK support to RtAudio
|
||||
- added optional doNormalize argument to WvIn to allow specification of data normalization or not
|
||||
- added volume control to demo program and various Tcl scripts
|
||||
- added volume control to demo program and various tcl scripts
|
||||
- added support for dynamic rawwavePath() setting
|
||||
- WaveLoop bug fix
|
||||
- fixed bug in ADSR::setReleaseTime() method
|
||||
@@ -193,7 +155,7 @@ v4.1: (8 October 2002)
|
||||
- added Voicer, SingWave, and VoicForm classes
|
||||
- improvements/fixes to the banded waveguide instruments
|
||||
- demo program now uses Voicer, allowing polyphony
|
||||
- demo Tcl/Tk scripts changed to use SKINI PitchChange instead of PitchBend
|
||||
- demo tcl/tk scripts changed to use SKINI PitchChange instead of PitchBend
|
||||
- demo program response to PitchBend modified to octave up/down
|
||||
- several RtAudio fixes and improvements (OS X and Windows ASIO support added)
|
||||
- added nextOut() method to Delay classes
|
||||
|
||||
@@ -85,7 +85,7 @@ upon/from which to build and depart.
|
||||
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
|
||||
SKINItbl.h file. This is described in more detail later.
|
||||
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,
|
||||
@@ -109,9 +109,9 @@ upon/from which to build and depart.
|
||||
|
||||
All fields other than type, time, and channel are optional, and the
|
||||
types and useage of the additional fields is defined in the file
|
||||
SKINItbl.h.
|
||||
SKINI.tbl.
|
||||
|
||||
The other important file used by SKINI is SKINImsg.h, which is a
|
||||
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
|
||||
@@ -127,13 +127,13 @@ upon/from which to build and depart.
|
||||
receiving SKINI messages a line at a time, usually in real time,
|
||||
but not restricted to real time.
|
||||
|
||||
SKINImsg.h should be included by anything wanting to use the
|
||||
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.
|
||||
|
||||
SKINItbl.h is used only by the SKINI parser object (Skini.cpp).
|
||||
In the file SKINItbl.h, an array of structures is declared and
|
||||
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
|
||||
@@ -195,7 +195,7 @@ upon/from which to build and depart.
|
||||
A -1 channel can be used as don't care, omni, or other functions
|
||||
depending on your needs and taste.
|
||||
|
||||
g) All remaining fields are specified in the SKINItbl.h file.
|
||||
g) 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
|
||||
@@ -237,9 +237,9 @@ upon/from which to build and depart.
|
||||
NoteOff 0.000000 2 71 82
|
||||
NoteOff 0.000000 2 79 82
|
||||
|
||||
7) The SKINItbl.h File, How Messages are Parsed:
|
||||
7) The SKINI.tbl File, How Messages are Parsed:
|
||||
|
||||
The SKINItbl.h file contains an array of structures which
|
||||
The SKINI.tbl file contains an array of structures which
|
||||
are accessed by the parser object Skini.cpp. The struct is:
|
||||
|
||||
struct SKINISpec { char messageString[32];
|
||||
@@ -276,7 +276,7 @@ upon/from which to build and depart.
|
||||
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 SKINItbl.h file
|
||||
Here's a couple of lines from the SKINI.tbl file
|
||||
|
||||
{"NoteOff" , __SK_NoteOff_, SK_DBL, SK_DBL},
|
||||
{"NoteOn" , __SK_NoteOn_, SK_DBL, SK_DBL},
|
||||
@@ -290,7 +290,7 @@ upon/from which to build and depart.
|
||||
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 SKINImsg.h to be the MIDI byte value, without
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.8.3.1
|
||||
# Doxyfile 1.6.2
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project
|
||||
@@ -22,9 +22,8 @@
|
||||
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
|
||||
# The PROJECT_NAME tag is a single word (or sequence of words) that should
|
||||
# identify the project. Note that if you do not use Doxywizard you need
|
||||
# to put quotes around the project name if it contains spaces.
|
||||
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
||||
# by quotes) that should identify the project.
|
||||
|
||||
PROJECT_NAME = STK
|
||||
|
||||
@@ -32,20 +31,7 @@ PROJECT_NAME = STK
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.6.2
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer
|
||||
# a quick idea about the purpose of the project. Keep the description short.
|
||||
|
||||
PROJECT_BRIEF =
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is
|
||||
# included in the documentation. The maximum height of the logo should not
|
||||
# exceed 55 pixels and the maximum width should not exceed 200 pixels.
|
||||
# Doxygen will copy the logo to the output directory.
|
||||
|
||||
PROJECT_LOGO =
|
||||
PROJECT_NUMBER = 4.4.4
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
@@ -71,7 +57,7 @@ CREATE_SUBDIRS = NO
|
||||
# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
|
||||
# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
|
||||
# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
|
||||
# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
|
||||
# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
|
||||
# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
|
||||
|
||||
OUTPUT_LANGUAGE = English
|
||||
@@ -126,9 +112,7 @@ FULL_PATH_NAMES = NO
|
||||
# only done if one of the specified strings matches the left-hand part of
|
||||
# the path. The tag can be used to show relative paths in the file list.
|
||||
# If left blank the directory from which doxygen is run is used as the
|
||||
# path to strip. Note that you specify absolute paths here, but also
|
||||
# relative paths, which will be relative from the directory where doxygen is
|
||||
# started.
|
||||
# path to strip.
|
||||
|
||||
STRIP_FROM_PATH =
|
||||
|
||||
@@ -142,7 +126,7 @@ STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
|
||||
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
|
||||
# (but less readable) file names. This can be useful if your file system
|
||||
# (but less readable) file names. This can be useful is your file systems
|
||||
# doesn't support long names like on DOS, Mac, or CD-ROM.
|
||||
|
||||
SHORT_NAMES = NO
|
||||
@@ -197,13 +181,6 @@ TAB_SIZE = 9
|
||||
|
||||
ALIASES =
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding
|
||||
# "class=itcl::class" will allow you to use the command class in the
|
||||
# itcl::class meaning.
|
||||
|
||||
TCL_SUBST =
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
|
||||
# sources only. Doxygen will then generate output that is more tailored for C.
|
||||
# For instance, some of the names that are used will be different. The list
|
||||
@@ -230,40 +207,23 @@ OPTIMIZE_FOR_FORTRAN = NO
|
||||
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
|
||||
# Doxygen selects the parser to use depending on the extension of the files it
|
||||
# parses. With this tag you can assign which parser to use for a given
|
||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||
# using this tag. The format is ext=language, where ext is a file extension,
|
||||
# and language is one of the parsers supported by doxygen: IDL, Java,
|
||||
# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
|
||||
# C++. For instance to make doxygen treat .inc files as Fortran files (default
|
||||
# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
|
||||
# that for custom extensions you also need to set FILE_PATTERNS otherwise the
|
||||
# files are not read by doxygen.
|
||||
# Doxygen selects the parser to use depending on the extension of the files it parses.
|
||||
# With this tag you can assign which parser to use for a given extension.
|
||||
# Doxygen has a built-in mapping, but you can override or extend it using this tag.
|
||||
# The format is ext=language, where ext is a file extension, and language is one of
|
||||
# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
|
||||
# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
|
||||
# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
|
||||
# use: inc=Fortran f=C. Note that for custom extensions you also need to set
|
||||
# FILE_PATTERNS otherwise the files are not read by doxygen.
|
||||
|
||||
EXTENSION_MAPPING =
|
||||
|
||||
# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
|
||||
# comments according to the Markdown format, which allows for more readable
|
||||
# documentation. See http://daringfireball.net/projects/markdown/ for details.
|
||||
# The output of markdown processing is further processed by doxygen, so you
|
||||
# can mix doxygen, HTML, and XML commands with Markdown formatting.
|
||||
# Disable only in case of backward compatibilities issues.
|
||||
|
||||
MARKDOWN_SUPPORT = YES
|
||||
|
||||
# When enabled doxygen tries to link words that correspond to documented classes,
|
||||
# or namespaces to their corresponding documentation. Such a link can be
|
||||
# prevented in individual cases by by putting a % sign in front of the word or
|
||||
# globally by setting AUTOLINK_SUPPORT to NO.
|
||||
|
||||
AUTOLINK_SUPPORT = YES
|
||||
|
||||
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
|
||||
# to include (a tag file for) the STL sources as input, then you should
|
||||
# set this tag to YES in order to let doxygen match functions declarations and
|
||||
# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
|
||||
# func(std::string) {}). This also makes the inheritance and collaboration
|
||||
# func(std::string) {}). This also make the inheritance and collaboration
|
||||
# diagrams that involve STL classes more complete and accurate.
|
||||
|
||||
BUILTIN_STL_SUPPORT = YES
|
||||
@@ -279,10 +239,10 @@ CPP_CLI_SUPPORT = NO
|
||||
|
||||
SIP_SUPPORT = NO
|
||||
|
||||
# For Microsoft's IDL there are propget and propput attributes to indicate
|
||||
# getter and setter methods for a property. Setting this option to YES (the
|
||||
# default) will make doxygen replace the get and set methods by a property in
|
||||
# the documentation. This will only work if the methods are indeed getting or
|
||||
# For Microsoft's IDL there are propget and propput attributes to indicate getter
|
||||
# and setter methods for a property. Setting this option to YES (the default)
|
||||
# will make doxygen to replace the get and set methods by a property in the
|
||||
# documentation. This will only work if the methods are indeed getting or
|
||||
# setting a simple type. If this is not the case, or you want to show the
|
||||
# methods anyway, you should set this option to NO.
|
||||
|
||||
@@ -303,22 +263,6 @@ DISTRIBUTE_GROUP_DOC = NO
|
||||
|
||||
SUBGROUPING = YES
|
||||
|
||||
# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
|
||||
# unions are shown inside the group in which they are included (e.g. using
|
||||
# @ingroup) instead of on a separate page (for HTML and Man pages) or
|
||||
# section (for LaTeX and RTF).
|
||||
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
|
||||
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
|
||||
# unions with only public data fields will be shown inline in the documentation
|
||||
# of the scope in which they are defined (i.e. file, namespace, or group
|
||||
# documentation), provided this scope is documented. If set to NO (the default),
|
||||
# structs, classes, and unions are shown on a separate page (for HTML and Man
|
||||
# pages) or section (for LaTeX and RTF).
|
||||
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
|
||||
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
|
||||
# is documented as struct, union, or enum with the name of the typedef. So
|
||||
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
|
||||
@@ -335,27 +279,16 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||
# For small to medium size projects (<1000 input files) the default value is
|
||||
# probably good enough. For larger projects a too small cache size can cause
|
||||
# doxygen to be busy swapping symbols to and from disk most of the time
|
||||
# causing a significant performance penalty.
|
||||
# causing a significant performance penality.
|
||||
# If the system has enough physical memory increasing the cache will improve the
|
||||
# performance by keeping more symbols in memory. Note that the value works on
|
||||
# a logarithmic scale so increasing the size by one will roughly double the
|
||||
# a logarithmic scale so increasing the size by one will rougly double the
|
||||
# memory usage. The cache size is given by this formula:
|
||||
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols.
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols
|
||||
|
||||
SYMBOL_CACHE_SIZE = 0
|
||||
|
||||
# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
|
||||
# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
|
||||
# their name and scope. Since this can be an expensive process and often the
|
||||
# same symbol appear multiple times in the code, doxygen keeps a cache of
|
||||
# pre-resolved symbols. If the cache is too small doxygen will become slower.
|
||||
# If the cache is too large, memory is wasted. The cache size is given by this
|
||||
# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols.
|
||||
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -372,11 +305,6 @@ EXTRACT_ALL = NO
|
||||
|
||||
EXTRACT_PRIVATE = NO
|
||||
|
||||
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
|
||||
# scope will be included in the documentation.
|
||||
|
||||
EXTRACT_PACKAGE = NO
|
||||
|
||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
||||
# will be included in the documentation.
|
||||
|
||||
@@ -399,7 +327,7 @@ EXTRACT_LOCAL_METHODS = NO
|
||||
# extracted and appear in the documentation as a namespace called
|
||||
# 'anonymous_namespace{file}', where file will be replaced with the base
|
||||
# name of the file that contains the anonymous namespace. By default
|
||||
# anonymous namespaces are hidden.
|
||||
# anonymous namespace are hidden.
|
||||
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
|
||||
@@ -484,12 +412,12 @@ SORT_MEMBER_DOCS = NO
|
||||
|
||||
SORT_BRIEF_DOCS = NO
|
||||
|
||||
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
|
||||
# will sort the (brief and detailed) documentation of class members so that
|
||||
# constructors and destructors are listed first. If set to NO (the default)
|
||||
# the constructors will appear in the respective orders defined by
|
||||
# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
|
||||
# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
|
||||
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
|
||||
# will sort the (brief and detailed) documentation of class members so that
|
||||
# constructors and destructors are listed first. If set to NO (the default)
|
||||
# the constructors will appear in the respective orders defined by
|
||||
# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
|
||||
# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
|
||||
# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
|
||||
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
@@ -510,15 +438,6 @@ SORT_GROUP_NAMES = NO
|
||||
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
|
||||
# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
|
||||
# do proper type resolution of all parameters of a function it will reject a
|
||||
# match between the prototype and the implementation of a member function even
|
||||
# if there is only one candidate or it is obvious which candidate to choose
|
||||
# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
|
||||
# will still accept a match between prototype and implementation in such cases.
|
||||
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
|
||||
# The GENERATE_TODOLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the todo list. This list is created by putting \todo
|
||||
# commands in the documentation.
|
||||
@@ -544,16 +463,15 @@ GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
|
||||
# The ENABLED_SECTIONS tag can be used to enable conditional
|
||||
# documentation sections, marked by \if section-label ... \endif
|
||||
# and \cond section-label ... \endcond blocks.
|
||||
# documentation sections, marked by \if sectionname ... \endif.
|
||||
|
||||
ENABLED_SECTIONS =
|
||||
|
||||
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
|
||||
# the initial value of a variable or macro consists of for it to appear in
|
||||
# the initial value of a variable or define consists of for it to appear in
|
||||
# the documentation. If the initializer consists of more lines than specified
|
||||
# here it will be hidden. Use a value of 0 to hide initializers completely.
|
||||
# The appearance of the initializer of individual variables and macros in the
|
||||
# The appearance of the initializer of individual variables and defines in the
|
||||
# documentation can be controlled using \showinitializer or \hideinitializer
|
||||
# command in the documentation regardless of this setting.
|
||||
|
||||
@@ -565,6 +483,12 @@ MAX_INITIALIZER_LINES = 30
|
||||
|
||||
SHOW_USED_FILES = YES
|
||||
|
||||
# If the sources in your project are distributed over multiple directories
|
||||
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
|
||||
# in the documentation. The default is NO.
|
||||
|
||||
SHOW_DIRECTORIES = YES
|
||||
|
||||
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
|
||||
# This will remove the Files entry from the Quick Index and from the
|
||||
# Folder Tree View (if specified). The default is YES.
|
||||
@@ -587,26 +511,15 @@ SHOW_NAMESPACES = YES
|
||||
|
||||
FILE_VERSION_FILTER =
|
||||
|
||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
||||
# by doxygen. The layout file controls the global structure of the generated
|
||||
# output files in an output format independent way. To create the layout file
|
||||
# that represents doxygen's defaults, run doxygen with the -l option.
|
||||
# You can optionally specify a file name after the option, if omitted
|
||||
# DoxygenLayout.xml will be used as the name of the layout file.
|
||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
|
||||
# doxygen. The layout file controls the global structure of the generated output files
|
||||
# in an output format independent way. The create the layout file that represents
|
||||
# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
|
||||
# file name after the option, if omitted DoxygenLayout.xml will be used as the name
|
||||
# of the layout file.
|
||||
|
||||
LAYOUT_FILE =
|
||||
|
||||
# The CITE_BIB_FILES tag can be used to specify one or more bib files
|
||||
# containing the references data. This must be a list of .bib files. The
|
||||
# .bib extension is automatically appended if omitted. Using this command
|
||||
# requires the bibtex tool to be installed. See also
|
||||
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
|
||||
# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
|
||||
# feature you need bibtex and perl available in the search path. Do not use
|
||||
# file names with spaces, bibtex cannot handle them.
|
||||
|
||||
CITE_BIB_FILES =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -635,7 +548,7 @@ WARN_IF_UNDOCUMENTED = YES
|
||||
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
|
||||
# The WARN_NO_PARAMDOC option can be enabled to get warnings for
|
||||
# This WARN_NO_PARAMDOC option can be abled to get warnings for
|
||||
# functions that are documented, but have no documentation for their parameters
|
||||
# or return value. If set to NO (the default) doxygen will only warn about
|
||||
# wrong or incomplete parameter documentation, but not about the absence of
|
||||
@@ -682,9 +595,8 @@ INPUT_ENCODING = UTF-8
|
||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
# and *.h) to filter out the source-files in the directories. If left
|
||||
# blank the following patterns are tested:
|
||||
# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
|
||||
# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
|
||||
# *.f90 *.f *.for *.vhd *.vhdl
|
||||
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
|
||||
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
|
||||
|
||||
FILE_PATTERNS = *.txt \
|
||||
*.msg \
|
||||
@@ -696,16 +608,14 @@ FILE_PATTERNS = *.txt \
|
||||
|
||||
RECURSIVE = NO
|
||||
|
||||
# The EXCLUDE tag can be used to specify files and/or directories that should be
|
||||
# The EXCLUDE tag can be used to specify files and/or directories that should
|
||||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE = ../../src/asio
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
||||
# directories that are symbolic links (a Unix filesystem feature) are excluded
|
||||
# from the input.
|
||||
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
@@ -766,8 +676,8 @@ INPUT_FILTER =
|
||||
# basis. Doxygen will compare the file name with each pattern and apply the
|
||||
# filter if there is a match. The filters are a list of the form:
|
||||
# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
|
||||
# info on how filters are used. If FILTER_PATTERNS is empty or if
|
||||
# non of the patterns match the file name, INPUT_FILTER is applied.
|
||||
# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
|
||||
# is applied to all files.
|
||||
|
||||
FILTER_PATTERNS =
|
||||
|
||||
@@ -777,21 +687,6 @@ FILTER_PATTERNS =
|
||||
|
||||
FILTER_SOURCE_FILES = NO
|
||||
|
||||
# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
|
||||
# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
|
||||
# and it is also possible to disable source filtering for a specific pattern
|
||||
# using *.ext= (so without naming a filter). This option only has effect when
|
||||
# FILTER_SOURCE_FILES is enabled.
|
||||
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
|
||||
# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
|
||||
# is part of the input, its contents will be placed on the main page (index.html).
|
||||
# This can be useful if you have a project on for instance GitHub and want reuse
|
||||
# the introduction page also for the doxygen output.
|
||||
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -810,7 +705,7 @@ INLINE_SOURCES = YES
|
||||
|
||||
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
|
||||
# doxygen to hide any special comment blocks from generated source code
|
||||
# fragments. Normal C, C++ and Fortran comments will always remain visible.
|
||||
# fragments. Normal C and C++ comments will always remain visible.
|
||||
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
|
||||
@@ -893,14 +788,7 @@ HTML_FILE_EXTENSION = .html
|
||||
|
||||
# The HTML_HEADER tag can be used to specify a personal HTML header for
|
||||
# each generated HTML page. If it is left blank doxygen will generate a
|
||||
# standard header. Note that when using a custom header you are responsible
|
||||
# for the proper inclusion of any scripts and style sheets that doxygen
|
||||
# needs, which is dependent on the configuration options used.
|
||||
# It is advised to generate a default header using "doxygen -w html
|
||||
# header.html footer.html stylesheet.css YourConfigFile" and then modify
|
||||
# that header. Note that the header is subject to change so you typically
|
||||
# have to redo this when upgrading to a newer version of doxygen or when
|
||||
# changing the value of configuration settings such as GENERATE_TREEVIEW!
|
||||
# standard header.
|
||||
|
||||
HTML_HEADER = header.html
|
||||
|
||||
@@ -912,80 +800,33 @@ HTML_FOOTER = footer.html
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
# fine-tune the look of the HTML output. If left blank doxygen will
|
||||
# generate a default style sheet. Note that it is recommended to use
|
||||
# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
|
||||
# tag will in the future become obsolete.
|
||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||
# will generate a default style sheet. Note that doxygen will try to copy
|
||||
# the style sheet file to the HTML output directory, so don't put your own
|
||||
# stylesheet in the HTML output directory as well, or it will be erased!
|
||||
|
||||
HTML_STYLESHEET =
|
||||
|
||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
|
||||
# user-defined cascading style sheet that is included after the standard
|
||||
# style sheets created by doxygen. Using this option one can overrule
|
||||
# certain style aspects. This is preferred over using HTML_STYLESHEET
|
||||
# since it does not replace the standard style sheet and is therefor more
|
||||
# robust against future updates. Doxygen will copy the style sheet file to
|
||||
# the output directory.
|
||||
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
# that these files will be copied to the base HTML output directory. Use the
|
||||
# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
|
||||
# files. In the HTML_STYLESHEET file, use the file name only. Also note that
|
||||
# the files will be copied as-is; there are no commands or markers available.
|
||||
|
||||
HTML_EXTRA_FILES =
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
|
||||
# Doxygen will adjust the colors in the style sheet and background images
|
||||
# according to this color. Hue is specified as an angle on a colorwheel,
|
||||
# see http://en.wikipedia.org/wiki/Hue for more information.
|
||||
# For instance the value 0 represents red, 60 is yellow, 120 is green,
|
||||
# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
|
||||
# The allowed range is 0 to 359.
|
||||
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
|
||||
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
|
||||
# the colors in the HTML output. For a value of 0 the output will use
|
||||
# grayscales only. A value of 255 will produce the most vivid colors.
|
||||
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
|
||||
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
|
||||
# the luminance component of the colors in the HTML output. Values below
|
||||
# 100 gradually make the output lighter, whereas values above 100 make
|
||||
# the output darker. The value divided by 100 is the actual gamma applied,
|
||||
# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
|
||||
# and 100 does not change the gamma.
|
||||
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
|
||||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
||||
# page will contain the date and time when the page was generated. Setting
|
||||
# this to NO can help when comparing the output of multiple runs.
|
||||
|
||||
HTML_TIMESTAMP = NO
|
||||
|
||||
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
|
||||
# files or namespaces will be aligned in HTML using tables. If set to
|
||||
# NO a bullet list will be used.
|
||||
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
|
||||
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
||||
# documentation will contain sections that can be hidden and shown after the
|
||||
# page has loaded.
|
||||
# page has loaded. For this to work a browser that supports
|
||||
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
|
||||
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
|
||||
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
|
||||
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
|
||||
# entries shown in the various tree structured indices initially; the user
|
||||
# can expand and collapse entries dynamically later on. Doxygen will expand
|
||||
# the tree to such a level that at most the specified number of entries are
|
||||
# visible (unless a fully collapsed tree already exceeds this amount).
|
||||
# So setting the number of entries 1 will produce a full collapsed tree by
|
||||
# default. 0 is a special value representing an infinite number of entries
|
||||
# and will result in a full expanded tree by default.
|
||||
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
|
||||
# If the GENERATE_DOCSET tag is set to YES, additional index files
|
||||
# will be generated that can be used as input for Apple's Xcode 3
|
||||
# integrated development environment, introduced with OSX 10.5 (Leopard).
|
||||
@@ -994,8 +835,7 @@ HTML_INDEX_NUM_ENTRIES = 100
|
||||
# directory and running "make install" will install the docset in
|
||||
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
|
||||
# it at startup.
|
||||
# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
|
||||
# for more information.
|
||||
# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
|
||||
|
||||
GENERATE_DOCSET = NO
|
||||
|
||||
@@ -1013,16 +853,6 @@ DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
|
||||
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
|
||||
# identify the documentation publisher. This should be a reverse domain-name
|
||||
# style string, e.g. com.mycompany.MyDocSet.documentation.
|
||||
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
|
||||
# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
|
||||
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
|
||||
# will be generated that can be used as input for tools like the
|
||||
# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
|
||||
@@ -1067,10 +897,10 @@ BINARY_TOC = NO
|
||||
|
||||
TOC_EXPAND = NO
|
||||
|
||||
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
|
||||
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
|
||||
# that can be used as input for Qt's qhelpgenerator to generate a
|
||||
# Qt Compressed Help (.qch) of the generated HTML documentation.
|
||||
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
|
||||
# are set, an additional index file will be generated that can be used as input for
|
||||
# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
|
||||
# HTML documentation.
|
||||
|
||||
GENERATE_QHP = NO
|
||||
|
||||
@@ -1092,24 +922,20 @@ QHP_NAMESPACE = org.doxygen.Project
|
||||
|
||||
QHP_VIRTUAL_FOLDER = doc
|
||||
|
||||
# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
|
||||
# add. For more information please see
|
||||
# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
|
||||
# For more information please see
|
||||
# http://doc.trolltech.com/qthelpproject.html#custom-filters
|
||||
|
||||
QHP_CUST_FILTER_NAME =
|
||||
|
||||
# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
|
||||
# custom filter to add. For more information please see
|
||||
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
|
||||
# Qt Help Project / Custom Filters</a>.
|
||||
# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
|
||||
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
|
||||
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
|
||||
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
|
||||
# project's
|
||||
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
|
||||
# filter section matches.
|
||||
# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
|
||||
# Qt Help Project / Filter Attributes</a>.
|
||||
# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
|
||||
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
|
||||
@@ -1121,12 +947,12 @@ QHP_SECT_FILTER_ATTRS =
|
||||
QHG_LOCATION =
|
||||
|
||||
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
|
||||
# will be generated, which together with the HTML files, form an Eclipse help
|
||||
# will be generated, which together with the HTML files, form an Eclipse help
|
||||
# plugin. To install this plugin and make it available under the help contents
|
||||
# menu in Eclipse, the contents of the directory containing the HTML and XML
|
||||
# files needs to be copied into the plugins directory of eclipse. The name of
|
||||
# the directory within the plugins directory should be the same as
|
||||
# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
|
||||
# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
|
||||
# the help appears.
|
||||
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
@@ -1137,32 +963,31 @@ GENERATE_ECLIPSEHELP = NO
|
||||
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
|
||||
# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
|
||||
# at top of each HTML page. The value NO (the default) enables the index and
|
||||
# the value YES disables it. Since the tabs have the same information as the
|
||||
# navigation tree you can set this option to NO if you already set
|
||||
# GENERATE_TREEVIEW to YES.
|
||||
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
|
||||
# top of each HTML page. The value NO (the default) enables the index and
|
||||
# the value YES disables it.
|
||||
|
||||
DISABLE_INDEX = YES
|
||||
|
||||
# This tag can be used to set the number of enum values (range [1..20])
|
||||
# that doxygen will group on one line in the generated HTML documentation.
|
||||
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
|
||||
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
|
||||
# structure should be generated to display hierarchical information.
|
||||
# If the tag value is set to YES, a side panel will be generated
|
||||
# containing a tree-like index structure (just like the one that
|
||||
# is generated for HTML Help). For this to work a browser that supports
|
||||
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
|
||||
# Windows users are probably better off using the HTML help feature.
|
||||
# Since the tree basically has the same information as the tab index you
|
||||
# could consider to set DISABLE_INDEX to NO when enabling this option.
|
||||
# Windows users are probably better off using the HTML help feature.
|
||||
|
||||
GENERATE_TREEVIEW = NO
|
||||
|
||||
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
|
||||
# (range [0,1..20]) that doxygen will group on one line in the generated HTML
|
||||
# documentation. Note that a value of 0 will completely suppress the enum
|
||||
# values from appearing in the overview section.
|
||||
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
|
||||
# and Class Hierarchy pages using a tree view instead of an ordered list.
|
||||
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
USE_INLINE_TREES = NO
|
||||
|
||||
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
|
||||
# used to set the initial width (in pixels) of the frame in which the tree
|
||||
@@ -1170,11 +995,6 @@ ENUM_VALUES_PER_LINE = 4
|
||||
|
||||
TREEVIEW_WIDTH = 250
|
||||
|
||||
# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
|
||||
# links to external symbols imported via tag files in a separate window.
|
||||
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
|
||||
# Use this tag to change the font size of Latex formulas included
|
||||
# as images in the HTML documentation. The default is 10. Note that
|
||||
# when you change the font size after a successful doxygen run you need
|
||||
@@ -1183,106 +1003,26 @@ EXT_LINKS_IN_WINDOW = NO
|
||||
|
||||
FORMULA_FONTSIZE = 10
|
||||
|
||||
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
|
||||
# generated for formulas are transparent PNGs. Transparent PNGs are
|
||||
# not supported properly for IE 6.0, but are supported on all modern browsers.
|
||||
# Note that when changing this option you need to delete any form_*.png files
|
||||
# in the HTML output before the changes have effect.
|
||||
|
||||
FORMULA_TRANSPARENT = YES
|
||||
|
||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
|
||||
# (see http://www.mathjax.org) which uses client side Javascript for the
|
||||
# rendering instead of using prerendered bitmaps. Use this if you do not
|
||||
# have LaTeX installed or if you want to formulas look prettier in the HTML
|
||||
# output. When enabled you may also need to install MathJax separately and
|
||||
# configure the path to it using the MATHJAX_RELPATH option.
|
||||
|
||||
USE_MATHJAX = NO
|
||||
|
||||
# When MathJax is enabled you can set the default output format to be used for
|
||||
# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
|
||||
# SVG. The default value is HTML-CSS, which is slower, but has the best
|
||||
# compatibility.
|
||||
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
|
||||
# When MathJax is enabled you need to specify the location relative to the
|
||||
# HTML output directory using the MATHJAX_RELPATH option. The destination
|
||||
# directory should contain the MathJax.js script. For instance, if the mathjax
|
||||
# directory is located at the same level as the HTML output directory, then
|
||||
# MATHJAX_RELPATH should be ../mathjax. The default value points to
|
||||
# the MathJax Content Delivery Network so you can quickly see the result without
|
||||
# installing MathJax. However, it is strongly recommended to install a local
|
||||
# copy of MathJax from http://www.mathjax.org before deployment.
|
||||
|
||||
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
||||
|
||||
# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
|
||||
# names that should be enabled during MathJax rendering.
|
||||
|
||||
MATHJAX_EXTENSIONS =
|
||||
|
||||
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
|
||||
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
|
||||
# for the HTML output. The underlying search engine uses javascript
|
||||
# and DHTML and should work on any modern browser. Note that when using
|
||||
# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
|
||||
# and DHTML and should work on any modern browser. Note that when using
|
||||
# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
|
||||
# (GENERATE_DOCSET) there is already a search function so this one should
|
||||
# typically be disabled. For large projects the javascript based search engine
|
||||
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
|
||||
|
||||
SEARCHENGINE = NO
|
||||
|
||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||
# implemented using a web server instead of a web client using Javascript.
|
||||
# There are two flavours of web server based search depending on the
|
||||
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
||||
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
||||
# enabled the indexing and searching needs to be provided by external tools.
|
||||
# See the manual for details.
|
||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||
# implemented using a PHP enabled web server instead of at the web client
|
||||
# using Javascript. Doxygen will generate the search PHP script and index
|
||||
# file to put on the web server. The advantage of the server
|
||||
# based approach is that it scales better to large projects and allows
|
||||
# full text search. The disadvances is that it is more difficult to setup
|
||||
# and does not have live searching capabilities.
|
||||
|
||||
SERVER_BASED_SEARCH = NO
|
||||
|
||||
# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
|
||||
# script for searching. Instead the search results are written to an XML file
|
||||
# which needs to be processed by an external indexer. Doxygen will invoke an
|
||||
# external search engine pointed to by the SEARCHENGINE_URL option to obtain
|
||||
# the search results. Doxygen ships with an example indexer (doxyindexer) and
|
||||
# search engine (doxysearch.cgi) which are based on the open source search engine
|
||||
# library Xapian. See the manual for configuration details.
|
||||
|
||||
EXTERNAL_SEARCH = NO
|
||||
|
||||
# The SEARCHENGINE_URL should point to a search engine hosted by a web server
|
||||
# which will returned the search results when EXTERNAL_SEARCH is enabled.
|
||||
# Doxygen ships with an example search engine (doxysearch) which is based on
|
||||
# the open source search engine library Xapian. See the manual for configuration
|
||||
# details.
|
||||
|
||||
SEARCHENGINE_URL =
|
||||
|
||||
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
|
||||
# search data is written to a file for indexing by an external tool. With the
|
||||
# SEARCHDATA_FILE tag the name of this file can be specified.
|
||||
|
||||
SEARCHDATA_FILE = searchdata.xml
|
||||
|
||||
# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
|
||||
# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
|
||||
# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
|
||||
# projects and redirect the results back to the right project.
|
||||
|
||||
EXTERNAL_SEARCH_ID =
|
||||
|
||||
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
|
||||
# projects other than the one defined by this configuration file, but that are
|
||||
# all added to the same external search index. Each project needs to have a
|
||||
# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
|
||||
# of to a relative location where the documentation can be found.
|
||||
# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
|
||||
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -1319,7 +1059,7 @@ MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
|
||||
# The PAPER_TYPE tag can be used to set the paper type that is used
|
||||
# by the printer. Possible values are: a4, letter, legal and
|
||||
# by the printer. Possible values are: a4, a4wide, letter, legal and
|
||||
# executive. If left blank a4wide will be used.
|
||||
|
||||
PAPER_TYPE = letter
|
||||
@@ -1336,13 +1076,6 @@ EXTRA_PACKAGES =
|
||||
|
||||
LATEX_HEADER = header.tex
|
||||
|
||||
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
|
||||
# the generated latex document. The footer should contain everything after
|
||||
# the last chapter. If it is left blank doxygen will generate a
|
||||
# standard footer. Notice: only use this tag if you know what you are doing!
|
||||
|
||||
LATEX_FOOTER =
|
||||
|
||||
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
|
||||
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
|
||||
# contain links (just like the HTML output) instead of page references
|
||||
@@ -1369,19 +1102,13 @@ LATEX_BATCHMODE = NO
|
||||
|
||||
LATEX_HIDE_INDICES = NO
|
||||
|
||||
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
|
||||
# source code with syntax highlighting in the LaTeX output.
|
||||
# Note that which sources are shown also depends on other settings
|
||||
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
|
||||
# source code with syntax highlighting in the LaTeX output.
|
||||
# Note that which sources are shown also depends on other settings
|
||||
# such as SOURCE_BROWSER.
|
||||
|
||||
LATEX_SOURCE_CODE = NO
|
||||
|
||||
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
||||
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
|
||||
# http://en.wikipedia.org/wiki/BibTeX for more info.
|
||||
|
||||
LATEX_BIB_STYLE = plain
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -1413,7 +1140,7 @@ COMPACT_RTF = NO
|
||||
|
||||
RTF_HYPERLINKS = NO
|
||||
|
||||
# Load style sheet definitions from file. Syntax is similar to doxygen's
|
||||
# Load stylesheet definitions from file. Syntax is similar to doxygen's
|
||||
# config file, i.e. a series of assignments. You only have to provide
|
||||
# replacements, missing definitions are set to their default value.
|
||||
|
||||
@@ -1556,7 +1283,7 @@ MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
|
||||
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
|
||||
# pointed to by INCLUDE_PATH will be searched when a #include is found.
|
||||
# in the INCLUDE_PATH (see below) will be search if a #include is found.
|
||||
|
||||
SEARCH_INCLUDES = YES
|
||||
|
||||
@@ -1586,15 +1313,15 @@ PREDEFINED =
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||
# this tag can be used to specify a list of macro names that should be expanded.
|
||||
# The macro definition that is found in the sources will be used.
|
||||
# Use the PREDEFINED tag if you want to use a different macro definition that
|
||||
# overrules the definition found in the source code.
|
||||
# Use the PREDEFINED tag if you want to use a different macro definition.
|
||||
|
||||
EXPAND_AS_DEFINED =
|
||||
|
||||
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
|
||||
# doxygen's preprocessor will remove all references to function-like macros
|
||||
# that are alone on a line, have an all uppercase name, and do not end with a
|
||||
# semicolon, because these will confuse the parser if not removed.
|
||||
# doxygen's preprocessor will remove all function-like macros that are alone
|
||||
# on a line, have an all uppercase name, and do not end with a semicolon. Such
|
||||
# function macros are typically used for boiler-plate code, and will confuse
|
||||
# the parser if not removed.
|
||||
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
|
||||
@@ -1602,16 +1329,20 @@ SKIP_FUNCTION_MACROS = YES
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The TAGFILES option can be used to specify one or more tagfiles. For each
|
||||
# tag file the location of the external documentation should be added. The
|
||||
# format of a tag file without this location is as follows:
|
||||
# The TAGFILES option can be used to specify one or more tagfiles.
|
||||
# Optionally an initial location of the external documentation
|
||||
# can be added for each tagfile. The format of a tag file without
|
||||
# this location is as follows:
|
||||
# TAGFILES = file1 file2 ...
|
||||
# Adding location for the tag files is done as follows:
|
||||
# TAGFILES = file1=loc1 "file2 = loc2" ...
|
||||
# where "loc1" and "loc2" can be relative or absolute paths
|
||||
# or URLs. Note that each tag file must have a unique name (where the name does
|
||||
# NOT include the path). If a tag file is not located in the directory in which
|
||||
# doxygen is run, you must also specify the path to the tagfile here.
|
||||
# where "loc1" and "loc2" can be relative or absolute paths or
|
||||
# URLs. If a location is present for each tag, the installdox tool
|
||||
# does not have to be run to correct the links.
|
||||
# Note that each tag file must have a unique name
|
||||
# (where the name does NOT include the path)
|
||||
# If a tag file is not located in the directory in which doxygen
|
||||
# is run, you must also specify the path to the tagfile here.
|
||||
|
||||
TAGFILES =
|
||||
|
||||
@@ -1644,8 +1375,9 @@ PERL_PATH = /usr/bin/perl
|
||||
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
|
||||
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
|
||||
# or super classes. Setting the tag to NO turns the diagrams off. Note that
|
||||
# this option also works with HAVE_DOT disabled, but it is recommended to
|
||||
# install and use dot, since it yields more powerful graphs.
|
||||
# this option is superseded by the HAVE_DOT option below. This is only a
|
||||
# fallback. It is recommended to install and use dot, since it yields more
|
||||
# powerful graphs.
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
@@ -1671,20 +1403,14 @@ HIDE_UNDOC_RELATIONS = YES
|
||||
|
||||
HAVE_DOT = NO
|
||||
|
||||
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
|
||||
# allowed to run in parallel. When set to 0 (the default) doxygen will
|
||||
# base this on the number of processors available in the system. You can set it
|
||||
# explicitly to a value larger than 0 to get control over the balance
|
||||
# between CPU load and processing speed.
|
||||
|
||||
DOT_NUM_THREADS = 0
|
||||
|
||||
# By default doxygen will use the Helvetica font for all dot files that
|
||||
# doxygen generates. When you want a differently looking font you can specify
|
||||
# the font name using DOT_FONTNAME. You need to make sure dot is able to find
|
||||
# the font, which can be done by putting it in a standard location or by setting
|
||||
# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
|
||||
# directory containing the font.
|
||||
# By default doxygen will write a font called FreeSans.ttf to the output
|
||||
# directory and reference it in all dot files that doxygen generates. This
|
||||
# font does not include all possible unicode characters however, so when you need
|
||||
# these (or just want a differently looking font) you can specify the font name
|
||||
# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
|
||||
# which can be done by putting it in a standard location or by setting the
|
||||
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
|
||||
# containing the font.
|
||||
|
||||
DOT_FONTNAME = FreeSans
|
||||
|
||||
@@ -1693,16 +1419,17 @@ DOT_FONTNAME = FreeSans
|
||||
|
||||
DOT_FONTSIZE = 10
|
||||
|
||||
# By default doxygen will tell dot to use the Helvetica font.
|
||||
# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
|
||||
# set the path where dot can find it.
|
||||
# By default doxygen will tell dot to use the output directory to look for the
|
||||
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
|
||||
# different font using DOT_FONTNAME you can set the path where dot
|
||||
# can find it using this tag.
|
||||
|
||||
DOT_FONTPATH =
|
||||
|
||||
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graph for each documented class showing the direct and
|
||||
# indirect inheritance relations. Setting this tag to YES will force the
|
||||
# CLASS_DIAGRAMS tag to NO.
|
||||
# the CLASS_DIAGRAMS tag to NO.
|
||||
|
||||
CLASS_GRAPH = YES
|
||||
|
||||
@@ -1724,15 +1451,6 @@ GROUP_GRAPHS = YES
|
||||
|
||||
UML_LOOK = NO
|
||||
|
||||
# If the UML_LOOK tag is enabled, the fields and methods are shown inside
|
||||
# the class node. If there are many fields or methods and many nodes the
|
||||
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
|
||||
# threshold limits the number of items for each type to make the size more
|
||||
# managable. Set this to 0 for no limit. Note that the threshold may be
|
||||
# exceeded by 50% before the limit is enforced.
|
||||
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will show the
|
||||
# relations between templates and their instances.
|
||||
|
||||
@@ -1769,11 +1487,11 @@ CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
|
||||
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graphical hierarchy of all classes instead of a textual one.
|
||||
# will graphical hierarchy of all classes instead of a textual one.
|
||||
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
|
||||
# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
|
||||
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
|
||||
# then doxygen will show the dependencies a directory has on other directories
|
||||
# in a graphical way. The dependency relations are determined by the #include
|
||||
# relations between the files in the directories.
|
||||
@@ -1781,22 +1499,11 @@ GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
|
||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||
# generated by dot. Possible values are svg, png, jpg, or gif.
|
||||
# If left blank png will be used. If you choose svg you need to set
|
||||
# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
|
||||
# visible in IE 9+ (other browsers do not have this requirement).
|
||||
# generated by dot. Possible values are png, jpg, or gif
|
||||
# If left blank png will be used.
|
||||
|
||||
DOT_IMAGE_FORMAT = png
|
||||
|
||||
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
|
||||
# enable generation of interactive SVG images that allow zooming and panning.
|
||||
# Note that this requires a modern browser other than Internet Explorer.
|
||||
# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
|
||||
# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
|
||||
# visible. Older versions of IE do not have SVG support.
|
||||
|
||||
INTERACTIVE_SVG = NO
|
||||
|
||||
# The tag DOT_PATH can be used to specify the path where the dot tool can be
|
||||
# found. If left blank, it is assumed the dot tool can be found in the path.
|
||||
|
||||
@@ -1808,12 +1515,6 @@ DOT_PATH = /sw/bin
|
||||
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the
|
||||
# \mscfile command).
|
||||
|
||||
MSCFILE_DIRS =
|
||||
|
||||
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
|
||||
# nodes that will be shown in the graph. If the number of nodes in a graph
|
||||
# becomes larger than this value, doxygen will truncate the graph, which is
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
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.
|
||||
|
||||
For specifics on creating Windows applications, see README-Win.txt.
|
||||
|
||||
\section rtvsnonrt "Realtime" vs. "Non-Realtime"
|
||||
|
||||
@@ -38,26 +37,26 @@ 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__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>OSS (version 4.0 only, use ALSA for MIDI support)</TD>
|
||||
<TD>__LINUX_OSS__, \__LINUX_ALSA__, \__LITTLE_ENDIAN__</TD>
|
||||
<TD>__LINUX_OSS__, __LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux and Macintosh OS-X</TD>
|
||||
<TD>Jack</TD>
|
||||
<TD>__UNIX_JACK__, \__LITTLE_ENDIAN__</TD>
|
||||
<TD>__UNIX_JACK__, __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, CoreAudio, CoreMIDI, CoreFoundation</TT></TD>
|
||||
<TD><TT>pthread, CoreAudio, CoreMidi, CoreFoundation</TT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
@@ -105,5 +104,24 @@ g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc sineosc.cpp -lstk
|
||||
\endcode
|
||||
|
||||
|
||||
\section compileWin Windows:
|
||||
|
||||
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 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>, <TT>__WINDOWS_DS__</TT>, and <TT>__WINDOWS_MM__</TT> preprocessor definitions.
|
||||
|
||||
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="tutorial.html">Main tutorial page</A>] [<A HREF="filtering.html">Next tutorial</A>]
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,7 @@ 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
|
||||
stk::Messager instance to accept control input from the accompanying tcl/tk
|
||||
graphical user interfaces, from external MIDI devices, or from SKINI
|
||||
scorefiles.
|
||||
|
||||
|
||||
@@ -1,288 +1,311 @@
|
||||
/*! \page download Download and Release Notes
|
||||
/*! \page download Download, Release Notes, and Bug Fixes
|
||||
|
||||
\section down Download Version 4.6.2 (17 November 2021):
|
||||
\section down Download Version 4.4.4 (24 August 2012):
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.4.4.tar.gz">Source distribution</A></LI>
|
||||
</UL>
|
||||
|
||||
- <A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.6.2.tar.gz">Source distribution</A>
|
||||
|
||||
\section notes Release Notes:
|
||||
\subsection v4dot6dot2 Version 4.6.2
|
||||
- see github site for complete details (github.com/thestk/stk)
|
||||
- bug fixes in LentPitShift and Granulate classes
|
||||
- Makefile fixes
|
||||
- miscellaneous bug fixes
|
||||
|
||||
\subsection v4dot6dot1 Version 4.6.1
|
||||
- see github site for complete details (github.com/thestk/stk)
|
||||
- various documentation updates
|
||||
- new Recorder (flute a la Verge) class (thanks to Mathias Bredholt)
|
||||
- updated Modulate class to allow noise rate control
|
||||
- new VS2017 project files
|
||||
- fix in FileLoop::getSize() to return file size (not chunk size)
|
||||
|
||||
\subsection v4dot6dot0 Version 4.6.0
|
||||
- see github site for complete details (github.com/thestk/stk)
|
||||
- various build system updates
|
||||
- fixes in FileWvIn / FileLoop for normalisation and scaling, as well as file opening
|
||||
- bug fix for MAT-files in FileWrite
|
||||
- bug fix in MidiFileIn.cpp for timing and time-code formats
|
||||
- updated versions of RtAudio and RtMidi
|
||||
|
||||
\subsection v4dot5dot1 Version 4.5.1
|
||||
- fix for FileWvIn / FileLoop classes to avoid keeping files open if not necessary
|
||||
- miscellaneous bug fixes, documented on GitHub site (github.com/thestk/stk)
|
||||
- update to play.cpp example to play mono files as stereo
|
||||
- bug fix in DelayL::setDelay() function
|
||||
- miscellanous build bug fixes
|
||||
|
||||
\subsection v4dot5dot0 Version 4.5.0
|
||||
- Updated versions of RtAudio and RtMidi, with associated renaming of RtError class to either RtAudioError or RtMidiError
|
||||
- New iOS project files (thanks to Ariel Elkin)
|
||||
- Bug fix in FreeVerb that could cause crackling for stereo input
|
||||
- Various bug fixes and updates to minimize compiler warnings
|
||||
- ADSR fix for decay/release time calculations
|
||||
- Various updates to build system
|
||||
|
||||
\subsection v4dot4dot4 Version 4.4.4
|
||||
- New FreeVerb class (thanks to Greg Burlet)
|
||||
- New Guitar class
|
||||
- New electric guitar project
|
||||
- Updated versions of RtAudio and RtMidi
|
||||
- Cleaned / revised Shakers class
|
||||
- Bug fix in LentPitShift
|
||||
- Bug fix in Echo constructor
|
||||
- Bug fix in FileWvIn (file size when chunking)
|
||||
- Bug fix in StkFrames copy constructor
|
||||
|
||||
<ul>
|
||||
<li>New FreeVerb class (thanks to Greg Burlet)</li>
|
||||
<li>New Guitar class</li>
|
||||
<li>New electric guitar project</li>
|
||||
<li>Updated versions of RtAudio and RtMidi</li>
|
||||
<li>Cleaned / revised Shakers class</li>
|
||||
<li>Bug fix in LentPitShift</li>
|
||||
<li>Bug fix in Echo constructor</li>
|
||||
<li>Bug fix in FileWvIn (file size when chunking)</li>
|
||||
<li>Bug fix in StkFrames copy constructor</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot4dot3 Version 4.4.3
|
||||
- Changed SINT24 to be lower 3 bytes of 32-bit word.
|
||||
- Bug fixes to vectorized tick functions in Effects classes.
|
||||
- Updated versions of RtAudio and RtMidi.
|
||||
- Bug fixes in ADSR and Envelope classes.
|
||||
- Updates to the internal argument checking and reporting scheme.
|
||||
- Updates to Bowed class (thanks to Esteban Maestre!).
|
||||
- Fixes for 24-bit support in FileRead and FileWrite.
|
||||
- Added WAVE_FORMAT_EXTENSIBLE support in FileWrite.
|
||||
- Added sample rate variable reading and writing for MAT-files in FileRead and FileWrite.
|
||||
|
||||
<ul>
|
||||
<li>Changed SINT24 to be lower 3 bytes of 32-bit word.</li>
|
||||
<li>Bug fixes to vectorized tick functions in Effects classes.</li>
|
||||
<li>Updated versions of RtAudio and RtMidi.</li>
|
||||
<li>Bug fixes in ADSR and Envelope classes.</li>
|
||||
<li>Updates to the internal argument checking and reporting scheme.</li>
|
||||
<li>Updates to Bowed class (thanks to Esteban Maestre!).</li>
|
||||
<li>Fixes for 24-bit support in FileRead and FileWrite.</li>
|
||||
<li>Added WAVE_FORMAT_EXTENSIBLE support in FileWrite.</li>
|
||||
<li>Added sample rate variable reading and writing for MAT-files in FileRead and FileWrite.</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot4dot2 Version 4.4.2
|
||||
- Added various header file includes for newer compilers.
|
||||
- Updates to RtAudio and RtMidi.
|
||||
- New LentPitShift class (thanks to Francois Germain).
|
||||
- Bug fixes in Voicer class (thanks Richard Dobson!).
|
||||
- Added Makefile.in to compile library and all projects, as well as clean and distclean.
|
||||
|
||||
<ul>
|
||||
<li>Added various header file includes for newer compilers.</li>
|
||||
<li>Updates to RtAudio and RtMidi.</li>
|
||||
<li>New LentPitShift class (thanks to Francois Germain).</li>
|
||||
<li>Bug fixes in Voicer class (thanks Richard Dobson!).</li>
|
||||
<li>Added Makefile.in to compile library and all projects, as well as clean and distclean.</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot4dot1 Version 4.4.1
|
||||
- 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.
|
||||
|
||||
<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
|
||||
- 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).
|
||||
|
||||
<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
|
||||
- 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.
|
||||
|
||||
<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
|
||||
- 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.
|
||||
|
||||
<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
|
||||
- Greatly expanded StkFrames functionality (including interpolation and indexing by channel/frame).
|
||||
- New Blit, BlitSaw, and BlitSquare bandlimited waveform classes (thanks to Robin Davies!).
|
||||
- New Granulate granular synthesis class.
|
||||
- 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 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.
|
||||
- Fixes to RtAudio, especially for Windows DirectSound and ASIO (thanks to Robin Davies).
|
||||
|
||||
<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
|
||||
- Simultaneous multiple audio APIs supported at compile time.
|
||||
- Various changes to better conform to standard C++ programming practices.
|
||||
- Fixed hidden overloaded virtual functions.
|
||||
- New Asymp exponential envelope class.
|
||||
- <tt>MY_FLOAT</tt> type converted to <tt>StkFloat</tt> and changed throughout (use \c 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 (API changes).
|
||||
- New abstract parent Effect class for various effects.
|
||||
- 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.
|
||||
|
||||
<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
|
||||
- Bug fix in RtAudio for Windows DirectSound output only support
|
||||
|
||||
<ul>
|
||||
<li>Bug fix in RtAudio for Windows DirectSound output only support</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot1dot2 Version 4.1.2
|
||||
- Added Linux JACK support to RtAudio.
|
||||
- Added optional doNormalize argument to WvIn to allow specification of data normalization or not.
|
||||
- Added volume control to demo program and various Tcl scripts.
|
||||
- Added support for dynamic rawwavePath() setting.
|
||||
- WaveLoop bug fix.
|
||||
- Fixed bug in ADSR::setReleaseTime() method.
|
||||
- Fixed missing initialization of apInput in non-default constructor of DelayA class.
|
||||
- Added time seeding of random number generator to Noise constructor.
|
||||
- Update to the contentsAt() method of Delay class.
|
||||
- WAV file fixes (8-bit) in WvIn and WvOut classes.
|
||||
- Configure script changes.
|
||||
- Updated \<iostream\> include statements and appended "std::" as necessary throughout for compatibility with gcc 3.
|
||||
|
||||
<UL>
|
||||
<li>Added Linux JACK support to RtAudio.</li>
|
||||
<li>Added optional doNormalize argument to WvIn to allow specification of data normalization or not.</li>
|
||||
<li>Added volume control to demo program and various tcl scripts.</li>
|
||||
<li>Added support for dynamic rawwavePath() setting.</li>
|
||||
<li>WaveLoop bug fix.</li>
|
||||
<li>Fixed bug in ADSR::setReleaseTime() method.</li>
|
||||
<li>Fixed missing initialization of apInput in non-default constructor of DelayA class.</li>
|
||||
<li>Added time seeding of random number generator to Noise constructor.</li>
|
||||
<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>
|
||||
</UL>
|
||||
|
||||
\subsection v4dot1dot1 Version 4.1.1
|
||||
- Bug fix in RtAudio for Macintosh OS X and Windows ASIO duplex operation.
|
||||
- Windows ASIO fix in Stk.h.
|
||||
- Documentation updates.
|
||||
- Expanded tutorial.
|
||||
- Fixed RtDuplex omission in src Makefile.
|
||||
<ul>
|
||||
<li>Bug fix in RtAudio for Macintosh OS X and Windows ASIO duplex operation.</li>
|
||||
<li>Windows ASIO fix in Stk.h.</li>
|
||||
<li>Documentation updates.</li>
|
||||
<li>Expanded tutorial.</li>
|
||||
<li>Fixed RtDuplex omission in src Makefile.</li>
|
||||
</ul>
|
||||
|
||||
\subsection v4dot1 Version 4.1
|
||||
- Macintosh OS X support added.
|
||||
- New Whistle class.
|
||||
- Added Voicer, SingWave, and VoicForm classes.
|
||||
- Improvements/fixes to the banded waveguide instruments.
|
||||
- Demo program now uses Voicer, allowing polyphony.
|
||||
- Demo Tcl/Tk scripts changed to use SKINI PitchChange instead of PitchBend.
|
||||
- Demo program response to PitchBend modified to octave up/down.
|
||||
- Several RtAudio fixes and improvements (OS X and Windows ASIO support added).
|
||||
- Added nextOut() method to Delay classes.
|
||||
- Documentation fixes for Reverb classes.
|
||||
- RAWWAVE_PATH changed to include the "rawwave" directory.
|
||||
- "configure" support added for unix systems.
|
||||
- Multivoice flag (-n NUMBER) added as command line option to demo program.
|
||||
- Sample rate flag added as command line option to example programs.
|
||||
- Socket port number added as command line option to example programs.
|
||||
|
||||
<UL>
|
||||
<LI>Macintosh OS X support added.</LI>
|
||||
<LI>New Whistle class.</LI>
|
||||
<LI>Added Voicer, SingWave, and VoicForm classes.</LI>
|
||||
<LI>Improvements/fixes to the banded waveguide instruments.</LI>
|
||||
<LI>Demo program now uses Voicer, allowing polyphony.</LI>
|
||||
<LI>Demo tcl/tk scripts changed to use SKINI PitchChange instead of PitchBend.</LI>
|
||||
<LI>Demo program response to PitchBend modified to octave up/down.</LI>
|
||||
<LI>Several RtAudio fixes and improvements (OS X and Windows ASIO support added).</LI>
|
||||
<LI>Added nextOut() method to Delay classes.</LI>
|
||||
<LI>Documentation fixes for Reverb classes.</LI>
|
||||
<LI>RAWWAVE_PATH changed to include the "rawwave" directory.</LI>
|
||||
<LI>"configure" support added for unix systems.</LI>
|
||||
<LI>Multivoice flag (-n NUMBER) added as command line option to demo program.</LI>
|
||||
<LI>Sample rate flag added as command line option to example programs.</LI>
|
||||
<LI>Socket port number added as command line option to example programs.</LI>
|
||||
</UL>
|
||||
|
||||
\subsection v4 Version 4.0
|
||||
- New documentation and tutorial.
|
||||
- Several new instruments, including Saxofony, BlowBotl, and StifKarp.
|
||||
- New Stk base class, replacing Object class.
|
||||
- New Filter class structure and methods.
|
||||
- Extensive modifications to WvIn and WvOut class structures and methods.
|
||||
- Looping functionality moved to WaveLoop (subclass of WvIn).
|
||||
- Automatic file type detection in WvIn ... hosed WavWvIn, AifWvIn, RawWavIn, SndWavIn, and MatWvIn subclasses.
|
||||
- New file type specifier argument in WvOut ... hosed WavWvOut, AifWvOut, RawWavOut, SndWavOut, and MatWvOut subclasses.
|
||||
- Some simplifications of Messager class (was Controller).
|
||||
- New independent RtAudio class.
|
||||
- Extensive revisions in code and a significant number of API changes.
|
||||
|
||||
<UL>
|
||||
<LI>New documentation and tutorial.</LI>
|
||||
<LI>Several new instruments, including Saxofony, BlowBotl, and StifKarp.</LI>
|
||||
<LI>New Stk base class, replacing Object class.</LI>
|
||||
<LI>New Filter class structure and methods.</LI>
|
||||
<LI>Extensive modifications to WvIn and WvOut class structures and methods.</LI>
|
||||
<LI>Looping functionality moved to WaveLoop (subclass of WvIn).</LI>
|
||||
<LI>Automatic file type detection in WvIn ... hosed WavWvIn, AifWvIn, RawWavIn, SndWavIn, and MatWvIn subclasses.</LI>
|
||||
<LI>New file type specifier argument in WvOut ... hosed WavWvOut, AifWvOut, RawWavOut, SndWavOut, and MatWvOut subclasses.</LI>
|
||||
<LI>Some simplifications of Messager class (was Controller).</LI>
|
||||
<LI>New independent RtAudio class.</LI>
|
||||
<LI>Extensive revisions in code and a significant number of API changes.</LI>
|
||||
</UL>
|
||||
|
||||
\subsection v3dot2 Version 3.2
|
||||
- New input control handling class (Controller)
|
||||
- Added AIFF file input/output support.
|
||||
- New C++ error handling capabilities.
|
||||
- New input/output internet streaming support (StrmWvIn/StrmWvOut).
|
||||
- Added native ALSA support for linux.
|
||||
- Added optional "device" argument to all "Rt" classes (audio and MIDI) and printout of devices when argument is invalid.
|
||||
- WvIn classes rewritten to support very big files (incremental load from disk).
|
||||
- Changed WvIn/WvOut classes to work with sample frame buffers.
|
||||
- Fixed looping and negative rate calculations in WvIn classes.
|
||||
- Fixed interpolation bug in RtWvIn.
|
||||
- Windoze RtAudio code rewritten (thank Dave!).
|
||||
- Simplified byte-swapping functions (in-place swapping).
|
||||
- "Stereo-ized" RagaMatic.
|
||||
- Miscellaneous renamings.
|
||||
- Probably a bunch more fixes that I've long since forgotten about.
|
||||
|
||||
<UL>
|
||||
<LI>New input control handling class (Controller)</LI>
|
||||
<LI>Added AIFF file input/output support.</LI>
|
||||
<LI>New C++ error handling capabilities.</LI>
|
||||
<LI>New input/output internet streaming support (StrmWvIn/StrmWvOut).</LI>
|
||||
<LI>Added native ALSA support for linux.</LI>
|
||||
<LI>Added optional "device" argument to all "Rt" classes (audio and MIDI) and printout of devices when argument is invalid.</LI>
|
||||
<LI>WvIn classes rewritten to support very big files (incremental load from disk).</LI>
|
||||
<LI>Changed WvIn/WvOut classes to work with sample frame buffers.</LI>
|
||||
<LI>Fixed looping and negative rate calculations in WvIn classes.</LI>
|
||||
<LI>Fixed interpolation bug in RtWvIn.</LI>
|
||||
<LI>Windoze RtAudio code rewritten (thank Dave!).</LI>
|
||||
<LI>Simplified byte-swapping functions (in-place swapping).</LI>
|
||||
<LI>"Stereo-ized" RagaMatic.</LI>
|
||||
<LI>Miscellaneous renamings.</LI>
|
||||
<LI>Probably a bunch more fixes that I've long since forgotten about.</LI>
|
||||
</UL>
|
||||
|
||||
\subsection v3dot1 Version 3.1
|
||||
- New RagaMatic project ... very cool!!!
|
||||
- Less clipping in the Shakers class.
|
||||
- Added "microphone position" to Mandolin in STKdemo.
|
||||
- Fixed MIDI system message exclusion under Irix.
|
||||
- Added a few bitmaps for the Shaker instruments.
|
||||
- Made destructors virtual for Reverb.h, WvIn.h and Simple.h.
|
||||
- Fixed bug setting delay length in DLineA when value too big.
|
||||
- Fixed bug in WinMM realtime code (RTSoundIO).
|
||||
- Added tick() method to BowTabl, JetTabl, and ReedTabl (same as lookup).
|
||||
- Switched to pthread API on SGI platforms.
|
||||
- Added some defines to Object.h for random number generation, FPU overflow checking, etc....
|
||||
- A few minor changes, some bug fixes ... can't remember all of them.
|
||||
|
||||
<UL>
|
||||
<LI>New RagaMatic project ... very cool!!!</LI>
|
||||
<LI>Less clipping in the Shakers class.</LI>
|
||||
<LI>Added "microphone position" to Mandolin in STKdemo.</LI>
|
||||
<LI>Fixed MIDI system message exclusion under Irix.</LI>
|
||||
<LI>Added a few bitmaps for the Shaker instruments.</LI>
|
||||
<LI>Made destructors virtual for Reverb.h, WvIn.h and Simple.h.</LI>
|
||||
<LI>Fixed bug setting delay length in DLineA when value too big.</LI>
|
||||
<LI>Fixed bug in WinMM realtime code (RTSoundIO).</LI>
|
||||
<LI>Added tick() method to BowTabl, JetTabl, and ReedTabl (same as lookup).</LI>
|
||||
<LI>Switched to pthread API on SGI platforms.</LI>
|
||||
<LI>Added some defines to Object.h for random number generation, FPU overflow checking, etc....</LI>
|
||||
<LI>A few minor changes, some bug fixes ... can't remember all of them.</LI>
|
||||
</UL>
|
||||
|
||||
\subsection v3 Version 3.0
|
||||
- New #define flags for OS and realtime dependencies (this will probably cause problems for old personal STK code, but it was necessary to make future ports easier).
|
||||
- Expanded and cleaned the Shakers class.
|
||||
- New BowedBar algorithm/class.
|
||||
- Fixed Linux MIDI input bug.
|
||||
- Fixed MIDI status masking problem in Windows.
|
||||
- OS type defines now in Makefile.
|
||||
- New RAWWAVE_PATH define in Object.h.
|
||||
- Syntmono project pulled out to separate directory and cleaned up.
|
||||
- Socketing capabilities under Unix, as well as Windoze.
|
||||
- Multiple simultaneous socket client connections to STK servers now possible.
|
||||
- MD2SKINI now can merge MIDI and piped messages under Irix and Linux (for TCL->MD2SKINI->syntmono control).
|
||||
- Defined INT16 and INT32 types and fixed various WvIn and WvOut classes.
|
||||
- Updated MatWvIn and MatWvOut for new MAT-file documentation from Matlab.
|
||||
- New demo Tcl/Tk GUI (TclDemo.tcl).
|
||||
- Minor fixes to FM behavior.
|
||||
- Added record/duplex capabilities to RTSoundIO (Linux, SGI, and Windoze).
|
||||
- Fixed bugs in WavWvOut and MatWvOut header specifications.
|
||||
- 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 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).
|
||||
|
||||
<UL>
|
||||
<LI>New #define flags for OS and realtime dependencies (this will probably cause problems for old personal STK code, but it was necessary to make future ports easier).</LI>
|
||||
<LI>Expanded and cleaned the Shakers class.</LI>
|
||||
<LI>New BowedBar algorithm/class.</LI>
|
||||
<LI>Fixed Linux MIDI input bug.</LI>
|
||||
<LI>Fixed MIDI status masking problem in Windows.</LI>
|
||||
<LI>OS type defines now in Makefile.</LI>
|
||||
<LI>New RAWWAVE_PATH define in Object.h.</LI>
|
||||
<LI>Syntmono project pulled out to separate directory and cleaned up.</LI>
|
||||
<LI>Socketing capabilities under Unix, as well as Windoze.</LI>
|
||||
<LI>Multiple simultaneous socket client connections to STK servers now possible.</LI>
|
||||
<LI>MD2SKINI now can merge MIDI and piped messages under Irix and Linux (for TCL->MD2SKINI->syntmono control).</LI>
|
||||
<LI>Defined INT16 and INT32 types and fixed various WvIn and WvOut classes.</LI>
|
||||
<LI>Updated MatWvIn and MatWvOut for new MAT-file documentation from Matlab.</LI>
|
||||
<LI>New demo Tcl/Tk GUI (TclDemo.tcl).</LI>
|
||||
<LI>Minor fixes to FM behavior.</LI>
|
||||
<LI>Added record/duplex capabilities to RTSoundIO (Linux, SGI, and Windoze).</LI>
|
||||
<LI>Fixed bugs in WavWvOut and MatWvOut header specifications.</LI>
|
||||
<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 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>
|
||||
</UL>
|
||||
|
||||
\subsection v2dot02 Version 2.02
|
||||
- Created RawWave abstract class, with subclasses of RawLoop (looping rawwave oscillator), RawShot (non-looping, non-interpolating rawwave player ... used to be RawWvIn), and RawInterp (looping or non-looping, interpolating rawwave player ... used to be RawWave).
|
||||
- Modified DrumSynt to correctly handle sample rates different than 22050 Hz.
|
||||
- Modified syntmono parsing vs. tick routine so that some ticking occurs between each message. When multiple messages are waiting to be processed, the time between message updates is inversely proportional to the number of messages in the buffer.
|
||||
- Fixed DirectSound playback bug in WinXX distribution. Sound was being played at 8-bit, 22 kHz in all cases. Playback is now 16-bit and dependent on SRATE.
|
||||
- Fixed bug in MD2SKINI which prevented some NoteOff statements from being output.
|
||||
- This distribution includes an example STK project, mus151, which demonstrates a means for keeping a user's personal projects separate from the main distribution. This is highly recommended, in order to simplify upgrades to future STK releases.
|
||||
|
||||
<UL>
|
||||
<LI>Created RawWave abstract class, with subclasses of RawLoop (looping rawwave oscillator), RawShot (non-looping, non-interpolating rawwave player ... used to be RawWvIn), and RawInterp (looping or non-looping, interpolating rawwave player ... used to be RawWave).</LI>
|
||||
<LI>Modified DrumSynt to correctly handle sample rates different than 22050 Hz.</LI>
|
||||
<LI>Modified syntmono parsing vs. tick routine so that some ticking occurs between each message. When multiple messages are waiting to be processed, the time between message updates is inversely proportional to the number of messages in the buffer.</LI>
|
||||
<LI>Fixed DirectSound playback bug in WinXX distribution. Sound was being played at 8-bit, 22 kHz in all cases. Playback is now 16-bit and dependent on SRATE.</LI>
|
||||
<LI>Fixed bug in MD2SKINI which prevented some NoteOff statements from being output.</LI>
|
||||
<LI>This distribution includes an example STK project, mus151, which demonstrates a means for keeping a user's personal projects separate from the main distribution. This is highly recommended, in order to simplify upgrades to future STK releases.</LI>
|
||||
</UL>
|
||||
|
||||
\subsection v2 Version 2
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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 (e.g. <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.
|
||||
- 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).
|
||||
- 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.
|
||||
|
||||
<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>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. <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>
|
||||
|
||||
*/
|
||||
|
||||
@@ -21,11 +21,10 @@ 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 GitHub site: https://github.com/thestk/stk
|
||||
STK WWW site: http://ccrma.stanford.edu/software/stk/
|
||||
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
Copyright (c) 1995--2021 Perry R. Cook and Gary P. Scavone
|
||||
Copyright (c) 1995-2012 Perry R. Cook and Gary P. Scavone
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
@@ -70,7 +69,7 @@ If the resultant sound generated by an STK program sounds like noise (and you're
|
||||
|
||||
\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:
|
||||
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"
|
||||
|
||||
@@ -33,7 +33,7 @@ The stk::Iir class implements the standard difference equation
|
||||
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.cplusplus.com/reference/vector/vector/">vector</a>, a container object provided by the C++ Standard Library.
|
||||
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.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995--2021 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td>©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*! \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 and RtMidi are defined within the stk namespace.
|
||||
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:
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ 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 20 years
|
||||
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
|
||||
|
||||
@@ -18,16 +18,16 @@ Here's a link to a book that includes an chapter on STK.
|
||||
|
||||
<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 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 20 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 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. 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="https://www.tcl.tk/">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. 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="https://www.tcl.tk/">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).
|
||||
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>
|
||||
|
||||
@@ -39,8 +39,8 @@ 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 compatible
|
||||
Windows port (using DirectSound API) in June 1998. Numerous
|
||||
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
|
||||
|
||||
@@ -14,7 +14,7 @@ We have written this program to accept control messages from \c STDIN. Assuming
|
||||
threebees < scores/bachfugue.ski
|
||||
\endcode
|
||||
|
||||
For more fun, surf to <A HREF="http://kern.ccarh.org/">Kern Scores</A> for a huge assortment of other scorefiles that can be downloaded in the SKINI format.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<B>General:</B>
|
||||
<UL>
|
||||
<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="https://www.tcl.tk/">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>
|
||||
<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>
|
||||
@@ -17,13 +17,13 @@
|
||||
<UL>
|
||||
<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.
|
||||
<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.
|
||||
|
||||
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>
|
||||
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>
|
||||
|
||||
<B>Windows95 and later (specific):</B>
|
||||
<B>Windows95/98/2000/XP/7 (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.microsoft.com/directx/">DirectX</A> 5.0 (or higher) runtime libraries.</LI>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/*! \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 and C++. STK's "target audience" includes people who:
|
||||
- want to create audio DSP and/or synthesis programs
|
||||
- want to use our unit generators and input/output routines rather than code their own
|
||||
- want to learn about synthesis and processing algorithms
|
||||
- wish to teach real-time synthesis and processing and wish to use some of our classes and examples
|
||||
<UL>
|
||||
<LI>want to create audio DSP and/or synthesis programs</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>
|
||||
</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.).
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ 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>stk-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>
|
||||
|
||||
@@ -46,7 +46,7 @@ This release of STK comes with four separate "project" directories:
|
||||
\section compiling Compiling:
|
||||
|
||||
<UL>
|
||||
<LI><B>Windows95 and later:</B> For specifics on creating Windows applications using Visual Studio, see README-Win.txt.</LI>
|
||||
<LI><B>Windows95/98/2000/XP/7:</B> Realtime support is available using either DirectSound or ASIO audio drivers. For DirectSound support, use the <TT>__WINDOWS_DS__</TT> preprocessor definition and link with the <TT>dsound.lib</TT>, <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries. For ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition, include all the files in the <TT>src/asio/</TT> directory (i.e. <TT>asio.h,cpp</TT>, <TT>asiodrivers.h,cpp</TT>, ...), and link with the <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries. In addition, the <TT>__LITTLE_ENDIAN__</TT> and <TT>__WINDOWS_MM__</TT> preprocessor definitions are necessary for all Windows systems (RtMidi uses the Windows MultiMedia MIDI API). Fairly old Visual C++ project files are provided in each project directory, though they may not work on newer versions of MSVS. As well, the MinGW compiler is supported (see below). It is important to link with the non-debug libraries when compiling "release" program versions and debug libraries when compiling "debug" program versions.</LI>
|
||||
|
||||
<LI><B>Unix (and MinGW) Systems:</B> A GNU <TT>configure</TT> shell script is included in the distribution for unix-based systems. From the top-level distribution directory, type <TT>'./configure'</TT> and the script will create <TT>Makefiles</TT> in each project directory specific to the characteristics of the host computer. Then from within any given project directory (example <TT>demo</TT>), type <TT>'make'</TT> to compile the project. In addition, an STK library can be compiled from within the <TT>src</TT> directory.
|
||||
|
||||
@@ -57,9 +57,7 @@ Several options can be supplied to the <TT>configure</TT> script to customize th
|
||||
<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 CoreAudio API support (Macintosh OS-X)</LI>
|
||||
<LI><TT>--with-asio</TT> to choose ASIO Audio API support (Windows)</LI>
|
||||
<LI><TT>--with-ds</TT> to choose Windows DirectSound Audio API support (Windows)</LI>
|
||||
<LI><TT>--with-core</TT> to choose Core Audio API support (Macintosh OS-X)</LI>
|
||||
</UL>
|
||||
<P>
|
||||
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:
|
||||
@@ -75,7 +73,7 @@ For those who wish to create their own system-specific <TT>Makefiles</TT>:
|
||||
<UL>
|
||||
<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> 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 CoreAudio support) and/or the JACK library. 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>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>
|
||||
@@ -94,7 +92,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="https://www.tcl.tk/">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.
|
||||
<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
|
||||
@@ -134,23 +132,23 @@ The <I><B>demo</B></I> project demonstrates the behavior of all the distributed
|
||||
|
||||
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>stk-demo</B></I> program, typing:
|
||||
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
|
||||
stk-demo BeeThree -ow myfile.wav -if scores/bookert.ski
|
||||
demo BeeThree -ow myfile.wav -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 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>stk-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, Mac OS-X, and Windows95 and later operating systems. STK realtime SKINI control input via piping is possible under Linux, Mac OS X, and Windows2000 and later 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>stk-demo</B></I> program is invoked as:
|
||||
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:
|
||||
|
||||
\code
|
||||
stk-demo instrument flags
|
||||
demo instrument flags
|
||||
\endcode
|
||||
|
||||
where instruments include those described above and flags can be any or all of:
|
||||
@@ -167,21 +165,21 @@ where instruments include those described above and flags can be any or all of:
|
||||
</UL>
|
||||
The <i>-ip</i> flag must be used when piping realtime SKINI control data to an STK program. The <i>-im</i> flag must be used to read MIDI control input from your MIDI port. Note that you can use both input types simultaneously.
|
||||
|
||||
Assuming a successful compilation of the <I><B>stk-demo</B></I> program, typing:
|
||||
Assuming a successful compilation of the <I><B>demo</B></I> program, typing:
|
||||
|
||||
\code
|
||||
stk-demo BeeThree -or -if 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>stk-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 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.
|
||||
|
||||
|
||||
\section tcl Realtime Control Input using Tcl/Tk Graphical User Interfaces:
|
||||
|
||||
There are a number of <A HREF="https://www.tcl.tk/">Tcl/Tk</A> GUIs supplied with the STK projects. These scripts require Tcl/Tk version 8.0 or later, which can be downloaded for free over the WWW. On Unix and Windows2000 and later platforms, you can run the various executable scripts (e.g. StkDemo.bat) provided with each project to start everything up (you may need to symbolically link the wishXX executable to the name <I>wish</I>). The Physical.bat script just implements the following command-line sequence:
|
||||
There are a number of <A HREF="http://dev.scriptics.com">Tcl/Tk</A> GUIs supplied with the STK projects. These scripts require Tcl/Tk version 8.0 or later, which can be downloaded for free over the WWW. On Unix and Windows2000/XP platforms, you can run the various executable scripts (e.g. StkDemo.bat) provided with each project to start everything up (you may need to symbolically link the wishXX executable to the name <I>wish</I>). The Physical.bat script just implements the following command-line sequence:
|
||||
|
||||
\code
|
||||
wish < tcl/Physical.tcl | stk-demo Clarinet -or -ip
|
||||
wish < tcl/Physical.tcl | demo Clarinet -or -ip
|
||||
\endcode
|
||||
|
||||
\section midi Realtime MIDI Control Input:
|
||||
@@ -189,17 +187,17 @@ wish < tcl/Physical.tcl | stk-demo Clarinet -or -ip
|
||||
On all supported realtime platforms, you can direct realtime MIDI input to the STK Clarinet by typing:
|
||||
|
||||
\code
|
||||
stk-demo Clarinet -or -im
|
||||
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:
|
||||
|
||||
The <I><B>stk-demo</B></I> program supports an arbitrary number of voices via the <TT>-n NUMBER</TT> command-line flag and argument. For example, you can play eight BeeThree instruments with realtime output and control them from a MIDI device by typing:
|
||||
The <I><B>demo</B></I> program supports an arbitrary number of voices via the <TT>-n NUMBER</TT> command-line flag and argument. For example, you can play eight BeeThree instruments with realtime output and control them from a MIDI device by typing:
|
||||
|
||||
\code
|
||||
stk-demo BeeThree -n 8 -or -im
|
||||
demo BeeThree -n 8 -or -im
|
||||
\endcode
|
||||
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995--2021.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
|
||||
STK Classes - See the HTML documentation in the html directory for complete information.
|
||||
|
||||
@@ -49,7 +49,7 @@ Stk -| UdpSocket
|
||||
.- Instrmnt -|
|
||||
|- Drummer
|
||||
|
|
||||
|- Clarinet, BlowHole, Saxofony, Flute, Brass, BlowBotl, Bowed, Plucked, StifKarp, Sitar, Recorder
|
||||
|- Clarinet, BlowHole, Saxofony, Flute, Brass, BlowBotl, Bowed, Plucked, StifKarp, Sitar
|
||||
|
|
||||
|- Shakers
|
||||
|
|
||||
@@ -129,7 +129,6 @@ Clarinet.cpp Pretty Good Clarinet DelayL, ReedTabl, OneZero, Envel
|
||||
BlowHole.cpp Clarinet w/ Tone & Vent Holes DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop, PoleZero
|
||||
Saxofony.cpp A Faux Saxophone DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
|
||||
Flute.cpp Pretty Good Flute JetTabl, DelayL, OnePole, PoleZero, Noise, ADSR, WaveLoop
|
||||
Recorder.cpp A More Physical Flute DelayL, IIR, Noise, ADSR, SineWave
|
||||
BlowBotl.cpp Blown Bottle JetTabl, BiQuad, PoleZero, Noise, ADSR, WaveLoop
|
||||
BandedWG.cpp Banded Waveguide Meta-Object Delay, BowTabl, ADSR, BiQuad
|
||||
Modal.cpp N Resonances Envelope, WaveLoop, BiQuad, OnePole
|
||||
@@ -174,7 +173,7 @@ effects.cpp Effects demonstration program
|
||||
ragamatic.cpp Nirvana just waiting to happen
|
||||
|
||||
Skini.cpp SKINI file/message parser object
|
||||
SKINImsg.h #defines for often used and universal MIDI/SKINI symbols
|
||||
SKINItbl.h Table of SKINI messages
|
||||
SKINI.msg #defines for often used and universal MIDI/SKINI symbols
|
||||
SKINI.tbl Table of SKINI messages
|
||||
|
||||
|
||||
|
||||
164
doc/html/ADSR_8h_source.html
Normal file
164
doc/html/ADSR_8h_source.html
Normal file
@@ -0,0 +1,164 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1ADSR.html">00024</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="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keyword">enum</span> {
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">00030</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">ATTACK</a>,
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">00031</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>,
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">00032</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>,
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">00033</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">RELEASE</a>,
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa1ed3238253daecbdba14da71759392d8">00034</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa1ed3238253daecbdba14da71759392d8">IDLE</a>
|
||||
<a name="l00035"></a>00035 };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1ADSR.html#ac7473272021307b0dcf1ef602143e144" title="Default constructor.">ADSR</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1ADSR.html#a714f0b9deb325050eba819bc1fe22127" title="Class destructor.">~ADSR</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#aad03e82009a20cfb49c1f04bae791631" title="Set target = 1, state = ADSR::ATTACK.">keyOn</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#a9400e04b313ab8900a3ba9b693f448e6" title="Set target = 0, state = ADSR::RELEASE.">keyOff</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_1ADSR.html#aff18347235fd52ce307c4b5de18a9c62" title="Set the attack rate (gain / sample).">setAttackRate</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#ae0af300e39f83f79776c04a3e83a85b1" title="Set the target value for the attack (default = 1.0).">setAttackTarget</a>( StkFloat target );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a285f500b1e149aed48dba2a155b95cdd" title="Set the decay rate (gain / sample).">setDecayRate</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#a85138fb6bbcc7b7cd85ec8449d68f7d8" title="Set the sustain level.">setSustainLevel</a>( StkFloat level );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a29da04231df73c2968c0e9387b43be6e" title="Set the release rate (gain / sample).">setReleaseRate</a>( StkFloat rate );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a48885319b8175cd4d6312fdf7980f116" title="Set the attack rate based on a time duration (seconds).">setAttackTime</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#a450703c45384ae27eb766551843ce82d" title="Set the decay rate based on a time duration (seconds).">setDecayTime</a>( StkFloat time );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a91c14442557cb65286a327f8b297237a" title="Set the release rate based on a time duration (seconds).">setReleaseTime</a>( StkFloat time );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a3567b02a0e8ab82d18eb949d362f9708" title="Set sustain level and attack, decay, and release time durations (seconds).">setAllTimes</a>( StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a428eebd510e464ccd7bb4e5728f80d63" title="Set a sustain target value and attack or decay from current value to target.">setTarget</a>( StkFloat target );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1ADSR.html#a87f9918cfa4104a841dc5b44f26f8904">00080</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1ADSR.html#a87f9918cfa4104a841dc5b44f26f8904" title="Return the current envelope state (ATTACK, DECAY, SUSTAIN, RELEASE, IDLE).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#aa99bf5fca3885bf8d99a3edc4072a4b5" title="Set to state = ADSR::SUSTAIN with current and target values of value.">setValue</a>( StkFloat value );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a><a class="code" href="classstk_1_1ADSR.html#aedbcb85346c354139f139b3232f36f39">00086</a> StkFloat <a class="code" href="classstk_1_1ADSR.html#aedbcb85346c354139f139b3232f36f39" 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="l00087"></a>00087
|
||||
<a name="l00089"></a>00089 StkFloat <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00099"></a>00099 <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#af2c0869f86210a55f4f668172373c975" 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="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="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00106"></a>00106 StkFloat value_;
|
||||
<a name="l00107"></a>00107 StkFloat target_;
|
||||
<a name="l00108"></a>00108 StkFloat attackRate_;
|
||||
<a name="l00109"></a>00109 StkFloat decayRate_;
|
||||
<a name="l00110"></a>00110 StkFloat releaseRate_;
|
||||
<a name="l00111"></a>00111 StkFloat releaseTime_;
|
||||
<a name="l00112"></a>00112 StkFloat sustainLevel_;
|
||||
<a name="l00113"></a>00113 };
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a><a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975">00115</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00116"></a>00116 {
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">switch</span> ( state_ ) {
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">ATTACK</a>:
|
||||
<a name="l00120"></a>00120 value_ += attackRate_;
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00122"></a>00122 value_ = target_;
|
||||
<a name="l00123"></a>00123 target_ = sustainLevel_;
|
||||
<a name="l00124"></a>00124 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126 lastFrame_[0] = value_;
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">break</span>;
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>:
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">if</span> ( value_ > sustainLevel_ ) {
|
||||
<a name="l00131"></a>00131 value_ -= decayRate_;
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">if</span> ( value_ <= sustainLevel_ ) {
|
||||
<a name="l00133"></a>00133 value_ = sustainLevel_;
|
||||
<a name="l00134"></a>00134 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>;
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">else</span> {
|
||||
<a name="l00138"></a>00138 value_ += decayRate_; <span class="comment">// attack target < sustain level</span>
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">if</span> ( value_ >= sustainLevel_ ) {
|
||||
<a name="l00140"></a>00140 value_ = sustainLevel_;
|
||||
<a name="l00141"></a>00141 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144 lastFrame_[0] = value_;
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">break</span>;
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">RELEASE</a>:
|
||||
<a name="l00148"></a>00148 value_ -= releaseRate_;
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">if</span> ( value_ <= 0.0 ) {
|
||||
<a name="l00150"></a>00150 value_ = 0.0;
|
||||
<a name="l00151"></a>00151 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa1ed3238253daecbdba14da71759392d8">IDLE</a>;
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153 lastFrame_[0] = value_;
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a><a class="code" href="classstk_1_1ADSR.html#a97a617c65e62aadb4f88bd10cf437a6a">00160</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#af2c0869f86210a55f4f668172373c975" 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="l00161"></a>00161 {
|
||||
<a name="l00162"></a>00162 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00163"></a>00163 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00164"></a>00164 oStream_ << <span class="stringliteral">"ADSR::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00165"></a>00165 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167 <span class="preprocessor">#endif</span>
|
||||
<a name="l00168"></a>00168 <span class="preprocessor"></span>
|
||||
<a name="l00169"></a>00169 StkFloat *samples = &frames[channel];
|
||||
<a name="l00170"></a>00170 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00171"></a>00171 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00172"></a>00172 *samples = <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR::tick</a>();
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00175"></a>00175 }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00177"></a>00177 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00178"></a>00178
|
||||
<a name="l00179"></a>00179 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
124
doc/html/Asymp_8h_source.html
Normal file
124
doc/html/Asymp_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#ad8ea9fc5621a1d8b81001d459de265a0" 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#ad869abbd938c263a2c177de636f5a57c" 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#a51f0aad846eb6bda4c20eb63534786e2" 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#a082e765dc3bd6b452e92b602af7a1042" 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#aebd8ebaf6f6c9570d3ee78e1bcbbcbd2" 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#aca998e9c4ae86b4958da59fc9433268c" 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#afa6fcf4bf3060c0c6092701e409d5fbf" title="Set the asymptotic rate such that the target value is perceptually reached (to within...">setT60</a>( StkFloat t60 );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a7b0f7025ba5f268f1e5ce097b209f0ec" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a81881bb8aca615f69bbbfd56267f971c" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Asymp.html#aaba01ef0ac1a493a14a73c3b29259bde">00073</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Asymp.html#aaba01ef0ac1a493a14a73c3b29259bde" 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="l00074"></a>00074
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Asymp.html#aeb868c171e07206e2d5d30f8ce8f4436">00076</a> StkFloat <a class="code" href="classstk_1_1Asymp.html#aeb868c171e07206e2d5d30f8ce8f4436" 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_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" 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_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" 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> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 StkFloat value_;
|
||||
<a name="l00096"></a>00096 StkFloat target_;
|
||||
<a name="l00097"></a>00097 StkFloat factor_;
|
||||
<a name="l00098"></a>00098 StkFloat constant_;
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00100"></a>00100 };
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a><a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e">00102</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00103"></a>00103 {
|
||||
<a name="l00104"></a>00104 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 value_ = factor_ * value_ + constant_;
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Check threshold.</span>
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( target_ - value_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00111"></a>00111 value_ = target_;
|
||||
<a name="l00112"></a>00112 state_ = 0;
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 }
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">else</span> {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">if</span> ( value_ - target_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00117"></a>00117 value_ = target_;
|
||||
<a name="l00118"></a>00118 state_ = 0;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121 lastFrame_[0] = value_;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a><a class="code" href="classstk_1_1Asymp.html#a2647bc013816f026915b1e92ddd6a322">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_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" 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="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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00131"></a>00131 oStream_ << <span class="stringliteral">"Asymp::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00132"></a>00132 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00139"></a>00139 *samples = <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp::tick</a>();
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
129
doc/html/BandedWG_8h_source.html
Normal file
129
doc/html/BandedWG_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#ad449f248adaa49344c2bd25be4a7872d" 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#ac4044055c28bad672c9537b985d18289" 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#a182dbf5d75aebf5714bd6df15b0df90c" 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#a4394ee4cd1c84a8b3f92713e60715c4d" 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#ab1e3a367eef86e6cb372b4ee232e1804" 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#acf104d4ed663b5f0cd034c8025f4d420" 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#a37b20c2554e7100241a99758f5a4433e" 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#aa14786c32af030311e2118db3b68a892" 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#a271573afaa2dc655446482bad6745cc1" 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#a8f334ae49b7baf561d74a0b6ec3c4f9a" 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#ac9c3c3ec0e821b1a080774bb55d3b881" 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#a16baac1cc6612332d6d0aa40a661c137" 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#a44f37146d33354afb085806bd8340497" 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="l00088"></a>00088
|
||||
<a name="l00095"></a>00095 <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_1BandedWG.html#a44f37146d33354afb085806bd8340497" 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="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keyword">protected</span>:
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">bool</span> doPluck_;
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">bool</span> trackVelocity_;
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">int</span> nModes_;
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">int</span> presetModes_;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00105"></a>00105 <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="l00106"></a>00106 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delay_[MAX_BANDED_MODES];
|
||||
<a name="l00107"></a>00107 StkFloat maxVelocity_;
|
||||
<a name="l00108"></a>00108 StkFloat modes_[MAX_BANDED_MODES];
|
||||
<a name="l00109"></a>00109 StkFloat frequency_;
|
||||
<a name="l00110"></a>00110 StkFloat baseGain_;
|
||||
<a name="l00111"></a>00111 StkFloat gains_[MAX_BANDED_MODES];
|
||||
<a name="l00112"></a>00112 StkFloat basegains_[MAX_BANDED_MODES];
|
||||
<a name="l00113"></a>00113 StkFloat excitation_[MAX_BANDED_MODES];
|
||||
<a name="l00114"></a>00114 StkFloat integrationConstant_;
|
||||
<a name="l00115"></a>00115 StkFloat velocityInput_;
|
||||
<a name="l00116"></a>00116 StkFloat bowVelocity_;
|
||||
<a name="l00117"></a>00117 StkFloat bowTarget_;
|
||||
<a name="l00118"></a>00118 StkFloat bowPosition_;
|
||||
<a name="l00119"></a>00119 StkFloat strikeAmp_;
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">int</span> strikePosition_;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 };
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1BandedWG.html#a6c2ebb66862b173c4835add6847801c9">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_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">BandedWG :: 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="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00127"></a>00127 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00128"></a>00128 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00129"></a>00129 oStream_ << <span class="stringliteral">"BandedWG::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00130"></a>00130 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00131"></a>00131 }
|
||||
<a name="l00132"></a>00132 <span class="preprocessor">#endif</span>
|
||||
<a name="l00133"></a>00133 <span class="preprocessor"></span>
|
||||
<a name="l00134"></a>00134 StkFloat *samples = &frames[channel];
|
||||
<a name="l00135"></a>00135 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00137"></a>00137 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00138"></a>00138 *samples++ = <a class="code" href="classstk_1_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">else</span> {
|
||||
<a name="l00141"></a>00141 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00142"></a>00142 *samples++ = <a class="code" href="classstk_1_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00144"></a>00144 *samples++ = lastFrame_[j];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/BeeThree_8h_source.html
Normal file
107
doc/html/BeeThree_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#ab4534210b85a2c4798bf1c88b348c20a" 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#af2a0c982731438cf6200b3e5642a288d" 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#a480c0fe8d4c2df9c00b82b192dd7eae4" 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#a4649b9471bde3b978c20fcafcbef0fc7" 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="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_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" 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="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <span class="keyword">protected</span>:
|
||||
<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_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7">00074</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">BeeThree :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00075"></a>00075 {
|
||||
<a name="l00076"></a>00076 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">if</span> ( modDepth_ > 0.0 ) {
|
||||
<a name="l00079"></a>00079 temp = 1.0 + ( modDepth_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * 0.1 );
|
||||
<a name="l00080"></a>00080 waves_[0]->setFrequency( baseFrequency_ * temp * ratios_[0] );
|
||||
<a name="l00081"></a>00081 waves_[1]->setFrequency( baseFrequency_ * temp * ratios_[1] );
|
||||
<a name="l00082"></a>00082 waves_[2]->setFrequency( baseFrequency_ * temp * ratios_[2] );
|
||||
<a name="l00083"></a>00083 waves_[3]->setFrequency( baseFrequency_ * temp * ratios_[3] );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00087"></a>00087 temp = control1_ * 2.0 * gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00088"></a>00088 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 temp += control2_ * 2.0 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00091"></a>00091 temp += gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00092"></a>00092 temp += gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = temp * 0.125;
|
||||
<a name="l00095"></a>00095 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1BeeThree.html#a30520efff3fac0674d3c7ab95ac35999">00098</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_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">BeeThree :: 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="l00099"></a>00099 {
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00101"></a>00101 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00102"></a>00102 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00103"></a>00103 oStream_ << <span class="stringliteral">"BeeThree::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span>
|
||||
<a name="l00108"></a>00108 StkFloat *samples = &frames[channel];
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">else</span> {
|
||||
<a name="l00115"></a>00115 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00116"></a>00116 *samples++ = <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00118"></a>00118 *samples++ = lastFrame_[j];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
148
doc/html/BiQuad_8h_source.html
Normal file
148
doc/html/BiQuad_8h_source.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a91aab9d1b4833e156edcf59cbe276e3f" 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#ad7e81be1c4e5c5ab69474f6df2610984" title="Class destructor.">~BiQuad</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BiQuad.html#aab468cd1aa79b95442b15bb04d8bb211">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#aab468cd1aa79b95442b15bb04d8bb211" 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#aeed58196cf798f664cddbb9a8564c7b5" 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#a26ee25d08116b20f326001166f087853">00037</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a26ee25d08116b20f326001166f087853" 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#add364ed410b3ed2a2b29b8a5fea127c8">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#add364ed410b3ed2a2b29b8a5fea127c8" 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#a208a654dd3393ed0b2b86ad56d9cf3e1">00043</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a208a654dd3393ed0b2b86ad56d9cf3e1" 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#a1c9799e47163fe8a59fd85196c089cb3">00046</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a1c9799e47163fe8a59fd85196c089cb3" 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#ae28afd560df11435ea54f128d23b9383">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#ae28afd560df11435ea54f128d23b9383" 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="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a55aaa01fd4156f1fac1168f526e3d969" 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="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#ae10a26fc319ba357bc92df4e528c2d8f" title="Set the filter coefficients for a notch at frequency (in Hz).">setNotch</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a28881f5876ce5bdcc846367cca9363f7" title="Sets the filter zeroes for equal resonance gain.">setEqualGainZeroes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a><a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063">00087</a> StkFloat <a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063" 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="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<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_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" 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="l00102"></a>00102
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00112"></a>00112 <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#a648086962c3cddcaa09c46a002c3e635" 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="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="keyword">protected</span>:
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00117"></a>00117 };
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a><a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635">00119</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( StkFloat input )
|
||||
<a name="l00120"></a>00120 {
|
||||
<a name="l00121"></a>00121 inputs_[0] = gain_ * input;
|
||||
<a name="l00122"></a>00122 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00123"></a>00123 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00124"></a>00124 inputs_[2] = inputs_[1];
|
||||
<a name="l00125"></a>00125 inputs_[1] = inputs_[0];
|
||||
<a name="l00126"></a>00126 outputs_[2] = outputs_[1];
|
||||
<a name="l00127"></a>00127 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00128"></a>00128
|
||||
<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_1BiQuad.html#af903e41217838470a5f267a20b905a12">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_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" 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="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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00136"></a>00136 oStream_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00137"></a>00137 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00144"></a>00144 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00145"></a>00145 *samples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00146"></a>00146 *samples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00147"></a>00147 inputs_[2] = inputs_[1];
|
||||
<a name="l00148"></a>00148 inputs_[1] = inputs_[0];
|
||||
<a name="l00149"></a>00149 outputs_[2] = outputs_[1];
|
||||
<a name="l00150"></a>00150 outputs_[1] = *samples;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a><a class="code" href="classstk_1_1BiQuad.html#ac9836f0e074ea9516727f27eb9b411aa">00157</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#a648086962c3cddcaa09c46a002c3e635" 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="l00158"></a>00158 {
|
||||
<a name="l00159"></a>00159 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00160"></a>00160 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00161"></a>00161 oStream_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00162"></a>00162 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00163"></a>00163 }
|
||||
<a name="l00164"></a>00164 <span class="preprocessor">#endif</span>
|
||||
<a name="l00165"></a>00165 <span class="preprocessor"></span>
|
||||
<a name="l00166"></a>00166 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00167"></a>00167 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00169"></a>00169 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00170"></a>00170 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00171"></a>00171 *oSamples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00172"></a>00172 *oSamples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00173"></a>00173 inputs_[2] = inputs_[1];
|
||||
<a name="l00174"></a>00174 inputs_[1] = inputs_[0];
|
||||
<a name="l00175"></a>00175 outputs_[2] = outputs_[1];
|
||||
<a name="l00176"></a>00176 outputs_[1] = *oSamples;
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178
|
||||
<a name="l00179"></a>00179 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00180"></a>00180 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00181"></a>00181 }
|
||||
<a name="l00182"></a>00182
|
||||
<a name="l00183"></a>00183 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00184"></a>00184
|
||||
<a name="l00185"></a>00185 <span class="preprocessor">#endif</span>
|
||||
<a name="l00186"></a>00186 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a8a245ef05cc58c521edaded5c6cdd5ee" 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#a24cd2cc9852ce73252a99f7eff63879b" 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#a3010cf9a0905368b857df2d332968036" 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#afa6f1103a61221eebf5f49f3a7df4145" 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#a8abd2b9a5b8d26926a383c1e56605545" 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#a254758ecd4166cc4e7d6fced5650a198">00062</a> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#a254758ecd4166cc4e7d6fced5650a198" 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#a03536a1f1823ea41649b4a62ba98007c" 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#a03536a1f1823ea41649b4a62ba98007c" 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#a03536a1f1823ea41649b4a62ba98007c">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" 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#ab53f6ba99ef5c4f8982f6c0f07bf2e1d">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#a03536a1f1823ea41649b4a62ba98007c" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00132"></a>00132 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#a03536a1f1823ea41649b4a62ba98007c" 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-2012 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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a2cb3aee415a6ee75fa85b01e4e85d70b" 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#a4bc6e424ca1631f353f55846084634ef" 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#a8f6dbe07d7f64b24cc9a41f6208dd6c4" 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#aeface58980a3ec865131f3cad59bbbef">00058</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#aeface58980a3ec865131f3cad59bbbef" 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#abbda8cb84bcd36fc6d96130e9832a6af">00064</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#abbda8cb84bcd36fc6d96130e9832a6af" 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#a8d0d8e0a12987ebccc56c09c7e7dbd6a" 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#a94521b4224d0873f5e783c721c123b21" 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#a77972e4e1c53600bf80cf692601ccae1">00085</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#a77972e4e1c53600bf80cf692601ccae1" 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#a04366d55cecb4c8a726ea0519683d817" 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#a04366d55cecb4c8a726ea0519683d817" 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#a04366d55cecb4c8a726ea0519683d817">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" 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#a7df894d40b3d6effbb2a09819356258d">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#a04366d55cecb4c8a726ea0519683d817" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00155"></a>00155 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#a04366d55cecb4c8a726ea0519683d817" 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-2012 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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a63c5e6dca28aa3b3c01808e049f3da33" 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#abed25206cc6cdb5fa8d667e7db0056a9" 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#abbe50319cd6ed762c15e148a8abb4920" 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#a58e2197cedfc366145b729256bf365cb">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#a58e2197cedfc366145b729256bf365cb" 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#a01fb40970e8905e47b7f39a1fb01589f">00055</a> StkFloat <a class="code" href="classstk_1_1Blit.html#a01fb40970e8905e47b7f39a1fb01589f" 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#a5571562e489947c4beccc206ecccfbdd" 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#a5a1fd506ab12ae614afaf0e402d24d30" 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#a530af82a27731734af4f4b58bce283de">00076</a> StkFloat <a class="code" href="classstk_1_1Blit.html#a530af82a27731734af4f4b58bce283de" 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#a528b8dc95499b11d6173cf065d62c717" 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#a528b8dc95499b11d6173cf065d62c717" 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#a528b8dc95499b11d6173cf065d62c717">00103</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" 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#a20a3634131ff890641931c1d04df19ad">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#a528b8dc95499b11d6173cf065d62c717" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00136"></a>00136 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#a528b8dc95499b11d6173cf065d62c717" 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/BlowBotl_8h_source.html
Normal file
134
doc/html/BlowBotl_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#aa505b4fc32ffe974b5840163395c321c" 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#adae826b0487471da1779761b0f885cb8" 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#a271161f45e0a706d8ccd299f9aaf2ada" 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#a75b679cd641bb4bae9bc4ac3021a03e3" 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#a926d428669edf9c87a1f88faf01550c4" 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#a91a174c3501aafbbfe6841f6915fe4f3" 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#afaf3f964cbdf99eddd7af99626169c02" 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#a132c87a453ecf25301243dc62f57f587" 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#a21a4b2aaaac7afcc67b4abe5ed833bfd" 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#a68501c2422994c8dca50086b3d944119" 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="l00069"></a>00069
|
||||
<a name="l00076"></a>00076 <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_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" 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="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="keyword">protected</span>:
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> resonator_;
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00086"></a>00086 StkFloat maxPressure_;
|
||||
<a name="l00087"></a>00087 StkFloat noiseGain_;
|
||||
<a name="l00088"></a>00088 StkFloat vibratoGain_;
|
||||
<a name="l00089"></a>00089 StkFloat outputGain_;
|
||||
<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_1BlowBotl.html#a68501c2422994c8dca50086b3d944119">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">BlowBotl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00094"></a>00094 {
|
||||
<a name="l00095"></a>00095 StkFloat breathPressure;
|
||||
<a name="l00096"></a>00096 StkFloat randPressure;
|
||||
<a name="l00097"></a>00097 StkFloat pressureDiff;
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Calculate the breath pressure (envelope + vibrato)</span>
|
||||
<a name="l00100"></a>00100 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00101"></a>00101 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 pressureDiff = breathPressure - resonator_.<a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 randPressure = noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00106"></a>00106 randPressure *= breathPressure;
|
||||
<a name="l00107"></a>00107 randPressure *= (1.0 + pressureDiff);
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 resonator_.<a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" 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#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) * pressureDiff ) );
|
||||
<a name="l00110"></a>00110 lastFrame_[0] = 0.2 * outputGain_ * dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00111"></a>00111
|
||||
<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><a class="code" href="classstk_1_1BlowBotl.html#a49e1f536d821a8b2bf133533cb4bc93e">00115</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_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">BlowBotl :: 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="l00116"></a>00116 {
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00118"></a>00118 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00119"></a>00119 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00120"></a>00120 oStream_ << <span class="stringliteral">"BlowBotl::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00121"></a>00121 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123 <span class="preprocessor">#endif</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span>
|
||||
<a name="l00125"></a>00125 StkFloat *samples = &frames[channel];
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00128"></a>00128 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00129"></a>00129 *samples++ = <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">else</span> {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 *samples++ = <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00135"></a>00135 *samples++ = lastFrame_[j];
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/BlowHole_8h_source.html
Normal file
156
doc/html/BlowHole_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a7f0aed9f79544d930c7f91dfa3e0efd9" 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#a691a14023e9283d12b0105dd886fba86" 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#a43b829201197f2d0f0e8a72072e6798a" 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#a023aa77cd11c9dc3a8013242ff92f982" 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#aaacb152624133d82e311b9e0b8218289" 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#a11c8a4a8483acf0f3e73c1d00008daff" 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#a1be64a601f2fbc8e9efaec5a53c55866" 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#aeb4dfd7d75b1996e15833c0928ed39c4" 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#a67e071cb26c1bba35e32f168d59b9be1" 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#abc3743ac2c8a9620c44cca41ce73e5b0" 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#a0d8ad0201c455894acb1416ffb21614b" 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#a3438c72b975481dae7d51f33f6f6fd94" 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="l00093"></a>00093
|
||||
<a name="l00100"></a>00100 <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_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" 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="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keyword">protected</span>:
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delays_[3];
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00107"></a>00107 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> tonehole_;
|
||||
<a name="l00108"></a>00108 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> vent_;
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00110"></a>00110 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00111"></a>00111 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 StkFloat scatter_;
|
||||
<a name="l00114"></a>00114 StkFloat thCoeff_;
|
||||
<a name="l00115"></a>00115 StkFloat rhGain_;
|
||||
<a name="l00116"></a>00116 StkFloat outputGain_;
|
||||
<a name="l00117"></a>00117 StkFloat noiseGain_;
|
||||
<a name="l00118"></a>00118 StkFloat vibratoGain_;
|
||||
<a name="l00119"></a>00119 };
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94">00121</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">BlowHole :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 StkFloat pressureDiff;
|
||||
<a name="l00124"></a>00124 StkFloat breathPressure;
|
||||
<a name="l00125"></a>00125 StkFloat temp;
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00128"></a>00128 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00129"></a>00129 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00130"></a>00130 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="comment">// Calculate the differential pressure = reflected - mouthpiece pressures</span>
|
||||
<a name="l00133"></a>00133 pressureDiff = delays_[0].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() - breathPressure;
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="comment">// Do two-port junction scattering for register vent</span>
|
||||
<a name="l00136"></a>00136 StkFloat pa = breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff );
|
||||
<a name="l00137"></a>00137 StkFloat pb = delays_[1].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00138"></a>00138 vent_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa+pb );
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 lastFrame_[0] = delays_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( vent_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>()+pb );
|
||||
<a name="l00141"></a>00141 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="comment">// Do three-port junction scattering (under tonehole)</span>
|
||||
<a name="l00144"></a>00144 pa += vent_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00145"></a>00145 pb = delays_[2].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00146"></a>00146 StkFloat pth = tonehole_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00147"></a>00147 temp = scatter_ * (pa + pb - 2 * pth);
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 delays_[2].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>(pa + temp) * -0.95 );
|
||||
<a name="l00150"></a>00150 delays_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pb + temp );
|
||||
<a name="l00151"></a>00151 tonehole_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa + pb - pth + temp );
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a><a class="code" href="classstk_1_1BlowHole.html#ad220cd597fa5f6edd043c0783bdc2ec7">00156</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_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">BlowHole :: 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="l00157"></a>00157 {
|
||||
<a name="l00158"></a>00158 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00159"></a>00159 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00160"></a>00160 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00161"></a>00161 oStream_ << <span class="stringliteral">"BlowHole::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00162"></a>00162 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00163"></a>00163 }
|
||||
<a name="l00164"></a>00164 <span class="preprocessor">#endif</span>
|
||||
<a name="l00165"></a>00165 <span class="preprocessor"></span>
|
||||
<a name="l00166"></a>00166 StkFloat *samples = &frames[channel];
|
||||
<a name="l00167"></a>00167 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00168"></a>00168 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00169"></a>00169 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00170"></a>00170 *samples++ = <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00171"></a>00171 }
|
||||
<a name="l00172"></a>00172 <span class="keywordflow">else</span> {
|
||||
<a name="l00173"></a>00173 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00174"></a>00174 *samples++ = <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00175"></a>00175 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00176"></a>00176 *samples++ = lastFrame_[j];
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a>00180 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00181"></a>00181 }
|
||||
<a name="l00182"></a>00182
|
||||
<a name="l00183"></a>00183 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00184"></a>00184
|
||||
<a name="l00185"></a>00185 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/BowTable_8h_source.html
Normal file
134
doc/html/BowTable_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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="l00020"></a>00020 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a><a class="code" href="classstk_1_1BowTable.html">00022</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="l00023"></a>00023 {
|
||||
<a name="l00024"></a>00024 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1BowTable.html#a25d0985fd6821a7e1608af1e8f51952a">00026</a> <a class="code" href="classstk_1_1BowTable.html#a25d0985fd6821a7e1608af1e8f51952a" title="Default constructor.">BowTable</a>( <span class="keywordtype">void</span> ) : offset_(0.0), slope_(0.1), minOutput_(0.01), maxOutput_(0.98) {};
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1BowTable.html#a9adcc3c36085b73d3b877828071a3b2c">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#a9adcc3c36085b73d3b877828071a3b2c" title="Set the table offset value.">setOffset</a>( StkFloat offset ) { offset_ = offset; };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BowTable.html#ad8391e46941ff9f49b78bf4f77c35143">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#ad8391e46941ff9f49b78bf4f77c35143" title="Set the table slope value.">setSlope</a>( StkFloat slope ) { slope_ = slope; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1BowTable.html#a9540d5c56cfd4556ab25c25f0612b25d">00045</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#a9540d5c56cfd4556ab25c25f0612b25d" title="Set the minimum table output value (0.0 - 1.0).">setMinOutput</a>( StkFloat minimum ) { minOutput_ = minimum; };
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1BowTable.html#a634d5063eba886445f4057c823b00ff7">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#a634d5063eba886445f4057c823b00ff7" title="Set the maximum table output value (0.0 - 1.0).">setMaxOutput</a>( StkFloat maximum ) { maxOutput_ = maximum; };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 StkFloat <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00062"></a>00062 <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#a8dc58c69ecda1471dce6d142cb5f4b19" 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="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00073"></a>00073 <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#a8dc58c69ecda1471dce6d142cb5f4b19" 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="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 <span class="keyword">protected</span>:
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 StkFloat offset_;
|
||||
<a name="l00078"></a>00078 StkFloat slope_;
|
||||
<a name="l00079"></a>00079 StkFloat minOutput_;
|
||||
<a name="l00080"></a>00080 StkFloat maxOutput_;
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 };
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19">00084</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( StkFloat input )
|
||||
<a name="l00085"></a>00085 {
|
||||
<a name="l00086"></a>00086 <span class="comment">// The input represents differential string vs. bow velocity.</span>
|
||||
<a name="l00087"></a>00087 StkFloat sample = input + offset_; <span class="comment">// add bias to input</span>
|
||||
<a name="l00088"></a>00088 sample *= slope_; <span class="comment">// then scale it</span>
|
||||
<a name="l00089"></a>00089 lastFrame_[0] = (StkFloat) fabs( (<span class="keywordtype">double</span>) sample ) + (StkFloat) 0.75;
|
||||
<a name="l00090"></a>00090 lastFrame_[0] = (StkFloat) pow( lastFrame_[0], (StkFloat) -4.0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="comment">// Set minimum threshold</span>
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">if</span> ( lastFrame_[0] < minOutput_ ) lastFrame_[0] = minOutput_;
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="comment">// Set maximum threshold</span>
|
||||
<a name="l00096"></a>00096 <span class="keywordflow">if</span> ( lastFrame_[0] > maxOutput_ ) lastFrame_[0] = maxOutput_;
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00099"></a>00099 }
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a><a class="code" href="classstk_1_1BowTable.html#a8ad2766def014b62dcbbd8765e133246">00101</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#a8dc58c69ecda1471dce6d142cb5f4b19" 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="l00102"></a>00102 {
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00105"></a>00105 oStream_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00107"></a>00107 }
|
||||
<a name="l00108"></a>00108 <span class="preprocessor">#endif</span>
|
||||
<a name="l00109"></a>00109 <span class="preprocessor"></span>
|
||||
<a name="l00110"></a>00110 StkFloat *samples = &frames[channel];
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00112"></a>00112 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00113"></a>00113 *samples = *samples + offset_;
|
||||
<a name="l00114"></a>00114 *samples *= slope_;
|
||||
<a name="l00115"></a>00115 *samples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *samples ) + 0.75;
|
||||
<a name="l00116"></a>00116 *samples = (StkFloat) pow( *samples, (StkFloat) -4.0 );
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1BowTable.html#aaf72f823f210b18f417337ac7181cde5">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_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" 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="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> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00128"></a>00128 oStream_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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 *iSamples = &iFrames[iChannel];
|
||||
<a name="l00134"></a>00134 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00135"></a>00135 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00136"></a>00136 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00137"></a>00137 *oSamples = *iSamples + offset_;
|
||||
<a name="l00138"></a>00138 *oSamples *= slope_;
|
||||
<a name="l00139"></a>00139 *oSamples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *oSamples ) + 0.75;
|
||||
<a name="l00140"></a>00140 *oSamples = (StkFloat) pow( *oSamples, (StkFloat) -4.0 );
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
140
doc/html/Bowed_8h_source.html
Normal file
140
doc/html/Bowed_8h_source.html
Normal file
@@ -0,0 +1,140 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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="l00038"></a>00038 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1Bowed.html">00040</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="l00041"></a>00041 {
|
||||
<a name="l00042"></a>00042 <span class="keyword">public</span>:
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Bowed.html#a1b442f60bbec3d07d2dd322ff761c767" title="Class constructor, taking the lowest desired playing frequency.">Bowed</a>( StkFloat lowestFrequency = 8.0 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1Bowed.html#a8067e4808bf7576922be4698f853c96c" title="Class destructor.">~Bowed</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#a8d522c36a35b86f90a06cf135fc83b11" title="Reset and clear all internal state.">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_1Bowed.html#a02dbcfbd0766fee8a2e75a8df809e62c" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Bowed.html#a7cf229e206a61259d381cf153a1c5096">00056</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a7cf229e206a61259d381cf153a1c5096" title="Set vibrato gain.">setVibrato</a>( StkFloat gain ) { vibratoGain_ = gain; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a519d511ddcc1cf23e897aeacdfe45020" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBowing</a>( StkFloat amplitude, 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#aae2a57d8e23536fd37a00af1fe07f21c" title="Decrease breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a4ebaf6bd27d90975e7b0aea0ee727dc1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, 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#ab86db568328b51e4adfae8b62987fc85" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#ad066af9bb1340b6fcf9002d6922021f4" 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="l00072"></a>00072
|
||||
<a name="l00074"></a>00074 StkFloat <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00084"></a>00084 <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_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" 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="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keyword">protected</span>:
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> neckDelay_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> bridgeDelay_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> stringFilter_;
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bodyFilters_[6];
|
||||
<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 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">bool</span> bowDown_;
|
||||
<a name="l00097"></a>00097 StkFloat maxVelocity_;
|
||||
<a name="l00098"></a>00098 StkFloat baseDelay_;
|
||||
<a name="l00099"></a>00099 StkFloat vibratoGain_;
|
||||
<a name="l00100"></a>00100 StkFloat betaRatio_;
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 };
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">Bowed :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 StkFloat bowVelocity = maxVelocity_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00107"></a>00107 StkFloat bridgeReflection = -stringFilter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00108"></a>00108 StkFloat nutReflection = -neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00109"></a>00109 StkFloat stringVelocity = bridgeReflection + nutReflection;
|
||||
<a name="l00110"></a>00110 StkFloat deltaV = bowVelocity - stringVelocity; <span class="comment">// Differential velocity</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 StkFloat newVelocity = 0.0;
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">if</span> ( bowDown_ )
|
||||
<a name="l00114"></a>00114 newVelocity = deltaV * bowTable_.<a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( deltaV ); <span class="comment">// Non-Linear bow function</span>
|
||||
<a name="l00115"></a>00115 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( bridgeReflection + newVelocity); <span class="comment">// Do string propagations</span>
|
||||
<a name="l00116"></a>00116 bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(nutReflection + newVelocity);
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( vibratoGain_ > 0.0 ) {
|
||||
<a name="l00119"></a>00119 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( (baseDelay_ * (1.0 - betaRatio_) ) +
|
||||
<a name="l00120"></a>00120 (baseDelay_ * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>()) );
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 lastFrame_[0] = 0.1248 * bodyFilters_[5].<a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( bodyFilters_[4].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bodyFilters_[3].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bodyFilters_[2].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bodyFilters_[1].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bodyFilters_[0].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() ) ) ) ) ) );
|
||||
<a name="l00124"></a>00124
|
||||
<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_1Bowed.html#ab7985e95058016201d16f3717039e1cd">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_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">Bowed :: 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="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00133"></a>00133 oStream_ << <span class="stringliteral">"Bowed::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00134"></a>00134 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00141"></a>00141 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00142"></a>00142 *samples++ = <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">else</span> {
|
||||
<a name="l00145"></a>00145 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00146"></a>00146 *samples++ = <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00148"></a>00148 *samples++ = lastFrame_[j];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> frames;
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
132
doc/html/Brass_8h_source.html
Normal file
132
doc/html/Brass_8h_source.html
Normal file
@@ -0,0 +1,132 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a5bf59263a54250be84c027198c7d2d1d" title="Class constructor, taking the lowest desired playing frequency.">Brass</a>( StkFloat lowestFrequency = 8.0 );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Brass.html#a474528a75bd4fb88cdb9c783d73df8f6" 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#a64e48334efdc8f2508c29c5ea4281f2d" 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#a5e99e7fee1b92138566a46c828df93e8" 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#a2e1a150328504050499c5cb9fa0e536f" 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#a02533e02818e2848fb6480106a54ce94" 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#a8bf1624aca6283fafb830a3f22546199" 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#ae74eba698f27abd43e66e825f5ce72da" 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#a32e2a6d2c9285bb5cf033d8a6b90e3c9" 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#a4d75ac361d11fcc870a330d393dbad80" 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#a4af1b7c4c1b374b65e04ccaa90886321" 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="l00075"></a>00075
|
||||
<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_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" 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="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_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> lipFilter_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 StkFloat lipTarget_;
|
||||
<a name="l00093"></a>00093 StkFloat slideTarget_;
|
||||
<a name="l00094"></a>00094 StkFloat vibratoGain_;
|
||||
<a name="l00095"></a>00095 StkFloat maxPressure_;
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 };
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321">00099</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">Brass :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 StkFloat breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00102"></a>00102 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 StkFloat mouthPressure = 0.3 * breathPressure;
|
||||
<a name="l00105"></a>00105 StkFloat borePressure = 0.85 * delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00106"></a>00106 StkFloat deltaPressure = mouthPressure - borePressure; <span class="comment">// Differential pressure.</span>
|
||||
<a name="l00107"></a>00107 deltaPressure = lipFilter_.<a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" 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="l00108"></a>00108 deltaPressure *= deltaPressure; <span class="comment">// Basic position to area mapping.</span>
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">if</span> ( deltaPressure > 1.0 ) deltaPressure = 1.0; <span class="comment">// Non-linear saturation.</span>
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// The following input scattering assumes the mouthPressure = area.</span>
|
||||
<a name="l00112"></a>00112 lastFrame_[0] = deltaPressure * mouthPressure + ( 1.0 - deltaPressure) * borePressure;
|
||||
<a name="l00113"></a>00113 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] ) );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a><a class="code" href="classstk_1_1Brass.html#a10334fc5573b68f2b5c2819bdba786b8">00118</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_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">Brass :: 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="l00119"></a>00119 {
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00121"></a>00121 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00122"></a>00122 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00123"></a>00123 oStream_ << <span class="stringliteral">"Brass::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00124"></a>00124 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#endif</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span>
|
||||
<a name="l00128"></a>00128 StkFloat *samples = &frames[channel];
|
||||
<a name="l00129"></a>00129 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00131"></a>00131 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00132"></a>00132 *samples++ = <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">else</span> {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00138"></a>00138 *samples++ = lastFrame_[j];
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
149
doc/html/Chorus_8h_source.html
Normal file
149
doc/html/Chorus_8h_source.html
Normal file
@@ -0,0 +1,149 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a529f668e66188ae5a42e4cc30779059f" 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#a63acbdd04d13110712c36a5cac5d972d" 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_1Chorus.html#acb3a55518c919dafa6c19698c1ab3389" title="Set modulation depth in range 0.0 - 1.0.">setModDepth</a>( StkFloat depth );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#aa4372095b8526d62ff9cfbdb03f21c4d" 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#aabcc110787ec3b443c21845b2f06bb3c" 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#a31d5c48d5b4a030040f6bb6b5e2c99cf" 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#a31d5c48d5b4a030040f6bb6b5e2c99cf" 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#a31d5c48d5b4a030040f6bb6b5e2c99cf" 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#aabcc110787ec3b443c21845b2f06bb3c">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#aabcc110787ec3b443c21845b2f06bb3c" 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 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#a31d5c48d5b4a030040f6bb6b5e2c99cf">00105</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" 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 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" 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#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" 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#a1d01bbaf40cc20a0b70241bb8072da7f" 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#a1d01bbaf40cc20a0b70241bb8072da7f" 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#aef55c6fb93a1d00498ae436868f84501">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#a31d5c48d5b4a030040f6bb6b5e2c99cf" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00125"></a>00125 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00134"></a>00134 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00135"></a>00135 *samples = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00136"></a>00136 samples++;
|
||||
<a name="l00137"></a>00137 *samples = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00141"></a>00141 lastFrame_[1] = *(samples-hop+1);
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a><a class="code" href="classstk_1_1Chorus.html#abdb8802a83f6b89716316399138e3032">00145</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#a31d5c48d5b4a030040f6bb6b5e2c99cf" 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="l00146"></a>00146 {
|
||||
<a name="l00147"></a>00147 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00148"></a>00148 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00149"></a>00149 oStream_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00150"></a>00150 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152 <span class="preprocessor">#endif</span>
|
||||
<a name="l00153"></a>00153 <span class="preprocessor"></span>
|
||||
<a name="l00154"></a>00154 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00155"></a>00155 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00156"></a>00156 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00157"></a>00157 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00158"></a>00158 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00159"></a>00159 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00160"></a>00160 *oSamples = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00161"></a>00161 *(oSamples+1) = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00162"></a>00162 }
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00165"></a>00165 lastFrame_[1] = *(oSamples-oHop+1);
|
||||
<a name="l00166"></a>00166 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00167"></a>00167 }
|
||||
<a name="l00168"></a>00168
|
||||
<a name="l00169"></a>00169 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00170"></a>00170
|
||||
<a name="l00171"></a>00171 <span class="preprocessor">#endif</span>
|
||||
<a name="l00172"></a>00172 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
136
doc/html/Clarinet_8h_source.html
Normal file
136
doc/html/Clarinet_8h_source.html
Normal file
@@ -0,0 +1,136 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#aad5cf9fb562ee87f2dc0aed0b4cd6c5b" title="Class constructor, taking the lowest desired playing frequency.">Clarinet</a>( StkFloat lowestFrequency = 8.0 );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Clarinet.html#a5166db9f4cf180fa189ba2e135affe34" 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#a7eae4377eb4178067c2dba704032a2d1" 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#af7c1cda6af97908c9b81b1be0c2a896d" 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#a0e4d016135c3ee291f4d74e9b030caee" 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#ae33627365f66f30c3685dc72cd7fadce" 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#a35f9158176c1b654c74bdf6f1296df67" 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#a501413064397d1650e18edac92a98b2e" 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#a63582205ab940101f5f9419fc717ff78" 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#a4cd08bca954ad434bc636eda957ca8d5" 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="l00075"></a>00075
|
||||
<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_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" 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="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_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 StkFloat outputGain_;
|
||||
<a name="l00094"></a>00094 StkFloat noiseGain_;
|
||||
<a name="l00095"></a>00095 StkFloat vibratoGain_;
|
||||
<a name="l00096"></a>00096 };
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5">00098</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">Clarinet :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00099"></a>00099 {
|
||||
<a name="l00100"></a>00100 StkFloat pressureDiff;
|
||||
<a name="l00101"></a>00101 StkFloat breathPressure;
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00104"></a>00104 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00105"></a>00105 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00106"></a>00106 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Perform commuted loss filtering.</span>
|
||||
<a name="l00109"></a>00109 pressureDiff = -0.95 * filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Calculate pressure difference of reflected and mouthpiece pressures.</span>
|
||||
<a name="l00112"></a>00112 pressureDiff = pressureDiff - breathPressure;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">// Perform non-linear scattering using pressure difference in reed function.</span>
|
||||
<a name="l00115"></a>00115 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>(pressureDiff));
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="comment">// Apply output gain.</span>
|
||||
<a name="l00118"></a>00118 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a><a class="code" href="classstk_1_1Clarinet.html#a059174eb1ab84e306bfad1d8b5833548">00123</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_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">Clarinet :: 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="l00124"></a>00124 {
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00128"></a>00128 oStream_ << <span class="stringliteral">"Clarinet::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00136"></a>00136 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00137"></a>00137 *samples++ = <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">else</span> {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00143"></a>00143 *samples++ = lastFrame_[j];
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00148"></a>00148 }
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
122
doc/html/Cubic_8h_source.html
Normal file
122
doc/html/Cubic_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Cubic.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CUBIC_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CUBIC_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="l00027"></a>00027 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1Cubic.html">00029</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Cubic.html" title="STK cubic non-linearity class.">Cubic</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00030"></a>00030 {
|
||||
<a name="l00031"></a>00031 <span class="keyword">public</span>:
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1Cubic.html#a2059a20146f6d7ec0854dc860ca90895">00033</a> <a class="code" href="classstk_1_1Cubic.html#a2059a20146f6d7ec0854dc860ca90895" title="Default constructor.">Cubic</a>( <span class="keywordtype">void</span> ) : a1_(0.5), a2_(0.5), a3_(0.5), gain_(1.0), threshold_(1.0) {};
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1Cubic.html#af4604c69f138415f9b9ee6944d2b54ef">00036</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#af4604c69f138415f9b9ee6944d2b54ef" title="Set the a1 coefficient value.">setA1</a>( StkFloat a1 ) { a1_ = a1; };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Cubic.html#afa16d53e6a720936543d0e0ea778f0eb">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#afa16d53e6a720936543d0e0ea778f0eb" title="Set the a2 coefficient value.">setA2</a>( StkFloat a2 ) { a2_ = a2; };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1Cubic.html#add4a05676471c4c09b76f5fe430b80fa">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#add4a05676471c4c09b76f5fe430b80fa" title="Set the a3 coefficient value.">setA3</a>( StkFloat a3 ) { a3_ = a3; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1Cubic.html#a3eca8ac3f81301592476aad7a2e1ec50">00045</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#a3eca8ac3f81301592476aad7a2e1ec50" title="Set the gain value.">setGain</a>( StkFloat gain ) { gain_ = gain; };
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1Cubic.html#a10ba2b5c858fc2d656d49c676d5561b4">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#a10ba2b5c858fc2d656d49c676d5561b4" title="Set the threshold value.">setThreshold</a>( StkFloat threshold ) { threshold_ = threshold; };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 StkFloat <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00062"></a>00062 <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_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function 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="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00073"></a>00073 <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_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function 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="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 <span class="keyword">protected</span>:
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 StkFloat a1_;
|
||||
<a name="l00078"></a>00078 StkFloat a2_;
|
||||
<a name="l00079"></a>00079 StkFloat a3_;
|
||||
<a name="l00080"></a>00080 StkFloat gain_;
|
||||
<a name="l00081"></a>00081 StkFloat threshold_;
|
||||
<a name="l00082"></a>00082 };
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c">00084</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">Cubic :: tick</a>( StkFloat input )
|
||||
<a name="l00085"></a>00085 {
|
||||
<a name="l00086"></a>00086 StkFloat inSquared = input * input;
|
||||
<a name="l00087"></a>00087 StkFloat inCubed = inSquared * input;
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 lastFrame_[0] = gain_ * (a1_ * input + a2_ * inSquared + a3_ * inCubed);
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="comment">// Apply threshold if we are out of range.</span>
|
||||
<a name="l00092"></a>00092 <span class="keywordflow">if</span> ( fabs( lastFrame_[0] ) > threshold_ ) {
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = ( lastFrame_[0] < 0 ? -threshold_ : threshold_ );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Cubic.html#af3e8a1d6ffe5e9788d841343bd5722cc">00099</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_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">Cubic :: 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="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00102"></a>00102 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00103"></a>00103 oStream_ << <span class="stringliteral">"Cubic::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span>
|
||||
<a name="l00108"></a>00108 StkFloat *samples = &frames[channel];
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00110"></a>00110 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00111"></a>00111 *samples = <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">tick</a>( *samples );
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a><a class="code" href="classstk_1_1Cubic.html#aef7887fe7e5131ce48c8488a21d295b9">00117</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_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">Cubic :: 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="l00118"></a>00118 {
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00121"></a>00121 oStream_ << <span class="stringliteral">"Cubic::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00122"></a>00122 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124 <span class="preprocessor">#endif</span>
|
||||
<a name="l00125"></a>00125 <span class="preprocessor"></span>
|
||||
<a name="l00126"></a>00126 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00127"></a>00127 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00128"></a>00128 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00129"></a>00129 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00130"></a>00130 *oSamples = <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">tick</a>( *iSamples );
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00136"></a>00136 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
168
doc/html/DelayA_8h_source.html
Normal file
168
doc/html/DelayA_8h_source.html
Normal file
@@ -0,0 +1,168 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a9beb31f924bca961df99c1ea7789c42d" 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#ab6f2ee45d350b4bb3515fcdaf25a986a" 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#ae5e59f497eb84280fd94d60257ffae69" 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><a class="code" href="classstk_1_1DelayA.html#a6ac5c818b6669bf904a4a5a81358bd28">00047</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1DelayA.html#a6ac5c818b6669bf904a4a5a81358bd28" title="Get the maximum delay-line length.">getMaximumDelay</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() - 1; };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#ab10bb5eb8316ce8b3c6667bdf4c98389" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#a83ddc9bdf2f5059159160fdac0e25eda" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a><a class="code" href="classstk_1_1DelayA.html#a363d9ccc50acbd1f3bb533aa1ab3d9c7">00066</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#a363d9ccc50acbd1f3bb533aa1ab3d9c7" 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="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00074"></a>00074 StkFloat <a class="code" href="classstk_1_1DelayA.html#aab723097f4634b23b0cd4ba8762271dc" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#adf33f950e60d31d355ea865ae3efd44e" title="Set the value at tapDelay samples from the delay-line input.">tapIn</a>( StkFloat value, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566">00080</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" 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
|
||||
<a name="l00086"></a>00086 StkFloat <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089 StkFloat <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00100"></a>00100 <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#ae602abe91560fb5f141db52333359b74" 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="l00101"></a>00101
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00111"></a>00111 <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#ae602abe91560fb5f141db52333359b74" 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="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <span class="keyword">protected</span>:
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00117"></a>00117 StkFloat delay_;
|
||||
<a name="l00118"></a>00118 StkFloat alpha_;
|
||||
<a name="l00119"></a>00119 StkFloat coeff_;
|
||||
<a name="l00120"></a>00120 StkFloat apInput_;
|
||||
<a name="l00121"></a>00121 StkFloat nextOutput_;
|
||||
<a name="l00122"></a>00122 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00123"></a>00123 };
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a><a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314">00125</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">DelayA :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00126"></a>00126 {
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00128"></a>00128 <span class="comment">// Do allpass interpolation delay.</span>
|
||||
<a name="l00129"></a>00129 nextOutput_ = -coeff_ * lastFrame_[0];
|
||||
<a name="l00130"></a>00130 nextOutput_ += apInput_ + ( coeff_ * inputs_[outPoint_] );
|
||||
<a name="l00131"></a>00131 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a><a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74">00137</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( StkFloat input )
|
||||
<a name="l00138"></a>00138 {
|
||||
<a name="l00139"></a>00139 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00143"></a>00143 inPoint_ = 0;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 lastFrame_[0] = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00146"></a>00146 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="comment">// Save the allpass input and increment modulo length.</span>
|
||||
<a name="l00149"></a>00149 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00151"></a>00151 outPoint_ = 0;
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a><a class="code" href="classstk_1_1DelayA.html#a57c568d56e5ed35926cfc23f83d48d98">00156</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#ae602abe91560fb5f141db52333359b74" 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="l00157"></a>00157 {
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00160"></a>00160 oStream_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00161"></a>00161 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00162"></a>00162 }
|
||||
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
|
||||
<a name="l00164"></a>00164 <span class="preprocessor"></span>
|
||||
<a name="l00165"></a>00165 StkFloat *samples = &frames[channel];
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00167"></a>00167 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00168"></a>00168 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00169"></a>00169 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00170"></a>00170 *samples = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00171"></a>00171 lastFrame_[0] = *samples;
|
||||
<a name="l00172"></a>00172 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00173"></a>00173 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00175"></a>00175 }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00177"></a>00177 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a><a class="code" href="classstk_1_1DelayA.html#a94a2998c9b2d1697ed9a747973be0a89">00180</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#ae602abe91560fb5f141db52333359b74" 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="l00181"></a>00181 {
|
||||
<a name="l00182"></a>00182 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00183"></a>00183 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00184"></a>00184 oStream_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00185"></a>00185 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00186"></a>00186 }
|
||||
<a name="l00187"></a>00187 <span class="preprocessor">#endif</span>
|
||||
<a name="l00188"></a>00188 <span class="preprocessor"></span>
|
||||
<a name="l00189"></a>00189 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00190"></a>00190 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00191"></a>00191 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00192"></a>00192 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00193"></a>00193 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00194"></a>00194 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00195"></a>00195 *oSamples = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00196"></a>00196 lastFrame_[0] = *oSamples;
|
||||
<a name="l00197"></a>00197 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00198"></a>00198 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00199"></a>00199 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00200"></a>00200 }
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="keywordflow">return</span> iFrames;
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
166
doc/html/DelayL_8h_source.html
Normal file
166
doc/html/DelayL_8h_source.html
Normal file
@@ -0,0 +1,166 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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 "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="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#ad60f2222397e19fe524fc3b76b59b846" 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#a8f9b49c7b098d9e379baf44b0c345457" title="Class destructor.">~DelayL</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1DelayL.html#acbcb8326db134a26fdad5f16f1a0ba7e">00043</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1DelayL.html#acbcb8326db134a26fdad5f16f1a0ba7e" title="Get the maximum delay-line length.">getMaximumDelay</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() - 1; };
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#a18b40806591654a9c9c32603990fce40" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<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_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1DelayL.html#aaf2d5ef7dba47ff1fb279c327021beb0">00062</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#aaf2d5ef7dba47ff1fb279c327021beb0" 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="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00070"></a>00070 StkFloat <a class="code" href="classstk_1_1DelayL.html#ad16a1f176e93a9beb8e685aafa32579e" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#a984843567ba3de6543bd13c23457f495" title="Set the value at tapDelay samples from the delay-line input.">tapIn</a>( StkFloat value, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9">00076</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" 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
|
||||
<a name="l00082"></a>00082 StkFloat <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085 StkFloat <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00096"></a>00096 <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#a1d01bbaf40cc20a0b70241bb8072da7f" 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="l00097"></a>00097
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00107"></a>00107 <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#a1d01bbaf40cc20a0b70241bb8072da7f" 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="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="keyword">protected</span>:
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00112"></a>00112 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00113"></a>00113 StkFloat delay_;
|
||||
<a name="l00114"></a>00114 StkFloat alpha_;
|
||||
<a name="l00115"></a>00115 StkFloat omAlpha_;
|
||||
<a name="l00116"></a>00116 StkFloat nextOutput_;
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00118"></a>00118 };
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a><a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8">00120</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">DelayL :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00121"></a>00121 {
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00123"></a>00123 <span class="comment">// First 1/2 of interpolation</span>
|
||||
<a name="l00124"></a>00124 nextOutput_ = inputs_[outPoint_] * omAlpha_;
|
||||
<a name="l00125"></a>00125 <span class="comment">// Second 1/2 of interpolation</span>
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">if</span> (outPoint_+1 < inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>())
|
||||
<a name="l00127"></a>00127 nextOutput_ += inputs_[outPoint_+1] * alpha_;
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">else</span>
|
||||
<a name="l00129"></a>00129 nextOutput_ += inputs_[0] * alpha_;
|
||||
<a name="l00130"></a>00130 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00131"></a>00131 }
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00136"></a><a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f">00136</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( StkFloat input )
|
||||
<a name="l00137"></a>00137 {
|
||||
<a name="l00138"></a>00138 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00142"></a>00142 inPoint_ = 0;
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 lastFrame_[0] = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00145"></a>00145 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="comment">// Increment output pointer modulo length.</span>
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00149"></a>00149 outPoint_ = 0;
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a><a class="code" href="classstk_1_1DelayL.html#acdc5d41de53c53d9d4b39ee8a46fb96c">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_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" 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="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> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00158"></a>00158 oStream_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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 *samples = &frames[channel];
|
||||
<a name="l00164"></a>00164 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00165"></a>00165 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00166"></a>00166 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00167"></a>00167 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00168"></a>00168 *samples = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00169"></a>00169 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00170"></a>00170 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00171"></a>00171 }
|
||||
<a name="l00172"></a>00172
|
||||
<a name="l00173"></a>00173 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00175"></a>00175 }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00177"></a><a class="code" href="classstk_1_1DelayL.html#a56ee486fb01fbf45d5a3dbad754a838e">00177</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#a1d01bbaf40cc20a0b70241bb8072da7f" 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="l00178"></a>00178 {
|
||||
<a name="l00179"></a>00179 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00180"></a>00180 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00181"></a>00181 oStream_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00182"></a>00182 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00183"></a>00183 }
|
||||
<a name="l00184"></a>00184 <span class="preprocessor">#endif</span>
|
||||
<a name="l00185"></a>00185 <span class="preprocessor"></span>
|
||||
<a name="l00186"></a>00186 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00187"></a>00187 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00188"></a>00188 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00189"></a>00189 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00190"></a>00190 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00191"></a>00191 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00192"></a>00192 *oSamples = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00193"></a>00193 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00194"></a>00194 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00195"></a>00195 }
|
||||
<a name="l00196"></a>00196
|
||||
<a name="l00197"></a>00197 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00198"></a>00198 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00199"></a>00199 }
|
||||
<a name="l00200"></a>00200
|
||||
<a name="l00201"></a>00201 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00202"></a>00202
|
||||
<a name="l00203"></a>00203 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
148
doc/html/Delay_8h_source.html
Normal file
148
doc/html/Delay_8h_source.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a9644532bfea44fae046e54f2509cf1ef" 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#a24b6ed6c7c5fc6d15935ec2a118b6b4f" title="Class destructor.">~Delay</a>();
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1Delay.html#a31d348fd15e5b6e23f2984b75968a3ec">00040</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Delay.html#a31d348fd15e5b6e23f2984b75968a3ec" title="Get the maximum delay-line length.">getMaximumDelay</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() - 1; };
|
||||
<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_1Delay.html#a0cf4c8da14bd4105eef06e35caaf1532" 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_1Delay.html#a5eaeed55ea0c7b30ed66fedd6ef52fc2" title="Set the delay-line length.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a><a class="code" href="classstk_1_1Delay.html#a7ae307dc997ff07ff986ca5c4d287441">00059</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Delay.html#a7ae307dc997ff07ff986ca5c4d287441" 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_1Delay.html#a4d5e5bab50e4fa062bd3f0e9e2fd19db" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#abd0b93da7a12eca94c1e68ec3b3774f1" title="Set the value at tapDelay samples from the delay-line input.">tapIn</a>( StkFloat value, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00078"></a>00078 StkFloat <a class="code" href="classstk_1_1Delay.html#a80f143ab956c9d3b1721958ece6da65e" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>( StkFloat value, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2">00081</a> StkFloat <a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" 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="l00082"></a>00082
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00087"></a><a class="code" href="classstk_1_1Delay.html#a2433e3246551f4fdf1366884cd2ae426">00087</a> StkFloat <a class="code" href="classstk_1_1Delay.html#a2433e3246551f4fdf1366884cd2ae426" 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="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1Delay.html#a240830690cd8fa26e0604fd82c65dda1" 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="l00091"></a>00091
|
||||
<a name="l00093"></a>00093 StkFloat <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00104"></a>00104 <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#aa1a929e0e324417b8a55cbf8770532e9" 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="l00105"></a>00105
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00115"></a>00115 <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#aa1a929e0e324417b8a55cbf8770532e9" 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="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="keyword">protected</span>:
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay_;
|
||||
<a name="l00122"></a>00122 };
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9">00124</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( StkFloat input )
|
||||
<a name="l00125"></a>00125 {
|
||||
<a name="l00126"></a>00126 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00130"></a>00130 inPoint_ = 0;
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="comment">// Read out next value</span>
|
||||
<a name="l00133"></a>00133 lastFrame_[0] = inputs_[outPoint_++];
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00136"></a>00136 outPoint_ = 0;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a><a class="code" href="classstk_1_1Delay.html#a93fe8e45acb933889be812f35810f977">00141</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#aa1a929e0e324417b8a55cbf8770532e9" 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="l00142"></a>00142 {
|
||||
<a name="l00143"></a>00143 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00144"></a>00144 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00145"></a>00145 oStream_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00146"></a>00146 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148 <span class="preprocessor">#endif</span>
|
||||
<a name="l00149"></a>00149 <span class="preprocessor"></span>
|
||||
<a name="l00150"></a>00150 StkFloat *samples = &frames[channel];
|
||||
<a name="l00151"></a>00151 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00152"></a>00152 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00153"></a>00153 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00155"></a>00155 *samples = inputs_[outPoint_++];
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00160"></a>00160 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a><a class="code" href="classstk_1_1Delay.html#ade0d544e45e535fd792fe70a2a22da6f">00163</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#aa1a929e0e324417b8a55cbf8770532e9" 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="l00164"></a>00164 {
|
||||
<a name="l00165"></a>00165 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00166"></a>00166 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00167"></a>00167 oStream_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00168"></a>00168 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00169"></a>00169 }
|
||||
<a name="l00170"></a>00170 <span class="preprocessor">#endif</span>
|
||||
<a name="l00171"></a>00171 <span class="preprocessor"></span>
|
||||
<a name="l00172"></a>00172 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00173"></a>00173 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00174"></a>00174 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00175"></a>00175 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00176"></a>00176 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00177"></a>00177 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00178"></a>00178 *oSamples = inputs_[outPoint_++];
|
||||
<a name="l00179"></a>00179 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00180"></a>00180 }
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 lastFrame_[0] = *(oSamples-oHop);
|
||||
<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>
|
||||
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
121
doc/html/Drummer_8h_source.html
Normal file
121
doc/html/Drummer_8h_source.html
Normal file
@@ -0,0 +1,121 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#af5262dd2b29ae453323c0a514d79d26a" 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#a365fb4b2c501129f2efd6edfad1f5453" 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#a5ea03a0ef9a3db02942799b5cbca2ea2" 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#aa735313fbdf7f1201fcb167874ecc7cc" 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#ad65c63bfad0ffac03db7f56cf706e4ba" 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="l00058"></a>00058
|
||||
<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_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" 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="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="keyword">protected</span>:
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> waves_[DRUM_POLYPHONY];
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filters_[DRUM_POLYPHONY];
|
||||
<a name="l00071"></a>00071 std::vector<int> soundOrder_;
|
||||
<a name="l00072"></a>00072 std::vector<int> soundNumber_;
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">int</span> nSounding_;
|
||||
<a name="l00074"></a>00074 };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba">00076</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">Drummer :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00077"></a>00077 {
|
||||
<a name="l00078"></a>00078 lastFrame_[0] = 0.0;
|
||||
<a name="l00079"></a>00079 <span class="keywordflow">if</span> ( nSounding_ == 0 ) <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<DRUM_POLYPHONY; i++ ) {
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">if</span> ( soundOrder_[i] >= 0 ) {
|
||||
<a name="l00083"></a>00083 <span class="keywordflow">if</span> ( waves_[i].isFinished() ) {
|
||||
<a name="l00084"></a>00084 <span class="comment">// Re-order the list.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j=0; j<DRUM_POLYPHONY; j++ ) {
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">if</span> ( soundOrder_[j] > soundOrder_[i] )
|
||||
<a name="l00087"></a>00087 soundOrder_[j] -= 1;
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 soundOrder_[i] = -1;
|
||||
<a name="l00090"></a>00090 nSounding_--;
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092 <span class="keywordflow">else</span>
|
||||
<a name="l00093"></a>00093 lastFrame_[0] += filters_[i].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( waves_[i].<a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 }
|
||||
<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_1Drummer.html#ad186a954527a518c47467e6caaa2e2f5">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_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">Drummer :: 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="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00105"></a>00105 oStream_ << <span class="stringliteral">"Drummer::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00107"></a>00107 }
|
||||
<a name="l00108"></a>00108 <span class="preprocessor">#endif</span>
|
||||
<a name="l00109"></a>00109 <span class="preprocessor"></span>
|
||||
<a name="l00110"></a>00110 StkFloat *samples = &frames[channel];
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00113"></a>00113 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00114"></a>00114 *samples++ = <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">else</span> {
|
||||
<a name="l00117"></a>00117 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00118"></a>00118 *samples++ = <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00119"></a>00119 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00120"></a>00120 *samples++ = lastFrame_[j];
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
113
doc/html/Echo_8h_source.html
Normal file
113
doc/html/Echo_8h_source.html
Normal file
@@ -0,0 +1,113 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a5f3320986d5c9b02ad10663ff11b6505" 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#a5fbe37000a611ce56075ee7d8936472d" 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#a253e0f8e4c628b431fdfcb6d880548c2" 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#a421a6f5f06f8e7df09edd179d397da7d" 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#ae58ea12a2864481cb7049c10810867ce" 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#a00a2a5949133a06680b026db7b21cc51">00038</a> StkFloat <a class="code" href="classstk_1_1Echo.html#a00a2a5949133a06680b026db7b21cc51" 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#a4cfb2c2dd350717cd8151749d3a32f91" 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#a4cfb2c2dd350717cd8151749d3a32f91" 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#a4cfb2c2dd350717cd8151749d3a32f91" 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#a4cfb2c2dd350717cd8151749d3a32f91">00072</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" 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#aa1a929e0e324417b8a55cbf8770532e9" 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#aefe863b7aa43d6a94c2a56bd31a30e7d">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#a4cfb2c2dd350717cd8151749d3a32f91" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00082"></a>00082 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#aa1a929e0e324417b8a55cbf8770532e9" 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#a1778a7da06b222afbe9281c886f678d8">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#a4cfb2c2dd350717cd8151749d3a32f91" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00101"></a>00101 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#aa1a929e0e324417b8a55cbf8770532e9" 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>
|
||||
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#af6eb27819aed132dd1edf2ce9640893e">00025</a> <a class="code" href="classstk_1_1Effect.html#af6eb27819aed132dd1edf2ce9640893e" title="Class constructor.">Effect</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" 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#abfdef9ce644c251607acfd183e3d7f7b">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Effect.html#abfdef9ce644c251607acfd183e3d7f7b" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a3d7e2b8942bf7adcc71dfc6dccbb7aa0">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#a3d7e2b8942bf7adcc71dfc6dccbb7aa0" 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#a0598128d1edc97729951310cc5df5171" title="Reset and clear all internal state.">clear</a>() = 0;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#ab4facbc9b317f18c139577e52fd69c3d" 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#ab4facbc9b317f18c139577e52fd69c3d">00049</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#ab4facbc9b317f18c139577e52fd69c3d" 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 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
120
doc/html/Envelope_8h_source.html
Normal file
120
doc/html/Envelope_8h_source.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a86ea29237a8d94c109388654703a0039" 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#a64365d24b6cdd3ea3bdcaa1abcbcb60a" 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#a42a1acf6a4606163056ad7d4122d2281" 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#a18cf8f21ef70227bd5cd17f53752bd0f">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a18cf8f21ef70227bd5cd17f53752bd0f" title="Set target = 1.">keyOn</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" 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#a9dbefb15f8d64aac3969f77d38791774">00038</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a9dbefb15f8d64aac3969f77d38791774" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 0.0 ); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#ade99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">setRate</a>( StkFloat rate );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#adeeb1676f9111980a0c1a48a6780c8f7" title="Set the rate based on a positive time duration (seconds).">setTime</a>( StkFloat time );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#ab8164a90c57616dc8bd55a6e5ba02fb6" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a><a class="code" href="classstk_1_1Envelope.html#addb2084add959a65733805bc2c1c39a9">00060</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Envelope.html#addb2084add959a65733805bc2c1c39a9" 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="l00061"></a>00061
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1Envelope.html#a31044eab6eaf668ba7e74ea17bed109d">00063</a> StkFloat <a class="code" href="classstk_1_1Envelope.html#a31044eab6eaf668ba7e74ea17bed109d" 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="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00076"></a>00076 <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#a8de91b9caf10a03f52bd2247648c4601" 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="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="keyword">protected</span>:
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 StkFloat value_;
|
||||
<a name="l00083"></a>00083 StkFloat target_;
|
||||
<a name="l00084"></a>00084 StkFloat rate_;
|
||||
<a name="l00085"></a>00085 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00086"></a>00086 };
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a><a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601">00088</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00089"></a>00089 {
|
||||
<a name="l00090"></a>00090 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00092"></a>00092 value_ += rate_;
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00094"></a>00094 value_ = target_;
|
||||
<a name="l00095"></a>00095 state_ = 0;
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098 <span class="keywordflow">else</span> {
|
||||
<a name="l00099"></a>00099 value_ -= rate_;
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">if</span> ( value_ <= target_ ) {
|
||||
<a name="l00101"></a>00101 value_ = target_;
|
||||
<a name="l00102"></a>00102 state_ = 0;
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105 lastFrame_[0] = value_;
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a><a class="code" href="classstk_1_1Envelope.html#a9341c9dea4fd54c360a4a23254319cf7">00111</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#a8de91b9caf10a03f52bd2247648c4601" 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="l00112"></a>00112 {
|
||||
<a name="l00113"></a>00113 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00114"></a>00114 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00115"></a>00115 oStream_ << <span class="stringliteral">"Envelope::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00116"></a>00116 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 <span class="preprocessor">#endif</span>
|
||||
<a name="l00119"></a>00119 <span class="preprocessor"></span>
|
||||
<a name="l00120"></a>00120 StkFloat *samples = &frames[channel];
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00122"></a>00122 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00123"></a>00123 *samples = <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
115
doc/html/FMVoices_8h_source.html
Normal file
115
doc/html/FMVoices_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a27d5570c83cad660a53f04d86d01c888" 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#a8ff218d379ec020a38e1bc7203409e37" 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#af47a92f6892f3a5bef5226d4772fc8cb" 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#af2fd5dd9af61db94ff1cb556e8e5cf4c" 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#a24e17888ff4e01edff96d81461d670a8" 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#a31111029e36d00230586250df7b4d887" 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="l00065"></a>00065
|
||||
<a name="l00072"></a>00072 <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_1FMVoices.html#a31111029e36d00230586250df7b4d887" 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="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">int</span> currentVowel_;
|
||||
<a name="l00077"></a>00077 StkFloat tilt_[3];
|
||||
<a name="l00078"></a>00078 StkFloat mods_[3];
|
||||
<a name="l00079"></a>00079 };
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887">00081</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">FMVoices :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00082"></a>00082 {
|
||||
<a name="l00083"></a>00083 <span class="keyword">register</span> StkFloat temp, temp2;
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00085"></a>00085 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00086"></a>00086 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.1;
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[0]);
|
||||
<a name="l00089"></a>00089 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[1]);
|
||||
<a name="l00090"></a>00090 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[2]);
|
||||
<a name="l00091"></a>00091 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[3]);
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 waves_[0]->addPhaseOffset(temp * mods_[0]);
|
||||
<a name="l00094"></a>00094 waves_[1]->addPhaseOffset(temp * mods_[1]);
|
||||
<a name="l00095"></a>00095 waves_[2]->addPhaseOffset(temp * mods_[2]);
|
||||
<a name="l00096"></a>00096 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00097"></a>00097 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00098"></a>00098 temp = gains_[0] * tilt_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00099"></a>00099 temp += gains_[1] * tilt_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00100"></a>00100 temp += gains_[2] * tilt_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 lastFrame_[0] = temp * 0.33;
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1FMVoices.html#abad16be89b38d4618a07c5d71ab49e26">00106</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_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">FMVoices :: 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="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00109"></a>00109 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00110"></a>00110 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00111"></a>00111 oStream_ << <span class="stringliteral">"FMVoices::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00112"></a>00112 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 <span class="preprocessor">#endif</span>
|
||||
<a name="l00115"></a>00115 <span class="preprocessor"></span>
|
||||
<a name="l00116"></a>00116 StkFloat *samples = &frames[channel];
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00119"></a>00119 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00120"></a>00120 *samples++ = <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">else</span> {
|
||||
<a name="l00123"></a>00123 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00124"></a>00124 *samples++ = <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00126"></a>00126 *samples++ = lastFrame_[j];
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">return</span> frames;
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
99
doc/html/FM_8h_source.html
Normal file
99
doc/html/FM_8h_source.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#af4732c22ce00743e1f751880fa07aa15" 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#aaba7e8bff02d105e146f8b62b20a27b9" 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#ac5697f9929afd43379e8720f2f271b2d" 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#a0a32c8327e842bb71ce945024d583941" 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#a8182c605d51ec623f90f4e07c2b90891" 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#a58f0898b677750a259036f628ec1a91b" 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#a65a8c54556f0c288871876ffad4d9eef" 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#a33e5d60131014a12a435c0ef20d104b6">00065</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a33e5d60131014a12a435c0ef20d104b6" title="Set the modulation speed in Hz.">setModulationSpeed</a>( StkFloat mSpeed ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#a1047a43714bc2e40c7e31e8f7e34adbc" 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#a11584256f23153551bc13b59518b415a">00068</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a11584256f23153551bc13b59518b415a" 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#a0425269a8fc0cc6bb7471d65b54b8a1a">00071</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a0425269a8fc0cc6bb7471d65b54b8a1a" 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#ad7e7d7067c8893040ef3bdf8a1fbe9ca">00074</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#ad7e7d7067c8893040ef3bdf8a1fbe9ca" 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#afc46280177d770404919f20ccf88e4ff" 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#a7235e94a153df135330a591511269f7c" 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#a56cc61b1923dba2ff80859df4904d4f9" 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#a1db9d177363fb7d8dedb20fa0c9104f1" 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#a81f351fd8732fd6e686735b7b45a4241" 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="l00092"></a>00092
|
||||
<a name="l00099"></a>00099 <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_1FM.html#a81f351fd8732fd6e686735b7b45a4241" 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 ) = 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 std::vector<ADSR *> adsr_;
|
||||
<a name="l00104"></a>00104 std::vector<FileLoop *> waves_;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1TwoZero.html" title="STK two-zero filter class.">TwoZero</a> twozero_;
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nOperators_;
|
||||
<a name="l00108"></a>00108 StkFloat baseFrequency_;
|
||||
<a name="l00109"></a>00109 std::vector<StkFloat> ratios_;
|
||||
<a name="l00110"></a>00110 std::vector<StkFloat> gains_;
|
||||
<a name="l00111"></a>00111 StkFloat modDepth_;
|
||||
<a name="l00112"></a>00112 StkFloat control1_;
|
||||
<a name="l00113"></a>00113 StkFloat control2_;
|
||||
<a name="l00114"></a>00114 StkFloat fmGains_[100];
|
||||
<a name="l00115"></a>00115 StkFloat fmSusLevels_[16];
|
||||
<a name="l00116"></a>00116 StkFloat fmAttTimes_[32];
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 };
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
97
doc/html/FileLoop_8h_source.html
Normal file
97
doc/html/FileLoop_8h_source.html
Normal file
@@ -0,0 +1,97 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a0d977aae11d75d0327057add00fa7f84" 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#a0d977aae11d75d0327057add00fa7f84" 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#ab6f0e0f9a5cc9c99627d0e12db007905" 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#a5905940c0dd046a95ca9c2a1d72983de" 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#a51688a9e84b2f9e5a9c4e62588b65c52">00052</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52" 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#a2c539902d697d0b87334ca7dc4f3ce69">00055</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69" 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#a2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">FileWvIn::reset</a>(); };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1FileLoop.html#a9f3c514ce166068197684a21d31c3a76">00058</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileLoop.html#a9f3c514ce166068197684a21d31c3a76" title="Return the number of audio channels in the data or stream.">channelsOut</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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00065"></a><a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b">00065</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( 1.0 ); };
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833">00072</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833" title="Normalize data to a maximum of +-peak.">normalize</a>( StkFloat peak ) { <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( peak ); };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1FileLoop.html#ad86d4f64c44a6f2488779fef24fc1ee7">00075</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileLoop.html#ad86d4f64c44a6f2488779fef24fc1ee7" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003">00083</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003" 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#a4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1FileLoop.html#aec8f94d8514b266acd83106ed0f24ead">00098</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#aec8f94d8514b266acd83106ed0f24ead" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( StkFloat frequency ) { this-><a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( file_.<a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>() * frequency / <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ); };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a1986db79fd04b93f4d10b8cdf75bca34" title="Increment the read pointer by time samples, modulo file size.">addTime</a>( StkFloat time );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a8e24d6f9292a9443fbc21e4e8797f482" title="Increment current read pointer by angle, relative to a looping frequency.">addPhase</a>( StkFloat angle );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#afe462794ba202dd879d29c39e76ae111" title="Add a phase offset to the current read pointer.">addPhaseOffset</a>( StkFloat angle );
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00129"></a><a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd">00129</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd" 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#a826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">FileWvIn::lastOut</a>( channel ); };
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00141"></a>00141 StkFloat <a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" 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="l00142"></a>00142
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00153"></a>00153 <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#a037b31918134ed1839a8b48de774ab95" 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="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="keyword">protected</span>:
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> firstFrame_;
|
||||
<a name="l00158"></a>00158 StkFloat phaseOffset_;
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 };
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
99
doc/html/FileRead_8h_source.html
Normal file
99
doc/html/FileRead_8h_source.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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="l00039"></a>00039 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1FileRead.html">00041</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="l00042"></a>00042 {
|
||||
<a name="l00043"></a>00043 <span class="keyword">public</span>:
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00054"></a>00054 <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089" 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="l00055"></a>00055 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a> = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <a class="code" href="classstk_1_1FileRead.html#a24802c0e1846ea9f420f40293af4cde4" title="Class destructor.">~FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#acc11b53871e05af1b0342e2cc1fc3157" 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="l00068"></a>00068 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a> = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a56d09169c0cca8623823579c7f80808a" title="If a file is open, close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a><a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488">00077</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" 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="l00078"></a>00078
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81">00080</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81" 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="l00081"></a>00081
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b">00083</a> StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> dataType_; };
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00091"></a><a class="code" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199">00091</a> StkFloat <a class="code" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199" 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="l00092"></a>00092
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8" 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="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="keyword">protected</span>:
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="comment">// Get STK RAW file information.</span>
|
||||
<a name="l00111"></a>00111 <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="l00112"></a>00112 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a>, StkFloat rate );
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">// Get WAV file header information.</span>
|
||||
<a name="l00115"></a>00115 <span class="keywordtype">bool</span> getWavInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="comment">// Get SND (AU) file header information.</span>
|
||||
<a name="l00118"></a>00118 <span class="keywordtype">bool</span> getSndInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="comment">// Get AIFF file header information.</span>
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">bool</span> getAifInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="comment">// Get MAT-file header information.</span>
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">bool</span> getMatInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">// Helper function for MAT-file parsing.</span>
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">bool</span> findNextMatArray( SINT32 *chunkSize, SINT32 *rows, SINT32 *columns, SINT32 *nametype );
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 FILE *fd_;
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">bool</span> wavFile_;
|
||||
<a name="l00132"></a>00132 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fileSize_;
|
||||
<a name="l00133"></a>00133 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dataOffset_;
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00135"></a>00135 StkFormat dataType_;
|
||||
<a name="l00136"></a>00136 StkFloat fileRate_;
|
||||
<a name="l00137"></a>00137 };
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <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-2012 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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#ac9e286cfc8037327eef493439e78f31e">00037</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">FILE_RAW</a>;
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">00038</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>;
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">00039</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">FILE_SND</a>;
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">00040</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">FILE_AIF</a>;
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">00041</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">FILE_MAT</a>;
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d" 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#ab362583b465c41ac0b411722621e9d3d" 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#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">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#ac4da2511c8d0640ec5484f88bd704747" 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#a7575ddb275c902207b7b6518bb5a4ed9" 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#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">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#a99a19988a4dd8d608b74421cfb6cbc69" 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#a636436624aa39eb5ba3401a9279a173e" 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#ad33ca8e729c14296af6dce457445832e" 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( std::string 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( std::string 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( std::string 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( std::string 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( std::string 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
119
doc/html/FileWvIn_8h_source.html
Normal file
119
doc/html/FileWvIn_8h_source.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a0562e85c4cb0d1565d9697da966add94" 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#a0562e85c4cb0d1565d9697da966add94" 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#ad63f10df8795ce5cb6348b0bb1ad884e" 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#a7986664cd986cbacf4fb19e5c77deda1" 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#ae586a93b45a979881d9bd6fc1cb364cb" 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#ac7dfd47e46a083d434e63c9d1b8c3d28" 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#aaecd1950fca3a5513e0efe4e86754b11" 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#aaecd1950fca3a5513e0efe4e86754b11" 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#aa8ef94c3ed01af0efc9e968f09207a26">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#aa8ef94c3ed01af0efc9e968f09207a26" 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> file_.<a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>(); };
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1FileWvIn.html#a867b7b7fdb60e5194e25d7a85a26ec0b">00100</a> <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#a867b7b7fdb60e5194e25d7a85a26ec0b" 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#a4dbbcbdc8db39a803e0861976f7f3522" 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#aa45344366bca49f71c7153ac5b296e91">00103</a> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWvIn.html#aa45344366bca49f71c7153ac5b296e91" title="Query whether a file is open.">isOpen</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> file_.<a class="code" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70" title="Returns true if a file is currently open.">isOpen</a>(); };
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b">00106</a> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b" 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="l00107"></a>00107
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00112"></a>00112 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aacd97ad5f30f9cdc8201b4244aa69901" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00118"></a>00118 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#ab2ccf7cc65c36a1ecfbb3b7d5707ea48" title="Increment the read pointer by time samples.">addTime</a>( StkFloat time );
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00127"></a><a class="code" href="classstk_1_1FileWvIn.html#a129c1e0b51497e6b09ad6aa37ad4d969">00127</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#a129c1e0b51497e6b09ad6aa37ad4d969" title="Turn linear interpolation on/off.">setInterpolate</a>( <span class="keywordtype">bool</span> doInterpolate ) { interpolate_ = doInterpolate; };
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00139"></a>00139 StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608" 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="l00140"></a>00140
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00151"></a>00151 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" 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="l00152"></a>00152
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00162"></a>00162 <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#ada668a0bc0bf89e155ef341de00babc2" 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="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 <span class="keyword">protected</span>:
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 <a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> file_;
|
||||
<a name="l00169"></a>00169 <span class="keywordtype">bool</span> finished_;
|
||||
<a name="l00170"></a>00170 <span class="keywordtype">bool</span> interpolate_;
|
||||
<a name="l00171"></a>00171 <span class="keywordtype">bool</span> normalizing_;
|
||||
<a name="l00172"></a>00172 <span class="keywordtype">bool</span> chunking_;
|
||||
<a name="l00173"></a>00173 StkFloat time_;
|
||||
<a name="l00174"></a>00174 StkFloat rate_;
|
||||
<a name="l00175"></a>00175 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold_;
|
||||
<a name="l00176"></a>00176 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize_;
|
||||
<a name="l00177"></a>00177 <span class="keywordtype">long</span> chunkPointer_;
|
||||
<a name="l00178"></a>00178
|
||||
<a name="l00179"></a>00179 };
|
||||
<a name="l00180"></a>00180
|
||||
<a name="l00181"></a><a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608">00181</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608" 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="l00182"></a>00182 {
|
||||
<a name="l00183"></a>00183 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00184"></a>00184 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00185"></a>00185 oStream_ << <span class="stringliteral">"FileWvIn::lastOut(): channel argument and soundfile data are incompatible!"</span>;
|
||||
<a name="l00186"></a>00186 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00187"></a>00187 }
|
||||
<a name="l00188"></a>00188 <span class="preprocessor">#endif</span>
|
||||
<a name="l00189"></a>00189 <span class="preprocessor"></span>
|
||||
<a name="l00190"></a>00190 <span class="keywordflow">if</span> ( finished_ ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00191"></a>00191 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00192"></a>00192 }
|
||||
<a name="l00193"></a>00193
|
||||
<a name="l00194"></a>00194 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 <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-2012 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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a6f0168fca20a3c9d6d5f2baedf03ec1b" 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#a6f0168fca20a3c9d6d5f2baedf03ec1b" 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#a800875bbcac8f137ed94f5606d55f8c6">FileWrite::FILE_WAV</a>,
|
||||
<a name="l00050"></a>00050 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">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#add13d21d51f639961977b63cb481c36e" 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#a31dde577d41a65018c3e03001de8d645" 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#a54cbced5ce278b0d16fa800e8445103c" 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#a9d3505aea3cd3c4d6822f05a2679dc41" 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#a9d3505aea3cd3c4d6822f05a2679dc41" 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
116
doc/html/Filter_8h_source.html
Normal file
116
doc/html/Filter_8h_source.html
Normal file
@@ -0,0 +1,116 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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 <span class="preprocessor">#include <cmath></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="l00020"></a>00020 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a><a class="code" href="classstk_1_1Filter.html">00022</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="l00023"></a>00023 {
|
||||
<a name="l00024"></a>00024 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1Filter.html#afc70117c0133d4a5d9a651ceb691d7c0">00026</a> <a class="code" href="classstk_1_1Filter.html#afc70117c0133d4a5d9a651ceb691d7c0" title="Class constructor.">Filter</a>( <span class="keywordtype">void</span> ) { gain_ = 1.0; channelsIn_ = 1; lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1Filter.html#a48f23ab6613be35e3be8aceaf5adfdd7">00029</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#a48f23ab6613be35e3be8aceaf5adfdd7" 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="l00030"></a>00030
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1Filter.html#a4f1ed97c9ad8aef32e54b48da03f5275">00032</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#a4f1ed97c9ad8aef32e54b48da03f5275" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<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_1Filter.html#a670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1Filter.html#a827b1bd3a99fa9af408cbd4eb559d212">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#a827b1bd3a99fa9af408cbd4eb559d212" title="Set the filter gain.">setGain</a>( StkFloat gain ) { gain_ = gain; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1Filter.html#af21e11b72ea59af4585c59600a0980c2">00045</a> StkFloat <a class="code" href="classstk_1_1Filter.html#af21e11b72ea59af4585c59600a0980c2" 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="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00053"></a>00053 StkFloat <a class="code" href="classstk_1_1Filter.html#a6453c68dca60f87053c888b3635b7220" title="Return the filter phase delay at the specified frequency.">phaseDelay</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Filter.html#ab2d944f649693511dced1df249f0abe6">00056</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#ab2d944f649693511dced1df249f0abe6" 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="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00067"></a>00067 <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#a3260a238824c4a748ac057b84b7d3f21" 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="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 <span class="keyword">protected</span>:
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 StkFloat gain_;
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channelsIn_;
|
||||
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 std::vector<StkFloat> b_;
|
||||
<a name="l00076"></a>00076 std::vector<StkFloat> a_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> outputs_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> inputs_;
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a><a class="code" href="classstk_1_1Filter.html#a670b9cc23ac798d3239cb819e801363c">00082</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#a670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">Filter :: clear</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00083"></a>00083 {
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">for</span> ( i=0; i<inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00086"></a>00086 inputs_[i] = 0.0;
|
||||
<a name="l00087"></a>00087 <span class="keywordflow">for</span> ( i=0; i<outputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00088"></a>00088 outputs_[i] = 0.0;
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">for</span> ( i=0; i<lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00090"></a>00090 lastFrame_[i] = 0.0;
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a><a class="code" href="classstk_1_1Filter.html#a6453c68dca60f87053c888b3635b7220">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Filter.html#a6453c68dca60f87053c888b3635b7220" title="Return the filter phase delay at the specified frequency.">Filter :: phaseDelay</a>( StkFloat frequency )
|
||||
<a name="l00094"></a>00094 {
|
||||
<a name="l00095"></a>00095 <span class="keywordflow">if</span> ( frequency <= 0.0 || frequency > 0.5 * <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ) {
|
||||
<a name="l00096"></a>00096 oStream_ << <span class="stringliteral">"Filter::phaseDelay: argument ("</span> << frequency << <span class="stringliteral">") is out of range!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING ); <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 StkFloat omegaT = 2 * PI * frequency / <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>();
|
||||
<a name="l00101"></a>00101 StkFloat real = 0.0, imag = 0.0;
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<b_.size(); i++ ) {
|
||||
<a name="l00103"></a>00103 real += b_[i] * std::cos( i * omegaT );
|
||||
<a name="l00104"></a>00104 imag -= b_[i] * std::sin( i * omegaT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 real *= gain_;
|
||||
<a name="l00107"></a>00107 imag *= gain_;
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 StkFloat phase = atan2( imag, real );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 real = 0.0, imag = 0.0;
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<a_.size(); i++ ) {
|
||||
<a name="l00113"></a>00113 real += a_[i] * std::cos( i * omegaT );
|
||||
<a name="l00114"></a>00114 imag -= a_[i] * std::sin( i * omegaT );
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 phase -= std::atan2( imag, real );
|
||||
<a name="l00118"></a>00118 phase = std::fmod( -phase, 2 * PI );
|
||||
<a name="l00119"></a>00119 <span class="keywordflow">return</span> phase / omegaT;
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a4ad986b7f644d3e22e75b0744b2f948a" 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#a4ad986b7f644d3e22e75b0744b2f948a" 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#a2a9db698672fcac97a77d95f3891b68f" 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#aa3f72042fb8b13e9dcc31acbff4e1672" 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#a5182288d564977bf172439f6ecaf2377">00055</a> StkFloat <a class="code" href="classstk_1_1Fir.html#a5182288d564977bf172439f6ecaf2377" 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#afc5fd95f6bf72edaf4ee3060ca947793" 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#afc5fd95f6bf72edaf4ee3060ca947793" 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#afc5fd95f6bf72edaf4ee3060ca947793" 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#afc5fd95f6bf72edaf4ee3060ca947793">00086</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" 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#a602e5ce0cd93f5103796ffd50ed8c988">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#afc5fd95f6bf72edaf4ee3060ca947793" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00104"></a>00104 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#a53bcdfc2e9ad757d2ec549529b7a9738">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#afc5fd95f6bf72edaf4ee3060ca947793" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00130"></a>00130 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
147
doc/html/Flute_8h_source.html
Normal file
147
doc/html/Flute_8h_source.html
Normal file
@@ -0,0 +1,147 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a9769eef3340651acc31b4997e9985e57" 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#a76120aedfc0bab94416917d173f8a74e" 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#a4554fc4feffd469b83d02dd4e5471ffa" 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#aea66780681552de9d12af6bb91f297da" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1Flute.html#a0732403c66b3667f5f6a8c80e90046e0">00058</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a0732403c66b3667f5f6a8c80e90046e0" title="Set the reflection coefficient for the jet delay (-1.0 - 1.0).">setJetReflection</a>( StkFloat coefficient ) { jetReflection_ = coefficient; };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a><a class="code" href="classstk_1_1Flute.html#a7c0ef95a3170dafde08b65ee47102969">00061</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a7c0ef95a3170dafde08b65ee47102969" title="Set the reflection coefficient for the air column delay (-1.0 - 1.0).">setEndReflection</a>( StkFloat coefficient ) { endReflection_ = coefficient; };
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#ad37a862df945987f91e3164813ce911b" 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#a33b58e80c6ebbd5bd45f90a7a1c6a025" 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#a65b8e74b1a99bc8bada4e80ebd512058" 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#af76a46645fd6ed5d3c15dc4bcde3d928" 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#ae371e0d2366ef9fae8d12898204e7b31" 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#a968b3799338e39df35dcf94fe7ee90a2" 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#ab8f307f9a26ef2756ec4c0ea05f3acbe" 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="l00085"></a>00085
|
||||
<a name="l00092"></a>00092 <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_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" 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="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <span class="keyword">protected</span>:
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> jetDelay_;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> boreDelay_;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 StkFloat lastFrequency_;
|
||||
<a name="l00106"></a>00106 StkFloat maxPressure_;
|
||||
<a name="l00107"></a>00107 StkFloat jetReflection_;
|
||||
<a name="l00108"></a>00108 StkFloat endReflection_;
|
||||
<a name="l00109"></a>00109 StkFloat noiseGain_;
|
||||
<a name="l00110"></a>00110 StkFloat vibratoGain_;
|
||||
<a name="l00111"></a>00111 StkFloat outputGain_;
|
||||
<a name="l00112"></a>00112 StkFloat jetRatio_;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 };
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a><a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe">00116</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">Flute :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00117"></a>00117 {
|
||||
<a name="l00118"></a>00118 StkFloat pressureDiff;
|
||||
<a name="l00119"></a>00119 StkFloat breathPressure;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00122"></a>00122 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00123"></a>00123 breathPressure += breathPressure * ( noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>() + vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 StkFloat temp = -filter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( boreDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00126"></a>00126 temp = dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( temp ); <span class="comment">// Block DC on reflection.</span>
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 pressureDiff = breathPressure - (jetReflection_ * temp);
|
||||
<a name="l00129"></a>00129 pressureDiff = jetDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00130"></a>00130 pressureDiff = jetTable_.<a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) + (endReflection_ * temp);
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = (StkFloat) 0.3 * boreDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a><a class="code" href="classstk_1_1Flute.html#a86640ddfacea6fd9385bc4e197fe1a28">00137</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_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">Flute :: 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="l00138"></a>00138 {
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00141"></a>00141 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00142"></a>00142 oStream_ << <span class="stringliteral">"Flute::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00143"></a>00143 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#endif</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span>
|
||||
<a name="l00147"></a>00147 StkFloat *samples = &frames[channel];
|
||||
<a name="l00148"></a>00148 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00150"></a>00150 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00151"></a>00151 *samples++ = <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153 <span class="keywordflow">else</span> {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00157"></a>00157 *samples++ = lastFrame_[j];
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">return</span> frames;
|
||||
<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>
|
||||
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/FormSwep_8h_source.html
Normal file
156
doc/html/FormSwep_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#aeb0093d5962acf4b5d582730e8c8bab9" 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#ac02cd2882f67e8ed9c315dfbf10b05a9" title="Class destructor.">~FormSwep</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FormSwep.html#a91096ebd684df25fc36a759f642b2200">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a91096ebd684df25fc36a759f642b2200" 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="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#aa6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a3aede7b088dbe2ca98b3398a5f953ae7" title="Set both the current and target resonance parameters.">setStates</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a2f00d2edf80fbf8f74a284c68caf07d6" title="Set target resonance parameters.">setTargets</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a27ba31acdbe8334da1830e14872fd226" title="Set the sweep rate (between 0.0 - 1.0).">setSweepRate</a>( StkFloat rate );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a242edcbe2a6f88393357b5a5ccec43e8" title="Set the sweep rate in terms of a time value in seconds.">setSweepTime</a>( StkFloat time );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1FormSwep.html#a3d8405c24e8539b389daf86fccfe5d70">00075</a> StkFloat <a class="code" href="classstk_1_1FormSwep.html#a3d8405c24e8539b389daf86fccfe5d70" 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="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 StkFloat <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<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_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" 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="l00090"></a>00090
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00100"></a>00100 <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#aba0d15e1d102cb0fee0806e1bb05c774" 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="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keyword">protected</span>:
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">bool</span> dirty_;
|
||||
<a name="l00107"></a>00107 StkFloat frequency_;
|
||||
<a name="l00108"></a>00108 StkFloat radius_;
|
||||
<a name="l00109"></a>00109 StkFloat startFrequency_;
|
||||
<a name="l00110"></a>00110 StkFloat startRadius_;
|
||||
<a name="l00111"></a>00111 StkFloat startGain_;
|
||||
<a name="l00112"></a>00112 StkFloat targetFrequency_;
|
||||
<a name="l00113"></a>00113 StkFloat targetRadius_;
|
||||
<a name="l00114"></a>00114 StkFloat targetGain_;
|
||||
<a name="l00115"></a>00115 StkFloat deltaFrequency_;
|
||||
<a name="l00116"></a>00116 StkFloat deltaRadius_;
|
||||
<a name="l00117"></a>00117 StkFloat deltaGain_;
|
||||
<a name="l00118"></a>00118 StkFloat sweepState_;
|
||||
<a name="l00119"></a>00119 StkFloat sweepRate_;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 };
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a><a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774">00123</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( StkFloat input )
|
||||
<a name="l00124"></a>00124 {
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( dirty_ ) {
|
||||
<a name="l00126"></a>00126 sweepState_ += sweepRate_;
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( sweepState_ >= 1.0 ) {
|
||||
<a name="l00128"></a>00128 sweepState_ = 1.0;
|
||||
<a name="l00129"></a>00129 dirty_ = <span class="keyword">false</span>;
|
||||
<a name="l00130"></a>00130 radius_ = targetRadius_;
|
||||
<a name="l00131"></a>00131 frequency_ = targetFrequency_;
|
||||
<a name="l00132"></a>00132 gain_ = targetGain_;
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">else</span> {
|
||||
<a name="l00135"></a>00135 radius_ = startRadius_ + (deltaRadius_ * sweepState_);
|
||||
<a name="l00136"></a>00136 frequency_ = startFrequency_ + (deltaFrequency_ * sweepState_);
|
||||
<a name="l00137"></a>00137 gain_ = startGain_ + (deltaGain_ * sweepState_);
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 this-><a class="code" href="classstk_1_1FormSwep.html#aa6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( frequency_, radius_ );
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 inputs_[0] = gain_ * input;
|
||||
<a name="l00143"></a>00143 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00144"></a>00144 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00145"></a>00145 inputs_[2] = inputs_[1];
|
||||
<a name="l00146"></a>00146 inputs_[1] = inputs_[0];
|
||||
<a name="l00147"></a>00147 outputs_[2] = outputs_[1];
|
||||
<a name="l00148"></a>00148 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a><a class="code" href="classstk_1_1FormSwep.html#a27f68dc2bb3fa41322ae49cf59cc9884">00153</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#aba0d15e1d102cb0fee0806e1bb05c774" 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="l00154"></a>00154 {
|
||||
<a name="l00155"></a>00155 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00156"></a>00156 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00157"></a>00157 oStream_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00158"></a>00158 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160 <span class="preprocessor">#endif</span>
|
||||
<a name="l00161"></a>00161 <span class="preprocessor"></span>
|
||||
<a name="l00162"></a>00162 StkFloat *samples = &frames[channel];
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00164"></a>00164 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00165"></a>00165 *samples = <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *samples );
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a>00167 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00168"></a>00168 }
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a><a class="code" href="classstk_1_1FormSwep.html#a8a16af2b4e169946cedb8fec2bb1417a">00170</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#aba0d15e1d102cb0fee0806e1bb05c774" 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="l00171"></a>00171 {
|
||||
<a name="l00172"></a>00172 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00173"></a>00173 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00174"></a>00174 oStream_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00175"></a>00175 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00176"></a>00176 }
|
||||
<a name="l00177"></a>00177 <span class="preprocessor">#endif</span>
|
||||
<a name="l00178"></a>00178 <span class="preprocessor"></span>
|
||||
<a name="l00179"></a>00179 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00180"></a>00180 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00181"></a>00181 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00182"></a>00182 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00183"></a>00183 *oSamples = <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *iSamples );
|
||||
<a name="l00184"></a>00184
|
||||
<a name="l00185"></a>00185 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00186"></a>00186 }
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00189"></a>00189
|
||||
<a name="l00190"></a>00190 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
212
doc/html/FreeVerb_8h_source.html
Normal file
212
doc/html/FreeVerb_8h_source.html
Normal file
@@ -0,0 +1,212 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FreeVerb.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FREEVERB_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FREEVERB_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 <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="l00024"></a>00024 <span class="comment">/***********************************************************************/</span>
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1FreeVerb.html">00026</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FreeVerb.html" title="Jezar at Dreampoint&#39;s FreeVerb, implemented in STK.">FreeVerb</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00027"></a>00027 {
|
||||
<a name="l00028"></a>00028 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1FreeVerb.html#aba12855fab8cddc4119cbd854e86214a" title="FreeVerb Constructor.">FreeVerb</a>();
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1FreeVerb.html#a203cd66e21f9ca127139b4948e26dfb9" title="Destructor.">~FreeVerb</a>();
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FreeVerb.html#af51f5592b04eba08092c2377debf16a8" title="Set the effect mix [0 = mostly dry, 1 = mostly wet].">setEffectMix</a>( StkFloat mix );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FreeVerb.html#a60133f8378e8a6f775a01d7d3ca44307" title="Set the room size (comb filter feedback gain) parameter [0,1].">setRoomSize</a>( StkFloat value );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 StkFloat <a class="code" href="classstk_1_1FreeVerb.html#af92c7e8a19aa0a265afc72cf45141d27" title="Get the room size (comb filter feedback gain) parameter.">getRoomSize</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_1FreeVerb.html#a8576f27cfb65f06c019e80772eaed0fb" title="Set the damping parameter [0=low damping, 1=higher damping].">setDamping</a>( StkFloat value );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 StkFloat <a class="code" href="classstk_1_1FreeVerb.html#a5dd46db58e656e5e9f1c1b1545a14036" title="Get the damping parameter.">getDamping</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FreeVerb.html#a6ebb13f2d7d2940a0f49a08a191185c5" title="Set the width (left-right mixing) parameter [0,1].">setWidth</a>( StkFloat value );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 StkFloat <a class="code" href="classstk_1_1FreeVerb.html#abb2e0328715a9446f0d5f625ffc88805" title="Get the width (left-right mixing) parameter.">getWidth</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_1FreeVerb.html#af1070d0612b81c22031907269cf60cfc" title="Set the mode [frozen = 1, unfrozen = 0].">setMode</a>( <span class="keywordtype">bool</span> isFrozen );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1FreeVerb.html#a6510448e8d12077bd475a714aace5177" title="Get the current freeze mode [frozen = 1, unfrozen = 0].">getMode</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FreeVerb.html#a3a6551cb5dcf80f27f683c81f47284f3" title="Clears delay lines, etc.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00080"></a>00080 StkFloat <a class="code" href="classstk_1_1FreeVerb.html#aab7afe56ff978369328cbf4dd4c4cfa3" 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="l00081"></a>00081
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1FreeVerb.html#a0cd5d18a9636029196415879e6a027ee" title="Input one or two samples to the effect and return the specified channel value of...">tick</a>( StkFloat inputL, StkFloat inputR = 0.0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00103"></a>00103 <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_1FreeVerb.html#a0cd5d18a9636029196415879e6a027ee" title="Input one or two samples to the effect and return the specified channel value of...">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="l00104"></a>00104
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00117"></a>00117 <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_1FreeVerb.html#a0cd5d18a9636029196415879e6a027ee" title="Input one or two samples to the effect and return the specified channel value of...">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="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="keyword">protected</span>:
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FreeVerb.html#a5be3a015730462494a5807a86cd693d1" title="Update interdependent parameters.">update</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="comment">// Clamp very small floats to zero, version from</span>
|
||||
<a name="l00124"></a>00124 <span class="comment">// http://music.columbia.edu/pipermail/linux-audio-user/2004-July/013489.html .</span>
|
||||
<a name="l00125"></a>00125 <span class="comment">// However, this is for 32-bit floats only.</span>
|
||||
<a name="l00126"></a>00126 <span class="comment">//static inline StkFloat undenormalize( volatile StkFloat s ) { </span>
|
||||
<a name="l00127"></a>00127 <span class="comment">// s += 9.8607615E-32f; </span>
|
||||
<a name="l00128"></a>00128 <span class="comment">// return s - 9.8607615E-32f; </span>
|
||||
<a name="l00129"></a>00129 <span class="comment">//}</span>
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> nCombs = 8;
|
||||
<a name="l00132"></a>00132 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> nAllpasses = 4;
|
||||
<a name="l00133"></a>00133 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> stereoSpread = 23;
|
||||
<a name="l00134"></a>00134 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat fixedGain;
|
||||
<a name="l00135"></a>00135 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat scaleWet;
|
||||
<a name="l00136"></a>00136 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat scaleDry;
|
||||
<a name="l00137"></a>00137 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat scaleDamp;
|
||||
<a name="l00138"></a>00138 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat scaleRoom;
|
||||
<a name="l00139"></a>00139 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat offsetRoom;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Delay line lengths for 44100Hz sampling rate.</span>
|
||||
<a name="l00142"></a>00142 <span class="keyword">static</span> <span class="keywordtype">int</span> cDelayLengths[nCombs];
|
||||
<a name="l00143"></a>00143 <span class="keyword">static</span> <span class="keywordtype">int</span> aDelayLengths[nAllpasses];
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 StkFloat g_; <span class="comment">// allpass coefficient</span>
|
||||
<a name="l00146"></a>00146 StkFloat gain_;
|
||||
<a name="l00147"></a>00147 StkFloat roomSizeMem_, roomSize_;
|
||||
<a name="l00148"></a>00148 StkFloat dampMem_, damp_;
|
||||
<a name="l00149"></a>00149 StkFloat wet1_, wet2_;
|
||||
<a name="l00150"></a>00150 StkFloat dry_;
|
||||
<a name="l00151"></a>00151 StkFloat width_;
|
||||
<a name="l00152"></a>00152 <span class="keywordtype">bool</span> frozenMode_;
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <span class="comment">// LBFC: Lowpass Feedback Comb Filters</span>
|
||||
<a name="l00155"></a>00155 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelayL_[nCombs];
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelayR_[nCombs];
|
||||
<a name="l00157"></a>00157 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> combLPL_[nCombs];
|
||||
<a name="l00158"></a>00158 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> combLPR_[nCombs];
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 <span class="comment">// AP: Allpass Filters</span>
|
||||
<a name="l00161"></a>00161 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allPassDelayL_[nAllpasses];
|
||||
<a name="l00162"></a>00162 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allPassDelayR_[nAllpasses];
|
||||
<a name="l00163"></a>00163 };
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a><a class="code" href="classstk_1_1FreeVerb.html#aab7afe56ff978369328cbf4dd4c4cfa3">00165</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FreeVerb.html#aab7afe56ff978369328cbf4dd4c4cfa3" title="Return the specified channel value of the last computed stereo frame.">FreeVerb :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00166"></a>00166 {
|
||||
<a name="l00167"></a>00167 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00168"></a>00168 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00169"></a>00169 oStream_ << <span class="stringliteral">"FreeVerb::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00170"></a>00170 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00171"></a>00171 }
|
||||
<a name="l00172"></a>00172 <span class="preprocessor">#endif</span>
|
||||
<a name="l00173"></a>00173 <span class="preprocessor"></span>
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00175"></a>00175 }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00177"></a><a class="code" href="classstk_1_1FreeVerb.html#a0cd5d18a9636029196415879e6a027ee">00177</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FreeVerb.html#a0cd5d18a9636029196415879e6a027ee" title="Input one or two samples to the effect and return the specified channel value of...">FreeVerb::tick</a>( StkFloat inputL, StkFloat inputR, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00178"></a>00178 {
|
||||
<a name="l00179"></a>00179 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00180"></a>00180 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00181"></a>00181 oStream_ << <span class="stringliteral">"FreeVerb::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00182"></a>00182 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>(StkError::FUNCTION_ARGUMENT);
|
||||
<a name="l00183"></a>00183 }
|
||||
<a name="l00184"></a>00184 <span class="preprocessor">#endif</span>
|
||||
<a name="l00185"></a>00185 <span class="preprocessor"></span>
|
||||
<a name="l00186"></a>00186 <span class="keywordflow">if</span> ( !inputR ) {
|
||||
<a name="l00187"></a>00187 inputR = inputL;
|
||||
<a name="l00188"></a>00188 }
|
||||
<a name="l00189"></a>00189
|
||||
<a name="l00190"></a>00190 StkFloat fInput = (inputL + inputR) * gain_;
|
||||
<a name="l00191"></a>00191 StkFloat outL = 0.0;
|
||||
<a name="l00192"></a>00192 StkFloat outR = 0.0;
|
||||
<a name="l00193"></a>00193
|
||||
<a name="l00194"></a>00194 <span class="comment">// Parallel LBCF filters</span>
|
||||
<a name="l00195"></a>00195 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < nCombs; i++ ) {
|
||||
<a name="l00196"></a>00196 <span class="comment">// Left channel</span>
|
||||
<a name="l00197"></a>00197 <span class="comment">//StkFloat yn = fInput + (roomSize_ * FreeVerb::undenormalize(combLPL_[i].tick(FreeVerb::undenormalize(combDelayL_[i].nextOut()))));</span>
|
||||
<a name="l00198"></a>00198 StkFloat yn = fInput + (roomSize_ * combLPL_[i].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combDelayL_[i].nextOut() ) );
|
||||
<a name="l00199"></a>00199 combDelayL_[i].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(yn);
|
||||
<a name="l00200"></a>00200 outL += yn;
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="comment">// Right channel</span>
|
||||
<a name="l00203"></a>00203 <span class="comment">//yn = fInput + (roomSize_ * FreeVerb::undenormalize(combLPR_[i].tick(FreeVerb::undenormalize(combDelayR_[i].nextOut()))));</span>
|
||||
<a name="l00204"></a>00204 yn = fInput + (roomSize_ * combLPR_[i].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combDelayR_[i].nextOut() ) );
|
||||
<a name="l00205"></a>00205 combDelayR_[i].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(yn);
|
||||
<a name="l00206"></a>00206 outR += yn;
|
||||
<a name="l00207"></a>00207 }
|
||||
<a name="l00208"></a>00208
|
||||
<a name="l00209"></a>00209 <span class="comment">// Series allpass filters</span>
|
||||
<a name="l00210"></a>00210 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < nAllpasses; i++ ) {
|
||||
<a name="l00211"></a>00211 <span class="comment">// Left channel</span>
|
||||
<a name="l00212"></a>00212 <span class="comment">//StkFloat vn_m = FreeVerb::undenormalize(allPassDelayL_[i].nextOut());</span>
|
||||
<a name="l00213"></a>00213 StkFloat vn_m = allPassDelayL_[i].<a class="code" href="classstk_1_1Delay.html#a2433e3246551f4fdf1366884cd2ae426" title="Return the value that will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00214"></a>00214 StkFloat vn = outL + (g_ * vn_m);
|
||||
<a name="l00215"></a>00215 allPassDelayL_[i].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(vn);
|
||||
<a name="l00216"></a>00216
|
||||
<a name="l00217"></a>00217 <span class="comment">// calculate output</span>
|
||||
<a name="l00218"></a>00218 outL = -vn + (1.0 + g_)*vn_m;
|
||||
<a name="l00219"></a>00219
|
||||
<a name="l00220"></a>00220 <span class="comment">// Right channel</span>
|
||||
<a name="l00221"></a>00221 <span class="comment">//vn_m = FreeVerb::undenormalize(allPassDelayR_[i].nextOut());</span>
|
||||
<a name="l00222"></a>00222 vn_m = allPassDelayR_[i].<a class="code" href="classstk_1_1Delay.html#a2433e3246551f4fdf1366884cd2ae426" title="Return the value that will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00223"></a>00223 vn = outR + (g_ * vn_m);
|
||||
<a name="l00224"></a>00224 allPassDelayR_[i].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(vn);
|
||||
<a name="l00225"></a>00225
|
||||
<a name="l00226"></a>00226 <span class="comment">// calculate output</span>
|
||||
<a name="l00227"></a>00227 outR = -vn + (1.0 + g_)*vn_m;
|
||||
<a name="l00228"></a>00228 }
|
||||
<a name="l00229"></a>00229
|
||||
<a name="l00230"></a>00230 <span class="comment">// Mix output</span>
|
||||
<a name="l00231"></a>00231 lastFrame_[0] = outL*wet1_ + outR*wet2_ + inputL*dry_;
|
||||
<a name="l00232"></a>00232 lastFrame_[1] = outR*wet1_ + outL*wet2_ + inputR*dry_;
|
||||
<a name="l00233"></a>00233
|
||||
<a name="l00234"></a>00234 <span class="comment">/*</span>
|
||||
<a name="l00235"></a>00235 <span class="comment"> // Hard limiter ... there's not much else we can do at this point</span>
|
||||
<a name="l00236"></a>00236 <span class="comment"> if ( lastFrame_[0] >= 1.0 ) {</span>
|
||||
<a name="l00237"></a>00237 <span class="comment"> lastFrame_[0] = 0.9999;</span>
|
||||
<a name="l00238"></a>00238 <span class="comment"> }</span>
|
||||
<a name="l00239"></a>00239 <span class="comment"> if ( lastFrame_[0] <= -1.0 ) {</span>
|
||||
<a name="l00240"></a>00240 <span class="comment"> lastFrame_[0] = -0.9999;</span>
|
||||
<a name="l00241"></a>00241 <span class="comment"> }</span>
|
||||
<a name="l00242"></a>00242 <span class="comment"> if ( lastFrame_[1] >= 1.0 ) {</span>
|
||||
<a name="l00243"></a>00243 <span class="comment"> lastFrame_[1] = 0.9999;</span>
|
||||
<a name="l00244"></a>00244 <span class="comment"> }</span>
|
||||
<a name="l00245"></a>00245 <span class="comment"> if ( lastFrame_[1] <= -1.0 ) {</span>
|
||||
<a name="l00246"></a>00246 <span class="comment"> lastFrame_[1] = -0.9999;</span>
|
||||
<a name="l00247"></a>00247 <span class="comment"> }</span>
|
||||
<a name="l00248"></a>00248 <span class="comment"> */</span>
|
||||
<a name="l00249"></a>00249
|
||||
<a name="l00250"></a>00250 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00251"></a>00251 }
|
||||
<a name="l00252"></a>00252
|
||||
<a name="l00253"></a>00253 }
|
||||
<a name="l00254"></a>00254
|
||||
<a name="l00255"></a>00255 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a21648ab236a66f3f0155bdb911f9f3c3">00024</a> <a class="code" href="classstk_1_1Function.html#a21648ab236a66f3f0155bdb911f9f3c3" title="Class constructor.">Function</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" 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#ae79bd6d0c9f53693b4ca28948d94fc25">00027</a> StkFloat <a class="code" href="classstk_1_1Function.html#ae79bd6d0c9f53693b4ca28948d94fc25" 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#a2545fede83a8afcbe11b3bcf3e4d9f42" 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-2012 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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#ac7f11d287fb903b04985c2f81dbf9a5d">00025</a> <a class="code" href="classstk_1_1Generator.html#ac7f11d287fb903b04985c2f81dbf9a5d" title="Class constructor.">Generator</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" 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#a9f9de4c495217ef8490a9d2d1fdabe11">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Generator.html#a9f9de4c495217ef8490a9d2d1fdabe11" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a499ad65aa6d939983863ffb922008654">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#a499ad65aa6d939983863ffb922008654" 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#a86bb0421223cf27e25704d5f27b97425" 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
158
doc/html/Granulate_8h_source.html
Normal file
158
doc/html/Granulate_8h_source.html
Normal file
@@ -0,0 +1,158 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a78af615a331de9b643dfabb8e106883f" 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#a78af615a331de9b643dfabb8e106883f" 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#a42eb1f39bd88eb8d4ca55972e7711313" 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#a6227f127a77b4fc581028033cd7658d8" 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#a9b7b17ae856f3a9ece6ec462285f456c" 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#a735f3ebe8fa2cacfba2c4722a56fd417" 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#aabd711f2b71bbcd28412d5cb73c085d6" 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#a9b7c15080256f920646d36bfa0ed3734" 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#a02b7b85f21999d4b350beff6a925bd25" 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#a60db060a365fc32fe789cb9bcd042dd3" 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#a0f8b162c9c309b3cbec3802138a53c24" 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#a0f8b162c9c309b3cbec3802138a53c24" 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="comment">//unsigned long pointer;</span>
|
||||
<a name="l00143"></a>00143 StkFloat pointer;
|
||||
<a name="l00144"></a>00144 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startPointer;
|
||||
<a name="l00145"></a>00145 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> repeats;
|
||||
<a name="l00146"></a>00146 GrainState state;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00149"></a>00149 Grain()
|
||||
<a name="l00150"></a>00150 :eScaler(0.0), eRate(0.0), attackCount(0), sustainCount(0), decayCount(0),
|
||||
<a name="l00151"></a>00151 delayCount(0), counter(0), pointer(0), startPointer(0), repeats(0), state(GRAIN_STOPPED) {}
|
||||
<a name="l00152"></a>00152 };
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">void</span> calculateGrain( Granulate::Grain& grain );
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data_;
|
||||
<a name="l00157"></a>00157 std::vector<Grain> grains_;
|
||||
<a name="l00158"></a>00158 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise;
|
||||
<a name="l00159"></a>00159 <span class="comment">//long gPointer_;</span>
|
||||
<a name="l00160"></a>00160 StkFloat gPointer_;
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="comment">// Global grain parameters.</span>
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDuration_;
|
||||
<a name="l00164"></a>00164 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gRampPercent_;
|
||||
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDelay_;
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gStretch_;
|
||||
<a name="l00167"></a>00167 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchCounter_;
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">int</span> gOffset_;
|
||||
<a name="l00169"></a>00169 StkFloat gRandomFactor_;
|
||||
<a name="l00170"></a>00170 StkFloat gain_;
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a>00172 };
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a><a class="code" href="classstk_1_1Granulate.html#a60db060a365fc32fe789cb9bcd042dd3">00174</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Granulate.html#a60db060a365fc32fe789cb9bcd042dd3" 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="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> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00178"></a>00178 oStream_ << <span class="stringliteral">"Granulate::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00179"></a>00179 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a><a class="code" href="classstk_1_1Granulate.html#aa9cc119b1515c5596a95d72f4b65b0c0">00186</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#a0f8b162c9c309b3cbec3802138a53c24" 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="l00187"></a>00187 {
|
||||
<a name="l00188"></a>00188 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00189"></a>00189 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00190"></a>00190 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00191"></a>00191 oStream_ << <span class="stringliteral">"Granulate::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00192"></a>00192 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00193"></a>00193 }
|
||||
<a name="l00194"></a>00194 <span class="preprocessor">#endif</span>
|
||||
<a name="l00195"></a>00195 <span class="preprocessor"></span>
|
||||
<a name="l00196"></a>00196 StkFloat *samples = &frames[channel];
|
||||
<a name="l00197"></a>00197 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00198"></a>00198 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00199"></a>00199 *samples++ = <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00200"></a>00200 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00201"></a>00201 *samples++ = lastFrame_[j];
|
||||
<a name="l00202"></a>00202 }
|
||||
<a name="l00203"></a>00203
|
||||
<a name="l00204"></a>00204 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00205"></a>00205 }
|
||||
<a name="l00206"></a>00206
|
||||
<a name="l00207"></a>00207 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00208"></a>00208
|
||||
<a name="l00209"></a>00209 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
153
doc/html/Guitar_8h_source.html
Normal file
153
doc/html/Guitar_8h_source.html
Normal file
@@ -0,0 +1,153 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Guitar.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GUITAR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GUITAR_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 "Twang.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.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="l00039"></a>00039 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1Guitar.html">00041</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Guitar.html" title="STK guitar model class.">Guitar</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00042"></a>00042 {
|
||||
<a name="l00043"></a>00043 <span class="keyword">public</span>:
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Guitar.html#a7eac8ce2d2d6db176770639fe547bcb2" title="Class constructor, specifying an arbitrary number of strings (default = 6).">Guitar</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nStrings = 6, std::string bodyfile = <span class="stringliteral">""</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Guitar.html#adb7355a9bcf6e94d9db4809175cbae1b" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Guitar.html#a95c212c2d6a72ee93c2000f0308df9cc" title="Set the string excitation, using either a soundfile or computed noise.">setBodyFile</a>( std::string bodyfile = <span class="stringliteral">""</span> );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Guitar.html#a4a2098002e20c5aac3927e2c080c64ca" title="Set the pluck position for one or all strings.">setPluckPosition</a>( StkFloat position, <span class="keywordtype">int</span> <span class="keywordtype">string</span> = -1 );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Guitar.html#adc1d5eadc46cbcdb8ddcf8b0e4aae9db" title="Set the loop gain for one or all strings.">setLoopGain</a>( StkFloat gain, <span class="keywordtype">int</span> <span class="keywordtype">string</span> = -1 );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Guitar.html#a8812168a7ffc5318d42a25b1cfda7bff" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <span class="keywordtype">string</span> = 0 );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Guitar.html#a9dec744a074dba5c869b2aec1198ada7" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <span class="keywordtype">string</span> = 0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Guitar.html#accf5a4b16602560591ed010245a297d4" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <span class="keywordtype">string</span> = 0 );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Guitar.html#ae9900d35d4f5ae7a67dfcc62a1175aba" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value, <span class="keywordtype">int</span> <span class="keywordtype">string</span> = -1 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a><a class="code" href="classstk_1_1Guitar.html#aee53aa17d760670cc875c06f1de6af91">00093</a> StkFloat <a class="code" href="classstk_1_1Guitar.html#aee53aa17d760670cc875c06f1de6af91" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00096"></a>00096 StkFloat <a class="code" href="classstk_1_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8" title="Take an optional input sample and compute one output sample.">tick</a>( StkFloat input = 0.0 );
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00107"></a>00107 <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_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8" title="Take an optional input sample and compute 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="l00108"></a>00108
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00118"></a>00118 <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_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8" title="Take an optional input sample and compute one output sample.">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="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="keyword">protected</span>:
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 std::vector< stk::Twang > strings_;
|
||||
<a name="l00123"></a>00123 std::vector< int > stringState_; <span class="comment">// 0 = off, 1 = decaying, 2 = on</span>
|
||||
<a name="l00124"></a>00124 std::vector< unsigned int > decayCounter_;
|
||||
<a name="l00125"></a>00125 std::vector< unsigned int > filePointer_;
|
||||
<a name="l00126"></a>00126 std::vector< StkFloat > pluckGains_;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> pickFilter_;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> couplingFilter_;
|
||||
<a name="l00130"></a>00130 StkFloat couplingGain_;
|
||||
<a name="l00131"></a>00131 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> excitation_;
|
||||
<a name="l00132"></a>00132 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00133"></a>00133 };
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a><a class="code" href="classstk_1_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8">00135</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8" title="Take an optional input sample and compute one output sample.">Guitar :: tick</a>( StkFloat input )
|
||||
<a name="l00136"></a>00136 {
|
||||
<a name="l00137"></a>00137 StkFloat temp, output = 0.0;
|
||||
<a name="l00138"></a>00138 lastFrame_[0] /= strings_.size(); <span class="comment">// evenly spread coupling across strings</span>
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<strings_.size(); i++ ) {
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">if</span> ( stringState_[i] ) {
|
||||
<a name="l00141"></a>00141 temp = input;
|
||||
<a name="l00142"></a>00142 <span class="comment">// If pluckGain < 0.2, let string ring but don't pluck it.</span>
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">if</span> ( filePointer_[i] < excitation_.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>() && pluckGains_[i] > 0.2 )
|
||||
<a name="l00144"></a>00144 temp += pluckGains_[i] * excitation_[filePointer_[i]++];
|
||||
<a name="l00145"></a>00145 temp += couplingGain_ * couplingFilter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] ); <span class="comment">// bridge coupling</span>
|
||||
<a name="l00146"></a>00146 output += strings_[i].tick( temp );
|
||||
<a name="l00147"></a>00147 <span class="comment">// Check if string energy has decayed sufficiently to turn it off.</span>
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">if</span> ( stringState_[i] == 1 ) {
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">if</span> ( fabs( strings_[i].<a class="code" href="classstk_1_1Guitar.html#aee53aa17d760670cc875c06f1de6af91" title="Return the last computed output value.">lastOut</a>() ) < 0.001 ) decayCounter_[i]++;
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">else</span> decayCounter_[i] = 0;
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">if</span> ( decayCounter_[i] > (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>) floor( 0.1 * <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ) ) {
|
||||
<a name="l00152"></a>00152 stringState_[i] = 0;
|
||||
<a name="l00153"></a>00153 decayCounter_[i] = 0;
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156 }
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 <span class="keywordflow">return</span> lastFrame_[0] = output;
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a><a class="code" href="classstk_1_1Guitar.html#aa8a2447a813f400c92ab2333c2d8a125">00162</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_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8" title="Take an optional input sample and compute one output sample.">Guitar :: 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="l00163"></a>00163 {
|
||||
<a name="l00164"></a>00164 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00165"></a>00165 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00166"></a>00166 oStream_ << <span class="stringliteral">"Guitar::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00167"></a>00167 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00168"></a>00168 }
|
||||
<a name="l00169"></a>00169 <span class="preprocessor">#endif</span>
|
||||
<a name="l00170"></a>00170 <span class="preprocessor"></span>
|
||||
<a name="l00171"></a>00171 StkFloat *samples = &frames[channel];
|
||||
<a name="l00172"></a>00172 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00173"></a>00173 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00174"></a>00174 *samples = <a class="code" href="classstk_1_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8" title="Take an optional input sample and compute one output sample.">tick</a>( *samples );
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178
|
||||
<a name="l00179"></a><a class="code" href="classstk_1_1Guitar.html#a8ed813db2c23a9893e7d329528d659e8">00179</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_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8" title="Take an optional input sample and compute one output sample.">Guitar :: 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="l00180"></a>00180 {
|
||||
<a name="l00181"></a>00181 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00182"></a>00182 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00183"></a>00183 oStream_ << <span class="stringliteral">"Guitar::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00184"></a>00184 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00185"></a>00185 }
|
||||
<a name="l00186"></a>00186 <span class="preprocessor">#endif</span>
|
||||
<a name="l00187"></a>00187 <span class="preprocessor"></span>
|
||||
<a name="l00188"></a>00188 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00189"></a>00189 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00190"></a>00190 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00191"></a>00191 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00192"></a>00192 *oSamples = <a class="code" href="classstk_1_1Guitar.html#a47223c1ef411141ae04b0971497b5fb8" title="Take an optional input sample and compute one output sample.">tick</a>( *iSamples );
|
||||
<a name="l00193"></a>00193
|
||||
<a name="l00194"></a>00194 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00195"></a>00195 }
|
||||
<a name="l00196"></a>00196
|
||||
<a name="l00197"></a>00197 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00198"></a>00198
|
||||
<a name="l00199"></a>00199 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
110
doc/html/HevyMetl_8h_source.html
Normal file
110
doc/html/HevyMetl_8h_source.html
Normal file
@@ -0,0 +1,110 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a61e000b4c2a8ba021e43e8074be44390" 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#a03b76a27541928bf9e7d156f9709a8f0" 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#aa7401a5cb44a69edaad304aac41b6eda" 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#a0261504b82845034be67ac573d564ff7" 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="l00057"></a>00057
|
||||
<a name="l00064"></a>00064 <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_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" 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="l00065"></a>00065
|
||||
<a name="l00066"></a>00066 <span class="keyword">protected</span>:
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 };
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7">00070</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">HevyMetl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00071"></a>00071 {
|
||||
<a name="l00072"></a>00072 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 temp = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.2;
|
||||
<a name="l00075"></a>00075 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
||||
<a name="l00076"></a>00076 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
||||
<a name="l00077"></a>00077 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
||||
<a name="l00078"></a>00078 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 temp = gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00081"></a>00081 waves_[1]->addPhaseOffset( temp );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00084"></a>00084 temp = (1.0 - (control2_ * 0.5)) * gains_[3] * adsr_[3]-><a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>() * waves_[3]->tick();
|
||||
<a name="l00085"></a>00085 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00088"></a>00088 temp = temp * control1_;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 waves_[0]->addPhaseOffset( temp );
|
||||
<a name="l00091"></a>00091 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00094"></a>00094 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a><a class="code" href="classstk_1_1HevyMetl.html#a555f3bf9322fd11150b00bb99476769a">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_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">HevyMetl :: 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="l00098"></a>00098 {
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00101"></a>00101 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00102"></a>00102 oStream_ << <span class="stringliteral">"HevyMetl::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105 <span class="preprocessor">#endif</span>
|
||||
<a name="l00106"></a>00106 <span class="preprocessor"></span>
|
||||
<a name="l00107"></a>00107 StkFloat *samples = &frames[channel];
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00110"></a>00110 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00111"></a>00111 *samples++ = <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">else</span> {
|
||||
<a name="l00114"></a>00114 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00115"></a>00115 *samples++ = <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00117"></a>00117 *samples++ = lastFrame_[j];
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a1d63797b4caf775de8d351ec0c15a4c0" 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#a1d63797b4caf775de8d351ec0c15a4c0" 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#ac15361cbfa19e6e4f73a155abc1459a8" 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#aa0249b92dcec86ae83688debedb8d95b" 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#a7a1473446857a14cdbb33cb5afde076c" 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#ae67cc04a452edfbd80f1a27097ea0187" 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#a5dcae9330f2c52d2bfa1647e6b250a14">00083</a> StkFloat <a class="code" href="classstk_1_1Iir.html#a5dcae9330f2c52d2bfa1647e6b250a14" 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#a9b79bb8ba512052a4b90444c9d2d0d84" 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#a9b79bb8ba512052a4b90444c9d2d0d84" 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#a9b79bb8ba512052a4b90444c9d2d0d84" 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#a9b79bb8ba512052a4b90444c9d2d0d84">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" 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#ad03f40e022b2adfe942d30908ec34793">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#a9b79bb8ba512052a4b90444c9d2d0d84" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00139"></a>00139 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#a60919d8e000bf83613bdd5e002d750f1">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#a9b79bb8ba512052a4b90444c9d2d0d84" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00171"></a>00171 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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-2012 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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#ad97edafdfb9db2aee77b11d3086113a4" 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#a760628dfbbca0a11142d28ff5cabd8b5" 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#af36ff382737f0fb84bc38046c01b4ce8" 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#a5a807971b7fc3c8985d97823be079a7b">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#a8b54226eabcd0c58d93fcc0792fa7e02" 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#acfd578027b2bbcbe4ceefa11e49e8cd2" 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#a2109090620c80013ef3ae68cb975fb17" 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#a2109090620c80013ef3ae68cb975fb17" 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#acfd578027b2bbcbe4ceefa11e49e8cd2">00140</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1InetWvIn.html#acfd578027b2bbcbe4ceefa11e49e8cd2" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00144"></a>00144 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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-2012 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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#acc7c0b00c68cb76d1b15e7187d67a966" 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#acc7c0b00c68cb76d1b15e7187d67a966" 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#a5a807971b7fc3c8985d97823be079a7b">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#ae58f286de491788df700479f88b3c625" 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#a4c8b6fb25c6d751b7929bec9a2d04a53" 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#a5a807971b7fc3c8985d97823be079a7b">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#a2314d2e2d005c5b08aa24d21075af638" 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#a800f77228d851a2d276fae6a24bcdc9a" 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#a800f77228d851a2d276fae6a24bcdc9a" 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
93
doc/html/Instrmnt_8h_source.html
Normal file
93
doc/html/Instrmnt_8h_source.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a6f3c4dc01e0484f0ca4a3b14f1b7caf0">00023</a> <a class="code" href="classstk_1_1Instrmnt.html#a6f3c4dc01e0484f0ca4a3b14f1b7caf0" title="Class constructor.">Instrmnt</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" 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#a0736ccd253b446660938d51909a32f44" 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#a582c77e71cd2c5cb46ba6f78fa0ac6a2" 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#a597efc508ad367a308fa11b8cbdc96a7" 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#a5aecf9f4d4dcecdbef8271c7fe62b2cf" 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#a32564b611598653fce5e708821b3fcb4">00038</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Instrmnt.html#a32564b611598653fce5e708821b3fcb4" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a277ac5149ec22c33d794dfd462a82d2b">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#a277ac5149ec22c33d794dfd462a82d2b" 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#aaa6bd5e4a5be7f9b0be967daf012872e" 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#ad5d070c1fc6f93124dfed2a27b8e3cf1" 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 <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_1Instrmnt.html#ad5d070c1fc6f93124dfed2a27b8e3cf1" 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 ) = 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#a597efc508ad367a308fa11b8cbdc96a7">00076</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">Instrmnt :: setFrequency</a>( StkFloat frequency )
|
||||
<a name="l00077"></a>00077 {
|
||||
<a name="l00078"></a>00078 oStream_ << <span class="stringliteral">"Instrmnt::setFrequency: virtual setFrequency function call!"</span>;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aaa6bd5e4a5be7f9b0be967daf012872e">00082</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aaa6bd5e4a5be7f9b0be967daf012872e" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00086"></a>00086 oStream_ << <span class="stringliteral">"Instrmnt::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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#a5aecf9f4d4dcecdbef8271c7fe62b2cf">00094</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a5aecf9f4d4dcecdbef8271c7fe62b2cf" 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="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 oStream_ << <span class="stringliteral">"Instrmnt::controlChange: virtual function call!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
136
doc/html/JCRev_8h_source.html
Normal file
136
doc/html/JCRev_8h_source.html
Normal file
@@ -0,0 +1,136 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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 <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="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1JCRev.html">00031</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="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1JCRev.html#a5b9f0e2b7acc1fcb94a663353f1253dd" title="Class constructor taking a T60 decay time argument (one second default value).">JCRev</a>( StkFloat T60 = 1.0 );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#abf92e9783e4a738b6d3a3350bfae986e" title="Reset and clear all internal state.">clear</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_1JCRev.html#a8f4caa6de1e662c76b853ebab814a2eb" title="Set the reverberation T60 decay time.">setT60</a>( StkFloat T60 );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 StkFloat <a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" 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="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00062"></a>00062 StkFloat <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" 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="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00074"></a>00074 <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#ad667b48a6dbd663f2d7c49e201325f00" 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="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<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_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" 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="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keyword">protected</span>:
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allpassDelays_[3];
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[4];
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> combFilters_[4];
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outLeftDelay_;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outRightDelay_;
|
||||
<a name="l00095"></a>00095 StkFloat allpassCoefficient_;
|
||||
<a name="l00096"></a>00096 StkFloat combCoefficient_[4];
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b">00100</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" 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="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 > 1 ) {
|
||||
<a name="l00104"></a>00104 oStream_ << <span class="stringliteral">"JCRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a><a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00">00112</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" 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="l00113"></a>00113 {
|
||||
<a name="l00114"></a>00114 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00115"></a>00115 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00116"></a>00116 oStream_ << <span class="stringliteral">"JCRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00117"></a>00117 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#endif</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span>
|
||||
<a name="l00121"></a>00121 StkFloat temp, temp0, temp1, temp2, temp3, temp4, temp5, temp6;
|
||||
<a name="l00122"></a>00122 StkFloat filtout;
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 temp = allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00125"></a>00125 temp0 = allpassCoefficient_ * temp;
|
||||
<a name="l00126"></a>00126 temp0 += input;
|
||||
<a name="l00127"></a>00127 allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp0);
|
||||
<a name="l00128"></a>00128 temp0 = -(allpassCoefficient_ * temp0) + temp;
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 temp = allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00131"></a>00131 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00132"></a>00132 temp1 += temp0;
|
||||
<a name="l00133"></a>00133 allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00134"></a>00134 temp1 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00136"></a>00136 temp = allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00137"></a>00137 temp2 = allpassCoefficient_ * temp;
|
||||
<a name="l00138"></a>00138 temp2 += temp1;
|
||||
<a name="l00139"></a>00139 allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp2);
|
||||
<a name="l00140"></a>00140 temp2 = -(allpassCoefficient_ * temp2) + temp;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 temp3 = temp2 + ( combFilters_[0].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combCoefficient_[0] * combDelays_[0].<a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>() ) );
|
||||
<a name="l00143"></a>00143 temp4 = temp2 + ( combFilters_[1].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combCoefficient_[1] * combDelays_[1].<a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>() ) );
|
||||
<a name="l00144"></a>00144 temp5 = temp2 + ( combFilters_[2].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combCoefficient_[2] * combDelays_[2].<a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>() ) );
|
||||
<a name="l00145"></a>00145 temp6 = temp2 + ( combFilters_[3].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combCoefficient_[3] * combDelays_[3].<a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>() ) );
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 combDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp3);
|
||||
<a name="l00148"></a>00148 combDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp4);
|
||||
<a name="l00149"></a>00149 combDelays_[2].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp5);
|
||||
<a name="l00150"></a>00150 combDelays_[3].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp6);
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 filtout = temp3 + temp4 + temp5 + temp6;
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 lastFrame_[0] = effectMix_ * (outLeftDelay_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00155"></a>00155 lastFrame_[1] = effectMix_ * (outRightDelay_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00156"></a>00156 temp = (1.0 - effectMix_) * input;
|
||||
<a name="l00157"></a>00157 lastFrame_[0] += temp;
|
||||
<a name="l00158"></a>00158 lastFrame_[1] += temp;
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 <span class="keywordflow">return</span> 0.7 * lastFrame_[channel];
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="preprocessor">#endif</span>
|
||||
<a name="l00166"></a>00166 <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-2012 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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a3fb5333e6305abdeee7cd83a10ef76b6" 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#a3fb5333e6305abdeee7cd83a10ef76b6" 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#a3fb5333e6305abdeee7cd83a10ef76b6" 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#a3fb5333e6305abdeee7cd83a10ef76b6">00054</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" 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#ae17ee82b1ed7b185713b4ae0b7c2b0cd">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#a3fb5333e6305abdeee7cd83a10ef76b6" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00071"></a>00071 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#a7b261fd07b2325348ef14e3f0ebf8429">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#a3fb5333e6305abdeee7cd83a10ef76b6" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00092"></a>00092 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
255
doc/html/LentPitShift_8h_source.html
Normal file
255
doc/html/LentPitShift_8h_source.html
Normal file
@@ -0,0 +1,255 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>LentPitShift.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_LENTPITSHIFT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_LENTPITSHIFT_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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1LentPitShift.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1LentPitShift.html" title="Pitch shifter effect class based on the Lent algorithm.">LentPitShift</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024 <a class="code" href="classstk_1_1LentPitShift.html#a0eb0c1ba3d8fdb6eaabb1c96c58ed536" title="Class constructor.">LentPitShift</a>( StkFloat periodRatio = 1.0, <span class="keywordtype">int</span> tMax = RT_BUFFER_SIZE );
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a>00026 ~<a class="code" href="classstk_1_1LentPitShift.html" title="Pitch shifter effect class based on the Lent algorithm.">LentPitShift</a>( <span class="keywordtype">void</span> ) {
|
||||
<a name="l00027"></a>00027 <span class="keyword">delete</span> window;
|
||||
<a name="l00028"></a>00028 <span class="keyword">delete</span> dt;
|
||||
<a name="l00029"></a>00029 <span class="keyword">delete</span> dpt;
|
||||
<a name="l00030"></a>00030 <span class="keyword">delete</span> cumDt;
|
||||
<a name="l00031"></a>00031 }
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5661bf4cd0a4b5b2bf9e4e81603c74be" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5dfe0a19b2ac3db599c808f4d676c076" title="Set the pitch shift factor (1.0 produces no shift).">setShift</a>( StkFloat shift );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 StkFloat <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00051"></a>00051 <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_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" 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="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00062"></a>00062 <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_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" 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="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 <span class="keyword">protected</span>:
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">process</a>( );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <span class="comment">// Frame storage vectors for process function</span>
|
||||
<a name="l00074"></a>00074 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> inputFrames;
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> outputFrames;
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">int</span> ptrFrames; <span class="comment">// writing pointer</span>
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="comment">// Input delay line</span>
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> inputLine_;
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">int</span> inputPtr;
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="comment">// Output delay line</span>
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outputLine_;
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">double</span> outputPtr;
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="comment">// Pitch tracker variables</span>
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tMax_; <span class="comment">// Maximal period measurable by the pitch tracker.</span>
|
||||
<a name="l00088"></a>00088 <span class="comment">// It is also the size of the window used by the pitch tracker and</span>
|
||||
<a name="l00089"></a>00089 <span class="comment">// the size of the frames that can be computed by the tick function</span>
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 StkFloat threshold_; <span class="comment">// Threshold of detection for the pitch tracker</span>
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> lastPeriod_; <span class="comment">// Result of the last pitch tracking loop</span>
|
||||
<a name="l00093"></a>00093 StkFloat* dt; <span class="comment">// Array containing the euclidian distance coefficients</span>
|
||||
<a name="l00094"></a>00094 StkFloat* cumDt; <span class="comment">// Array containing the cumulative sum of the coefficients in dt</span>
|
||||
<a name="l00095"></a>00095 StkFloat* dpt; <span class="comment">// Array containing the pitch tracking function coefficients</span>
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="comment">// Pitch shifter variables</span>
|
||||
<a name="l00098"></a>00098 StkFloat env[2]; <span class="comment">// Coefficients for the linear interpolation when modifying the output samples</span>
|
||||
<a name="l00099"></a>00099 StkFloat* window; <span class="comment">// Hamming window used for the input portion extraction</span>
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">double</span> periodRatio_; <span class="comment">// Ratio of modification of the signal period</span>
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> zeroFrame; <span class="comment">// Frame of tMax_ zero samples</span>
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="comment">// Coefficient delay line that could be used for a dynamic calculation of the pitch</span>
|
||||
<a name="l00105"></a>00105 <span class="comment">//Delay* coeffLine_;</span>
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 };
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a><a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445">00109</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">LentPitShift::process</a>()
|
||||
<a name="l00110"></a>00110 {
|
||||
<a name="l00111"></a>00111 StkFloat x_t; <span class="comment">// input coefficient</span>
|
||||
<a name="l00112"></a>00112 StkFloat x_t_T; <span class="comment">// previous input coefficient at T samples</span>
|
||||
<a name="l00113"></a>00113 StkFloat coeff; <span class="comment">// new coefficient for the difference function</span>
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordtype">int</span> alternativePitch = tMax_; <span class="comment">// Global minimum storage</span>
|
||||
<a name="l00116"></a>00116 lastPeriod_ = tMax_+1; <span class="comment">// Storage of the lowest local minimum under the threshold</span>
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Loop variables</span>
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay_;
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="comment">// Initialization of the dt coefficients. Since the</span>
|
||||
<a name="l00123"></a>00123 <span class="comment">// frames are of tMax_ length, there is no overlapping</span>
|
||||
<a name="l00124"></a>00124 <span class="comment">// between the successive windows where pitch tracking</span>
|
||||
<a name="l00125"></a>00125 <span class="comment">// is performed.</span>
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">for</span> ( delay_=1; delay_<=tMax_; delay_++ )
|
||||
<a name="l00127"></a>00127 dt[delay_] = 0.;
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="comment">// Calculation of the dt coefficients and update of the input delay line.</span>
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">for</span> ( n=0; n<inputFrames.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); n++ ) {
|
||||
<a name="l00131"></a>00131 x_t = inputLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( inputFrames[ n ] );
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">for</span> ( delay_=1; delay_<= tMax_; delay_++ ) {
|
||||
<a name="l00133"></a>00133 x_t_T = inputLine_.<a class="code" href="classstk_1_1Delay.html#a4d5e5bab50e4fa062bd3f0e9e2fd19db" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>( delay_ );
|
||||
<a name="l00134"></a>00134 coeff = x_t - x_t_T;
|
||||
<a name="l00135"></a>00135 dt[delay_] += coeff * coeff;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 <span class="comment">// Calculation of the pitch tracking function and test for the minima.</span>
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( delay_=1; delay_<=tMax_; delay_++ ) {
|
||||
<a name="l00141"></a>00141 cumDt[delay_] = dt[delay_] + cumDt[delay_-1];
|
||||
<a name="l00142"></a>00142 dpt[delay_] = dt[delay_] * delay_ / cumDt[delay_];
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <span class="comment">// Look for a minimum</span>
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">if</span> ( dpt[delay_-1]-dpt[delay_-2] < 0 && dpt[delay_]-dpt[delay_-1] > 0 ) {
|
||||
<a name="l00146"></a>00146 <span class="comment">// Check if the minimum is under the threshold</span>
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">if</span> ( dpt[delay_-1] < threshold_ ){
|
||||
<a name="l00148"></a>00148 lastPeriod_ = delay_-1;
|
||||
<a name="l00149"></a>00149 <span class="comment">// If a minimum is found, we can stop the loop</span>
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">break</span>;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( dpt[alternativePitch] > dpt[delay_-1] )
|
||||
<a name="l00153"></a>00153 <span class="comment">// Otherwise we store it if it is the current global minimum</span>
|
||||
<a name="l00154"></a>00154 alternativePitch = delay_-1;
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156 }
|
||||
<a name="l00157"></a>00157
|
||||
<a name="l00158"></a>00158 <span class="comment">// Test for the last period length.</span>
|
||||
<a name="l00159"></a>00159 <span class="keywordflow">if</span> ( dpt[delay_]-dpt[delay_-1] < 0 ) {
|
||||
<a name="l00160"></a>00160 <span class="keywordflow">if</span> ( dpt[delay_] < threshold_ )
|
||||
<a name="l00161"></a>00161 lastPeriod_ = delay_;
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( dpt[alternativePitch] > dpt[delay_] )
|
||||
<a name="l00163"></a>00163 alternativePitch = delay_;
|
||||
<a name="l00164"></a>00164 }
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 <span class="keywordflow">if</span> ( lastPeriod_ == tMax_+1 )
|
||||
<a name="l00167"></a>00167 <span class="comment">// No period has been under the threshold so we used the global minimum</span>
|
||||
<a name="l00168"></a>00168 lastPeriod_ = alternativePitch;
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 <span class="comment">// We put the new zero output coefficients in the output delay line and </span>
|
||||
<a name="l00171"></a>00171 <span class="comment">// we get the previous calculated coefficients</span>
|
||||
<a name="l00172"></a>00172 outputLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( zeroFrame, outputFrames );
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a>00174 <span class="comment">// Initialization of the Hamming window used in the algorithm</span>
|
||||
<a name="l00175"></a>00175 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> n=-(<span class="keywordtype">int</span>)lastPeriod_; n<(int)lastPeriod_; n++ )
|
||||
<a name="l00176"></a>00176 window[n+lastPeriod_] = (1 + cos(PI*n/lastPeriod_)) / 2 ;
|
||||
<a name="l00177"></a>00177
|
||||
<a name="l00178"></a>00178 <span class="keywordtype">int</span> M; <span class="comment">// Index of reading in the input delay line</span>
|
||||
<a name="l00179"></a>00179 <span class="keywordtype">int</span> N; <span class="comment">// Index of writing in the output delay line</span>
|
||||
<a name="l00180"></a>00180 <span class="keywordtype">double</span> sample; <span class="comment">// Temporary storage for the new coefficient</span>
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 <span class="comment">// We loop for all the frames of length lastPeriod_ presents between inputPtr and tMax_</span>
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">for</span> ( ; inputPtr<(int)(tMax_-lastPeriod_); inputPtr+=lastPeriod_ ) {
|
||||
<a name="l00184"></a>00184 <span class="comment">// Test for the decision of compression/expansion</span>
|
||||
<a name="l00185"></a>00185 <span class="keywordflow">while</span> ( outputPtr < inputPtr ) {
|
||||
<a name="l00186"></a>00186 <span class="comment">// Coefficients for the linear interpolation</span>
|
||||
<a name="l00187"></a>00187 env[1] = fmod( outputPtr + tMax_, 1.0 );
|
||||
<a name="l00188"></a>00188 env[0] = 1.0 - env[1];
|
||||
<a name="l00189"></a>00189 M = tMax_ - inputPtr + lastPeriod_ - 1; <span class="comment">// New reading pointer</span>
|
||||
<a name="l00190"></a>00190 N = 2*tMax_ - (<span class="keywordtype">unsigned</span> long)floor(outputPtr + tMax_) + lastPeriod_ - 1; <span class="comment">// New writing pointer</span>
|
||||
<a name="l00191"></a>00191 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<2*lastPeriod_; j++,M--,N-- ) {
|
||||
<a name="l00192"></a>00192 sample = inputLine_.<a class="code" href="classstk_1_1Delay.html#a4d5e5bab50e4fa062bd3f0e9e2fd19db" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>(M) * window[j] / 2.;
|
||||
<a name="l00193"></a>00193 <span class="comment">// Linear interpolation</span>
|
||||
<a name="l00194"></a>00194 outputLine_.<a class="code" href="classstk_1_1Delay.html#a80f143ab956c9d3b1721958ece6da65e" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>(env[0] * sample, N);
|
||||
<a name="l00195"></a>00195 outputLine_.<a class="code" href="classstk_1_1Delay.html#a80f143ab956c9d3b1721958ece6da65e" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>(env[1] * sample, N-1);
|
||||
<a name="l00196"></a>00196 }
|
||||
<a name="l00197"></a>00197 outputPtr = outputPtr + lastPeriod_ * periodRatio_; <span class="comment">// new output pointer</span>
|
||||
<a name="l00198"></a>00198 }
|
||||
<a name="l00199"></a>00199 }
|
||||
<a name="l00200"></a>00200 <span class="comment">// Shifting of the pointers waiting for the new frame of length tMax_.</span>
|
||||
<a name="l00201"></a>00201 outputPtr -= tMax_;
|
||||
<a name="l00202"></a>00202 inputPtr -= tMax_;
|
||||
<a name="l00203"></a>00203 }
|
||||
<a name="l00204"></a>00204
|
||||
<a name="l00205"></a>00205
|
||||
<a name="l00206"></a><a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d">00206</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: tick</a>( StkFloat input )
|
||||
<a name="l00207"></a>00207 {
|
||||
<a name="l00208"></a>00208 StkFloat sample;
|
||||
<a name="l00209"></a>00209
|
||||
<a name="l00210"></a>00210 inputFrames[ptrFrames] = input;
|
||||
<a name="l00211"></a>00211
|
||||
<a name="l00212"></a>00212 sample = outputFrames[ptrFrames++];
|
||||
<a name="l00213"></a>00213
|
||||
<a name="l00214"></a>00214 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00215"></a>00215 <span class="keywordflow">if</span> ( ptrFrames == (<span class="keywordtype">int</span>) inputFrames.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ){
|
||||
<a name="l00216"></a>00216 ptrFrames = 0;
|
||||
<a name="l00217"></a>00217 <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">process</a>( );
|
||||
<a name="l00218"></a>00218 }
|
||||
<a name="l00219"></a>00219
|
||||
<a name="l00220"></a>00220 <span class="keywordflow">return</span> sample;
|
||||
<a name="l00221"></a>00221 }
|
||||
<a name="l00222"></a>00222
|
||||
<a name="l00223"></a><a class="code" href="classstk_1_1LentPitShift.html#a158cb313f45bbae6ee327cbc539abdd1">00223</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_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: 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="l00224"></a>00224 {
|
||||
<a name="l00225"></a>00225 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00226"></a>00226 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00227"></a>00227 oStream_ << <span class="stringliteral">"LentPitShift::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00228"></a>00228 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00229"></a>00229 }
|
||||
<a name="l00230"></a>00230 <span class="preprocessor">#endif</span>
|
||||
<a name="l00231"></a>00231 <span class="preprocessor"></span>
|
||||
<a name="l00232"></a>00232 StkFloat *samples = &frames[channel];
|
||||
<a name="l00233"></a>00233 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00234"></a>00234 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00235"></a>00235 *samples = <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( *samples );
|
||||
<a name="l00236"></a>00236 }
|
||||
<a name="l00237"></a>00237
|
||||
<a name="l00238"></a>00238 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00239"></a>00239 }
|
||||
<a name="l00240"></a>00240
|
||||
<a name="l00241"></a><a class="code" href="classstk_1_1LentPitShift.html#af93de733eedca65de40597bd4a1f7b2a">00241</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_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: 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="l00242"></a>00242 {
|
||||
<a name="l00243"></a>00243 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00244"></a>00244 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00245"></a>00245 oStream_ << <span class="stringliteral">"LentPitShift::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00246"></a>00246 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00247"></a>00247 }
|
||||
<a name="l00248"></a>00248 <span class="preprocessor">#endif</span>
|
||||
<a name="l00249"></a>00249 <span class="preprocessor"></span>
|
||||
<a name="l00250"></a>00250 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00251"></a>00251 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00252"></a>00252 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00253"></a>00253 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00254"></a>00254 *oSamples = <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( *iSamples );
|
||||
<a name="l00255"></a>00255 }
|
||||
<a name="l00256"></a>00256
|
||||
<a name="l00257"></a>00257 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00258"></a>00258 }
|
||||
<a name="l00259"></a>00259
|
||||
<a name="l00260"></a>00260 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00261"></a>00261
|
||||
<a name="l00262"></a>00262 <span class="preprocessor">#endif</span>
|
||||
<a name="l00263"></a>00263 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
122
doc/html/Mandolin_8h_source.html
Normal file
122
doc/html/Mandolin_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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 "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Twang.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "FileWvIn.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="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_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_1Mandolin.html#a5b2aaaf5697cbe57df62b568982f6300" 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#a92d50a0f0c1c974683bf4685cfc6ff86" 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#a2caec477ed0fe9479ed6d1fbdb45d827" 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_1Mandolin.html#af46367787cd0a21a04655be82d18df08" title="Detune the two strings by the given factor. A value of 1.0 produces unison strings...">setDetune</a>( StkFloat detune );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a21a5b0669b013cfd9c7142174530f629" title="Set the body size (a value of 1.0 produces the &quot;default&quot; size).">setBodySize</a>( StkFloat size );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a8a0df47cccec5225e26d3b0e702a7c02" title="Set the pluck or &quot;excitation&quot; position along the string (0.0 - 1.0).">setPluckPosition</a>( StkFloat position );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#af5beeafcdfef7b71a5dda14e0c30c7fb" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude,StkFloat position );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a8b60733652e54f1d6c93d63c915c9ca7" title="Start a note with the given frequency and amplitude (0.0 - 1.0).">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a569de60008c218f0939ab9aedd038776" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#abf341aa5e7d751012178ff7b853b73a1" 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_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" 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="l00081"></a>00081
|
||||
<a name="l00088"></a>00088 <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_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" 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="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keyword">protected</span>:
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1Twang.html" title="STK enhanced plucked string class.">Twang</a> strings_[2];
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> soundfile_[12];
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">int</span> mic_;
|
||||
<a name="l00096"></a>00096 StkFloat detuning_;
|
||||
<a name="l00097"></a>00097 StkFloat frequency_;
|
||||
<a name="l00098"></a>00098 StkFloat pluckAmplitude_;
|
||||
<a name="l00099"></a>00099 };
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a><a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62">00101</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">Mandolin :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00102"></a>00102 {
|
||||
<a name="l00103"></a>00103 StkFloat temp = 0.0;
|
||||
<a name="l00104"></a>00104 <span class="keywordflow">if</span> ( !soundfile_[mic_].isFinished() )
|
||||
<a name="l00105"></a>00105 temp = soundfile_[mic_].<a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * pluckAmplitude_;
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 lastFrame_[0] = strings_[0].<a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( temp );
|
||||
<a name="l00108"></a>00108 lastFrame_[0] += strings_[1].<a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( temp );
|
||||
<a name="l00109"></a>00109 lastFrame_[0] *= 0.2;
|
||||
<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><a class="code" href="classstk_1_1Mandolin.html#a37134f89e73e3e62ad5dfcfb0300a12d">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_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">Mandolin :: 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="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00117"></a>00117 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00118"></a>00118 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00119"></a>00119 oStream_ << <span class="stringliteral">"Mandolin::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00120"></a>00120 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 <span class="preprocessor">#endif</span>
|
||||
<a name="l00123"></a>00123 <span class="preprocessor"></span>
|
||||
<a name="l00124"></a>00124 StkFloat *samples = &frames[channel];
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00127"></a>00127 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00128"></a>00128 *samples++ = <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">else</span> {
|
||||
<a name="l00131"></a>00131 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00132"></a>00132 *samples++ = <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00134"></a>00134 *samples++ = lastFrame_[j];
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 }
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
125
doc/html/Mesh2D_8h_source.html
Normal file
125
doc/html/Mesh2D_8h_source.html
Normal file
@@ -0,0 +1,125 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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">unsigned</span> <span class="keywordtype">short</span> NXMAX = 12;
|
||||
<a name="l00036"></a>00036 <span class="keyword">const</span> <span class="keywordtype">unsigned</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#aef48c3c65901f62a8dbdbe606763203e" title="Class constructor, taking the x and y dimensions in samples.">Mesh2D</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> nX, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> nY );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Mesh2D.html#ac4abd6b5190587d69c7c2b13870fb646" 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#a49f56b4865dc041ae874fbc1b80e967b" 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#a6834a52f03b072e18387b799f804527b" title="Set the x dimension size in samples.">setNX</a>( <span class="keywordtype">unsigned</span> <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#a2be2badaccfeb57e52e548f1b7515fbe" title="Set the y dimension size in samples.">setNY</a>( <span class="keywordtype">unsigned</span> <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#a9cdfa80ecccf3f12dc184003458ba3a3" 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#ab7b3d950e40308e7060e5ff9a62a8b8d" 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#a7915dae1032ace5960c85790a7b93e0f" 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#a0580962b3cc0dbac092581d0fc15127b" 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#a52d9552b67edea0fc6ff3e949d6331a0" 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#a688bed8725ef2d8bf4c6465251bd8b86" 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#acc618a91b288305785644d852cfdaf83" 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#ae8a7e86e4774d8738098c79ab0d5e00a" 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="l00081"></a>00081
|
||||
<a name="l00088"></a>00088 <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_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" 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="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keyword">protected</span>:
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 StkFloat tick0();
|
||||
<a name="l00093"></a>00093 StkFloat tick1();
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">void</span> clearMesh();
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> NX_, NY_;
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> xInput_, yInput_;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filterX_[NXMAX];
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filterY_[NYMAX];
|
||||
<a name="l00100"></a>00100 StkFloat v_[NXMAX-1][NYMAX-1]; <span class="comment">// junction velocities</span>
|
||||
<a name="l00101"></a>00101 StkFloat vxp_[NXMAX][NYMAX]; <span class="comment">// positive-x velocity wave</span>
|
||||
<a name="l00102"></a>00102 StkFloat vxm_[NXMAX][NYMAX]; <span class="comment">// negative-x velocity wave</span>
|
||||
<a name="l00103"></a>00103 StkFloat vyp_[NXMAX][NYMAX]; <span class="comment">// positive-y velocity wave</span>
|
||||
<a name="l00104"></a>00104 StkFloat vym_[NXMAX][NYMAX]; <span class="comment">// negative-y velocity wave</span>
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 <span class="comment">// Alternate buffers</span>
|
||||
<a name="l00107"></a>00107 StkFloat vxp1_[NXMAX][NYMAX]; <span class="comment">// positive-x velocity wave</span>
|
||||
<a name="l00108"></a>00108 StkFloat vxm1_[NXMAX][NYMAX]; <span class="comment">// negative-x velocity wave</span>
|
||||
<a name="l00109"></a>00109 StkFloat vyp1_[NXMAX][NYMAX]; <span class="comment">// positive-y velocity wave</span>
|
||||
<a name="l00110"></a>00110 StkFloat vym1_[NXMAX][NYMAX]; <span class="comment">// negative-y velocity wave</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="keywordtype">int</span> counter_; <span class="comment">// time in samples</span>
|
||||
<a name="l00113"></a>00113 };
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a><a class="code" href="classstk_1_1Mesh2D.html#a0bfe62f0ab05859963571f4a9a569bd8">00115</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_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">Mesh2D :: 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="l00116"></a>00116 {
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00118"></a>00118 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00119"></a>00119 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00120"></a>00120 oStream_ << <span class="stringliteral">"Mesh2D::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00121"></a>00121 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123 <span class="preprocessor">#endif</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span>
|
||||
<a name="l00125"></a>00125 StkFloat *samples = &frames[channel];
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00128"></a>00128 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00129"></a>00129 *samples++ = <a class="code" href="classstk_1_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">else</span> {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 *samples++ = <a class="code" href="classstk_1_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00135"></a>00135 *samples++ = lastFrame_[j];
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
110
doc/html/Messager_8h_source.html
Normal file
110
doc/html/Messager_8h_source.html
Normal file
@@ -0,0 +1,110 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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 "<a class="code" href="RtMidi_8h.html">RtMidi.h</a>"</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#aa4c8f3396345157ccd19395258a253a9" title="Default constructor.">Messager</a>();
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Messager.html#a8300dba83620cc86388780b5fa4080e0" 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#a18525952880382c25322e57353a34372" 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#ae8b09328c103bffd180456bf57ee64b3" 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#a172cf26bfebc8b4b12943e2bd76d5f72" 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#a180fd45d109a2058ecbd6a629b979cb7" 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#a49877209a4ee08e684de82a73f2d9df9" 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>
|
||||
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#ad273dc7c13d4c4a4ced893af93d9176e" 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#a857246dbaf234cc9d68709afea6d0141" title="Class destructor.">~MidiFileIn</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1MidiFileIn.html#ac93b16c4de0ed3d98d31a2edb92bc105">00043</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#ac93b16c4de0ed3d98d31a2edb92bc105" title="Return the MIDI file format (0, 1, or 2).">getFileFormat</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> format_; };
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a><a class="code" href="classstk_1_1MidiFileIn.html#a7db7e6b2f6c1aedfbb78045106d36b17">00046</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#a7db7e6b2f6c1aedfbb78045106d36b17" title="Return the number of tracks in the MIDI file.">getNumberOfTracks</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nTracks_; };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00054"></a><a class="code" href="classstk_1_1MidiFileIn.html#a43bc34a26e72f3311b855139a1408f78">00054</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#a43bc34a26e72f3311b855139a1408f78" title="Return the MIDI file division value from the file header.">getDivision</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> division_; };
|
||||
<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#a3bd547e3ee5bb8ad780274d7a09f12ff" 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#a92508a5847e45a05a3ff05de3e5d3efe" 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#a117dd19afbc42d6c769d959588f9176b" 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#ab10ea0e225484fa2d31796f505d4e582" 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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
55
doc/html/ModalBar_8h_source.html
Normal file
55
doc/html/ModalBar_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a28577ea9c8c474eca560134d7991855d" 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#ab804e801a2d0b8e8c3552162152d6f3b" 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#ad4fbd1f97cd8c8c0782827969b0b4acf" 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#a5f0c4d254cb7efb87603a9732a072b38" 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#a3a09a114ccd420ab549b8565eb4928af" 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#ae67fe1187b2e2018fd147c7e6293cde2" 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#a84e5b9963b74f0e4657f79d5dea013cb" 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>
|
||||
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
145
doc/html/Modal_8h_source.html
Normal file
145
doc/html/Modal_8h_source.html
Normal file
@@ -0,0 +1,145 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#af6bfea135e80abb5537e62cf099c989a" 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#a7f45379ae10495b7a864cade0063705a" 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#af064dc6ee4290fd51b4a6dc8a1f0909d" 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#a503092926e66667227bb46312a82a264" 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#a7e4f9a875e60485d07d50386ff63117f" 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#a6e8d79358a5024b2e9a6c6f7c69a43c1">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#a6e8d79358a5024b2e9a6c6f7c69a43c1" 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#a70006135da2ecdc46eff4156504d94e1">00051</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#a70006135da2ecdc46eff4156504d94e1" 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#a08bdfedf10d00dcf19e82809926eab2f" 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#ab3bac00a47fa6fef70cf3ea442e9b121" 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#a1884c49b76ec8b902f22d50e26a7e365" 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#a44ce41e8e24e591f382914d00a259c7f" 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#a3483dafe33fa37e98781279810ea808f" 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#a9fab49ec164852c381758f5d333f8891" 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#ac1fd3f5dcb9b5cbb8bed0bff330c3890" 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="l00075"></a>00075
|
||||
<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_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" 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="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_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> *wave_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> **filters_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> onepole_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nModes_;
|
||||
<a name="l00093"></a>00093 std::vector<StkFloat> ratios_;
|
||||
<a name="l00094"></a>00094 std::vector<StkFloat> radii_;
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 StkFloat vibratoGain_;
|
||||
<a name="l00097"></a>00097 StkFloat masterGain_;
|
||||
<a name="l00098"></a>00098 StkFloat directGain_;
|
||||
<a name="l00099"></a>00099 StkFloat stickHardness_;
|
||||
<a name="l00100"></a>00100 StkFloat strikePosition_;
|
||||
<a name="l00101"></a>00101 StkFloat baseFrequency_;
|
||||
<a name="l00102"></a>00102 };
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">Modal :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 StkFloat temp = masterGain_ * onepole_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( wave_-><a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 StkFloat temp2 = 0.0;
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<nModes_; i++ )
|
||||
<a name="l00110"></a>00110 temp2 += filters_[i]-><a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>(temp);
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 temp2 -= temp2 * directGain_;
|
||||
<a name="l00113"></a>00113 temp2 += directGain_ * temp;
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">if</span> ( vibratoGain_ != 0.0 ) {
|
||||
<a name="l00116"></a>00116 <span class="comment">// Calculate AM and apply to master out</span>
|
||||
<a name="l00117"></a>00117 temp = 1.0 + ( vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * vibratoGain_ );
|
||||
<a name="l00118"></a>00118 temp2 = temp * temp2;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 lastFrame_[0] = temp2;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a><a class="code" href="classstk_1_1Modal.html#ad2a28e7bd5fdae7d2a6d9fb79bbfb7b0">00125</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_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">Modal :: 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="l00126"></a>00126 {
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<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> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00130"></a>00130 oStream_ << <span class="stringliteral">"Modal::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00131"></a>00131 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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 *samples = &frames[channel];
|
||||
<a name="l00136"></a>00136 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00139"></a>00139 *samples++ = <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">else</span> {
|
||||
<a name="l00142"></a>00142 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00143"></a>00143 *samples++ = <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00145"></a>00145 *samples++ = lastFrame_[j];
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
106
doc/html/Modulate_8h_source.html
Normal file
106
doc/html/Modulate_8h_source.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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#a96812173415bfb086f5d8d738f4d0c2e" 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#add541ec0d037a21bd236b5790878d060" 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#a6cb78fe2dec3bebf2586764421556706">00036</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#a6cb78fe2dec3bebf2586764421556706" 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#a298b25f4b7cc56f2dffae5474a05999d">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#a298b25f4b7cc56f2dffae5474a05999d" title="Set the periodic (vibrato) rate or frequency in Hz.">setVibratoRate</a>( StkFloat rate ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#a1047a43714bc2e40c7e31e8f7e34adbc" 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#a08f2d489a3fba3a10d1f301aed869ed4">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#a08f2d489a3fba3a10d1f301aed869ed4" 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#ac6e7a02378facf59916f2460ed5c2fa5" 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#addf73f58590ab082f106c9745c5bedc9">00048</a> StkFloat <a class="code" href="classstk_1_1Modulate.html#addf73f58590ab082f106c9745c5bedc9" 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#a237b96dd553d65253abbf00a186e293d" 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#a237b96dd553d65253abbf00a186e293d" 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#a237b96dd553d65253abbf00a186e293d">00077</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Modulate.html#a237b96dd553d65253abbf00a186e293d" 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#a31a55627bf8064919b5e063059260eda" 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#a8ac40f69475eb744e803d557e8438a6d" 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#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( noise_.<a class="code" href="classstk_1_1Noise.html#a1d6c8ed80425cd0cea014bd2e328c823" 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#a942eee1bb78318e1b59afeb311748b2d">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#a237b96dd553d65253abbf00a186e293d" 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00093"></a>00093 oStream_ << <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#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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#a237b96dd553d65253abbf00a186e293d" 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>
|
||||
|
||||
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
115
doc/html/Moog_8h_source.html
Normal file
115
doc/html/Moog_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Moog.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MOOG_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MOOG_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Sampler.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FormSwep.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="l00027"></a>00027 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1Moog.html">00029</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Moog.html" title="STK moog-like swept filter sampling synthesis class.">Moog</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Sampler.html" title="STK sampling synthesis abstract base class.">Sampler</a>
|
||||
<a name="l00030"></a>00030 {
|
||||
<a name="l00031"></a>00031 <span class="keyword">public</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1Moog.html#a07c8d02638711d5f08a3b320b7274156" title="Class constructor.">Moog</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1Moog.html#ac05815f49aab07e01ff0d4e5e8c4edba" title="Class destructor.">~Moog</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Moog.html#ab0d66174dd734d55ef7224d6d8f2cb06" 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_1Moog.html#a899bc1c5c76fb29875d4df4ce594d44e" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1Moog.html#afeb63bf762f07851db22ae5bf18f0a81">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Moog.html#afeb63bf762f07851db22ae5bf18f0a81" title="Set the modulation (vibrato) speed in Hz.">setModulationSpeed</a>( StkFloat mSpeed ) { loops_[1]->setFrequency( mSpeed ); };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a><a class="code" href="classstk_1_1Moog.html#a32e5ee083d5d92494bbe9fac43c2070f">00051</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Moog.html#a32e5ee083d5d92494bbe9fac43c2070f" title="Set the modulation (vibrato) depth.">setModulationDepth</a>( StkFloat mDepth ) { modDepth_ = mDepth * 0.5; };
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Moog.html#acadb54eccab35e3b18b62ffd96c18ac4" 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="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 StkFloat <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<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_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" 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="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 <span class="keyword">protected</span>:
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <a class="code" href="classstk_1_1FormSwep.html" title="STK sweepable formant filter class.">FormSwep</a> filters_[2];
|
||||
<a name="l00072"></a>00072 StkFloat modDepth_;
|
||||
<a name="l00073"></a>00073 StkFloat filterQ_;
|
||||
<a name="l00074"></a>00074 StkFloat filterRate_;
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 };
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a">00078</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">Moog :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00079"></a>00079 {
|
||||
<a name="l00080"></a>00080 StkFloat temp;
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">if</span> ( modDepth_ != 0.0 ) {
|
||||
<a name="l00083"></a>00083 temp = loops_[1]->tick() * modDepth_;
|
||||
<a name="l00084"></a>00084 loops_[0]->setFrequency( baseFrequency_ * (1.0 + temp) );
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 temp = attackGain_ * attacks_[0]->tick();
|
||||
<a name="l00088"></a>00088 temp += loopGain_ * loops_[0]->tick();
|
||||
<a name="l00089"></a>00089 temp = filter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00090"></a>00090 temp *= adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00091"></a>00091 temp = filters_[0].<a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( temp );
|
||||
<a name="l00092"></a>00092 lastFrame_[0] = filters_[1].<a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( temp );
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">return</span> lastFrame_[0] * 6.0;
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a><a class="code" href="classstk_1_1Moog.html#aee6aa6373c424e941f963b2709310f4e">00096</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_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">Moog :: 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="l00097"></a>00097 {
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<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> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00101"></a>00101 oStream_ << <span class="stringliteral">"Moog::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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 *samples = &frames[channel];
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00108"></a>00108 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00109"></a>00109 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00110"></a>00110 *samples++ = <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">else</span> {
|
||||
<a name="l00113"></a>00113 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00114"></a>00114 *samples++ = <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00116"></a>00116 *samples++ = lastFrame_[j];
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
76
doc/html/Mutex_8h_source.html
Normal file
76
doc/html/Mutex_8h_source.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Mutex.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MUTEX_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MUTEX_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="preprocessor">#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor"></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor"> #include <pthread.h></span>
|
||||
<a name="l00009"></a>00009 <span class="keyword">typedef</span> pthread_mutex_t MUTEX;
|
||||
<a name="l00010"></a>00010 <span class="keyword">typedef</span> pthread_cond_t CONDITION;
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="preprocessor">#elif defined(__OS_WINDOWS__)</span>
|
||||
<a name="l00013"></a>00013 <span class="preprocessor"></span>
|
||||
<a name="l00014"></a>00014 <span class="preprocessor"> #include <windows.h></span>
|
||||
<a name="l00015"></a>00015 <span class="preprocessor"> #include <process.h></span>
|
||||
<a name="l00016"></a>00016 <span class="keyword">typedef</span> CRITICAL_SECTION MUTEX;
|
||||
<a name="l00017"></a>00017 <span class="keyword">typedef</span> HANDLE CONDITION;
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a>00019 <span class="preprocessor">#endif</span>
|
||||
<a name="l00020"></a>00020 <span class="preprocessor"></span>
|
||||
<a name="l00021"></a>00021 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a>00023 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00034"></a>00034 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1Mutex.html">00036</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00037"></a>00037 {
|
||||
<a name="l00038"></a>00038 <span class="keyword">public</span>:
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Mutex.html#a869b23f40be55c01cc381290de1d1375" title="Default constructor.">Mutex</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1Mutex.html#a63df62eabfb7976e34951145d7a7ced3" title="Class destructor.">~Mutex</a>();
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#af2bb62c13745502b58644189d1db5b35" title="Lock the mutex.">lock</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_1Mutex.html#ae518f6d3177dd8c2138eccb8944591ee" title="Unlock the mutex.">unlock</a>(<span class="keywordtype">void</span>);
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#afa637fae8940d6c3ad42384439962bbe" title="Wait indefinitely on the mutex condition variable.">wait</a>(<span class="keywordtype">void</span>);
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#ac3e3e69efa1587cb1f65fb645a8d43db" title="Signal the condition variable.">signal</a>(<span class="keywordtype">void</span>);
|
||||
<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 MUTEX mutex_;
|
||||
<a name="l00068"></a>00068 CONDITION condition_;
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
135
doc/html/NRev_8h_source.html
Normal file
135
doc/html/NRev_8h_source.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>NRev.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_NREV_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_NREV_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="l00023"></a>00023 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1NRev.html">00025</a> <span class="keyword">class </span><a class="code" href="classstk_1_1NRev.html" title="CCRMA&#39;s NRev reverberator class.">NRev</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00026"></a>00026 {
|
||||
<a name="l00027"></a>00027 <span class="keyword">public</span>:
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1NRev.html#a68757d7a44e960acfd18cb94b465c727" title="Class constructor taking a T60 decay time argument (one second default value).">NRev</a>( StkFloat T60 = 1.0 );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1NRev.html#a4097b11b38dd00d084ae4a94bc18f02c" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1NRev.html#a9c0d41a2b9ce7fb9edb2d620ba005e3c" title="Set the reverberation T60 decay time.">setT60</a>( StkFloat T60 );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00046"></a>00046 StkFloat <a class="code" href="classstk_1_1NRev.html#a9f9faa6542271163680c1925309ed788" 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="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00056"></a>00056 StkFloat <a class="code" href="classstk_1_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1" 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="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<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_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1" 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="l00069"></a>00069
|
||||
<a name="l00071"></a>00071
|
||||
<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_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1" 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="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keyword">protected</span>:
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allpassDelays_[8];
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[6];
|
||||
<a name="l00086"></a>00086 StkFloat allpassCoefficient_;
|
||||
<a name="l00087"></a>00087 StkFloat combCoefficient_[6];
|
||||
<a name="l00088"></a>00088 StkFloat lowpassState_;
|
||||
<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_1NRev.html#a9f9faa6542271163680c1925309ed788">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1NRev.html#a9f9faa6542271163680c1925309ed788" title="Return the specified channel value of the last computed stereo frame.">NRev :: 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 oStream_ << <span class="stringliteral">"NRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1" title="Input one sample to the effect and return the specified channel value of the computed...">NRev :: 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 oStream_ << <span class="stringliteral">"NRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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;
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">int</span> i;
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 temp0 = 0.0;
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( i=0; i<6; i++ ) {
|
||||
<a name="l00118"></a>00118 temp = input + (combCoefficient_[i] * combDelays_[i].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00119"></a>00119 temp0 += combDelays_[i].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">for</span> ( i=0; i<3; i++ ) {
|
||||
<a name="l00123"></a>00123 temp = allpassDelays_[i].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00124"></a>00124 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00125"></a>00125 temp1 += temp0;
|
||||
<a name="l00126"></a>00126 allpassDelays_[i].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00127"></a>00127 temp0 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 <span class="comment">// One-pole lowpass filter.</span>
|
||||
<a name="l00131"></a>00131 lowpassState_ = 0.7 * lowpassState_ + 0.3 * temp0;
|
||||
<a name="l00132"></a>00132 temp = allpassDelays_[3].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00133"></a>00133 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00134"></a>00134 temp1 += lowpassState_;
|
||||
<a name="l00135"></a>00135 allpassDelays_[3].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( temp1 );
|
||||
<a name="l00136"></a>00136 temp1 = -( allpassCoefficient_ * temp1 ) + temp;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 temp = allpassDelays_[4].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00139"></a>00139 temp2 = allpassCoefficient_ * temp;
|
||||
<a name="l00140"></a>00140 temp2 += temp1;
|
||||
<a name="l00141"></a>00141 allpassDelays_[4].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( temp2 );
|
||||
<a name="l00142"></a>00142 lastFrame_[0] = effectMix_*( -( allpassCoefficient_ * temp2 ) + temp );
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 temp = allpassDelays_[5].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00145"></a>00145 temp3 = allpassCoefficient_ * temp;
|
||||
<a name="l00146"></a>00146 temp3 += temp1;
|
||||
<a name="l00147"></a>00147 allpassDelays_[5].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( temp3 );
|
||||
<a name="l00148"></a>00148 lastFrame_[1] = effectMix_*( - ( allpassCoefficient_ * temp3 ) + temp );
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 temp = ( 1.0 - effectMix_ ) * input;
|
||||
<a name="l00151"></a>00151 lastFrame_[0] += temp;
|
||||
<a name="l00152"></a>00152 lastFrame_[1] += temp;
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 <span class="preprocessor">#endif</span>
|
||||
<a name="l00160"></a>00160 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
82
doc/html/Noise_8h_source.html
Normal file
82
doc/html/Noise_8h_source.html
Normal file
@@ -0,0 +1,82 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Noise.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_NOISE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_NOISE_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 <stdlib.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="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Noise.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</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 name="l00030"></a>00030 <a class="code" href="classstk_1_1Noise.html#a2d442a08883be25f10952dff4e515f98" title="Default constructor that can also take a specific seed value.">Noise</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> seed = 0 );
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Noise.html#a9507ae6eb261c577a64b4ecb5c1805dc" title="Seed the random number generator with a specific seed value.">setSeed</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> seed = 0 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1Noise.html#a1d6c8ed80425cd0cea014bd2e328c823">00040</a> StkFloat <a class="code" href="classstk_1_1Noise.html#a1d6c8ed80425cd0cea014bd2e328c823" 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="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 StkFloat <a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00053"></a>00053 <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_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" 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="l00054"></a>00054
|
||||
<a name="l00055"></a>00055 <span class="keyword">protected</span>:
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00057"></a>00057 };
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a><a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d">00059</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">Noise :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00060"></a>00060 {
|
||||
<a name="l00061"></a>00061 <span class="keywordflow">return</span> lastFrame_[0] = (StkFloat) ( 2.0 * rand() / (RAND_MAX + 1.0) - 1.0 );
|
||||
<a name="l00062"></a>00062 }
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1Noise.html#a2f92e91787dc19309305cf246632cd50">00064</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_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">Noise :: 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="l00065"></a>00065 {
|
||||
<a name="l00066"></a>00066 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00067"></a>00067 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00068"></a>00068 oStream_ << <span class="stringliteral">"Noise::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00070"></a>00070 }
|
||||
<a name="l00071"></a>00071 <span class="preprocessor">#endif</span>
|
||||
<a name="l00072"></a>00072 <span class="preprocessor"></span>
|
||||
<a name="l00073"></a>00073 StkFloat *samples = &frames[channel];
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00075"></a>00075 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00076"></a>00076 *samples = (StkFloat) ( 2.0 * rand() / (RAND_MAX + 1.0) - 1.0 );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00079"></a>00079 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00080"></a>00080 }
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
118
doc/html/OnePole_8h_source.html
Normal file
118
doc/html/OnePole_8h_source.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>OnePole.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ONEPOLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ONEPOLE_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_1OnePole.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</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_1OnePole.html#ad0d322987780778e9f53f34837bea4b8" title="The default constructor creates a low-pass filter (pole at z = 0.9).">OnePole</a>( StkFloat thePole = 0.9 );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1OnePole.html#a03ac84c397620180090d86f2ecafccc5" title="Class destructor.">~OnePole</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1OnePole.html#aff587fbf5ba36b3dd24b2fb8d66b7e00">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OnePole.html#aff587fbf5ba36b3dd24b2fb8d66b7e00" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1OnePole.html#a1f99beebd9c4fbdfce6478e40d7625d8">00034</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OnePole.html#a1f99beebd9c4fbdfce6478e40d7625d8" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OnePole.html#aa92dd54382721d5151ef29b291ba6cb5" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat a1, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OnePole.html#acc1aaa35c6d5ffbbebfe0c4bfa7d1132" title="Set the pole position in the z-plane.">setPole</a>( StkFloat thePole );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a><a class="code" href="classstk_1_1OnePole.html#ad1ad906374102791a01bfd60844028ec">00051</a> StkFloat <a class="code" href="classstk_1_1OnePole.html#ad1ad906374102791a01bfd60844028ec" 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="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 StkFloat <a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<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_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" 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="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00076"></a>00076 <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_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" 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="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e">00080</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">OnePole :: tick</a>( StkFloat input )
|
||||
<a name="l00081"></a>00081 {
|
||||
<a name="l00082"></a>00082 inputs_[0] = gain_ * input;
|
||||
<a name="l00083"></a>00083 lastFrame_[0] = b_[0] * inputs_[0] - a_[1] * outputs_[1];
|
||||
<a name="l00084"></a>00084 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00085"></a>00085
|
||||
<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_1OnePole.html#af6611322a3c17f728cf6d57a4f932a1f">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_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">OnePole :: 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00093"></a>00093 oStream_ << <span class="stringliteral">"OnePole::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00101"></a>00101 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00102"></a>00102 *samples = b_[0] * inputs_[0] - a_[1] * outputs_[1];
|
||||
<a name="l00103"></a>00103 outputs_[1] = *samples;
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a><a class="code" href="classstk_1_1OnePole.html#a495943f1659f2da6208703a24275defb">00110</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_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">OnePole :: 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="l00111"></a>00111 {
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00113"></a>00113 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00114"></a>00114 oStream_ << <span class="stringliteral">"OnePole::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00115"></a>00115 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117 <span class="preprocessor">#endif</span>
|
||||
<a name="l00118"></a>00118 <span class="preprocessor"></span>
|
||||
<a name="l00119"></a>00119 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00120"></a>00120 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00122"></a>00122 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00123"></a>00123 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00124"></a>00124 *oSamples = b_[0] * inputs_[0] - a_[1] * outputs_[1];
|
||||
<a name="l00125"></a>00125 outputs_[1] = *oSamples;
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
119
doc/html/OneZero_8h_source.html
Normal file
119
doc/html/OneZero_8h_source.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>OneZero.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ONEZERO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ONEZERO_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_1OneZero.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</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_1OneZero.html#ada639198d28be5d170508a301ba854da" title="The default constructor creates a low-pass filter (zero at z = -1.0).">OneZero</a>( StkFloat theZero = -1.0 );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1OneZero.html#a8abe6156bad57d3a5cfebcf2ddc9b703" title="Class destructor.">~OneZero</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1OneZero.html#aef2a8aa1759762649a74fc031198ebca">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OneZero.html#aef2a8aa1759762649a74fc031198ebca" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1OneZero.html#ad4eda332f920e43a33871c8beb6f3042">00034</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OneZero.html#ad4eda332f920e43a33871c8beb6f3042" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OneZero.html#a6113bf1dce0cb23719e30ee29e7c6735" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<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_1OneZero.html#af8301fdb6a893ec6eb74fbcbeeaa463c" title="Set the zero position in the z-plane.">setZero</a>( StkFloat theZero );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a><a class="code" href="classstk_1_1OneZero.html#a54e160f62354939876477d9c5a65890c">00050</a> StkFloat <a class="code" href="classstk_1_1OneZero.html#a54e160f62354939876477d9c5a65890c" 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="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 StkFloat <a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00064"></a>00064 <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_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" 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="l00065"></a>00065
|
||||
<a name="l00067"></a>00067
|
||||
<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_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" 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="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 };
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a><a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da">00079</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">OneZero :: tick</a>( StkFloat input )
|
||||
<a name="l00080"></a>00080 {
|
||||
<a name="l00081"></a>00081 inputs_[0] = gain_ * input;
|
||||
<a name="l00082"></a>00082 lastFrame_[0] = b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00083"></a>00083 inputs_[1] = inputs_[0];
|
||||
<a name="l00084"></a>00084
|
||||
<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><a class="code" href="classstk_1_1OneZero.html#a2ca42a158bed919d8578c4a2dd184b3d">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_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">OneZero :: 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="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> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00092"></a>00092 oStream_ << <span class="stringliteral">"OneZero::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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 *samples = &frames[channel];
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00099"></a>00099 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00100"></a>00100 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00101"></a>00101 *samples = b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00102"></a>00102 inputs_[1] = inputs_[0];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00107"></a>00107 }
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a><a class="code" href="classstk_1_1OneZero.html#a8568a0d8c4aacc64b656b9fe46f217a4">00109</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_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">OneZero :: 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="l00110"></a>00110 {
|
||||
<a name="l00111"></a>00111 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00112"></a>00112 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00113"></a>00113 oStream_ << <span class="stringliteral">"OneZero::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00114"></a>00114 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
<a name="l00117"></a>00117 <span class="preprocessor"></span>
|
||||
<a name="l00118"></a>00118 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00119"></a>00119 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00121"></a>00121 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00122"></a>00122 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00123"></a>00123 *oSamples = b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00124"></a>00124 inputs_[1] = inputs_[0];
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">return</span> iFrames;
|
||||
<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>
|
||||
<a name="l00134"></a>00134 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
116
doc/html/PRCRev_8h_source.html
Normal file
116
doc/html/PRCRev_8h_source.html
Normal file
@@ -0,0 +1,116 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>PRCRev.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PRCREV_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PRCREV_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_1PRCRev.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1PRCRev.html" title="Perry&#39;s simple reverberator class.">PRCRev</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_1PRCRev.html#afb6440fb909a3091f21f31f3565014de" title="Class constructor taking a T60 decay time argument (one second default value).">PRCRev</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_1PRCRev.html#a3e2fa911784a02a6d7211cbe2348ffe1" 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_1PRCRev.html#a9478ed84e76d12cc66d11716ebfa8b3b" 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_1PRCRev.html#a47ed5fee4401f0050d6a47d1154e81c6" 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_1PRCRev.html#ada84d5241777575b660db100a85b35a6" 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_1PRCRev.html#ada84d5241777575b660db100a85b35a6" 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_1PRCRev.html#ada84d5241777575b660db100a85b35a6" 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_[2];
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[2];
|
||||
<a name="l00085"></a>00085 StkFloat allpassCoefficient_;
|
||||
<a name="l00086"></a>00086 StkFloat combCoefficient_[2];
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 };
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a><a class="code" href="classstk_1_1PRCRev.html#a47ed5fee4401f0050d6a47d1154e81c6">00090</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PRCRev.html#a47ed5fee4401f0050d6a47d1154e81c6" title="Return the specified channel value of the last computed stereo frame.">PRCRev :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00091"></a>00091 {
|
||||
<a name="l00092"></a>00092 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00093"></a>00093 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00094"></a>00094 oStream_ << <span class="stringliteral">"PRCRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097 <span class="preprocessor">#endif</span>
|
||||
<a name="l00098"></a>00098 <span class="preprocessor"></span>
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00100"></a>00100 }
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a><a class="code" href="classstk_1_1PRCRev.html#ada84d5241777575b660db100a85b35a6">00102</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PRCRev.html#ada84d5241777575b660db100a85b35a6" title="Input one sample to the effect and return the specified channel value of the computed...">PRCRev :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00103"></a>00103 {
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00106"></a>00106 oStream_ << <span class="stringliteral">"PRCRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00107"></a>00107 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109 <span class="preprocessor">#endif</span>
|
||||
<a name="l00110"></a>00110 <span class="preprocessor"></span>
|
||||
<a name="l00111"></a>00111 StkFloat temp, temp0, temp1, temp2, temp3;
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 temp = allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00114"></a>00114 temp0 = allpassCoefficient_ * temp;
|
||||
<a name="l00115"></a>00115 temp0 += input;
|
||||
<a name="l00116"></a>00116 allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp0);
|
||||
<a name="l00117"></a>00117 temp0 = -(allpassCoefficient_ * temp0) + temp;
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 temp = allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00120"></a>00120 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00121"></a>00121 temp1 += temp0;
|
||||
<a name="l00122"></a>00122 allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00123"></a>00123 temp1 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 temp2 = temp1 + ( combCoefficient_[0] * combDelays_[0].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00126"></a>00126 temp3 = temp1 + ( combCoefficient_[1] * combDelays_[1].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = effectMix_ * (combDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp2));
|
||||
<a name="l00129"></a>00129 lastFrame_[1] = effectMix_ * (combDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp3));
|
||||
<a name="l00130"></a>00130 temp = (1.0 - effectMix_) * input;
|
||||
<a name="l00131"></a>00131 lastFrame_[0] += temp;
|
||||
<a name="l00132"></a>00132 lastFrame_[1] += temp;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a>00137 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
|
||||
<a name="l00140"></a>00140 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
112
doc/html/PercFlut_8h_source.html
Normal file
112
doc/html/PercFlut_8h_source.html
Normal file
@@ -0,0 +1,112 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>PercFlut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PERCFLUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PERCFLUT_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="l00034"></a>00034 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1PercFlut.html">00036</a> <span class="keyword">class </span><a class="code" href="classstk_1_1PercFlut.html" title="STK percussive flute FM synthesis instrument.">PercFlut</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="l00037"></a>00037 {
|
||||
<a name="l00038"></a>00038 <span class="keyword">public</span>:
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1PercFlut.html#ab51f05b79d818ed8ba80fd827a4839c2" title="Class constructor.">PercFlut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1PercFlut.html#add2a18e8835d665d505521e0298bd2f0" title="Class destructor.">~PercFlut</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_1PercFlut.html#a24197fb4ae0bf806d8e3f6fe4eb5598c" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PercFlut.html#a7ebfc19d4c41482a699f43b2c06dc02d" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" 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="l00058"></a>00058
|
||||
<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_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" 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="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="keyword">protected</span>:
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054">00071</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">PercFlut :: 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;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 temp = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.2;
|
||||
<a name="l00076"></a>00076 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
||||
<a name="l00077"></a>00077 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
||||
<a name="l00078"></a>00078 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
||||
<a name="l00079"></a>00079 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00082"></a>00082 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00085"></a>00085 waves_[2]->addPhaseOffset( temp );
|
||||
<a name="l00086"></a>00086 temp = (1.0 - (control2_ * 0.5)) * gains_[2] * adsr_[2]-><a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>() * waves_[2]->tick();
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00089"></a>00089 temp = temp * control1_;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 waves_[0]->addPhaseOffset(temp);
|
||||
<a name="l00092"></a>00092 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00095"></a>00095 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1PercFlut.html#a4105b2b1dfe375bcf870fb4903509e4e">00098</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_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">PercFlut :: 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="l00099"></a>00099 {
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00101"></a>00101 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00102"></a>00102 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00103"></a>00103 oStream_ << <span class="stringliteral">"PercFlut::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span>
|
||||
<a name="l00108"></a>00108 StkFloat *samples = &frames[channel];
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">else</span> {
|
||||
<a name="l00115"></a>00115 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00116"></a>00116 *samples++ = <a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00118"></a>00118 *samples++ = lastFrame_[j];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
64
doc/html/Phonemes_8h_source.html
Normal file
64
doc/html/Phonemes_8h_source.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Phonemes.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PHONEMES_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PHONEMES_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_1Phonemes.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Phonemes.html" title="STK phonemes table.">Phonemes</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="l00024"></a>00024 <a class="code" href="classstk_1_1Phonemes.html" title="STK phonemes table.">Phonemes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a>00026 ~<a class="code" href="classstk_1_1Phonemes.html" title="STK phonemes table.">Phonemes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="classstk_1_1Phonemes.html#a8b1a29ac4e6ddb629154d298d5abf585" title="Returns the phoneme name for the given index (0-31).">name</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#a3e4cded114bb563bc78412c7b6b1d099" title="Returns the voiced component gain for the given phoneme index (0-31).">voiceGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#a57715042b02c835da194753bc8f8a99e" title="Returns the unvoiced component gain for the given phoneme index (0-31).">noiseGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#a1234a72b76a952865642c783e80d4d84" title="Returns the formant frequency for the given phoneme index (0-31) and partial (0-3)...">formantFrequency</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> partial );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#aaa22b87de100770a4995632932c324bb" title="Returns the formant radius for the given phoneme index (0-31) and partial (0-3).">formantRadius</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> partial );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#a212b5fd0d61c8e4b08a78bb9912f7903" title="Returns the formant gain for the given phoneme index (0-31) and partial (0-3).">formantGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> partial );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00046"></a>00046 <span class="keyword">private</span>:
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00048"></a>00048 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> phonemeNames[][4];
|
||||
<a name="l00049"></a>00049 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat phonemeGains[][2];
|
||||
<a name="l00050"></a>00050 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat phonemeParameters[][4][3];
|
||||
<a name="l00051"></a>00051 };
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00053"></a>00053 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00055"></a>00055 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
102
doc/html/PitShift_8h_source.html
Normal file
102
doc/html/PitShift_8h_source.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>PitShift.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PITSHIFT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PITSHIFT_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
|
||||
<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>00020 <span class="keyword">const</span> <span class="keywordtype">int</span> maxDelay = 5024;
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a><a class="code" href="classstk_1_1PitShift.html">00022</a> <span class="keyword">class </span><a class="code" href="classstk_1_1PitShift.html" title="STK simple pitch shifter effect class.">PitShift</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00023"></a>00023 {
|
||||
<a name="l00024"></a>00024 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1PitShift.html#a8fdf3ef3b1a94e126a2953c6b8ed8cca" title="Class constructor.">PitShift</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PitShift.html#afa1b0ff95ef9a22991525f72d703220e" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PitShift.html#a1ade8534def67636af6f0d7e50825891" title="Set the pitch shift factor (1.0 produces no shift).">setShift</a>( StkFloat shift );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1PitShift.html#a782ad7b47c450c1584cebd20570f17e3">00035</a> StkFloat <a class="code" href="classstk_1_1PitShift.html#a782ad7b47c450c1584cebd20570f17e3" 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="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 StkFloat <a class="code" href="classstk_1_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033" title="Input one sample to the effect and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00049"></a>00049 <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_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033" 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="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00060"></a>00060 <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_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033" 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="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 <span class="keyword">protected</span>:
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_[2];
|
||||
<a name="l00065"></a>00065 StkFloat delay_[2];
|
||||
<a name="l00066"></a>00066 StkFloat env_[2];
|
||||
<a name="l00067"></a>00067 StkFloat rate_;
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delayLength_;
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> halfLength_;
|
||||
<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_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033">00073</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033" title="Input one sample to the effect and return one output.">PitShift :: tick</a>( StkFloat input )
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 <span class="comment">// Calculate the two delay length values, keeping them within the</span>
|
||||
<a name="l00076"></a>00076 <span class="comment">// range 12 to maxDelay-12.</span>
|
||||
<a name="l00077"></a>00077 delay_[0] += rate_;
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">while</span> ( delay_[0] > maxDelay-12 ) delay_[0] -= delayLength_;
|
||||
<a name="l00079"></a>00079 <span class="keywordflow">while</span> ( delay_[0] < 12 ) delay_[0] += delayLength_;
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 delay_[1] = delay_[0] + halfLength_;
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">while</span> ( delay_[1] > maxDelay-12 ) delay_[1] -= delayLength_;
|
||||
<a name="l00083"></a>00083 <span class="keywordflow">while</span> ( delay_[1] < 12 ) delay_[1] += delayLength_;
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00085"></a>00085 <span class="comment">// Set the new delay line lengths.</span>
|
||||
<a name="l00086"></a>00086 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( delay_[0] );
|
||||
<a name="l00087"></a>00087 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( delay_[1] );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="comment">// Calculate a triangular envelope.</span>
|
||||
<a name="l00090"></a>00090 env_[1] = fabs( ( delay_[0] - halfLength_ + 12 ) * ( 1.0 / (halfLength_ + 12 ) ) );
|
||||
<a name="l00091"></a>00091 env_[0] = 1.0 - env_[1];
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="comment">// Delay input and apply envelope.</span>
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = env_[0] * delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input );
|
||||
<a name="l00095"></a>00095 lastFrame_[0] += env_[1] * delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input );
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="comment">// Compute effect mix and output.</span>
|
||||
<a name="l00098"></a>00098 lastFrame_[0] *= effectMix_;
|
||||
<a name="l00099"></a>00099 lastFrame_[0] += ( 1.0 - effectMix_ ) * input;
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/Plucked_8h_source.html
Normal file
107
doc/html/Plucked_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Plucked.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PLUCKED_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PLUCKED_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 "OneZero.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Noise.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="l00032"></a>00032 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Plucked.html">00034</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Plucked.html" title="STK basic plucked string class.">Plucked</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</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_1Plucked.html#a65eee23eda411e7fd82bf4a555d8dd85" title="Class constructor, taking the lowest desired playing frequency.">Plucked</a>( StkFloat lowestFrequency = 10.0 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Plucked.html#a6232b4a1ed48407fe9e66e1835011b5e" title="Class destructor.">~Plucked</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_1Plucked.html#a32a7063198af354fc007e3d903e21208" title="Reset and clear all internal state.">clear</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_1Plucked.html#a1864c705b85633542621ba3ba4491331" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Plucked.html#a9c8741ae249b590d24937743caf11f6c" title="Pluck the string with the given amplitude using the current frequency.">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Plucked.html#a1a8ce6b094c8e2b5c6dda805c032cd44" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Plucked.html#aba5a6b6850874da55c32388e9857d6fc" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 StkFloat <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<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_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" 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 <a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00074"></a>00074 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> loopFilter_;
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> pickFilter_;
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 StkFloat loopGain_;
|
||||
<a name="l00079"></a>00079 };
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25">00081</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">Plucked :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00082"></a>00082 {
|
||||
<a name="l00083"></a>00083 <span class="comment">// Here's the whole inner loop of the instrument!!</span>
|
||||
<a name="l00084"></a>00084 <span class="keywordflow">return</span> lastFrame_[0] = 3.0 * delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( loopFilter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_ ) );
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a><a class="code" href="classstk_1_1Plucked.html#ab9bb602c6f6867cf00995bc42101c006">00087</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_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">Plucked :: 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="l00088"></a>00088 {
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<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> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00092"></a>00092 oStream_ << <span class="stringliteral">"Plucked::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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 *samples = &frames[channel];
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<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#a05b1ab6fa750a8221a7d65c30e0cdab9" 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_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">else</span> {
|
||||
<a name="l00104"></a>00104 <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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00105"></a>00105 *samples++ = <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00107"></a>00107 *samples++ = lastFrame_[j];
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110
|
||||
<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>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
<a name="l00117"></a>00117 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
100
doc/html/PoleZero_8h_source.html
Normal file
100
doc/html/PoleZero_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.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>PoleZero.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_POLEZERO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_POLEZERO_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="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1PoleZero.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</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_1PoleZero.html#ad9a46d21ee470d7afcd641807b5e314e" title="Default constructor creates a first-order pass-through filter.">PoleZero</a>();
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1PoleZero.html#abeb7feab68b5d8370bd9c2aef94c8541" title="Class destructor.">~PoleZero</a>();
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1PoleZero.html#a8e4a45e4a5263c66e9d447688975ca0f">00032</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#a8e4a45e4a5263c66e9d447688975ca0f" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1PoleZero.html#ae33d1e1f594b4cf9063518c7b065c5f5">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#ae33d1e1f594b4cf9063518c7b065c5f5" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1PoleZero.html#ae3f0fc1182eb06730f09b8137c01779f">00038</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#ae3f0fc1182eb06730f09b8137c01779f" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#af34e485fbcaa1f4985a88a882ca9d5c5" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, StkFloat a1, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#a51264d601b635aa0274c75ba1aa5a048" title="Set the filter for allpass behavior using coefficient.">setAllpass</a>( StkFloat coefficient );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#acb7119d8964215546bbeeb6029f5c46f" title="Create a DC blocking filter with the given pole position in the z-plane.">setBlockZero</a>( StkFloat thePole = 0.99 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232">00062</a> StkFloat <a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" 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_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<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_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" 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="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 };
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a><a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228">00079</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">PoleZero :: tick</a>( StkFloat input )
|
||||
<a name="l00080"></a>00080 {
|
||||
<a name="l00081"></a>00081 inputs_[0] = gain_ * input;
|
||||
<a name="l00082"></a>00082 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] - a_[1] * outputs_[1];
|
||||
<a name="l00083"></a>00083 inputs_[1] = inputs_[0];
|
||||
<a name="l00084"></a>00084 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00085"></a>00085
|
||||
<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_1PoleZero.html#a1b5e97a13c582d97cfaa7fcbd4211b47">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_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">PoleZero :: 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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00093"></a>00093 oStream_ << <span class="stringliteral">"PoleZero::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" 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#aec7ef9c46675a24111aa6e2fda3ba870" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00101"></a>00101 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00102"></a>00102 *samples = b_[0] * inputs_[0] + b_[1] * inputs_[1] - a_[1] * outputs_[1];
|
||||
<a name="l00103"></a>00103 inputs_[1] = inputs_[0];
|
||||
<a name="l00104"></a>00104 outputs_[1] = *samples;
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00108"></a>00108 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user