Version 4.1.2

This commit is contained in:
Gary Scavone
2009-03-24 23:02:13 -04:00
committed by Stephen Sinclair
parent 6e0d1955a8
commit 586b0add5f
125 changed files with 7301 additions and 5337 deletions

View File

@@ -1,6 +1,6 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2002.
By Perry R. Cook and Gary P. Scavone, 1995-2004.
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people just choose the classes they need for a particular project and copy those to their project directory. Others like to compile and link to a library of object files. STK was not designed with one particular style of use in mind.
@@ -19,14 +19,15 @@ Several options can be passed to configure, including:
--disable-realtime = only compile generic non-realtime classes
--enable-debug = enable various debug output
--with-alsa = choose native ALSA API support (linux only)
--with-jack = choose native JACK server API support (linux only)
--enable-midiator = enable native MS-124W MIDI support (linux only)
Typing "./configure --help" will display all the available options. In addition, it is possible to specify the RAWWAVES and INCLUDE paths to configure as (ex. to set to /home/gary/rawwaves and /home/gary/include):
At the moment, it is not possible to specify more than one Linux audio API, though this will change in the next release. Typing "./configure --help" will display all the available options. In addition, it is possible to specify the RAWWAVES and INCLUDE paths to configure as (ex. to set to /home/gary/rawwaves and /home/gary/include):
./configure RAWWAVE_PATH="/home/gary/rawwaves/"
./configure INCLUDE_PATH="/home/gary/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).
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):

2
README
View File

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

189
bin/treesed Executable file
View File

@@ -0,0 +1,189 @@
#!/usr/bin/perl
# treesed
# Written January 1996 by Rick Jansen (rick@sara.nl)
# URL: http://www.sara.nl/rick
# usage: treesed pattern1 pattern2 -tree
# treesed pattern1 pattern2 -files file1 file2 ...
# example: treesed href HREF -files *.html
# Treesed searches for pattern1 and replaces pattern1 by pattern2
# if pattern2 supplied. If only pattern1 given treesed just searches.
# Treesed will search in all files and subdirectories of the current
# directory
#--------------------------------------------------------
# Parameters
$DoEdit=0;
$search_pattern = $ARGV[0];
$search_pattern =~ s/(\W)/\\$1/g; # escape regexp chars
shift;
while ($#ARGV >= 0) {
if ($ARGV[0] eq '-files') {
@temp_ls = @ARGV[1 .. $#ARGV];
# Get list of files, skip dirs
foreach $file (@ARGV[1 .. $#ARGV]) {
if (-f $file) {
push(@ls, $file);
}
}
last;
}
elsif ($ARGV[0] eq '-tree') {
&Get_LS;
last;
}
if (! -f $ARGV[0]) {
if (defined($replacement_pattern)) {
print "usage: treesed pattern1 <pattern2> -tree/-files <files>\n";
exit(1);
}
$replacement_pattern = $ARGV[0];
#$replacement_pattern =~ s/(\W)/\\$1/g; # escape regexp chars
$DoEdit=1;
shift;
}
}
# No files?
if ($#ls < 0) {
print "xx No input files\n";
exit(1);
}
print "search_pattern: $search_pattern\n";
print "replacement_pattern: $replacement_pattern\n";
if ($DoEdit) {
print "\n** EDIT MODE!\n\n"; }
else {
print "\n** Search mode\n\n";
}
#foreach $file (@ls) {
# print "$file \n";
#}
#--------------------------------------------------------
# Search list of files for pattern
$linepos=0;
$| = 1; # Force flush after every write
foreach $file (@ls) {
#print "$file\n";
print '.';
$linepos++;
if ($linepos > 50) {
$linepos=0;
print "\n";
}
if (!open(FILE, $file)) {
print "\nCould not open $file\n";
next;
}
$Found = 0;
$Count = 0;
$lineno = 0;
@lines = ();
while (<FILE>) {
$lineno++;
if (/$search_pattern/i) {
#print;
$Count++;
$Found = 1;
push(@lines, $lineno);
}
}
close(FILE);
if ($Found) {
print "\n$file: $Count lines on: @lines\n";
}
if ($Found && $DoEdit) { &Edit($file); }
}
$| = 0;
print "\n";
exit(0);
#--------------------------------------------------------
# Edit file
sub Edit {
# Replace $ARGV[0] with $ARGV[1] in $file
local($file) = @_;
local($bakfile) = $file.'.'.$$;
# First create backup
open(FILE, $file) || die "Could not open $file for read\n";
open(BAKFILE, ">$bakfile") || die "Could not open $bakfile for backup\n";
while (<FILE>) {
print BAKFILE;
}
close(BAKFILE);
close(FILE);
# Now replace $ARGV[0] by $ARGV[1] in the backupfile,
# result into $file
open(BAKFILE, $bakfile) || die "Could not open $bakfile for read\n";
open(FILE,">$file") || die "Could not open $file for write\n";
$Count=0;
while (<BAKFILE>) {
if (/$search_pattern/i) { $Count++; }
s/$search_pattern/$replacement_pattern/gi;
print FILE;
}
close(BAKFILE);
close(FILE);
print
"\nReplaced $search_pattern by $replacement_pattern on $Count lines in $file\n";
} #sub Edit
#--------------------------------------------------------
sub Get_LS {
# Get a list of full path names into array @ls
local(@localls)=`ls -R1`;
local($item,$Dir);
#print "localls: @localls\n";
$Dir='';
foreach $item (@localls) {
#print "$item\n";
if ($item =~ /:$/) {
$Dir=$item;
chop($Dir);
$Dir =~ s/:$/\//;
}
else {
chop($item);
$item = $Dir.$item;
if ($item !~ /^\s*$/) { push(@ls, $item); }
}
}
@localls=();
} # sub Get_LS

View File

@@ -1,16 +1,12 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(STK, 4.1, gary@ccrma.stanford.edu, stk)
AC_INIT(STK, 4.1.2, gary@ccrma.stanford.edu, stk)
AC_CONFIG_SRCDIR(src/Stk.cpp)
AC_CONFIG_FILES(src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile)
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX(CC g++ c++ cxx)
AC_PROG_CXX(g++ CC c++ cxx)
AC_PROG_CXX
AC_PROG_RANLIB
# Checks for libraries.
AC_CHECK_LIB(stdc++, printf, , AC_MSG_ERROR(Stk requires the C++ library!) )
# Checks for header files.
AC_HEADER_STDC
@@ -40,6 +36,9 @@ AC_MSG_CHECKING(whether to compile realtime support)
AC_ARG_ENABLE(realtime, [ --disable-realtime = only compile generic non-realtime classes], [AC_SUBST( realtime, [no] ) AC_SUBST( sound_api, [] )], [AC_SUBST( realtime, [yes] ) ] )
AC_MSG_RESULT($realtime)
# Check for math library
AC_CHECK_LIB(m, cos, , AC_MSG_ERROR(math library is needed!))
if test $realtime = yes; then
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(realtime support requires the pthread library!))
AC_CHECK_FUNCS(gettimeofday select socket)
@@ -54,7 +53,7 @@ AC_ARG_ENABLE(debug,
# Check compiler and use -Wall if gnu.
if test $GXX = "yes" ; then
AC_SUBST( warn, [-Wall] )
AC_SUBST( warn, ["-Wall -g"] )
fi
if test $realtime = yes; then
@@ -63,16 +62,43 @@ if test $realtime = yes; then
AC_MSG_CHECKING(for audio API)
case $host in
*-*-linux*)
AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_ALSA__] ) AC_MSG_RESULT(using ALSA) ], [AC_SUBST( sound_api, [-D__LINUX_OSS__] ) AC_MSG_RESULT(using OSS)])
AC_SUBST( sound_api, [_NO_API_] )
# Look for Jack flag
AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_JACK__] ) AC_MSG_RESULT(using JACK)] , )
if [test $sound_api = -D__LINUX_JACK__;] then
TEMP_LIBS=$LIBS
AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
LIBS="`pkg-config --cflags --libs jack` $TEMP_LIBS -lasound"
audio_apis="-D__LINUX_JACK__"
fi
# Look for Alsa flag
AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_ALSA__] ) AC_MSG_RESULT(using ALSA)], )
if test $sound_api = -D__LINUX_ALSA__; then
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
audio_apis="-D__LINUX_ALSA__ $audio_apis"
fi
# Look for OSS flag
AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_OSS__] ) AC_MSG_RESULT(using OSS)], )
if test $sound_api = -D__LINUX_OSS__; then
audio_apis="-D__LINUX_OSS__ $audio_apis"
fi
# If no audio api flags specified, use OSS
if [test $sound_api = _NO_API_;] then
AC_SUBST( sound_api, [-D__LINUX_OSS__] )
AC_MSG_RESULT(using OSS)
AC_SUBST( audio_apis, [-D__LINUX_OSS__] )
fi
AC_ARG_ENABLE(midiator, [ --enable-midiator = enable native MS-124W MIDI support (linux only)], [AC_SUBST( midiator, [-D__MIDIATOR__] )], [AC_SUBST( midiator, [] )])
;;
*-sgi*)
AC_SUBST( sound_api, [-D__IRIX_AL__] )
AC_SUBST( audio_apis, ["-D__IRIX_AL__ -LANG:std -w"] )
AC_MSG_RESULT(using IRIX AL)
AC_CHECK_LIB(audio, alOpenPort, , AC_MSG_ERROR(IRIX audio support requires the audio library!) )
AC_CHECK_LIB(md, mdOpenInPort, , AC_MSG_ERROR(IRIX MIDI support requires the md library!) )
@@ -81,9 +107,11 @@ if test $realtime = yes; then
*-apple*)
# Check for CoreAudio and CoreMIDI framework
AC_CHECK_HEADERS(CoreAudio/CoreAudio.h CoreMIDI/CoreMIDI.h CoreServices/CoreServices.h,
[AC_SUBST( sound_api, [-D__MACOSX_CORE__] )],
[AC_SUBST( audio_apis, [-D__MACOSX_CORE__] )],
[AC_MSG_ERROR(CoreAudio and/or CoreMIDI header files not found!)] )
AC_SUBST( frameworks, ["-framework CoreAudio -framework CoreMIDI -framework CoreFoundation"] )
# Explicitly link with c++ library.
AC_CHECK_LIB(stdc++, printf, , AC_MSG_ERROR(Stk requires the C++ library!) )
;;
*)

View File

@@ -1,6 +1,6 @@
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
By Perry R. Cook and Gary P. Scavone, 1995-2002.
By Perry R. Cook and Gary P. Scavone, 1995-2004.
STK Classes - See the HTML documentation in the html directory for complete information.
@@ -77,7 +77,7 @@ Sources: Envelope.cpp Linearly Goes to Target by Rate
TcpWvIn.cpp Audio Streaming (socket server) Input Class (subclass of WvIn)
Sinks: WvOut.cpp Output Master Class for RAW, WAV, SND (AU), AIFF, MAT-file files
RtWvOut.cpp Realtime Output Class (subclass of WvOut)
RtWvOut.cpp Realtime Audio Output Class (subclass of WvOut)
TcpWvOut.cpp Audio Streaming (socket client) Output Class (subclass of WvOut)
Duplex: RtDuplex.cpp Synchronous Realtime Audio Input/Output Class
@@ -98,14 +98,14 @@ Non-Linear: JetTabl.cpp Cubic Jet Non-Linearity
BowTabl.cpp x^(-3) Bow Non-Linearity
ReedTabl.cpp One Breakpoint Saturating Reed Non-Linearity
Derived: Modulate.cpp Periodic and Random Vibrato: RawWvIn, SubNoise, OnePole
Derived: Modulate.cpp Periodic and Random Vibrato: WvIn, SubNoise, OnePole
SingWave.cpp Looping wave table with randomness: Modulate, WaveLoop, Envelope
********** INSTRUMENTS AND ALGORITHMS **************
Each Class will be listed either with all the unit generators it uses,
or the <<Algorithm>> of which it is a flavor. All inherit from Instrmnt,
Each class is listed either with some of the unit generators it uses,
or in terms of the algorithm it implements. All inherit from Instrmnt,
which inherits from Stk.
Simple.cpp Simple Instrument Pulse oscillator + resonant filtered noise

View File

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

View File

@@ -1,12 +1,12 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2002.
By Perry R. Cook and Gary P. Scavone, 1995-2004.
Please read the file README and INSTALL for more general STK information.
Realtime support for Macintosh OS X uses the CoreAudio HAL API and is specified during compilation using the __MACOSX_CORE__ preprocessor definition.
It is necessary to download the OS X developer kit in order to compile STK. STK was successfully tested on OS X versions 10.1 and 10.2.
It is necessary to download the OS X developer kit in order to compile STK. STK was successfully tested on OS X version 10.2.
The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. Therefore, it is necessary to either specify this rate as a command-line option to the STK example programs or to change the default sample rate inside the Stk.h file before compilation. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.
@@ -15,15 +15,8 @@ There is a potential conflict between the STK Delay class and a Delay() function
Tcl/Tk on OS X:
The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. Binary distributions exist but it is instead recommended that you download recent tcl and tk source distributions (http://dev.scriptics.com/software/tcltk/downloadnow84.tml) and compile them as follows:
make -C tcl/macosx deploy
make -C tk/macosx deploy
sudo make -C tcl/macosx install-deploy
sudo make -C tk/macosx install-deploy
(Note: the tcl and tk directories specified in the above lines will more likely be appended with version numbers) The default installation will place a link to the wish interpretor at /usr/bin/wish. The latest 8.4.1 release of tcl/tk has been tested on a 10.2 system and found to work correctly. In particular, redirection of a tcl/tk script to the interpreter (e.g., wish < test.tcl) works normally (which is not the case with binary distributions tested thus far).
The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. The latest Tcl/Tk Aqua distribution (http://www.apple.com/downloads/macosx/unix_open_source/tcltk.html) has been successfully tested on a 10.2 system. The default installation will place a link to the wish interpretor at /usr/bin/wish.
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates.
Also, it is not recommended to connect by socket from a tcl/tk script to an STK program because the tcl/tk interpreter does not appear to properly close the socket connection, leaving the STK program in a "hung" state.
It is possible to connect a tcl/tk interface to an STK program via a socket connection. However, the tcl/tk interpreter does not appear to properly close the socket connection during disconnection. It is therefore necessary to type "Exit" in the STK program terminal window to properly exit the STK program.

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,20 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2002.
By Perry R. Cook and Gary P. Scavone, 1995-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 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 changes
- updated <iostream> include statements and appended "std::" as necessary throughout for compatibility with gcc 3
v4.1.1: (24 October 2002)
- bug fix in RtAudio for Macintosh OS X and Windows ASIO duplex operation
@@ -122,4 +136,4 @@ v1.0:
v0.8:
- One of (if not THE) original distributions for SGI, NeXTStep, and basic Win support. I think this came out in 1996.
- One of (if not THE) original distributions for SGI, NeXTStep, and basic Win support. I think this came out in 1996.

View File

@@ -1,44 +1,56 @@
# Doxyfile 1.2.6
# Doxyfile 1.3.6
#---------------------------------------------------------------------------
# General configuration options
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = STK
PROJECT_NUMBER =
OUTPUT_DIRECTORY = .
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CLASS_DIAGRAMS = YES
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
ENABLED_SECTIONS =
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
ALIASES =
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
@@ -46,22 +58,37 @@ SHOW_USED_FILES = YES
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = . ../../include
FILE_PATTERNS = *.txt *.h
INPUT = . \
../../include
FILE_PATTERNS = *.txt \
*.h \
*.cpp
RECURSIVE = YES
EXCLUDE =
EXCLUDE_PATTERNS =
EXCLUDE = ../../src/asio
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
@@ -72,11 +99,14 @@ IGNORE_PREFIX =
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = ../html
HTML_FILE_EXTENSION = .html
HTML_HEADER = header.html
HTML_FOOTER = footer.html
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
@@ -89,6 +119,8 @@ TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = letter
EXTRA_PACKAGES =
@@ -96,6 +128,7 @@ LATEX_HEADER = header.tex
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -104,12 +137,33 @@ RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
@@ -121,35 +175,38 @@ INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =

View File

@@ -58,7 +58,7 @@ g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp
Note that the <TT>sineosc.cpp</TT> example does not make use of realtime audio or MIDI input/output classes. For programs using any of the STK realtime classes mentioned above, it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks.
When working with a number of different projects that make use of ToolKit classes, the above approach can become cumbersome (especially when trying to synchronize with new STK releases). The example STK projects (e.g., demo, effects, ...) contain <TT>Makefiles</TT> (built by the configure script) which compile project-specific class objects from the distribution <TT>src</TT> and <TT>include</TT> directories. This approach makes it relatively easy when upgrading to a new STK release (by making path substitutions in the <TT>Makefile</TT> or by moving the projects to a similar relative path within the new STK source tree). A <TT>Makefile</TT> of this sort is provided in the <TT>projects/examples</TT> directory for compiling all the tutorial programs, as well as other example programs. To compile the <TT>sineosc.cpp</TT> program, for example, one need only type <TT>make sineosc</TT> from within the <TT>projects/examples</TT> directory.
When working with a number of different projects that make use of ToolKit classes, the above approach can become cumbersome (especially when trying to synchronize with new STK releases). Most of the STK projects (e.g., demo, effects, ...) contain <TT>Makefiles</TT> (built by the configure script) which compile project-specific class objects from the distribution <TT>src</TT> and <TT>include</TT> directories. This approach makes it relatively easy when upgrading to a new STK release (by making path substitutions in the <TT>Makefile</TT> or by moving the projects to a similar relative path within the new STK source tree). A <TT>Makefile</TT> is provided in the <TT>projects/examples</TT> directory for compiling all the tutorial programs, as well as other example programs. To compile the <TT>sineosc.cpp</TT> program, for example, one need only type <TT>make sineosc</TT> from within the <TT>projects/examples</TT> directory. Note that this particular <TT>Makefile</TT> depends on a static library, as described in the next section.
\subsection library Library Use:

View File

@@ -1,26 +1,41 @@
/*! \page download Download and Release Notes
<B>Version 4.1.1, 24 October 2002</B><P>
<B>Version 4.1.2, 15 March 2004</B><P>
<UL>
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.1.tar.gz">Source distribution</A> (1.2 MB tar/gzipped)</LI>
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.1.binaries.tar.gz">Source with precompiled Windows binaries</A> (2.0 MB tar/gzipped)</LI>
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.1-1.i386.rpm">Linux RPM</A> (1.2 MB) <B>Note: Library and Makefiles built for ALSA, though the rpm can be rebuilt to use OSS</B></LI>
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stkmanual.pdf">STK Manual (PDF)</A> (1.62 MB) <B>Note: HTML version already in /doc/html/ directory of distribution</B></LI>
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.2.tar.gz">Source distribution</A></LI>
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.2.binaries.tar.gz">Source with precompiled Windows binaries</A></LI>
<LI><A HREF="http://www-ccrma.stanford.edu/planetccrma/software/">Linux RPMs from Planet CCRMA</A></LI>
</UL>
\section notes Release Notes:
\subsection v4dot1dot3 Version 4.1.1
\subsection v4dot1dot2 Version 4.1.2
<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>
<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
<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
<UL>

View File

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

View File

@@ -5,6 +5,6 @@
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<img src="princeton.gif"> &nbsp; <img src="ccrma.gif"><P>
<img src="princeton.gif"> &nbsp; <img src="ccrma.gif"> &nbsp; <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="information.html">Information</a> &nbsp; <a class="qindex" href="classes.html">Classes</a> &nbsp; <a class="qindex" href="download.html">Download</a> &nbsp; <a class="qindex" href="usage.html">Usage</a> &nbsp; <a class="qindex" href="maillist.html">Mail List</a> &nbsp; <a class="qindex" href="system.html">Requirements</a> &nbsp; <a class="qindex" href="links.html">Links</a> &nbsp; <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<HR>

View File

@@ -2,6 +2,8 @@
<BODY BGCOLOR="white">
<center><h3>Perry R. Cook & Gary P. Scavone</h3></center>
The <B>Synthesis ToolKit in C++ (STK)</B> is a set of open source audio signal processing and algorithmic synthesis classes written in C++. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
- \ref information
@@ -18,4 +20,5 @@ The <B>Synthesis ToolKit in C++ (STK)</B> is a set of open source audio signal p
<P>
<FONT SIZE=-1>
STK is a registered trademark of Analytical Graphics, Inc., 40 General Warren Blvd., Malvern, PA 19355, the manufacturer of the Satellite Tool Kit<69> (STK<54>) family of satellite simulation software. Although the term "STK" is used in this website, the content of this site is in no way related to Analytical Graphics, Inc, or its registered STK mark. Nothing in this website should be construed to mean that a business relationship, either past or present, exists between Analytical Graphics, Inc. and the owners of this particular website.
</FONT>
</FONT>

View File

@@ -4,8 +4,16 @@
- <A HREF="http://kern.humdrum.net/">Kern Scores: A Library of Electronic Musical Scores</A> (with automatic conversion to SKINI format)
- <A HREF="http://stk.sapp.org/midi2skini">MIDI to SKINI file converter</A> by Craig Sapp
- <A HREF="http://stk.sapp.org/kern2skini">Kern Score to SKINI file converter</A> by Craig Sapp
- <A HREF="http://www.artassault.org/software/software.html">Calico - A Polyphonic Score File Parser for STK</A> by Greg Kellum
- <A HREF="http://www.music.columbia.edu/PeRColate/">PeRColate: A Port of STK for Max/MSP</A>
- <A HREF="http://mathmorphs.swiki.net/32/">A Partial Port of STK to Squeak</A>
*/
- <a href="http://airy.andre.online.fr/AU/index.html">AUStk: a demo of integration of STK instruments into an AudioUnit</a> by Airy Andre
*/

View File

@@ -2,6 +2,8 @@
An <A HREF="mailto:stk-request@ccrma.stanford.edu">STK</A> mailing list has been set up to facilitate communication among STK users. Subscribing to this list is your best way of keeping on top of new releases, bug fixes, and various user developments.
<P>
For answers to frequently asked questions, check the list <A HREF="http://ccrma-mail.stanford.edu/pipermail/stk/">archives</A>.
<P>
To join send a message to <A HREF="mailto:stk-request@ccrma.stanford.edu">&lt;stk-request@ccrma.stanford.edu&gt;</A>
with the contents: <TT>subscribe</TT>

View File

@@ -108,7 +108,7 @@ int main()
}
\endcode
Assuming the program is compiled as <TT>threebees</TT>, the three-voice SKINI scorefile <A HREF="tutorial/bachfugue.ski"><TT>bachfugue.ski</TT></A> could be redirected to the program as:
Assuming the program is compiled as <TT>threebees</TT>, the three-voice SKINI scorefile <A HREF="tutorial/bachfugue.ski"><TT>bachfugue.ski</TT></A> (also located in the <tt>scores</tt> directory with the examples) could be redirected to the program as:
\code
threebees < bachfugue.ski

View File

@@ -15,17 +15,10 @@
<B>Macintosh OS X (specific):</B>
<UL>
<LI>A C++ compiler does not ship by default with OS X. It is necessary to download the Developer Kit from the Apple WWW site in order to compile STK.</LI>
<LI>The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. Therefore, it is necessary to either specify this rate as a command-line option to the STK example programs or to change the default sample rate inside the Stk.h file before compilation. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.</LI>
<LI>The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. Binary distributions exist but it is instead recommended that you download recent tcl and tk source distributions (http://dev.scriptics.com/software/tcltk/downloadnow84.tml) and compile them as follows:
<LI><B>IMPORTANT:</B>The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. Therefore, it is necessary to either specify this rate as a command-line option to the STK example programs or to change the default sample rate inside the Stk.h file before compilation. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.</LI>
<LI>The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. The latest Tcl/Tk Aqua distribution (http://www.apple.com/downloads/macosx/unix_open_source/tcltk.html) has been successfully tested on a 10.2 system. The default installation will place a link to the wish interpretor at /usr/bin/wish.
make -C tcl/macosx deploy<BR>
make -C tk/macosx deploy<BR>
sudo make -C tcl/macosx install-deploy<BR>
sudo make -C tk/macosx install-deploy<BR>
(Note: the tcl and tk directories specified in the above lines will more likely be appended with version numbers) The default installation will place a link to the wish interpretor at /usr/bin/wish. The latest 8.4.1 release of tcl/tk has been tested on a 10.2 system and found to work correctly. In particular, redirection of a tcl/tk script to the interpreter (e.g., wish < test.tcl) works normally (which is not the case with binary distributions tested thus far).
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates. Also, it is not recommended to connect by socket from a tcl/tk script to an STK program because the tcl/tk interpreter does not appear to properly close the socket connection, leaving the STK program in a "hung" state.</LI>
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates. It is possible to connect a tcl/tk interface to an STK program via a socket connection. However, the tcl/tk interpreter does not appear to properly close the socket connection during disconnection. It is therefore necessary to type "Exit" in the STK program terminal window to properly exit the STK program.</LI>
</UL>

175
doc/treesed.html Normal file
View File

@@ -0,0 +1,175 @@
<html>
<head>
<title>Treesed Usage</title>
</head>
<body>
<table border="0" width="660" cellpadding="0" cellspacing="0">
<tbody><tr valign="top"><td width="165">
<h3>How to Use Treesed</h3>
Go to the directory where you want to search or make changes.
<p>
There are two choices you can make when using treesed:
</p><ol>
<li>Do I just want to search for a text, or do I want to search for a
text and replace it with something else?
<br>
If you are just searching you are using Treesed in "search mode", otherwise it is in
"replace mode."
</li><li>Do I want to search/replace only in files in my current directory,
or should files in all subdirectories (and all directories below that)
also be done?
</li></ol>
Some examples will make this clear.
<h4>Searching</h4>
Say you are faced with the situation that the author of a slew of web-pages, Nathan Brazil, has left and has been succeeded by Mavra Chang. First, let us see which files are affected by this (what you type in is shown in <b><tt>bold</tt></b>):
<blockquote>
<pre>[localhost] <b>treesed "Nathan Brazil" -files *.html</b>
search_pattern: Nathan\ Brazil
replacement_pattern:
** Search mode
.
midnight.html: 1 lines on: 2
..
well.html: 1 lines on: 3
</pre>
</blockquote>
We notice the following:
<ul>
<li>The search text <tt>"Nathan Brazil"</tt> is enclosed in
double-quotes (<tt>"</tt>).
</li><li>You specify which files to search with <tt>-files</tt> followed by a
list of file names--in this case <tt>*.html</tt>.
</li><li>Treesed reports the search pattern ("pattern" is just a fancy word
for "text") you specified (you can ignore
that \).
</li><li>Treesed reports an empty <tt>replacement_pattern</tt>. This is
correct, because you haven't entered one.
</li><li>It therefore deduces that is is in search mode.
</li><li>It finds two files containing "Nathan Brazil", and reports on which
lines of these files it found it; it does not show the lines themselves.
</li></ul>
Because you used <tt>-files</tt>, Treesed will search in the files you
specify <i>in the current directory</i>. You can also search files in
the current directory <i>and</i> all directories below it. However, in
that case you can not specify which file names to use, all files will be
searched:
<blockquote>
<pre>[localhost] <b>treesed "Nathan Brazil" -tree</b>
search_pattern: Nathan\ Brazil
replacement_pattern:
** Search mode
.
midnight.html: 1 lines on: 2
...
well.html: 1 lines on: 3
.
new/echoes.html: 1 lines on: 2
</pre>
</blockquote>
We notice the following:
<ul>
<li>Instead of <tt>-files</tt> we now see <tt>-tree</tt>.
</li><li>We do not see a specification of file names.
</li><li>Treesed finds an occurence of "Nathan Brazil" in the file
<tt>echoes.html</tt> in the subdirectory <tt>new</tt>; it did not
find this file in the previous example (as it shouldn't).
</li></ul>
<h4>Replacing</h4>
To replace a text you simply add the replacement text right after the
search text:
<blockquote>
<pre>[localhost] <b>treesed "Nathan Brazil" "Mavra Change" -files *.html</b>
search_pattern: Nathan\ Brazil
replacement_pattern: Mavra Chang
** EDIT MODE!
.
midnight.html: 1 lines on: 2
Replaced Nathan\ Brazil by Mavra Chang on 1 lines in midnight.html
..
well.html: 1 lines on: 3
Replaced Nathan\ Brazil by Mavra Chang on 1 lines in well.html
</pre>
</blockquote>
We notice the following:
<ul>
<li>Right after the search text "Nathan Brazil" you specify the
replacement text "Mavra Chang".
</li><li>As a result, Treesed now reports a non-empty
<tt>replacement_pattern</tt>.
</li><li>Hence it concludes it is in "edit mode", which means replacment mode.
</li><li>Treesed dutifully reports on which lines in which files it did the
replacement.
</li></ul>
To replace a text in all files in the current directory and the ones
below it, we do the following:
<blockquote>
<pre>[localhost] <b>treesed "Nathan Brazil" "Mavra Chang" -tree</b>
search_pattern: Nathan\ Brazil
replacement_pattern: Mavra Chang
** EDIT MODE!
.
midnight.html: 1 lines on: 2
Replaced Nathan\ Brazil by Mavra Chang on 1 lines in midnight.html
....
well.html: 1 lines on: 3
Replaced Nathan\ Brazil by Mavra Chang on 1 lines in well.html
.
new/echoes.html: 1 lines on: 2
Replaced Nathan\ Brazil by Mavra Chang on 1 lines in new/echoes.html
</pre>
</blockquote>
and we get the expected results, including the replace in
<tt>new/echoes.html</tt>.
<h4>Old Versions</h4>
Treesed leaves behind quite a mess of old versions of the files it
changed (only in change-mode, of course). These old files have the same
name as the original file, with <tt>.ddddd</tt> appended to it. For
example, if treesed makes a change to <tt>midnight.html</tt> it will
leave the original version as something like
<tt>midnight.html.26299</tt>. You'll have to remove these files lest
your disk area clutters up. Here is a command that does that, <b>but
beware!</b> This command removes all files in the current directory and
all below it, that end in a period followed by one or more
digits:
<blockquote>
<pre>find . -name "*.[0-9]*" -exec rm {} \;
</pre>
</blockquote>
It is interesting to note that if you use treesed again without cleaning
up, you may get files like <tt>midnight.html.26299.27654</tt>. These
will also be cleaned up by the above slightly dangerous command.
<h3>About Treesed</h3>
<tt>treesed</tt> is public domain software developed
and designed by Rick Jansen from Sara, Amsterdam, Netherlands, January
1996.
<p>
<h3>About This Document</h3>
This usage document was created by the Division of Information Technology Services at The
University of Western Ontario.
</body></html>

View File

@@ -53,9 +53,11 @@ public:
//! Return the value at \e tapDelay samples from the delay-line input.
/*!
The valid range for \e tapDelay is 1 to the delay-line length.
The tap point is determined modulo the delay-line length and is
relative to the last input value (i.e., a tapDelay of zero returns
the last input value).
*/
MY_FLOAT contentsAt(long tapDelay) const;
MY_FLOAT contentsAt(unsigned long tapDelay) const;
//! Return the last computed output value.
MY_FLOAT lastOut(void) const;

View File

@@ -13,7 +13,7 @@
#define __INSTRMNT_H
#include "Stk.h"
#include <iostream.h>
#include <iostream>
class Instrmnt : public Stk
{
@@ -36,6 +36,12 @@ class Instrmnt : public Stk
//! Return the last output value.
MY_FLOAT lastOut() const;
//! Return the last left output value.
MY_FLOAT lastOutLeft() const;
//! Return the last right output value.
MY_FLOAT lastOutRight() const;
//! Compute one output sample.
virtual MY_FLOAT tick() = 0;

View File

@@ -19,12 +19,26 @@ class Noise : public Stk
{
public:
//! Default constructor.
//! Default constructor which seeds the random number generator with the system time.
Noise();
//! Constructor which seeds the random number generator with a given seed.
/*!
If the seed value is zero, the random number generator is
seeded with the system time.
*/
Noise( unsigned int seed );
//! Class destructor.
virtual ~Noise();
//! Seed the random number generator with a specific seed value.
/*!
If no seed is provided or the seed value is zero, the random
number generator is seeded with the current system time.
*/
void setSeed( unsigned int seed = 0 );
//! Return a random number between -1.0 and 1.0 using rand().
virtual MY_FLOAT tick();

File diff suppressed because it is too large Load Diff

View File

@@ -85,14 +85,13 @@ public:
protected:
RtAudio *audio;
MY_FLOAT *data;
MY_FLOAT *lastOutput;
int bufferSize;
bool stopped;
int stream;
long counter;
unsigned int channels;
RtAudio *audio_;
MY_FLOAT *data_;
MY_FLOAT *lastOutput_;
int bufferSize_;
bool stopped_;
long counter_;
unsigned int channels_;
};

60
include/RtError.h Normal file
View File

@@ -0,0 +1,60 @@
/************************************************************************/
/*! \class RtError
\brief Exception handling class for RtAudio & RtMidi.
The RtError class is quite simple but it does allow errors to be
"caught" by RtError::Type. See the RtAudio and RtMidi
documentation to know which methods can throw an RtError.
*/
/************************************************************************/
#ifndef RTERROR_H
#define RTERROR_H
#include <iostream>
#include <string>
class RtError
{
public:
//! Defined RtError types.
enum Type {
WARNING, /*!< A non-critical error. */
DEBUG_WARNING, /*!< A non-critical error which might be useful for debugging. */
UNSPECIFIED, /*!< The default, unspecified error type. */
NO_DEVICES_FOUND, /*!< No devices found on system. */
INVALID_DEVICE, /*!< An invalid device ID was specified. */
INVALID_STREAM, /*!< An invalid stream ID was specified. */
MEMORY_ERROR, /*!< An error occured during memory allocation. */
INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
DRIVER_ERROR, /*!< A system driver error occured. */
SYSTEM_ERROR, /*!< A system error occured. */
THREAD_ERROR /*!< A thread error occured. */
};
protected:
std::string message_;
Type type_;
public:
//! The constructor.
RtError(const std::string& message, Type type = RtError::UNSPECIFIED) : message_(message), type_(type){}
//! The destructor.
virtual ~RtError(void) {};
//! Prints thrown error message to stderr.
virtual void printMessage(void) { std::cerr << '\n' << message_ << "\n\n"; }
//! Returns the thrown error message type.
virtual const Type& getType(void) { return type_; }
//! Returns the thrown error message string.
virtual const std::string& getMessage(void) { return message_; }
//! Returns the thrown error message as a C string.
virtual const char *getMessageString(void) { return message_.c_str(); }
};
#endif

View File

@@ -90,10 +90,9 @@ public:
protected:
RtAudio *audio;
bool stopped;
int stream;
long counter;
RtAudio *audio_;
bool stopped_;
long counter_;
};

View File

@@ -23,10 +23,12 @@
#include "WvOut.h"
#include "RtAudio.h"
#include "Thread.h"
class RtWvOut : protected WvOut
{
public:
//! Default constructor.
/*!
The \e device argument is passed to RtAudio during
@@ -82,10 +84,9 @@ class RtWvOut : protected WvOut
protected:
RtAudio *audio;
bool stopped;
int stream;
int bufferSize;
RtAudio *audio_;
bool stopped_;
int bufferSize_;
};

View File

@@ -29,7 +29,7 @@
#define __SK_ChannelPressure_ __SK_AfterTouch_
#define __SK_PitchWheel_ 224
#define __SK_PitchBend_ __SK_PitchWheel_
#define __SK_PitchChange_ 249
#define __SK_PitchChange_ 49
#define __SK_Clock_ 248
#define __SK_SongStart_ 250

View File

@@ -3,10 +3,10 @@
\brief STK base class
Nearly all STK classes inherit from this class.
The global sample rate can be queried and
modified via Stk. In addition, this class
provides error handling and byte-swapping
functions.
The global sample rate and rawwave path variables
can be queried and modified via Stk. In addition,
this class provides error handling and
byte-swapping functions.
by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
*/
@@ -15,11 +15,24 @@
#if !defined(__STK_H)
#define __STK_H
// Most data in STK is passed and calculated with the following
// user-definable floating-point type. You can change this to "float"
// if you prefer or perhaps a "long double" in the future.
#include <string>
// Most data in STK is passed and calculated with the
// following user-definable floating-point type. You
// can change this to "float" if you prefer or perhaps
// a "long double" in the future.
typedef double MY_FLOAT;
// The "MY_FLOAT" type will be deprecated in STK
// versions higher than 4.1.2 and replaced with the variable
// "StkFloat".
//typedef double StkFloat;
//#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
// #pragma deprecated(MY_FLOAT)
//#else
// typedef StkFloat MY_FLOAT __attribute__ ((deprecated));
//#endif
//! STK error handling class.
/*!
This is a fairly abstract exception handling class. There could
@@ -74,8 +87,8 @@ public:
static const STK_FORMAT STK_SINT8; /*!< -128 to +127 */
static const STK_FORMAT STK_SINT16; /*!< -32768 to +32767 */
static const STK_FORMAT STK_SINT32; /*!< -2147483648 to +2147483647. */
static const STK_FORMAT STK_FLOAT32; /*!< Normalized between plus/minus 1.0. */
static const STK_FORMAT STK_FLOAT64; /*!< Normalized between plus/minus 1.0. */
static const STK_FORMAT MY_FLOAT32; /*!< Normalized between plus/minus 1.0. */
static const STK_FORMAT MY_FLOAT64; /*!< Normalized between plus/minus 1.0. */
//! Static method which returns the current STK sample rate.
static MY_FLOAT sampleRate(void);
@@ -91,6 +104,12 @@ public:
*/
static void setSampleRate(MY_FLOAT newRate);
//! Static method which returns the current rawwave path.
static std::string rawwavePath(void);
//! Static method which sets the STK rawwave path.
static void setRawwavePath(std::string newPath);
//! Static method which byte-swaps a 16-bit data type.
static void swap16(unsigned char *ptr);
@@ -105,6 +124,7 @@ public:
private:
static MY_FLOAT srate;
static std::string rawwavepath;
protected:
@@ -130,22 +150,23 @@ typedef double FLOAT64;
#define TRUE 1
// The default sampling rate.
#define SRATE (MY_FLOAT) 22050.0
// Real-time audio input and output buffer size. If clicks are
// occuring in the input and/or output sound stream, a larger buffer
// size may help. Larger buffer sizes, however, produce more latency.
#define SRATE (MY_FLOAT) 44100.0
// The default real-time audio input and output buffer size. If
// clicks are occuring in the input and/or output sound stream, a
// larger buffer size may help. Larger buffer sizes, however, produce
// more latency.
#define RT_BUFFER_SIZE 512
// The RAWWAVE_PATH definition is concatenated to the beginning of all
// references to rawwave files in the various STK core classes
// (ex. Clarinet.cpp). If you wish to move the rawwaves directory to
// a different location in your file system, you will need to set this
// path definition appropriately. The current definition is a
// relative reference that will work for the programs in the STK
// projects directory. The path can also be specified to configure and
// set via the Makefiles.
// The default rawwave path value is set with the preprocessor
// definition RAWWAVE_PATH. This can be specified as an argument to
// the configure script, in an integrated development environment, or
// below. The global STK rawwave path variable can be dynamically set
// with the Stk::setRawwavePath() function. This value is
// concatenated to the beginning of all references to rawwave files in
// the various STK core classes (ex. Clarinet.cpp). If you wish to
// move the rawwaves directory to a different location in your file
// system, you will need to set this path definition appropriately.
#if !defined(RAWWAVE_PATH)
#define RAWWAVE_PATH "../../rawwaves/"
#endif
@@ -158,7 +179,7 @@ typedef double FLOAT64;
#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
#define __OS_WINDOWS__
#define __STK_REALTIME__
#elif defined(__LINUX_OSS__) || defined(__LINUX_ALSA__)
#elif defined(__LINUX_OSS__) || defined(__LINUX_ALSA__) || defined(__LINUX_JACK__)
#define __OS_LINUX__
#define __STK_REALTIME__
#elif defined(__IRIX_AL__)

View File

@@ -82,7 +82,7 @@ class TcpWvOut : protected WvOut
protected:
// Write a buffer of length \e frames via the socket connection.
void writeData( long frames );
void writeData( unsigned long frames );
char msg[256];
char *buffer;

View File

@@ -112,12 +112,18 @@ public:
//! Mix the output for all sounding voices.
MY_FLOAT tick();
//! Computer \e vectorSize output mixes and return them in \e vector.
//! Compute \e vectorSize output mixes and return them in \e vector.
MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
//! Return the last output value.
MY_FLOAT lastOut() const;
//! Return the last left output value.
MY_FLOAT lastOutLeft() const;
//! Return the last right output value.
MY_FLOAT lastOutRight() const;
protected:
typedef struct {
@@ -135,7 +141,8 @@ protected:
long tags;
int muteTime;
MY_FLOAT lastOutput;
MY_FLOAT lastOutputLeft;
MY_FLOAT lastOutputRight;
};
#endif

View File

@@ -60,7 +60,7 @@ public:
An StkError will be thrown if the file is not found, its format is
unknown, or a read error occurs.
*/
WvIn( const char *fileName, bool raw = FALSE );
WvIn( const char *fileName, bool raw = FALSE, bool doNormalize = TRUE );
//! Class destructor.
virtual ~WvIn();
@@ -70,7 +70,7 @@ public:
An StkError will be thrown if the file is not found, its format is
unknown, or a read error occurs.
*/
void openFile( const char *fileName, bool raw = FALSE );
void openFile( const char *fileName, bool raw = FALSE, bool doNormalize = TRUE );
//! If a file is open, close it.
void closeFile(void);

View File

@@ -83,19 +83,19 @@ class WvOut : public Stk
//! Output a single sample to all channels in a sample frame.
/*!
An StkError is thrown if a file read error occurs.
An StkError is thrown if a file write error occurs.
*/
virtual void tick(const MY_FLOAT sample);
//! Output each sample in \e vector to all channels in \e vectorSize sample frames.
/*!
An StkError is thrown if a file read error occurs.
An StkError is thrown if a file write error occurs.
*/
virtual void tick(const MY_FLOAT *vector, unsigned int vectorSize);
//! Output the \e frameVector of sample frames of the given length.
/*!
An StkError is thrown if a file read error occurs.
An StkError is thrown if a file write error occurs.
*/
virtual void tickFrame(const MY_FLOAT *frameVector, unsigned int frames = 1);

View File

@@ -40,7 +40,7 @@ LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o Thread.o Socket.o
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif

View File

@@ -157,6 +157,12 @@ int main(int argc,char *argv[])
case __SK_ControlChange_:
j = (int) byte2;
switch(j) {
case __SK_PitchChange_:
sprintf(s,"PitchChange\t%.3f %d %.1f\n",0.0,channel,byte3);
if (writeFile) {
fprintf(file,"PitchChange\t%.3f %d %.1f\n",dt,channel,byte3);
}
break;
case __SK_Volume_:
sprintf(s,"Volume\t%.3f %d %.1f\n",0.0,channel,byte3);
if (writeFile) {

View File

@@ -1 +1 @@
wish < tcl/Modal.tcl | demo ModalBar -or -ip
wish < tcl/Modal.tcl | ./demo ModalBar -or -ip

View File

@@ -1 +1 @@
wish < tcl/Physical.tcl | demo Clarinet -or -ip
wish < tcl/Physical.tcl | ./demo Clarinet -or -ip

View File

@@ -1 +1 @@
wish < tcl/Demo.tcl | demo Clarinet -or -ip
wish < tcl/Demo.tcl | ./demo Clarinet -or -ip

View File

@@ -1 +1 @@
wish < tcl/Voice.tcl | demo FMVoices -or -ip
wish < tcl/Voice.tcl | ./demo FMVoices -or -ip

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <signal.h>
#include <math.h>
#include <iostream.h>
#include <iostream>
bool done;
static void finish(int ignore){ done = true; }
@@ -28,12 +28,13 @@ int main(int argc, char *argv[])
Reverb *reverb = 0;
Voicer *voicer = 0;
int i, nVoices = 1;
MY_FLOAT volume = 1.0;
MY_FLOAT t60 = 1.0; // in seconds
// If you want to change the default sample rate (set in Stk.h), do
// it before instantiating any objects! If the sample rate is
// specified in the command line, it will override this setting.
Stk::setSampleRate( 22050.0 );
Stk::setSampleRate( 44100.0 );
// Check the command-line arguments for errors and to determine
// the number of WvOut objects to be instantiated (in utilities.cpp).
@@ -67,6 +68,11 @@ int main(int argc, char *argv[])
goto cleanup;
}
// Set the number of ticks between realtime messages (default =
// RT_BUFFER_SIZE).
messager->setRtDelta( 64 );
// Set the reverb parameters.
reverb = new PRCRev( t60 );
reverb->setEffectMix(0.2);
@@ -86,7 +92,7 @@ int main(int argc, char *argv[])
nTicks = messager->getDelta();
for ( i=0; i<nTicks; i++ ) {
sample = reverb->tick( voicer->tick() );
sample = volume * reverb->tick( voicer->tick() );
for ( j=0; j<nOutputs; j++ ) output[j]->tick(sample);
}
@@ -111,6 +117,10 @@ int main(int argc, char *argv[])
case __SK_ControlChange_:
if (byte2 == 44.0)
reverb->setEffectMix(byte3 * ONE_OVER_128);
else if (byte2 == 7.0)
volume = byte3 * ONE_OVER_128;
else if (byte2 == 49.0)
voicer->setFrequency( byte3 );
else
voicer->controlChange( (int) byte2, byte3 );
break;
@@ -127,6 +137,10 @@ int main(int argc, char *argv[])
voicer->pitchBend( byte2 );
break;
case __SK_Volume_:
volume = byte2 * ONE_OVER_128;
break;
case __SK_ProgramChange_:
if ( voice != (int) byte2 ) {
voicer->silence();
@@ -167,7 +181,7 @@ int main(int argc, char *argv[])
for ( i=0; i<nVoices; i++ ) delete instrument[i];
free(instrument);
cout << "\nStk demo finished ... goodbye.\n" << endl;
std::cout << "\nStk demo finished ... goodbye.\n" << std::endl;
return 0;
}

View File

@@ -8,6 +8,7 @@ set velocity 96.0
set cont1 0.0
set cont2 10.0
set cont4 20.0
set cont7 128.0
set cont11 64.0
set cont44 24.0
set outID "stdout"
@@ -194,22 +195,16 @@ pack .noteOn.exit -side left -padx 5 -pady 10
pack .noteOn
# Configure reverb slider
frame .reverb -bg black
scale .reverb.mix -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
pack .reverb.mix -padx 10 -pady 10
pack .reverb
# Configure sliders
frame .left -bg black
frame .right -bg black
scale .left.volume -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 7} \
-orient horizontal -label "Volume" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont7
scale .left.bPressure -from 0 -to 128 -length 200 \
-command {changePress } -variable press \
-orient horizontal -label "Breath Pressure" \
@@ -226,6 +221,12 @@ scale .left.cont2 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont2
scale .right.reverb -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
scale .right.cont4 -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 4} \
-orient horizontal -label "Breath Noise" \
@@ -244,9 +245,11 @@ scale .right.cont1 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont1
pack .left.volume -padx 10 -pady 10
pack .left.bPressure -padx 10 -pady 10
pack .left.pitch -padx 10 -pady 10
pack .left.cont2 -padx 10 -pady 10
pack .right.reverb -padx 10 -pady 10
pack .right.cont4 -padx 10 -pady 10
pack .right.cont11 -padx 10 -pady 10
pack .right.cont1 -padx 10 -pady 10

View File

@@ -3,6 +3,7 @@ set press 64.0
set cont1 0.0
set cont2 64.0
set cont4 64.0
set cont7 128.0
set cont11 64.0
set cont44 24.0
set outID "stdout"
@@ -82,22 +83,16 @@ pack .noteOn.exit -side left -padx 5 -pady 10
pack .noteOn
# Configure reverb slider
frame .reverb -bg black
scale .reverb.mix -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
pack .reverb.mix -padx 10 -pady 10
pack .reverb
# Configure sliders
frame .left -bg black
frame .right -bg black
scale .left.volume -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 7} \
-orient horizontal -label "Volume" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont7
scale .left.bPressure -from 0 -to 128 -length 200 \
-command {changePress } -variable press \
-orient horizontal -label "Strike Vigor" \
@@ -114,6 +109,12 @@ scale .left.cont2 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont2
scale .right.reverb -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
scale .right.cont4 -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 4} \
-orient horizontal -label "Stick Position" \
@@ -132,9 +133,11 @@ scale .right.cont1 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont1
pack .left.volume -padx 10 -pady 10
pack .left.bPressure -padx 10 -pady 10
pack .left.pitch -padx 10 -pady 10
pack .left.cont2 -padx 10 -pady 10
pack .right.reverb -padx 10 -pady 10
pack .right.cont4 -padx 10 -pady 10
pack .right.cont11 -padx 10 -pady 10
pack .right.cont1 -padx 10 -pady 10

View File

@@ -6,6 +6,7 @@ set press 64.0
set cont1 0.0
set cont2 20.0
set cont4 64.0
set cont7 128.0
set cont11 64.0
set cont44 24.0
set outID "stdout"
@@ -93,22 +94,16 @@ pack .noteOn.exit -side left -padx 5 -pady 10
pack .noteOn
# Configure reverb slider
frame .reverb -bg black
scale .reverb.mix -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
pack .reverb.mix -padx 10 -pady 10
pack .reverb
# Configure sliders
frame .left -bg black
frame .right -bg black
scale .left.volume -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 7} \
-orient horizontal -label "Volume" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont7
scale .left.bPressure -from 0 -to 128 -length 200 \
-command {changePress } -variable press \
-orient horizontal -label "Breath Pressure" \
@@ -125,6 +120,12 @@ scale .left.cont2 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont2
scale .right.reverb -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
scale .right.cont4 -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 4} \
-orient horizontal -label "Breath Noise" \
@@ -143,9 +144,11 @@ scale .right.cont1 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont1
pack .left.volume -padx 10 -pady 10
pack .left.bPressure -padx 10 -pady 10
pack .left.pitch -padx 10 -pady 10
pack .left.cont2 -padx 10 -pady 10
pack .right.reverb -padx 10 -pady 10
pack .right.cont4 -padx 10 -pady 10
pack .right.cont11 -padx 10 -pady 10
pack .right.cont1 -padx 10 -pady 10

View File

@@ -1 +1 @@
wish < tcl/Effects.tcl | effects -ip
wish < tcl/Effects.tcl | ./effects -ip

View File

@@ -29,7 +29,7 @@ LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
OBJECTS += RtMidi.o RtAudio.o RtDuplex.o Thread.o Socket.o
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif

View File

@@ -22,7 +22,7 @@ LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif

View File

@@ -5,8 +5,9 @@
int main()
{
// Set the global sample rate before creating class instances.
// Set the global sample rate and rawwave path before creating class instances.
Stk::setSampleRate( 44100.0 );
Stk::setRawwavePath( "../../rawwaves/" );
Instrmnt *instrument = 0;
RtWvOut *output = 0;

View File

@@ -8,8 +8,9 @@
int main()
{
// Set the global sample rate before creating class instances.
// Set the global sample rate and rawwave path before creating class instances.
Stk::setSampleRate( 44100.0 );
Stk::setRawwavePath( "../../rawwaves/" );
Instrmnt *instrument = 0;
RtWvOut *output = 0;

View File

@@ -16,7 +16,8 @@
#include "RtDuplex.h"
#include <stdio.h>
#if defined(__OS_LINUX_) || defined(__OS_IRIX__)
#if defined(__OS_LINUX__) || defined(__OS_IRIX__)
#include <unistd.h>
#include <sched.h>
#endif

View File

@@ -0,0 +1,77 @@
### STK examples Makefile - for various flavors of unix
PROGRAMS = sine play record io tcpIn tcpOut sineosc rtsine bethree controlbee foursine threebees
RM = /bin/rm
INCLUDE = @include@
ifeq ($(strip $(INCLUDE)), )
INCLUDE = ../../include
endif
vpath %.h $(INCLUDE)
CC = @CXX@
DEFS = @byte_order@
DEFS += @debug@
CFLAGS = @cflags@
CFLAGS += @warn@ -I$(INCLUDE)
LIBRARY = @LIBS@
LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
DEFS += @audio_apis@
DEFS += @midiator@
endif
RAWWAVES = @rawwaves@
ifeq ($(strip $(RAWWAVES)), )
RAWWAVES = ../../rawwaves/
endif
DEFS += -DRAWWAVE_PATH=\"$(RAWWAVES)\"
all : $(PROGRAMS)
$(OBJECTS) : Stk.h
clean :
-rm $(PROGRAMS)
strip :
strip $(PROGRAMS)
#play: play.cpp Stk.o WvIn.o WvOut.o RtWvOut.o RtAudio.o
play: play.cpp
$(CC) $(CFLAGS) $(DEFS) -o play play.cpp -L../../src $(LIBRARY) -lstk
record: record.cpp
$(CC) $(CFLAGS) $(DEFS) -o record record.cpp -L../../src $(LIBRARY) -lstk
sine: sine.cpp
$(CC) $(CFLAGS) $(DEFS) -o sine sine.cpp -L../../src $(LIBRARY) -lstk
io: io.cpp
$(CC) $(CFLAGS) $(DEFS) -o io io.cpp -L../../src $(LIBRARY) -lstk
tcpIn: tcpIn.cpp
$(CC) $(CFLAGS) $(DEFS) -o tcpIn tcpIn.cpp -L../../src $(LIBRARY) -lstk
tcpOut: tcpOut.cpp
$(CC) $(CFLAGS) $(DEFS) -o tcpOut tcpOut.cpp -L../../src $(LIBRARY) -lstk
sineosc: sineosc.cpp
$(CC) $(CFLAGS) $(DEFS) -o sineosc sineosc.cpp -L../../src $(LIBRARY) -lstk
rtsine: rtsine.cpp
$(CC) $(CFLAGS) $(DEFS) -o rtsine rtsine.cpp -L../../src $(LIBRARY) -lstk
bethree: bethree.cpp
$(CC) $(CFLAGS) $(DEFS) -o bethree bethree.cpp -L../../src $(LIBRARY) -lstk
controlbee: controlbee.cpp
$(CC) $(CFLAGS) $(DEFS) -o controlbee controlbee.cpp -L../../src $(LIBRARY) -lstk
foursine: foursine.cpp
$(CC) $(CFLAGS) $(DEFS) -o foursine foursine.cpp -L../../src $(LIBRARY) -lstk
threebees: threebees.cpp
$(CC) $(CFLAGS) $(DEFS) -o threebees threebees.cpp -L../../src $(LIBRARY) -lstk

View File

@@ -44,12 +44,10 @@ int main(int argc, char *argv[])
exit(0);
}
// Set the global STK sample rate to the file rate.
Stk::setSampleRate( input->getFileRate() );
// Set input read rate.
// Set input read rate based on the default STK sample rate.
float rate = 1.0;
if ( argc == 3 ) rate = atof(argv[2]);
rate = input->getFileRate() / Stk::sampleRate();
if ( argc == 3 ) rate *= atof(argv[2]);
input->setRate( rate );
// Find out how many channels we have.
@@ -57,7 +55,7 @@ int main(int argc, char *argv[])
// Define and open the realtime output device
try {
output = new RtWvOut( channels, Stk::sampleRate(), 0, 512, 4 );
output = new RtWvOut( channels, Stk::sampleRate(), 0, RT_BUFFER_SIZE, 4 );
}
catch (StkError &) {
goto cleanup;

View File

@@ -15,7 +15,6 @@
#include "WaveLoop.h"
#include "WvOut.h"
#include <stdlib.h>
#include <iostream.h>
void usage(void) {
// Error function in case of incorrect command-line
@@ -68,7 +67,7 @@ main(int argc, char *argv[])
// Define and open the soundfile for output. Other file
// format options include: WVOUT_SND, WVOUT_AIF, WVOUT_MAT,
// and WVOUT_RAW. Other data type options include:
// STK_SINT8, STK_SINT32, STK_FLOAT32, and STK_FLOAT64.
// STK_SINT8, STK_SINT32, MY_FLOAT32, and MY_FLOAT64.
try {
output = new WvOut( argv[2], channels, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
}

View File

@@ -8,8 +8,9 @@
int main()
{
// Set the global sample rate before creating class instances.
// Set the global sample rate and rawwave path before creating class instances.
Stk::setSampleRate( 44100.0 );
Stk::setRawwavePath( "../../rawwaves/" );
int i;
RtWvOut *output = 0;

View File

@@ -49,7 +49,7 @@ void Drone :: setFrequency(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Drone: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "Drone: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -73,7 +73,7 @@ void Drone :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->pluck(amplitude);
#if defined(_STK_DEBUG_)
cerr << "Drone: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Drone: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -81,16 +81,16 @@ void Drone :: noteOff(MY_FLOAT amplitude)
{
loopGain = (MY_FLOAT) 1.0 - amplitude;
if ( loopGain < 0.0 ) {
cerr << "Drone: noteOff amplitude greater than 1.0!" << endl;
std::cerr << "Drone: noteOff amplitude greater than 1.0!" << std::endl;
loopGain = 0.0;
}
else if ( loopGain > 1.0 ) {
cerr << "Drone: noteOff amplitude less than or zero!" << endl;
std::cerr << "Drone: noteOff amplitude less than or zero!" << std::endl;
loopGain = (MY_FLOAT) 0.99999;
}
#if defined(_STK_DEBUG_)
cerr << "Drone: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Drone: NoteOff amplitude = " << amplitude << std::endl;
#endif
}

View File

@@ -30,7 +30,7 @@ LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o Thread.o Socket.o
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif
@@ -66,4 +66,4 @@ Drone.o: Drone.cpp
$(CC) $(CFLAGS) $(DEFS) -c Drone.cpp -o $(OBJECT_PATH)/$@
VoicDrum.o: VoicDrum.cpp
$(CC) $(CFLAGS) $(DEFS) -c VoicDrum.cpp -o $(OBJECT_PATH)/$@
$(CC) $(CFLAGS) $(DEFS) -c VoicDrum.cpp -o $(OBJECT_PATH)/$@

View File

@@ -1 +1 @@
wish < tcl/Raga.tcl | ragamat -ip
wish < tcl/Raga.tcl | ./ragamat -ip

View File

@@ -40,16 +40,16 @@ Tabla :: ~Tabla()
void Tabla :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
{
#if defined(_STK_DEBUG_)
cerr << "Tabla: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << endl;
std::cerr << "Tabla: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << std::endl;
#endif
MY_FLOAT gain = amplitude;
if ( amplitude > 1.0 ) {
cerr << "Tabla: noteOn amplitude parameter is greater than 1.0!" << endl;
std::cerr << "Tabla: noteOn amplitude parameter is greater than 1.0!" << std::endl;
gain = 1.0;
}
else if ( amplitude < 0.0 ) {
cerr << "Tabla: noteOn amplitude parameter is less than 0.0!" << endl;
std::cerr << "Tabla: noteOn amplitude parameter is less than 0.0!" << std::endl;
return;
}
@@ -115,9 +115,9 @@ void Tabla :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
}
#if defined(_STK_DEBUG_)
cerr << "Number Sounding = " << nSounding << endl;
for (i=0; i<nSounding; i++) cerr << sounding[i] << " ";
cerr << "\n";
std::cerr << "Number Sounding = " << nSounding << std::endl;
for (i=0; i<nSounding; i++) std::cerr << sounding[i] << " ";
std::cerr << "\n";
#endif
}

View File

@@ -40,16 +40,16 @@ VoicDrum :: ~VoicDrum()
void VoicDrum :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
{
#if defined(_STK_DEBUG_)
cerr << "VoicDrum: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << endl;
std::cerr << "VoicDrum: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << std::endl;
#endif
MY_FLOAT gain = amplitude;
if ( amplitude > 1.0 ) {
cerr << "VoicDrum: noteOn amplitude parameter is greater than 1.0!" << endl;
std::cerr << "VoicDrum: noteOn amplitude parameter is greater than 1.0!" << std::endl;
gain = 1.0;
}
else if ( amplitude < 0.0 ) {
cerr << "VoicDrum: noteOn amplitude parameter is less than 0.0!" << endl;
std::cerr << "VoicDrum: noteOn amplitude parameter is less than 0.0!" << std::endl;
return;
}
@@ -112,9 +112,9 @@ void VoicDrum :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
}
#if defined(_STK_DEBUG_)
cerr << "Number Sounding = " << nSounding << endl;
for (i=0; i<nSounding; i++) cerr << sounding[i] << " ";
cerr << "\n";
std::cerr << "Number Sounding = " << nSounding << std::endl;
for (i=0; i<nSounding; i++) std::cerr << sounding[i] << " ";
std::cerr << "\n";
#endif
}

View File

@@ -1,55 +1,55 @@
/**********************************************/
/** Utility to make various functions **/
/** like exponential and log gain curves. **/
/** **/
/** Included here: **/
/** Yamaha TX81Z curves for master gain, **/
/** Envelope Rates (in normalized units), **/
/** envelope sustain level, and more.... **/
/**********************************************/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
int i,j;
double temp;
double data[128];
/*************** TX81Z Master Gain *************/
for (i=0;i<100;i++) {
data[i] = pow(2.0,-(99-i)/10.0);
}
data[0] = 0.0;
printf("double __FM4Op_gains[99] = {");
for (i=0;i<100;i++) {
if (i%8 == 0) printf("\n");
printf("%lf,",data[i]);
}
printf("};\n");
/*************** TX81Z Sustain Level ***********/
for (i=0;i<16;i++) {
data[i] = pow(2.0,-(15-i)/2.0);
}
data[0] = 0.0;
printf("double __FM4Op_susLevels[16] = {");
for (i=0;i<16;i++) {
if (i%8 == 0) printf("\n");
printf("%lf,",data[i]);
}
printf("};\n");
/****************** Attack Rate ***************/
for (i=0;i<32;i++) {
data[i] = 6.0 * pow(5.7,-(i-1)/5.0);
}
printf("double __FM4Op_attTimes[16] = {");
for (i=0;i<32;i++) {
if (i%8 == 0) printf("\n");
printf("%lf,",data[i]);
}
printf("};\n");
exit(1);
}
/**********************************************/
/** Utility to make various functions **/
/** like exponential and log gain curves. **/
/** **/
/** Included here: **/
/** Yamaha TX81Z curves for master gain, **/
/** Envelope Rates (in normalized units), **/
/** envelope sustain level, and more.... **/
/**********************************************/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
int i,j;
double temp;
double data[128];
/*************** TX81Z Master Gain *************/
for (i=0;i<100;i++) {
data[i] = pow(2.0,-(99-i)/10.0);
}
data[0] = 0.0;
printf("double __FM4Op_gains[99] = {");
for (i=0;i<100;i++) {
if (i%8 == 0) printf("\n");
printf("%lf,",data[i]);
}
printf("};\n");
/*************** TX81Z Sustain Level ***********/
for (i=0;i<16;i++) {
data[i] = pow(2.0,-(15-i)/2.0);
}
data[0] = 0.0;
printf("double __FM4Op_susLevels[16] = {");
for (i=0;i<16;i++) {
if (i%8 == 0) printf("\n");
printf("%lf,",data[i]);
}
printf("};\n");
/****************** Attack Rate ***************/
for (i=0;i<32;i++) {
data[i] = 6.0 * pow(5.7,-(i-1)/5.0);
}
printf("double __FM4Op_attTimes[16] = {");
for (i=0;i<32;i++) {
if (i%8 == 0) printf("\n");
printf("%lf,",data[i]);
}
printf("};\n");
exit(1);
}

View File

@@ -1,33 +1,33 @@
/**********************************************/
/** Utility to make various functions **/
/** like exponential and log gain curves. **/
/** Specifically for direct MIDI parameter **/
/** conversions. **/
/** Included here: **/
/** A440 Referenced Equal Tempered Pitches **/
/** as a function of MIDI note number. **/
/** **/
/**********************************************/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
int i,j;
double temp;
double data[128];
/********* Pitch as fn. of MIDI Note **********/
printf("double __MIDI_To_Pitch[128] = {");
for (i=0;i<128;i++) {
if (i%8 == 0) printf("\n");
temp = 220.0 * pow(2.0,((double) i - 57) / 12.0);
printf("%.2lf,",temp);
}
printf("};\n");
exit(1);
}
/**********************************************/
/** Utility to make various functions **/
/** like exponential and log gain curves. **/
/** Specifically for direct MIDI parameter **/
/** conversions. **/
/** Included here: **/
/** A440 Referenced Equal Tempered Pitches **/
/** as a function of MIDI note number. **/
/** **/
/**********************************************/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
int i,j;
double temp;
double data[128];
/********* Pitch as fn. of MIDI Note **********/
printf("double __MIDI_To_Pitch[128] = {");
for (i=0;i<128;i++) {
if (i%8 == 0) printf("\n");
temp = 220.0 * pow(2.0,((double) i - 57) / 12.0);
printf("%.2lf,",temp);
}
printf("};\n");
exit(1);
}

View File

@@ -1,116 +1,116 @@
/**********************************************/
/** Utility to make various flavors of **/
/** sine wave (rectified, etc), and **/
/** other commonly needed waveforms, like **/
/** triangles, ramps, etc. **/
/** The files generated are all 16 bit **/
/** linear signed integer, of length **/
/** as defined by LENGTH below **/
/**********************************************/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define LENGTH 256
#define PI 3.14159265358979323846
void main()
{
int i,j;
double temp;
short data[LENGTH + 2];
FILE *fd;
/////////// Yer Basic TX81Z Waves, Including Sine ///////////
fd = fopen("halfwave.raw","wb");
for (i=0;i<LENGTH/2;i++)
data[i] = 32767 * sin(i * 2 * PI / (double) LENGTH);
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 0;
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("sinewave.raw","wb");
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 32767 * sin(i * 2 * PI / (double) LENGTH);
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("sineblnk.raw","wb");
for (i=0;i<LENGTH/2;i++)
data[i] = data[2*i];
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 0;
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("fwavblnk.raw","wb");
for (i=0;i<LENGTH/4;i++)
data[i+LENGTH/4] = data[i];
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("snglpeak.raw","wb");
for (i=0;i<=LENGTH/4;i++)
data[i] = 32767 * (1.0 - cos(i * 2 * PI / (double) LENGTH));
for (i=0;i<=LENGTH/4;i++)
data[LENGTH/2-i] = data[i];
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 0;
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("twopeaks.raw","wb");
for (i=0;i<=LENGTH/2;i++) {
data[LENGTH/2+i] = -data[i];
}
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("peksblnk.raw","wb");
for (i=0;i<=LENGTH/2;i++)
data[i] = data[i*2];
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 0;
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("ppksblnk.raw","wb");
for (i=0;i<=LENGTH/4;i++)
data[i+LENGTH/4] = data[i];
fwrite(&data,2,LENGTH,fd);
fclose(fd);
/////////// Impulses of various bandwidth ///////////
fd = fopen("impuls10.raw","wb");
for (i=0;i<LENGTH;i++) {
temp = 0.0;
for (j=1;j<=10;j++)
temp += cos(i * j * 2 * PI / (double) LENGTH);
data[i] = 32767 / 10.0 * temp;
}
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("impuls20.raw","wb");
for (i=0;i<LENGTH;i++) {
temp = 0.0;
for (j=1;j<=20;j++)
temp += cos(i * j * 2 * PI / (double) LENGTH);
data[i] = 32767 / 20.0 * temp;
}
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("impuls40.raw","wb");
for (i=0;i<LENGTH;i++) {
temp = 0.0;
for (j=1;j<=40;j++)
temp += cos(i * j * 2 * PI / (double) LENGTH);
data[i] = 32767 / 40.0 * temp;
}
fwrite(&data,2,LENGTH,fd);
fclose(fd);
}
/**********************************************/
/** Utility to make various flavors of **/
/** sine wave (rectified, etc), and **/
/** other commonly needed waveforms, like **/
/** triangles, ramps, etc. **/
/** The files generated are all 16 bit **/
/** linear signed integer, of length **/
/** as defined by LENGTH below **/
/**********************************************/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define LENGTH 256
#define PI 3.14159265358979323846
void main()
{
int i,j;
double temp;
short data[LENGTH + 2];
FILE *fd;
/////////// Yer Basic TX81Z Waves, Including Sine ///////////
fd = fopen("halfwave.raw","wb");
for (i=0;i<LENGTH/2;i++)
data[i] = 32767 * sin(i * 2 * PI / (double) LENGTH);
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 0;
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("sinewave.raw","wb");
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 32767 * sin(i * 2 * PI / (double) LENGTH);
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("sineblnk.raw","wb");
for (i=0;i<LENGTH/2;i++)
data[i] = data[2*i];
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 0;
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("fwavblnk.raw","wb");
for (i=0;i<LENGTH/4;i++)
data[i+LENGTH/4] = data[i];
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("snglpeak.raw","wb");
for (i=0;i<=LENGTH/4;i++)
data[i] = 32767 * (1.0 - cos(i * 2 * PI / (double) LENGTH));
for (i=0;i<=LENGTH/4;i++)
data[LENGTH/2-i] = data[i];
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 0;
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("twopeaks.raw","wb");
for (i=0;i<=LENGTH/2;i++) {
data[LENGTH/2+i] = -data[i];
}
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("peksblnk.raw","wb");
for (i=0;i<=LENGTH/2;i++)
data[i] = data[i*2];
for (i=LENGTH/2;i<LENGTH;i++)
data[i] = 0;
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("ppksblnk.raw","wb");
for (i=0;i<=LENGTH/4;i++)
data[i+LENGTH/4] = data[i];
fwrite(&data,2,LENGTH,fd);
fclose(fd);
/////////// Impulses of various bandwidth ///////////
fd = fopen("impuls10.raw","wb");
for (i=0;i<LENGTH;i++) {
temp = 0.0;
for (j=1;j<=10;j++)
temp += cos(i * j * 2 * PI / (double) LENGTH);
data[i] = 32767 / 10.0 * temp;
}
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("impuls20.raw","wb");
for (i=0;i<LENGTH;i++) {
temp = 0.0;
for (j=1;j<=20;j++)
temp += cos(i * j * 2 * PI / (double) LENGTH);
data[i] = 32767 / 20.0 * temp;
}
fwrite(&data,2,LENGTH,fd);
fclose(fd);
fd = fopen("impuls40.raw","wb");
for (i=0;i<LENGTH;i++) {
temp = 0.0;
for (j=1;j<=40;j++)
temp += cos(i * j * 2 * PI / (double) LENGTH);
data[i] = 32767 / 40.0 * temp;
}
fwrite(&data,2,LENGTH,fd);
fclose(fd);
}

View File

@@ -105,9 +105,9 @@ void ADSR :: setReleaseTime(MY_FLOAT aTime)
{
if (aTime < 0.0) {
printf("ADSR: negative times not allowed ... correcting!\n");
releaseRate = 1.0 / ( -aTime * Stk::sampleRate() );
releaseRate = sustainLevel / ( -aTime * Stk::sampleRate() );
}
else releaseRate = 1.0 / ( aTime * Stk::sampleRate() );
else releaseRate = sustainLevel / ( aTime * Stk::sampleRate() );
}
void ADSR :: setAllTimes(MY_FLOAT aTime, MY_FLOAT dTime, MY_FLOAT sLevel, MY_FLOAT rTime)

View File

@@ -182,7 +182,7 @@ void BandedWG :: setFrequency(MY_FLOAT frequency)
{
freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "BandedWG: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "BandedWG: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
if (freakency > 1568.0) freakency = 1568.0;
@@ -197,13 +197,13 @@ void BandedWG :: setFrequency(MY_FLOAT frequency)
delay[i].setDelay( length );
gains[i]=basegains[i];
// gains[i]=(MY_FLOAT) pow(basegains[i], 1/((MY_FLOAT)delay[i].getDelay()));
// cerr << gains[i];
// std::cerr << gains[i];
}
else {
nModes = i;
break;
}
// cerr << endl;
// std::cerr << std::endl;
// Set the bandpass filter resonances
radius = 1.0 - PI * 32 / Stk::sampleRate(); //freakency * modes[i] / Stk::sampleRate()/32;
@@ -257,7 +257,7 @@ void BandedWG :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->startBowing(amplitude, amplitude * 0.001);
#if defined(_STK_DEBUG_)
cerr << "BandedWG: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "BandedWG: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -267,7 +267,7 @@ void BandedWG :: noteOff(MY_FLOAT amplitude)
this->stopBowing((1.0 - amplitude) * 0.005);
#if defined(_STK_DEBUG_)
cerr << "BandedWG: NoteOff amplitude = " << amplitude << endl;
std::cerr << "BandedWG: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -320,11 +320,11 @@ void BandedWG :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "BandedWG: Control value less than zero!" << endl;
std::cerr << "BandedWG: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "BandedWG: Control value greater than 128.0!" << endl;
std::cerr << "BandedWG: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_BowPressure_) { // 2
@@ -353,7 +353,7 @@ void BandedWG :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_ModWheel_) { // 1
// baseGain = 0.9989999999 + (0.001 * norm );
baseGain = 0.8999999999999999 + (0.1 * norm);
// cerr << "Yuck!" << endl;
// std::cerr << "Yuck!" << std::endl;
for (int i=0; i<nModes; i++)
gains[i]=(MY_FLOAT) basegains[i]*baseGain;
// gains[i]=(MY_FLOAT) pow(baseGain, (int)((MY_FLOAT)delay[i].getDelay()+i));
@@ -371,10 +371,10 @@ void BandedWG :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_ProphesyRibbon_) // 16
this->setPreset((int) value);
else
cerr << "BandedWG: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "BandedWG: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "BandedWG: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "BandedWG: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -33,25 +33,14 @@
/***************************************************/
#include "BeeThree.h"
#include <string.h>
BeeThree :: BeeThree()
: FM()
{
int i;
char files[4][128];
// Concatenate the STK RAWWAVE_PATH to the rawwave file
for ( i=0; i<4; i++ )
strcpy( files[i], RAWWAVE_PATH);
strcat(files[0], "sinewave.raw");
strcat(files[1], "sinewave.raw");
strcat(files[2], "sinewave.raw");
strcat(files[3], "fwavblnk.raw");
for ( i=0; i<4; i++ )
waves[i] = new WaveLoop( files[i], TRUE );
// Concatenate the STK rawwave path to the rawwave files
for ( int i=0; i<3; i++ )
waves[i] = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
waves[3] = new WaveLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), TRUE );
this->setRatio(0, 0.999);
this->setRatio(1, 1.997);

View File

@@ -18,7 +18,6 @@
#include "BlowBotl.h"
#include "SKINI.msg"
#include <string.h>
#define __BOTTLE_RADIUS_ 0.999
@@ -29,10 +28,8 @@ BlowBotl :: BlowBotl()
dcBlock = new PoleZero();
dcBlock->setBlockZero();
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char file[128];
strcpy(file, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(file,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
vibrato->setFrequency( 5.925 );
vibratoGain = 0.0;
@@ -67,7 +64,7 @@ void BlowBotl :: setFrequency(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "BlowBotl: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "BlowBotl: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -94,7 +91,7 @@ void BlowBotl :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
outputGain = amplitude + 0.001;
#if defined(_STK_DEBUG_)
cerr << "BlowBotl: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "BlowBotl: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -103,7 +100,7 @@ void BlowBotl :: noteOff(MY_FLOAT amplitude)
this->stopBlowing(amplitude * 0.02);
#if defined(_STK_DEBUG_)
cerr << "BlowBotl: NoteOff amplitude = " << amplitude << endl;
std::cerr << "BlowBotl: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -134,11 +131,11 @@ void BlowBotl :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "BlowBotl: Control value less than zero!" << endl;
std::cerr << "BlowBotl: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "BlowBotl: Control value greater than 128.0!" << endl;
std::cerr << "BlowBotl: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_NoiseLevel_) // 4
@@ -150,9 +147,9 @@ void BlowBotl :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
adsr->setTarget( norm );
else
cerr << "BlowBotl: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "BlowBotl: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "BlowBotl: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "BlowBotl: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -36,7 +36,6 @@
#include "BlowHole.h"
#include "SKINI.msg"
#include <math.h>
#include <string.h>
BlowHole :: BlowHole(MY_FLOAT lowestFrequency)
{
@@ -83,10 +82,8 @@ BlowHole :: BlowHole(MY_FLOAT lowestFrequency)
// Start with register vent closed
vent->setGain(0.0);
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char file[128];
strcpy(file, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(file,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
vibrato->setFrequency((MY_FLOAT) 5.735);
outputGain = (MY_FLOAT) 1.0;
noiseGain = (MY_FLOAT) 0.2;
@@ -121,7 +118,7 @@ void BlowHole :: setFrequency(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "BlowHole: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "BlowHole: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -181,7 +178,7 @@ void BlowHole :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
outputGain = amplitude + 0.001;
#if defined(_STK_DEBUG_)
cerr << "BlowHole: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "BlowHole: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -190,7 +187,7 @@ void BlowHole :: noteOff(MY_FLOAT amplitude)
this->stopBlowing(amplitude * 0.01);
#if defined(_STK_DEBUG_)
cerr << "BlowHole: NoteOff amplitude = " << amplitude << endl;
std::cerr << "BlowHole: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -234,11 +231,11 @@ void BlowHole :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "BlowHole: Control value less than zero!" << endl;
std::cerr << "BlowHole: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "BlowHole: Control value greater than 128.0!" << endl;
std::cerr << "BlowHole: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_ReedStiffness_) // 2
@@ -252,9 +249,9 @@ void BlowHole :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
envelope->setValue( norm );
else
cerr << "BlowHole: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "BlowHole: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "BlowHole: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "BlowHole: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -23,7 +23,6 @@
#include "Bowed.h"
#include "SKINI.msg"
#include <string.h>
Bowed :: Bowed(MY_FLOAT lowestFrequency)
{
@@ -36,10 +35,8 @@ Bowed :: Bowed(MY_FLOAT lowestFrequency)
bowTable = new BowTabl;
bowTable->setSlope((MY_FLOAT) 3.0);
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char file[128];
strcpy(file, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(file,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
vibrato->setFrequency((MY_FLOAT) 6.12723);
vibratoGain = (MY_FLOAT) 0.0;
@@ -81,7 +78,7 @@ void Bowed :: setFrequency(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Bowed: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "Bowed: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -111,7 +108,7 @@ void Bowed :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->setFrequency(frequency);
#if defined(_STK_DEBUG_)
cerr << "Bowed: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Bowed: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -120,7 +117,7 @@ void Bowed :: noteOff(MY_FLOAT amplitude)
this->stopBowing(((MY_FLOAT) 1.0 - amplitude) * (MY_FLOAT) 0.005);
#if defined(_STK_DEBUG_)
cerr << "Bowed: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Bowed: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -163,11 +160,11 @@ void Bowed :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "Bowed: Control value less than zero!" << endl;
std::cerr << "Bowed: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "Bowed: Control value greater than 128.0!" << endl;
std::cerr << "Bowed: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_BowPressure_) // 2
@@ -184,9 +181,9 @@ void Bowed :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
adsr->setTarget(norm);
else
cerr << "Bowed: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "Bowed: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "Bowed: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "Bowed: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -22,7 +22,6 @@
#include "Brass.h"
#include "SKINI.msg"
#include <string.h>
#include <math.h>
Brass :: Brass(MY_FLOAT lowestFrequency)
@@ -38,10 +37,8 @@ Brass :: Brass(MY_FLOAT lowestFrequency)
adsr = new ADSR;
adsr->setAllTimes( 0.005, 0.001, 1.0, 0.010);
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char file[128];
strcpy(file, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(file,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
vibrato->setFrequency( 6.137 );
vibratoGain = 0.0;
@@ -73,7 +70,7 @@ void Brass :: setFrequency(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Brass: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "Brass: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -89,7 +86,7 @@ void Brass :: setLip(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Brass: setLip parameter is less than or equal to zero!" << endl;
std::cerr << "Brass: setLip parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -115,7 +112,7 @@ void Brass :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->startBlowing(amplitude, amplitude * 0.001);
#if defined(_STK_DEBUG_)
cerr << "Brass: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Brass: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -124,7 +121,7 @@ void Brass :: noteOff(MY_FLOAT amplitude)
this->stopBlowing(amplitude * 0.005);
#if defined(_STK_DEBUG_)
cerr << "Brass: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Brass: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -151,11 +148,11 @@ void Brass :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "Brass: Control value less than zero!" << endl;
std::cerr << "Brass: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "Brass: Control value greater than 128.0!" << endl;
std::cerr << "Brass: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_LipTension_) { // 2
@@ -171,9 +168,9 @@ void Brass :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
adsr->setTarget( norm );
else
cerr << "Brass: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "Brass: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "Brass: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "Brass: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -9,8 +9,7 @@
/***************************************************/
#include "Chorus.h"
#include <string.h>
#include <iostream.h>
#include <iostream>
Chorus :: Chorus(MY_FLOAT baseDelay)
{
@@ -18,12 +17,9 @@ Chorus :: Chorus(MY_FLOAT baseDelay)
delayLine[1] = new DelayL((long) (baseDelay), (long) baseDelay + 2);
baseLength = baseDelay;
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char path[128];
strcpy(path, RAWWAVE_PATH);
mods[0] = new WaveLoop( strcat(path,"sinewave.raw"), TRUE );
strcpy(path, RAWWAVE_PATH);
mods[1] = new WaveLoop( strcat(path,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
mods[0] = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
mods[1] = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
mods[0]->setFrequency(0.2);
mods[1]->setFrequency(0.222222);
modDepth = 0.05;
@@ -51,11 +47,11 @@ void Chorus :: setEffectMix(MY_FLOAT mix)
{
effectMix = mix;
if ( mix < 0.0 ) {
cerr << "Chorus: setEffectMix parameter is less than zero!" << endl;
std::cerr << "Chorus: setEffectMix parameter is less than zero!" << std::endl;
effectMix = 0.0;
}
else if ( mix > 1.0 ) {
cerr << "Chorus: setEffectMix parameter is greater than 1.0!" << endl;
std::cerr << "Chorus: setEffectMix parameter is greater than 1.0!" << std::endl;
effectMix = 1.0;
}
}

View File

@@ -24,7 +24,6 @@
#include "Clarinet.h"
#include "SKINI.msg"
#include <string.h>
Clarinet :: Clarinet(MY_FLOAT lowestFrequency)
{
@@ -37,10 +36,8 @@ Clarinet :: Clarinet(MY_FLOAT lowestFrequency)
envelope = new Envelope;
noise = new Noise;
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char path[128];
strcpy(path, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(path,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
vibrato->setFrequency((MY_FLOAT) 5.735);
outputGain = (MY_FLOAT) 1.0;
noiseGain = (MY_FLOAT) 0.2;
@@ -67,7 +64,7 @@ void Clarinet :: setFrequency(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Clarinet: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "Clarinet: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -97,7 +94,7 @@ void Clarinet :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
outputGain = amplitude + (MY_FLOAT) 0.001;
#if defined(_STK_DEBUG_)
cerr << "Clarinet: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Clarinet: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -106,7 +103,7 @@ void Clarinet :: noteOff(MY_FLOAT amplitude)
this->stopBlowing(amplitude * (MY_FLOAT) 0.01);
#if defined(_STK_DEBUG_)
cerr << "Clarinet: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Clarinet: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -140,11 +137,11 @@ void Clarinet :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "Clarinet: Control value less than zero!" << endl;
std::cerr << "Clarinet: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "Clarinet: Control value greater than 128.0!" << endl;
std::cerr << "Clarinet: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_ReedStiffness_) // 2
@@ -158,9 +155,9 @@ void Clarinet :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
envelope->setValue(norm);
else
cerr << "Clarinet: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "Clarinet: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "Clarinet: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "Clarinet: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -19,7 +19,7 @@
/***************************************************/
#include "Delay.h"
#include <iostream.h>
#include <iostream>
Delay :: Delay()
{
@@ -64,13 +64,13 @@ void Delay :: clear(void)
void Delay :: setDelay(long theDelay)
{
if (theDelay > length-1) { // The value is too big.
cerr << "Delay: setDelay(" << theDelay << ") too big!" << endl;
std::cerr << "Delay: setDelay(" << theDelay << ") too big!" << std::endl;
// Force delay to maxLength.
outPoint = inPoint + 1;
delay = length - 1;
}
else if (theDelay < 0 ) {
cerr << "Delay: setDelay(" << theDelay << ") less than zero!" << endl;
std::cerr << "Delay: setDelay(" << theDelay << ") less than zero!" << std::endl;
outPoint = inPoint;
delay = 0;
}
@@ -109,15 +109,15 @@ MY_FLOAT Delay :: energy(void) const
return e;
}
MY_FLOAT Delay :: contentsAt(long tapDelay) const
MY_FLOAT Delay :: contentsAt(unsigned long tapDelay) const
{
long i = tapDelay;
if (i < 0) {
cerr << "Delay: contentsAt(" << tapDelay << ") too small!" << endl;
i = 0;
if (i < 1) {
std::cerr << "Delay: contentsAt(" << tapDelay << ") too small!" << std::endl;
i = 1;
}
else if (i > delay) {
cerr << "Delay: contentsAt(" << tapDelay << ") too big!" << endl;
std::cerr << "Delay: contentsAt(" << tapDelay << ") too big!" << std::endl;
i = (long) delay;
}

View File

@@ -23,7 +23,7 @@
/***************************************************/
#include "DelayA.h"
#include <iostream.h>
#include <iostream>
DelayA :: DelayA()
{
@@ -46,6 +46,7 @@ DelayA :: DelayA(MY_FLOAT theDelay, long maxDelay)
inPoint = 0;
this->setDelay(theDelay);
apInput = 0.0;
doNextOut = true;
}
@@ -64,13 +65,13 @@ void DelayA :: setDelay(MY_FLOAT theDelay)
MY_FLOAT outPointer;
if (theDelay > length-1) {
cerr << "DelayA: setDelay(" << theDelay << ") too big!" << endl;
std::cerr << "DelayA: setDelay(" << theDelay << ") too big!" << std::endl;
// Force delay to maxLength
outPointer = inPoint + 1.0;
delay = length - 1;
}
else if (theDelay < 0.5) {
cerr << "DelayA: setDelay(" << theDelay << ") less than 0.5 not possible!" << endl;
std::cerr << "DelayA: setDelay(" << theDelay << ") less than 0.5 not possible!" << std::endl;
outPointer = inPoint + 0.4999999999;
delay = 0.5;
}

View File

@@ -23,7 +23,7 @@
/***************************************************/
#include "DelayL.h"
#include <iostream.h>
#include <iostream>
DelayL :: DelayL()
{
@@ -56,13 +56,13 @@ void DelayL :: setDelay(MY_FLOAT theDelay)
MY_FLOAT outPointer;
if (theDelay > length-1) {
cerr << "DelayL: setDelay(" << theDelay << ") too big!" << endl;
std::cerr << "DelayL: setDelay(" << theDelay << ") too big!" << std::endl;
// Force delay to maxLength
outPointer = inPoint + 1.0;
delay = length - 1;
}
else if (theDelay < 0 ) {
cerr << "DelayL: setDelay(" << theDelay << ") less than zero!" << endl;
std::cerr << "DelayL: setDelay(" << theDelay << ") less than zero!" << std::endl;
outPointer = inPoint;
delay = 0;
}

View File

@@ -16,7 +16,6 @@
/***************************************************/
#include "Drummer.h"
#include <string.h>
#include <math.h>
// Not really General MIDI yet. Coming soon.
@@ -75,16 +74,16 @@ Drummer :: ~Drummer()
void Drummer :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
{
#if defined(_STK_DEBUG_)
cerr << "Drummer: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << endl;
std::cerr << "Drummer: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << std::endl;
#endif
MY_FLOAT gain = amplitude;
if ( amplitude > 1.0 ) {
cerr << "Drummer: noteOn amplitude parameter is greater than 1.0!" << endl;
std::cerr << "Drummer: noteOn amplitude parameter is greater than 1.0!" << std::endl;
gain = 1.0;
}
else if ( amplitude < 0.0 ) {
cerr << "Drummer: noteOn amplitude parameter is less than 0.0!" << endl;
std::cerr << "Drummer: noteOn amplitude parameter is less than 0.0!" << std::endl;
return;
}
@@ -122,11 +121,8 @@ void Drummer :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
nSounding += 1;
sounding[nSounding-1] = noteNum;
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char path[128];
strcpy(path, RAWWAVE_PATH);
strcat(path, waveNames[genMIDIMap[noteNum]]);
waves[nSounding-1] = new WvIn(path, TRUE);
// Concatenate the STK rawwave path to the rawwave file
waves[nSounding-1] = new WvIn( (Stk::rawwavePath() + waveNames[genMIDIMap[noteNum]]).c_str(), TRUE );
if (Stk::sampleRate() != 22050.0)
waves[nSounding-1]->setRate( 22050.0 / Stk::sampleRate() );
filters[nSounding-1]->setPole((MY_FLOAT) 0.999 - (gain * 0.6) );
@@ -134,9 +130,9 @@ void Drummer :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
}
#if defined(_STK_DEBUG_)
cerr << "Number Sounding = " << nSounding << endl;
for (i=0; i<nSounding; i++) cerr << sounding[i] << " ";
cerr << "\n";
std::cerr << "Number Sounding = " << nSounding << std::endl;
for (i=0; i<nSounding; i++) std::cerr << sounding[i] << " ";
std::cerr << "\n";
#endif
}

View File

@@ -9,7 +9,7 @@
/***************************************************/
#include "Echo.h"
#include <iostream.h>
#include <iostream>
Echo :: Echo(MY_FLOAT longestDelay)
{
@@ -34,11 +34,11 @@ void Echo :: setDelay(MY_FLOAT delay)
{
MY_FLOAT size = delay;
if ( delay < 0.0 ) {
cerr << "Echo: setDelay parameter is less than zero!" << endl;
std::cerr << "Echo: setDelay parameter is less than zero!" << std::endl;
size = 0.0;
}
else if ( delay > length ) {
cerr << "Echo: setDelay parameter is greater than delay length!" << endl;
std::cerr << "Echo: setDelay parameter is greater than delay length!" << std::endl;
size = length;
}
@@ -49,11 +49,11 @@ void Echo :: setEffectMix(MY_FLOAT mix)
{
effectMix = mix;
if ( mix < 0.0 ) {
cerr << "Echo: setEffectMix parameter is less than zero!" << endl;
std::cerr << "Echo: setEffectMix parameter is less than zero!" << std::endl;
effectMix = 0.0;
}
else if ( mix > 1.0 ) {
cerr << "Echo: setEffectMix parameter is greater than 1.0!" << endl;
std::cerr << "Echo: setEffectMix parameter is greater than 1.0!" << std::endl;
effectMix = 1.0;
}
}

View File

@@ -25,7 +25,6 @@
#include "FM.h"
#include "SKINI.msg"
#include <string.h>
#include <stdlib.h>
FM :: FM(int operators)
@@ -41,10 +40,8 @@ FM :: FM(int operators)
twozero->setB2( -1.0 );
twozero->setGain( 0.0 );
// Concatenate the STK RAWWAVE_PATH to the rawwave file.
char file[128];
strcpy(file, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(file,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
vibrato->setFrequency(6.0);
int i;
@@ -115,11 +112,11 @@ void FM :: setFrequency(MY_FLOAT frequency)
void FM :: setRatio(int waveIndex, MY_FLOAT ratio)
{
if ( waveIndex < 0 ) {
cerr << "FM: setRatio waveIndex parameter is less than zero!" << endl;
std::cerr << "FM: setRatio waveIndex parameter is less than zero!" << std::endl;
return;
}
else if ( waveIndex >= nOperators ) {
cerr << "FM: setRatio waveIndex parameter is greater than the number of operators!" << endl;
std::cerr << "FM: setRatio waveIndex parameter is greater than the number of operators!" << std::endl;
return;
}
@@ -133,11 +130,11 @@ void FM :: setRatio(int waveIndex, MY_FLOAT ratio)
void FM :: setGain(int waveIndex, MY_FLOAT gain)
{
if ( waveIndex < 0 ) {
cerr << "FM: setGain waveIndex parameter is less than zero!" << endl;
std::cerr << "FM: setGain waveIndex parameter is less than zero!" << std::endl;
return;
}
else if ( waveIndex >= nOperators ) {
cerr << "FM: setGain waveIndex parameter is greater than the number of operators!" << endl;
std::cerr << "FM: setGain waveIndex parameter is greater than the number of operators!" << std::endl;
return;
}
@@ -181,7 +178,7 @@ void FM :: noteOff(MY_FLOAT amplitude)
keyOff();
#if defined(_STK_DEBUG_)
cerr << "FM: NoteOff amplitude = " << amplitude << endl;
std::cerr << "FM: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -190,11 +187,11 @@ void FM :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "FM: Control value less than zero!" << endl;
std::cerr << "FM: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "FM: Control value greater than 128.0!" << endl;
std::cerr << "FM: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_Breath_) // 2
@@ -212,10 +209,10 @@ void FM :: controlChange(int number, MY_FLOAT value)
adsr[3]->setTarget( norm );
}
else
cerr << "FM: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "FM: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "FM: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "FM: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -33,25 +33,14 @@
#include "FMVoices.h"
#include "SKINI.msg"
#include "Phonemes.h"
#include <string.h>
FMVoices :: FMVoices()
: FM()
{
int i;
char files[4][128];
// Concatenate the STK RAWWAVE_PATH to the rawwave file
for ( i=0; i<4; i++ )
strcpy( files[i], RAWWAVE_PATH);
strcat(files[0], "sinewave.raw");
strcat(files[1], "sinewave.raw");
strcat(files[2], "sinewave.raw");
strcat(files[3], "fwavblnk.raw");
for ( i=0; i<4; i++ )
waves[i] = new WaveLoop( files[i], TRUE );
// Concatenate the STK rawwave path to the rawwave files
for ( int i=0; i<3; i++ )
waves[i] = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
waves[3] = new WaveLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), TRUE );
this->setRatio(0, 2.00);
this->setRatio(1, 4.00);
@@ -129,7 +118,7 @@ void FMVoices :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->keyOn();
#if defined(_STK_DEBUG_)
cerr << "FMVoices: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "FMVoices: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -162,11 +151,11 @@ void FMVoices :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "FMVoices: Control value less than zero!" << endl;
std::cerr << "FMVoices: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "FMVoices: Control value greater than 128.0!" << endl;
std::cerr << "FMVoices: Control value greater than 128.0!" << std::endl;
}
@@ -186,9 +175,9 @@ void FMVoices :: controlChange(int number, MY_FLOAT value)
tilt[2] = tilt[1] * norm;
}
else
cerr << "FMVoices: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "FMVoices: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "FMVoices: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "FMVoices: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -1,5 +1,5 @@
/***************************************************/
/*! \class Fluate
/*! \class Flute
\brief STK flute physical model class.
This class implements a simple flute
@@ -24,7 +24,6 @@
#include "Flute.h"
#include "SKINI.msg"
#include <string.h>
Flute :: Flute(MY_FLOAT lowestFrequency)
{
@@ -39,10 +38,8 @@ Flute :: Flute(MY_FLOAT lowestFrequency)
noise = new Noise();
adsr = new ADSR();
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char file[128];
strcpy(file, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(file,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
vibrato->setFrequency( 5.925 );
this->clear();
@@ -84,7 +81,7 @@ void Flute :: setFrequency(MY_FLOAT frequency)
{
lastFrequency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Flute: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "Flute: setFrequency parameter is less than or equal to zero!" << std::endl;
lastFrequency = 220.0;
}
@@ -119,7 +116,7 @@ void Flute :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
outputGain = amplitude + 0.001;
#if defined(_STK_DEBUG_)
cerr << "Flute: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Flute: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -128,7 +125,7 @@ void Flute :: noteOff(MY_FLOAT amplitude)
this->stopBlowing(amplitude * 0.02);
#if defined(_STK_DEBUG_)
cerr << "Flute: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Flute: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -177,11 +174,11 @@ void Flute :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "Flute: Control value less than zero!" << endl;
std::cerr << "Flute: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "Flute: Control value greater than 128.0!" << endl;
std::cerr << "Flute: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_JetDelay_) // 2
@@ -195,9 +192,9 @@ void Flute :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
adsr->setTarget( norm );
else
cerr << "Flute: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "Flute: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "Flute: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "Flute: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -27,25 +27,14 @@
/***************************************************/
#include "HevyMetl.h"
#include <string.h>
HevyMetl :: HevyMetl()
: FM()
{
int i;
char files[4][128];
// Concatenate the STK RAWWAVE_PATH to the rawwave file
for ( i=0; i<4; i++ )
strcpy( files[i], RAWWAVE_PATH);
strcat(files[0], "sinewave.raw");
strcat(files[1], "sinewave.raw");
strcat(files[2], "sinewave.raw");
strcat(files[3], "fwavblnk.raw");
for ( i=0; i<4; i++ )
waves[i] = new WaveLoop( files[i], TRUE );
// Concatenate the STK rawwave path to the rawwave files
for ( int i=0; i<3; i++ )
waves[i] = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
waves[3] = new WaveLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), TRUE );
this->setRatio(0, 1.0 * 1.000);
this->setRatio(1, 4.0 * 0.999);

View File

@@ -21,7 +21,7 @@ Instrmnt :: ~Instrmnt()
void Instrmnt :: setFrequency(MY_FLOAT frequency)
{
cerr << "Instrmnt: virtual setFrequency function call!" << endl;
std::cerr << "Instrmnt: virtual setFrequency function call!" << std::endl;
}
MY_FLOAT Instrmnt :: lastOut() const
@@ -29,6 +29,17 @@ MY_FLOAT Instrmnt :: lastOut() const
return lastOutput;
}
// Support for stereo output:
MY_FLOAT Instrmnt :: lastOutLeft(void) const
{
return 0.5 * lastOutput;
}
MY_FLOAT Instrmnt :: lastOutRight(void) const
{
return 0.5 * lastOutput;
}
MY_FLOAT *Instrmnt :: tick(MY_FLOAT *vector, unsigned int vectorSize)
{
for (unsigned int i=0; i<vectorSize; i++)

View File

@@ -38,7 +38,7 @@ JCRev :: JCRev(MY_FLOAT T60)
for (i=0; i<4; i++) {
combDelays[i] = new Delay(lengths[i], lengths[i]);
combCoefficient[i] = pow(10,(-3 * lengths[i] / (T60 * Stk::sampleRate())));
combCoefficient[i] = pow(10.0,(-3 * lengths[i] / (T60 * Stk::sampleRate())));
}
outLeftDelay = new Delay(lengths[7], lengths[7]);

View File

@@ -1,7 +1,7 @@
### libstk Makefile - for various flavors of unix
LIBRARY = libstk.a
AR = ar -qc
AR = ar -rsc
RM = /bin/rm
OBJECT_PATH = @object_path@
vpath %.o $(OBJECT_PATH)
@@ -43,7 +43,7 @@ CFLAGS += @warn@ $(INCLUDE)
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o RtWvIn.o RtDuplex.o TcpWvOut.o TcpWvIn.o Thread.o Socket.o
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif
@@ -61,7 +61,6 @@ all : $(LIBRARY)
$(LIBRARY) : $(OBJECTS)
/bin/rm -f $(LIBRARY)
$(AR) $(LIBRARY) $(OBJECT_PATH)/*.o
ranlib $(LIBRARY)
$(OBJECTS) : Stk.h

View File

@@ -30,37 +30,23 @@
#include "Mandolin.h"
#include "SKINI.msg"
#include <string.h>
Mandolin :: Mandolin(MY_FLOAT lowestFrequency)
: PluckTwo(lowestFrequency)
{
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char temp[128];
strcpy(temp, RAWWAVE_PATH);
soundfile[0] = new WvIn( strcat(temp,"mand1.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[1] = new WvIn( strcat(temp,"mand2.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[2] = new WvIn( strcat(temp,"mand3.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[3] = new WvIn( strcat(temp,"mand4.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[4] = new WvIn( strcat(temp,"mand5.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[5] = new WvIn( strcat(temp,"mand6.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[6] = new WvIn( strcat(temp,"mand7.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[7] = new WvIn( strcat(temp,"mand8.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[8] = new WvIn( strcat(temp,"mand9.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[9] = new WvIn( strcat(temp,"mand10.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[10] = new WvIn( strcat(temp,"mand11.raw"), TRUE );
strcpy(temp, RAWWAVE_PATH);
soundfile[11] = new WvIn( strcat(temp,"mand12.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave files
soundfile[0] = new WvIn( (Stk::rawwavePath() + "mand1.raw").c_str(), TRUE );
soundfile[1] = new WvIn( (Stk::rawwavePath() + "mand2.raw").c_str(), TRUE );
soundfile[2] = new WvIn( (Stk::rawwavePath() + "mand3.raw").c_str(), TRUE );
soundfile[3] = new WvIn( (Stk::rawwavePath() + "mand4.raw").c_str(), TRUE );
soundfile[4] = new WvIn( (Stk::rawwavePath() + "mand5.raw").c_str(), TRUE );
soundfile[5] = new WvIn( (Stk::rawwavePath() + "mand6.raw").c_str(), TRUE );
soundfile[6] = new WvIn( (Stk::rawwavePath() + "mand7.raw").c_str(), TRUE );
soundfile[7] = new WvIn( (Stk::rawwavePath() + "mand8.raw").c_str(), TRUE );
soundfile[8] = new WvIn( (Stk::rawwavePath() + "mand9.raw").c_str(), TRUE );
soundfile[9] = new WvIn( (Stk::rawwavePath() + "mand10.raw").c_str(), TRUE );
soundfile[10] = new WvIn( (Stk::rawwavePath() + "mand11.raw").c_str(), TRUE );
soundfile[11] = new WvIn( (Stk::rawwavePath() + "mand12.raw").c_str(), TRUE );
directBody = 1.0;
mic = 0;
dampTime = 0;
@@ -83,11 +69,11 @@ void Mandolin :: pluck(MY_FLOAT amplitude)
waveDone = false;
pluckAmplitude = amplitude;
if ( amplitude < 0.0 ) {
cerr << "Mandolin: pluck amplitude parameter less than zero!" << endl;
std::cerr << "Mandolin: pluck amplitude parameter less than zero!" << std::endl;
pluckAmplitude = 0.0;
}
else if ( amplitude > 1.0 ) {
cerr << "Mandolin: pluck amplitude parameter greater than 1.0!" << endl;
std::cerr << "Mandolin: pluck amplitude parameter greater than 1.0!" << std::endl;
pluckAmplitude = 1.0;
}
@@ -101,11 +87,11 @@ void Mandolin :: pluck(MY_FLOAT amplitude, MY_FLOAT position)
// Pluck position puts zeroes at position * length.
pluckPosition = position;
if ( position < 0.0 ) {
cerr << "Mandolin: pluck position parameter less than zero!" << endl;
std::cerr << "Mandolin: pluck position parameter less than zero!" << std::endl;
pluckPosition = 0.0;
}
else if ( position > 1.0 ) {
cerr << "Mandolin: pluck position parameter greater than 1.0!" << endl;
std::cerr << "Mandolin: pluck position parameter greater than 1.0!" << std::endl;
pluckPosition = 1.0;
}
@@ -118,7 +104,7 @@ void Mandolin :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->pluck(amplitude);
#if defined(_STK_DEBUG_)
cerr << "Mandolin: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Mandolin: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -165,11 +151,11 @@ void Mandolin :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "Mandolin: Control value less than zero!" << endl;
std::cerr << "Mandolin: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "Mandolin: Control value greater than 128.0!" << endl;
std::cerr << "Mandolin: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_BodySize_) // 2
@@ -183,9 +169,9 @@ void Mandolin :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
mic = (int) (norm * 11.0);
else
cerr << "Mandolin: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "Mandolin: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "Mandolin: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "Mandolin: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -145,11 +145,11 @@ void Mesh2D :: setNX(short lenX)
{
NX = lenX;
if ( lenX < 2 ) {
cerr << "Mesh2D::setNX(" << lenX << "): Minimum length is 2!" << endl;
std::cerr << "Mesh2D::setNX(" << lenX << "): Minimum length is 2!" << std::endl;
NX = 2;
}
else if ( lenX > NXMAX ) {
cerr << "Mesh2D::setNX(" << lenX << "): Maximum length is " << NXMAX << "!" << endl;
std::cerr << "Mesh2D::setNX(" << lenX << "): Maximum length is " << NXMAX << "!" << std::endl;
NX = NXMAX;
}
}
@@ -158,11 +158,11 @@ void Mesh2D :: setNY(short lenY)
{
NY = lenY;
if ( lenY < 2 ) {
cerr << "Mesh2D::setNY(" << lenY << "): Minimum length is 2!" << endl;
std::cerr << "Mesh2D::setNY(" << lenY << "): Minimum length is 2!" << std::endl;
NY = 2;
}
else if ( lenY > NYMAX ) {
cerr << "Mesh2D::setNY(" << lenY << "): Maximum length is " << NYMAX << "!" << endl;
std::cerr << "Mesh2D::setNY(" << lenY << "): Maximum length is " << NYMAX << "!" << std::endl;
NY = NYMAX;
}
}
@@ -171,11 +171,11 @@ void Mesh2D :: setDecay(MY_FLOAT decayFactor)
{
MY_FLOAT gain = decayFactor;
if ( decayFactor < 0.0 ) {
cerr << "Mesh2D::setDecay decayFactor value is less than 0.0!" << endl;
std::cerr << "Mesh2D::setDecay decayFactor value is less than 0.0!" << std::endl;
gain = 0.0;
}
else if ( decayFactor > 1.0 ) {
cerr << "Mesh2D::setDecay decayFactor value is greater than 1.0!" << endl;
std::cerr << "Mesh2D::setDecay decayFactor value is greater than 1.0!" << std::endl;
gain = 1.0;
}
@@ -190,22 +190,22 @@ void Mesh2D :: setDecay(MY_FLOAT decayFactor)
void Mesh2D :: setInputPosition(MY_FLOAT xFactor, MY_FLOAT yFactor)
{
if ( xFactor < 0.0 ) {
cerr << "Mesh2D::setInputPosition xFactor value is less than 0.0!" << endl;
std::cerr << "Mesh2D::setInputPosition xFactor value is less than 0.0!" << std::endl;
xInput = 0;
}
else if ( xFactor > 1.0 ) {
cerr << "Mesh2D::setInputPosition xFactor value is greater than 1.0!" << endl;
std::cerr << "Mesh2D::setInputPosition xFactor value is greater than 1.0!" << std::endl;
xInput = NX - 1;
}
else
xInput = (short) (xFactor * (NX - 1));
if ( yFactor < 0.0 ) {
cerr << "Mesh2D::setInputPosition yFactor value is less than 0.0!" << endl;
std::cerr << "Mesh2D::setInputPosition yFactor value is less than 0.0!" << std::endl;
yInput = 0;
}
else if ( yFactor > 1.0 ) {
cerr << "Mesh2D::setInputPosition yFactor value is greater than 1.0!" << endl;
std::cerr << "Mesh2D::setInputPosition yFactor value is greater than 1.0!" << std::endl;
yInput = NY - 1;
}
else
@@ -225,14 +225,14 @@ void Mesh2D :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
}
#if defined(_STK_DEBUG_)
cerr << "Mesh2D: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Mesh2D: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
void Mesh2D :: noteOff(MY_FLOAT amplitude)
{
#if defined(_STK_DEBUG_)
cerr << "Mesh2D: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Mesh2D: NoteOff amplitude = " << amplitude << std::endl;
#endif
}
@@ -362,11 +362,11 @@ void Mesh2D :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "Mesh2D: Control value less than zero!" << endl;
std::cerr << "Mesh2D: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "Mesh2D: Control value greater than 128.0!" << endl;
std::cerr << "Mesh2D: Control value greater than 128.0!" << std::endl;
}
if (number == 2) // 2
@@ -380,9 +380,9 @@ void Mesh2D :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
;
else
cerr << "Mesh2D: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "Mesh2D: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "Mesh2D: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "Mesh2D: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -35,7 +35,7 @@
#include "Messager.h"
#include <string.h>
#include <iostream.h>
#include <iostream>
int socket_port = 2001;
@@ -76,7 +76,7 @@ Messager :: Messager(int inputMask, int port)
// If STK_PIPE is not specified, let the users know they can exit
// the program via the console if necessary.
if ( !(sources & STK_PIPE) && sources )
cout << "\nType `Exit<cr>' to quit.\n" << endl;
std::cout << "\nType `Exit<cr>' to quit.\n" << std::endl;
sources |= STK_SOCKET;
socket_port = port;
@@ -148,7 +148,7 @@ void Messager :: setRtDelta(long nSamples)
if ( nSamples > 0 )
rtDelta = nSamples;
else
cerr << "Messager: setRtDelta(" << nSamples << ") less than or equal to zero!" << endl;
std::cerr << "Messager: setRtDelta(" << nSamples << ") less than or equal to zero!" << std::endl;
}
long Messager :: getDelta() const
@@ -245,7 +245,7 @@ bool Messager :: socketMessage()
if (nSockets == 0)
pipefd = newfd;
else
cout << "New socket connection made.\n" << endl;
std::cout << "New socket connection made.\n" << std::endl;
// Set the socket to non-blocking mode.
Socket::setBlocking( newfd, false );
@@ -274,7 +274,7 @@ bool Messager :: socketMessage()
if ( nSockets == 1 && FD_ISSET(pipefd, &mask) ) {
// The "piping" socket is still running.
if (sources & STK_MIDI) {
cout << "MIDI input still running ... type 'Exit<cr>' to quit.\n" << endl;
std::cout << "MIDI input still running ... type 'Exit<cr>' to quit.\n" << std::endl;
}
else if (!(sources & STK_PIPE) ) {
// The user didn't specify this connection, so quit now.

View File

@@ -12,7 +12,6 @@
/***************************************************/
#include "Modal.h"
#include <string.h>
#include <stdlib.h>
Modal :: Modal(int modes)
@@ -38,10 +37,8 @@ Modal :: Modal(int modes)
envelope = new Envelope;
onepole = new OnePole;
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char file[128];
strcpy(file, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(file,"sinewave.raw"), TRUE);
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
// Set some default values.
vibrato->setFrequency( 6.0 );
@@ -87,11 +84,11 @@ void Modal :: setFrequency(MY_FLOAT frequency)
void Modal :: setRatioAndRadius(int modeIndex, MY_FLOAT ratio, MY_FLOAT radius)
{
if ( modeIndex < 0 ) {
cerr << "Modal: setRatioAndRadius modeIndex parameter is less than zero!" << endl;
std::cerr << "Modal: setRatioAndRadius modeIndex parameter is less than zero!" << std::endl;
return;
}
else if ( modeIndex >= nModes ) {
cerr << "Modal: setRatioAndRadius modeIndex parameter is greater than the number of operators!" << endl;
std::cerr << "Modal: setRatioAndRadius modeIndex parameter is greater than the number of operators!" << std::endl;
return;
}
@@ -106,7 +103,7 @@ void Modal :: setRatioAndRadius(int modeIndex, MY_FLOAT ratio, MY_FLOAT radius)
while (temp * baseFrequency > nyquist) temp *= (MY_FLOAT) 0.5;
ratios[modeIndex] = temp;
#if defined(_STK_DEBUG_)
cerr << "Modal : Aliasing would occur here ... correcting." << endl;
std::cerr << "Modal : Aliasing would occur here ... correcting." << std::endl;
#endif
}
radii[modeIndex] = radius;
@@ -131,11 +128,11 @@ void Modal :: setDirectGain(MY_FLOAT aGain)
void Modal :: setModeGain(int modeIndex, MY_FLOAT gain)
{
if ( modeIndex < 0 ) {
cerr << "Modal: setModeGain modeIndex parameter is less than zero!" << endl;
std::cerr << "Modal: setModeGain modeIndex parameter is less than zero!" << std::endl;
return;
}
else if ( modeIndex >= nModes ) {
cerr << "Modal: setModeGain modeIndex parameter is greater than the number of operators!" << endl;
std::cerr << "Modal: setModeGain modeIndex parameter is greater than the number of operators!" << std::endl;
return;
}
@@ -146,11 +143,11 @@ void Modal :: strike(MY_FLOAT amplitude)
{
MY_FLOAT gain = amplitude;
if ( amplitude < 0.0 ) {
cerr << "Modal: strike amplitude is less than zero!" << endl;
std::cerr << "Modal: strike amplitude is less than zero!" << std::endl;
gain = 0.0;
}
else if ( amplitude > 1.0 ) {
cerr << "Modal: strike amplitude is greater than 1.0!" << endl;
std::cerr << "Modal: strike amplitude is greater than 1.0!" << std::endl;
gain = 1.0;
}
@@ -176,7 +173,7 @@ void Modal :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->setFrequency(frequency);
#if defined(_STK_DEBUG_)
cerr << "Modal: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Modal: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -187,7 +184,7 @@ void Modal :: noteOff(MY_FLOAT amplitude)
this->damp(1.0 - (amplitude * 0.03));
#if defined(_STK_DEBUG_)
cerr << "Modal: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Modal: NoteOff amplitude = " << amplitude << std::endl;
#endif
}

View File

@@ -30,16 +30,13 @@
#include "ModalBar.h"
#include "SKINI.msg"
#include <string.h>
#include <math.h>
ModalBar :: ModalBar()
: Modal()
{
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char file[128];
strcpy(file, RAWWAVE_PATH);
wave = new WvIn( strcat(file,"marmstk1.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
wave = new WvIn( (Stk::rawwavePath() + "marmstk1.raw").c_str(), TRUE );
wave->setRate((MY_FLOAT) 0.5 * 22050.0 / Stk::sampleRate() );
// Set the resonances for preset 0 (marimba).
@@ -55,11 +52,11 @@ void ModalBar :: setStickHardness(MY_FLOAT hardness)
{
stickHardness = hardness;
if ( hardness < 0.0 ) {
cerr << "ModalBar: setStickHardness parameter is less than zero!" << endl;
std::cerr << "ModalBar: setStickHardness parameter is less than zero!" << std::endl;
stickHardness = 0.0;
}
else if ( hardness > 1.0 ) {
cerr << "ModalBar: setStickHarness parameter is greater than 1.0!" << endl;
std::cerr << "ModalBar: setStickHarness parameter is greater than 1.0!" << std::endl;
stickHardness = 1.0;
}
@@ -71,11 +68,11 @@ void ModalBar :: setStrikePosition(MY_FLOAT position)
{
strikePosition = position;
if ( position < 0.0 ) {
cerr << "ModalBar: setStrikePositions parameter is less than zero!" << endl;
std::cerr << "ModalBar: setStrikePositions parameter is less than zero!" << std::endl;
strikePosition = 0.0;
}
else if ( position > 1.0 ) {
cerr << "ModalBar: setStrikePosition parameter is greater than 1.0!" << endl;
std::cerr << "ModalBar: setStrikePosition parameter is greater than 1.0!" << std::endl;
strikePosition = 1.0;
}
@@ -160,11 +157,11 @@ void ModalBar :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "ModalBar: Control value less than zero!" << endl;
std::cerr << "ModalBar: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "ModalBar: Control value greater than 128.0!" << endl;
std::cerr << "ModalBar: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_StickHardness_) // 2
@@ -182,9 +179,9 @@ void ModalBar :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
envelope->setTarget( norm );
else
cerr << "ModalBar: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "ModalBar: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "ModalBar: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "ModalBar: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -11,14 +11,11 @@
/***************************************************/
#include "Modulate.h"
#include <string.h>
Modulate :: Modulate()
{
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char file[128];
strcpy(file, RAWWAVE_PATH);
vibrato = new WaveLoop( strcat(file,"sinewave.raw"), TRUE );
// Concatenate the STK rawwave path to the rawwave file
vibrato = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
vibrato->setFrequency( 6.0 );
vibratoGain = 0.04;

View File

@@ -21,20 +21,12 @@
#include "Moog.h"
#include "SKINI.msg"
#include <string.h>
Moog :: Moog()
{
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char temp[128];
char file[128];
strcpy(temp, RAWWAVE_PATH);
strcpy(file,temp);
attacks[0] = new WvIn( strcat(file,"mandpluk.raw"), TRUE );
strcpy(file,temp);
loops[0] = new WaveLoop( strcat(file,"impuls20.raw"), TRUE );
strcpy(file,temp);
loops[1] = new WaveLoop( strcat(file,"sinewave.raw"), TRUE ); // vibrato
// Concatenate the STK rawwave path to the rawwave file
attacks[0] = new WvIn( (Stk::rawwavePath() + "mandpluk.raw").c_str(), TRUE );
loops[0] = new WaveLoop( (Stk::rawwavePath() + "impuls20.raw").c_str(), TRUE );
loops[1] = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE ); // vibrato
loops[1]->setFrequency((MY_FLOAT) 6.122);
filters[0] = new FormSwep();
@@ -62,7 +54,7 @@ void Moog :: setFrequency(MY_FLOAT frequency)
{
baseFrequency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Moog: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "Moog: setFrequency parameter is less than or equal to zero!" << std::endl;
baseFrequency = 220.0;
}
@@ -92,7 +84,7 @@ void Moog :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
filters[1]->setSweepRate( filterRate * 22050.0 / Stk::sampleRate() );
#if defined(_STK_DEBUG_)
cerr << "Moog: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Moog: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -126,11 +118,11 @@ void Moog :: controlChange(int number, MY_FLOAT value)
MY_FLOAT norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
cerr << "Moog: Control value less than zero!" << endl;
std::cerr << "Moog: Control value less than zero!" << std::endl;
}
else if ( norm > 1.0 ) {
norm = 1.0;
cerr << "Moog: Control value greater than 128.0!" << endl;
std::cerr << "Moog: Control value greater than 128.0!" << std::endl;
}
if (number == __SK_FilterQ_) // 2
@@ -144,10 +136,10 @@ void Moog :: controlChange(int number, MY_FLOAT value)
else if (number == __SK_AfterTouch_Cont_) // 128
adsr->setTarget( norm );
else
cerr << "Moog: Undefined Control Number (" << number << ")!!" << endl;
std::cerr << "Moog: Undefined Control Number (" << number << ")!!" << std::endl;
#if defined(_STK_DEBUG_)
cerr << "Moog: controlChange number = " << number << ", value = " << value << endl;
std::cerr << "Moog: controlChange number = " << number << ", value = " << value << std::endl;
#endif
}

View File

@@ -34,7 +34,7 @@ NRev :: NRev(MY_FLOAT T60)
for (i=0; i<6; i++) {
combDelays[i] = new Delay( lengths[i], lengths[i]);
combCoefficient[i] = pow(10, (-3 * lengths[i] / (T60 * Stk::sampleRate())));
combCoefficient[i] = pow(10.0, (-3 * lengths[i] / (T60 * Stk::sampleRate())));
}
for (i=0; i<8; i++)

View File

@@ -12,9 +12,19 @@
#include "Noise.h"
#include <stdlib.h>
#include <time.h>
Noise :: Noise() : Stk()
{
{
// Seed the random number generator with system time.
this->setSeed( 0 );
lastOutput = (MY_FLOAT) 0.0;
}
Noise :: Noise( unsigned int seed ) : Stk()
{
// Seed the random number generator
this->setSeed( seed );
lastOutput = (MY_FLOAT) 0.0;
}
@@ -22,6 +32,14 @@ Noise :: ~Noise()
{
}
void Noise :: setSeed( unsigned int seed )
{
if ( seed == 0 )
srand( (unsigned int) time(NULL) );
else
srand( seed );
}
MY_FLOAT Noise :: tick()
{
lastOutput = (MY_FLOAT) (2.0 * rand() / (RAND_MAX + 1.0) );

View File

@@ -35,10 +35,10 @@ PRCRev :: PRCRev(MY_FLOAT T60)
}
for (i=0; i<2; i++) {
allpassDelays[i] = new Delay( lengths[i], lengths[i] );
combDelays[i] = new Delay( lengths[i+2], lengths[i+2] );
combCoefficient[i] = pow(10,(-3 * lengths[i+2] / (T60 * Stk::sampleRate())));
}
allpassDelays[i] = new Delay( lengths[i], lengths[i] );
combDelays[i] = new Delay( lengths[i+2], lengths[i+2] );
combCoefficient[i] = pow(10.0,(-3 * lengths[i+2] / (T60 * Stk::sampleRate())));
}
allpassCoefficient = 0.7;
effectMix = 0.5;

View File

@@ -27,25 +27,14 @@
/***************************************************/
#include "PercFlut.h"
#include <string.h>
PercFlut :: PercFlut()
: FM()
{
int i;
char files[4][128];
// Concatenate the STK RAWWAVE_PATH to the rawwave file
for ( i=0; i<4; i++ )
strcpy( files[i], RAWWAVE_PATH);
strcat(files[0], "sinewave.raw");
strcat(files[1], "sinewave.raw");
strcat(files[2], "sinewave.raw");
strcat(files[3], "fwavblnk.raw");
for ( i=0; i<4; i++ )
waves[i] = new WaveLoop( files[i], TRUE );
// Concatenate the STK rawwave path to the rawwave files
for ( int i=0; i<3; i++ )
waves[i] = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), TRUE );
waves[3] = new WaveLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), TRUE );
this->setRatio(0, 1.50 * 1.000);
this->setRatio(1, 3.00 * 0.995);

View File

@@ -11,7 +11,7 @@
/***************************************************/
#include "Phonemes.h"
#include <iostream.h>
#include <iostream>
const char Phonemes :: phonemeNames[32][4] =
{"eee", "ihh", "ehh", "aaa",
@@ -215,7 +215,7 @@ Phonemes :: ~Phonemes(void)
const char *Phonemes :: name( unsigned int index )
{
if ( index > 31 ) {
cerr << "Phonemes: name index is greater than 31!" << endl;
std::cerr << "Phonemes: name index is greater than 31!" << std::endl;
return 0;
}
return phonemeNames[index];
@@ -224,7 +224,7 @@ const char *Phonemes :: name( unsigned int index )
MY_FLOAT Phonemes :: voiceGain( unsigned int index )
{
if ( index > 31 ) {
cerr << "Phonemes: voiceGain index is greater than 31!" << endl;
std::cerr << "Phonemes: voiceGain index is greater than 31!" << std::endl;
return 0.0;
}
return phonemeGains[index][0];
@@ -233,7 +233,7 @@ MY_FLOAT Phonemes :: voiceGain( unsigned int index )
MY_FLOAT Phonemes :: noiseGain( unsigned int index )
{
if ( index > 31 ) {
cerr << "Phonemes: noiseGain index is greater than 31!" << endl;
std::cerr << "Phonemes: noiseGain index is greater than 31!" << std::endl;
return 0.0;
}
return phonemeGains[index][1];
@@ -242,11 +242,11 @@ MY_FLOAT Phonemes :: noiseGain( unsigned int index )
MY_FLOAT Phonemes :: formantFrequency( unsigned int index, unsigned int partial )
{
if ( index > 31 ) {
cerr << "Phonemes: formantFrequency index is greater than 31!" << endl;
std::cerr << "Phonemes: formantFrequency index is greater than 31!" << std::endl;
return 0.0;
}
if ( partial > 3 ) {
cerr << "Phonemes: formantFrequency partial is greater than 3!" << endl;
std::cerr << "Phonemes: formantFrequency partial is greater than 3!" << std::endl;
return 0.0;
}
return phonemeParameters[index][partial][0];
@@ -255,11 +255,11 @@ MY_FLOAT Phonemes :: formantFrequency( unsigned int index, unsigned int partial
MY_FLOAT Phonemes :: formantRadius( unsigned int index, unsigned int partial )
{
if ( index > 31 ) {
cerr << "Phonemes: formantRadius index is greater than 31!" << endl;
std::cerr << "Phonemes: formantRadius index is greater than 31!" << std::endl;
return 0.0;
}
if ( partial > 3 ) {
cerr << "Phonemes: formantRadius partial is greater than 3!" << endl;
std::cerr << "Phonemes: formantRadius partial is greater than 3!" << std::endl;
return 0.0;
}
return phonemeParameters[index][partial][1];
@@ -268,11 +268,11 @@ MY_FLOAT Phonemes :: formantRadius( unsigned int index, unsigned int partial )
MY_FLOAT Phonemes :: formantGain( unsigned int index, unsigned int partial )
{
if ( index > 31 ) {
cerr << "Phonemes: formantGain index is greater than 31!" << endl;
std::cerr << "Phonemes: formantGain index is greater than 31!" << std::endl;
return 0.0;
}
if ( partial > 3 ) {
cerr << "Phonemes: formantGain partial is greater than 3!" << endl;
std::cerr << "Phonemes: formantGain partial is greater than 3!" << std::endl;
return 0.0;
}
return phonemeParameters[index][partial][2];

View File

@@ -10,7 +10,7 @@
/***************************************************/
#include "PitShift.h"
#include <iostream.h>
#include <iostream>
#include <math.h>
PitShift :: PitShift()
@@ -40,11 +40,11 @@ void PitShift :: setEffectMix(MY_FLOAT mix)
{
effectMix = mix;
if ( mix < 0.0 ) {
cerr << "PitShift: setEffectMix parameter is less than zero!" << endl;
std::cerr << "PitShift: setEffectMix parameter is less than zero!" << std::endl;
effectMix = 0.0;
}
else if ( mix > 1.0 ) {
cerr << "PitShift: setEffectMix parameter is greater than 1.0!" << endl;
std::cerr << "PitShift: setEffectMix parameter is greater than 1.0!" << std::endl;
effectMix = 1.0;
}
}

View File

@@ -59,7 +59,7 @@ void PluckTwo :: setFrequency(MY_FLOAT frequency)
{
lastFrequency = frequency;
if ( lastFrequency <= 0.0 ) {
cerr << "PluckTwo: setFrequency parameter less than or equal to zero!" << endl;
std::cerr << "PluckTwo: setFrequency parameter less than or equal to zero!" << std::endl;
lastFrequency = 220.0;
}
@@ -83,7 +83,7 @@ void PluckTwo :: setDetune(MY_FLOAT detune)
{
detuning = detune;
if ( detuning <= 0.0 ) {
cerr << "PluckTwo: setDetune parameter less than or equal to zero!" << endl;
std::cerr << "PluckTwo: setDetune parameter less than or equal to zero!" << std::endl;
detuning = 0.1;
}
delayLine->setDelay(( lastLength / detuning) - (MY_FLOAT) 0.5);
@@ -100,11 +100,11 @@ void PluckTwo :: setPluckPosition(MY_FLOAT position)
{
pluckPosition = position;
if ( position < 0.0 ) {
cerr << "PluckTwo: setPluckPosition parameter is less than zero!" << endl;
std::cerr << "PluckTwo: setPluckPosition parameter is less than zero!" << std::endl;
pluckPosition = 0.0;
}
else if ( position > 1.0 ) {
cerr << "PluckTwo: setPluckPosition parameter is greater than 1.0!" << endl;
std::cerr << "PluckTwo: setPluckPosition parameter is greater than 1.0!" << std::endl;
pluckPosition = 1.0;
}
}
@@ -121,7 +121,7 @@ void PluckTwo :: noteOff(MY_FLOAT amplitude)
loopGain = ((MY_FLOAT) 1.0 - amplitude) * (MY_FLOAT) 0.5;
#if defined(_STK_DEBUG_)
cerr << "PluckTwo: NoteOff amplitude = " << amplitude << endl;
std::cerr << "PluckTwo: NoteOff amplitude = " << amplitude << std::endl;
#endif
}

View File

@@ -49,7 +49,7 @@ void Plucked :: setFrequency(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Plucked: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "Plucked: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -66,11 +66,11 @@ void Plucked :: pluck(MY_FLOAT amplitude)
{
MY_FLOAT gain = amplitude;
if ( gain > 1.0 ) {
cerr << "Plucked: pluck amplitude greater than 1.0!" << endl;
std::cerr << "Plucked: pluck amplitude greater than 1.0!" << std::endl;
gain = 1.0;
}
else if ( gain < 0.0 ) {
cerr << "Plucked: pluck amplitude less than zero!" << endl;
std::cerr << "Plucked: pluck amplitude less than zero!" << std::endl;
gain = 0.0;
}
@@ -87,7 +87,7 @@ void Plucked :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->pluck(amplitude);
#if defined(_STK_DEBUG_)
cerr << "Plucked: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Plucked: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -95,16 +95,16 @@ void Plucked :: noteOff(MY_FLOAT amplitude)
{
loopGain = (MY_FLOAT) 1.0 - amplitude;
if ( loopGain < 0.0 ) {
cerr << "Plucked: noteOff amplitude greater than 1.0!" << endl;
std::cerr << "Plucked: noteOff amplitude greater than 1.0!" << std::endl;
loopGain = 0.0;
}
else if ( loopGain > 1.0 ) {
cerr << "Plucked: noteOff amplitude less than or zero!" << endl;
std::cerr << "Plucked: noteOff amplitude less than or zero!" << std::endl;
loopGain = (MY_FLOAT) 0.99999;
}
#if defined(_STK_DEBUG_)
cerr << "Plucked: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Plucked: NoteOff amplitude = " << amplitude << std::endl;
#endif
}

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