mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Merge 4.1.1 into releases
This commit is contained in:
2
README
2
README
@@ -17,7 +17,7 @@ For compiling and installing STK, see the INSTALL file in this directory.
|
||||
|
||||
OVERVIEW:
|
||||
|
||||
The Synthesis ToolKit in C++ (STK) is a set of audio signal processing and synthesis classes and algorithms written in C++. You can use these classes to create programs that make sounds with a variety of synthesis techniques. This is not a terribly novel concept, except that the Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (no unusual libraries, no hidden drivers, and all source code is included). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
|
||||
The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in C++. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
|
||||
|
||||
The Synthesis ToolKit is free for non-commercial use. The only parts of the Synthesis ToolKit that are platform-dependent concern real-time audio and MIDI input and output, and that is taken care of with a few special classes. The interface for MIDI input and the simple Tcl/Tk graphical user interfaces (GUIs) provided is the same, so it's easy to experiment in real time using either the GUIs or MIDI. The Synthesis ToolKit can generate simultaneous SND (AU), WAV, AIFF, and MAT-file output soundfile formats (as well as realtime sound output), so you can view your results using one of a large variety of sound/signal analysis tools already available (e.g. Snd, Cool Edit, Matlab).
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ By Perry R. Cook and Gary P. Scavone, 1995-2002.
|
||||
|
||||
Please read the file README and INSTALL for more general STK information.
|
||||
|
||||
Realtime support for Linux is currently using either the Open Sound System (OSS) or the Advanced Linux Sound Architecture (ALSA) sound and MIDI APIs. The free version of OSS works as well (and in some cases better than the commercial OSS version ... such as with my Maestro 2e chipset). In general, the ALSA drivers also seem to perform well. You can read more about ALSA at http://www.alsa-project.org/. ALSA is open source and holds great promise for audio under Linux. The API is selected during compilation using either the __LINUX_ALSA__ or __LINUX_OSS__ definitions.
|
||||
Realtime support for Linux is currently using either the Open Sound System (OSS) or the Advanced Linux Sound Architecture (ALSA) sound and MIDI APIs. The free version of OSS works as well (and in some cases better than the commercial OSS version ... such as with my Maestro 2e chipset). In general, the ALSA drivers also seem to perform well. You can read more about ALSA at http://www.alsa-project.org/. ALSA is open source and holds great promise for audio under Linux. The API is selected during compilation using either the __LINUX_ALSA__ or __LINUX_OSS__ definitions. The configure script uses the OSS API by default. The ALSA API can be selected by passing the "--with-alsa" option to configure.
|
||||
|
||||
STK should compile without much trouble under Linux ... afterall, it is primarily developed on Linux platforms. Since all Linux distributions typically include the GNU makefile utilities, you should be able to use the default Makefile. Typing "make" will initiate the compilation process.
|
||||
|
||||
MIDIATOR SERIAL PORT MIDI SUPPORT:
|
||||
|
||||
STK now has special support for the MIDIator serial port MIDI interface. This is of primary interest to us laptop users, whose computers usually don't have a gameport. If you want to buy one of these devices, make sure you get the MS-124w model (www.midiator.com). For it to work in STK, you must provide the __MIDIATOR__ definition during compilation (in addition to either __LINUX_ALSA__ or __LINUX_OSS__).
|
||||
STK now has special support for the MIDIator serial port MIDI interface. This is of primary interest to us laptop users, whose computers usually don't have a gameport. If you want to buy one of these devices, make sure you get the MS-124w model (www.midiator.com). For it to work in STK, you must provide the __MIDIATOR__ definition during compilation (in addition to either __LINUX_ALSA__ or __LINUX_OSS__) or pass the "--enable-midiator" option to configure.
|
||||
|
||||
There are a few things that need to be done on your system to get the MIDIator working. Assuming you wish to attach the MIDIator to serial port 0, add the following lines to your bootup sequence in /etc/rc.d/rc.local:
|
||||
|
||||
|
||||
@@ -6,19 +6,24 @@ 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 version 10.1.
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
There is a potential conflict between the STK Delay class and a Delay() function declared in OSUtils.h (which is included via <CoreServices/CoreServices.h>). In general, this conflict can be avoided via the use of a namespace (an explicit Delay::Delay declaration), though this made the Windows Visual C++ compiler barf. If you use STK classes within a project that includes the OSUtils.h file, you will likely need to make changes in STK classes that use the Delay class.
|
||||
|
||||
|
||||
Tcl/Tk on OS X:
|
||||
|
||||
The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. Once installed, it is suggested that a link be made to the executable from a standard search path (/usr/bin/wish). In any event, it will not be possible to use the supplied startup scripts in the demo directory (i.e. StkDemo.bat) because the tcl/tk script startup sequence is slightly different than for all the other systems. Assuming you have made the link mentioned above, the STK demo program and tcl/tk script can be started by typing:
|
||||
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:
|
||||
|
||||
wish tcl/Demo.tcl | demo Clarinet -or -ip
|
||||
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).
|
||||
|
||||
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates.
|
||||
|
||||
At this point, it is not recommended to connect by socket from a tcl/tk script to an STK program because tcl/tk does not appear to properly close the socket connection and the STK program is left hanging.
|
||||
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.
|
||||
|
||||
@@ -2,6 +2,13 @@ The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2002.
|
||||
|
||||
v4.1.1: (24 October 2002)
|
||||
- bug fix in RtAudio for Macintosh OS X and Windows ASIO duplex operation
|
||||
- windows ASIO fix in Stk.h
|
||||
- documentation updates
|
||||
- expanded tutorial
|
||||
- fixed RtDuplex omission in src Makefile
|
||||
|
||||
v4.1: (8 October 2002)
|
||||
- Macintosh OS X support added
|
||||
- new Whistle class
|
||||
|
||||
99
doc/doxygen/compile.txt
Normal file
99
doc/doxygen/compile.txt
Normal file
@@ -0,0 +1,99 @@
|
||||
/*! \page compile Compiling
|
||||
|
||||
The Synthesis ToolKit can be used in a variety of ways, depending on your particular needs. Some people choose the classes they need for a particular project and copy those to their working directory. Others create <TT>Makefiles</TT> which compile project-specific class objects from common <TT>src</TT> and <TT>include</TT> directories. And still others like to compile and link to a common library of object files. STK was not designed with one particular style of use in mind.
|
||||
|
||||
|
||||
\section rtvsnonrt "Realtime" vs. "Non-Realtime"
|
||||
|
||||
Most of the Synthesis ToolKit classes are platform independent. That means that they should compile on any reasonably current C++ compiler. The functionality needed for realtime audio and MIDI input/output, as well as realtime control message acquistion, is inherently platform and operating-system (OS) <I>dependent</I>. STK classes which require specific platform/OS support include RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, TcpWvIn, TcpWvOut, Socket, and Thread. These classes currently can only be compiled on Linux, Irix, Macintosh OS X, and Windows systems using the <TT>__LINUX_OSS__</TT>, <TT>__LINUX_ALSA__</TT>, <TT>__IRIX_AL__</TT>, <TT>__MACOSX_CORE__</TT>, <TT>__WINDOWS_DS__</TT>, or <TT>__WINDOWS_ASIO__</TT> preprocessor definitions.
|
||||
|
||||
Without the "realtime" classes, it is still possible to read SKINI scorefiles for control input and to read and write to/from a variety of audio file formats (WAV, SND, AIFF, MAT-file, and RAW). If compiling for a "little-endian" host processor, the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition should be provided.
|
||||
|
||||
|
||||
\section unix Unix Systems:
|
||||
|
||||
STK compiles with realtime support on the following flavors of the Unix operating system: Linux, Irix, and Macintosh OS X. Aside from differences in compilers, audio/MIDI APIs, and host endianness, the steps necessary to compile STK programs and classes on these platforms are the same. The following table summarizes these differences.
|
||||
|
||||
<CENTER>
|
||||
<TABLE BORDER=2 COLS=5 WIDTH="100%">
|
||||
<TR BGCOLOR="beige">
|
||||
<TD WIDTH="5%"><B>OS:</B></TD>
|
||||
<TD WIDTH="5%"><B>Realtime Audio/MIDI API:</B></TD>
|
||||
<TD WIDTH="5%"><B>Preprocessor Definition:</B></TD>
|
||||
<TD WIDTH="5%"><B>Library or Framework:</B></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>ALSA</TD>
|
||||
<TD>__LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>OSS</TD>
|
||||
<TD>__LINUX_OSS__, __LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Macintosh OS X</TD>
|
||||
<TD>CoreAudio</TD>
|
||||
<TD>__MACOSX_CORE__</TD>
|
||||
<TD><TT>pthread, stdc++, CoreAudio, CoreMIDI, CoreFoundation</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Irix</TD>
|
||||
<TD>AL</TD>
|
||||
<TD>__IRIX_AL__</TD>
|
||||
<TD><TT>audio, pthread</TT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
|
||||
The available C++ compilers on any of these systems can vary.
|
||||
|
||||
One approach in using STK is to simply copy the class files needed for a particular program into a project directory. Taking the <TT>sineosc.cpp</TT> example from the previous tutorial chapter, it would be necessary to set up a directory that includes the files <TT>sineosc.cpp</TT>, the rawwave file <TT>sinewave.raw</TT> in a subdirectory called <TT>rawwaves</TT>, and the header and source files for the classes Stk, WvIn, WaveLoop, and WvOut. The program could then be compiled on a Linux system using the GNU g++ compiler as follows:
|
||||
\code
|
||||
g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp sineosc.cpp
|
||||
\endcode
|
||||
|
||||
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.
|
||||
|
||||
|
||||
\subsection library Library Use:
|
||||
|
||||
The STK distribution provides a <TT>Makefile</TT> that can be used on Unix systems to build a static library. After unpacking the distribution (<TT>tar -xzf stk-4.x.tar.gz</TT>), run the configure script by typing <TT>./configure</TT> from the top level distribution directory (see the INSTALL file in the same directory for more information). Then from within the <TT>src</TT> directory, type <TT>make</TT>. After a successful build, you may wish to move the library (<TT>libstk.a</TT>) and the contents of the <TT>include</TT> directory to standard library and include search paths on your system. For example, the linux RPM distribution of STK puts the library in <TT>/usr/lib/</TT> and the STK header files in <TT>/usr/include/stk/</TT>.
|
||||
|
||||
Assuming the library is located in a standard search path and the header files are located in <TT>/usr/include/stk/</TT>, the <TT>sineosc.cpp</TT> example from the previous tutorial chapter can be compiled on a Linux system using the GNU g++ compiler as follows:
|
||||
|
||||
\code
|
||||
g++ -Wall -D__LITTLE_ENDIAN__ -I/usr/include/stk -o sineosc sineosc.cpp -lstk
|
||||
\endcode
|
||||
|
||||
With the header files in a standard search path, it is possible to modify the <TT>\#include</TT> statements in the <TT>sineosc.cpp</TT> program as follows:
|
||||
|
||||
\code
|
||||
#include "stk/WaveLoop.h"
|
||||
#include "stk/WvOut.h"
|
||||
\endcode
|
||||
|
||||
and then compile without an explicit include path argument to the compiler:
|
||||
|
||||
\code
|
||||
g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc sineosc.cpp -lstk
|
||||
\endcode
|
||||
|
||||
|
||||
\section compileWin Windows:
|
||||
|
||||
STK has been tested on Windows platforms using the Visual C++ compiler only. It is assumed here that you're familiar with Visual C++ and its particular idiosyncrasies.
|
||||
|
||||
The approach when using Visual C++ is to build a project which includes the necessary ToolKit files from the distribution <TT>src</TT> and <TT>include</TT> directories. For the example program from the previous tutorial chapter, create a VC++ console application project, add the Stk, WvIn, WaveLoop, and WvOut class files, as well as <TT>sineosc.cpp</TT>, and make sure the <TT>sinewave.raw</TT> file is in the subdirectory <TT>rawwaves</TT>.
|
||||
|
||||
For programs using any of the STK realtime classes mentioned above, it is necessary to link with the DirectSound (<TT>dsound.lib</TT>), <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries, select the multithreaded library, and provide the <TT>__LITTLE_ENDIAN__</TT> and <TT>__WINDOWS_DS__</TT> preprocessor definitions.
|
||||
|
||||
For Steinberg ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition, include all the files in the <TT>src/asio/</TT> directory (i.e., <TT>asio.h,cpp</TT>, <TT>asiodrivers.h,cpp</TT>, ...), and link with the <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries.
|
||||
|
||||
[<A HREF="realtime.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
*/
|
||||
130
doc/doxygen/control.txt
Normal file
130
doc/doxygen/control.txt
Normal file
@@ -0,0 +1,130 @@
|
||||
/*! \page controlin Control Input
|
||||
|
||||
Each Synthesis ToolKit instrument exposes its relevant control parameters via public functions such as setFrequency() and controlChange(). Programmers are free to implement the control scheme of their choice in exposing those parameters to the user.
|
||||
|
||||
A text-based control protocol called <A HREF="skini.html">SKINI</A> is provided with the Synthesis ToolKit. SKINI extends the MIDI protocol in incremental ways, providing a text-based messaging scheme in human-readable format and making use of floating-point numbers wherever possible. Each SKINI message consists of a message type (e.g., NoteOn, PitchBend), a time specification (absolute or delta), a channel number (scanned as a long integer), and a maximum of two subsequent message-specific field values. Knowing this, it should be relatively clear what the following SKINI "scorefile" specifies:
|
||||
|
||||
\code
|
||||
NoteOn 0.000082 2 55.0 82.3
|
||||
NoteOff 1.000000 2 55.0 64.0
|
||||
NoteOn 0.000082 2 69.0 82.8
|
||||
StringDetune 0.100000 2 10.0
|
||||
StringDetune 0.100000 2 30.0
|
||||
StringDetune 0.100000 2 50.0
|
||||
StringDetune 0.100000 2 40.0
|
||||
StringDetune 0.100000 2 22.0
|
||||
StringDetune 0.100000 2 12.0
|
||||
NoteOff 1.000000 2 69.0 64.0
|
||||
\endcode
|
||||
|
||||
MIDI messages (with the exception of Sysex) are easily represented within the SKINI protocol.
|
||||
|
||||
The class Messager can be used to acquire and parse MIDI messages from a MIDI device and SKINI messages from STDIN and socket connections. Many of the example programs included with the ToolKit distribution use a Messager instance to accept control input from the accompanying tcl/tk graphical user interfaces, from external MIDI devices, or from SKINI scorefiles.
|
||||
|
||||
In the following example, we'll modify the <TT>bethree.cpp</TT> program from the previous tutorial chapter and incorporate a Messager class to allow control via a SKINI scorefile.
|
||||
|
||||
\code
|
||||
// controlbee.cpp
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
#include "Messager.h"
|
||||
#include "SKINI.msg"
|
||||
#include <math.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
Instrmnt *instrument = 0;
|
||||
RtWvOut *output = 0;
|
||||
Messager *messager = 0;
|
||||
bool done = FALSE;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instrument
|
||||
instrument = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a Messager instance to read from a redirected SKINI scorefile.
|
||||
messager = new Messager();
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Play the instrument until the end of the scorefile.
|
||||
int i, nTicks, type;
|
||||
MY_FLOAT byte2, byte3, frequency;
|
||||
while (!done) {
|
||||
|
||||
// Look for new messages and return a delta time (in samples).
|
||||
type = messager->nextMessage();
|
||||
if (type < 0)
|
||||
done = TRUE;
|
||||
|
||||
nTicks = messager->getDelta();
|
||||
try {
|
||||
for ( i=0; i<nTicks; i++ )
|
||||
output->tick( instrument->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ( type > 0 ) {
|
||||
// Process the new control message.
|
||||
byte2 = messager->getByteTwo();
|
||||
byte3 = messager->getByteThree();
|
||||
|
||||
switch(type) {
|
||||
|
||||
case __SK_NoteOn_:
|
||||
frequency = (MY_FLOAT) 220.0 * pow( 2.0, (byte2 - 57.0) / 12.0 );
|
||||
instrument->noteOn( frequency, byte3 * ONE_OVER_128 );
|
||||
break;
|
||||
|
||||
case __SK_NoteOff_:
|
||||
instrument->noteOff( byte3 * ONE_OVER_128 );
|
||||
break;
|
||||
|
||||
case __SK_ControlChange_:
|
||||
instrument->controlChange( (int) byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_AfterTouch_:
|
||||
instrument->controlChange( 128, byte2 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete instrument;
|
||||
delete output;
|
||||
delete messager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
Assuming the program is compiled as <TT>controlbee</TT> and the SKINI scorefile <A HREF="tutorial/bookert.ski"><TT>bookert.ski</TT></A> is in the <TT>scores</TT> directory, the scorefile could be redirected to the program as:
|
||||
|
||||
\code
|
||||
controlbee < scores/bookert.ski
|
||||
\endcode
|
||||
|
||||
Only a few basic SKINI message type case statements are included in this example. It is easy to extend the program to support a much more elaborate set of instrument control parameters.
|
||||
|
||||
This example could also be easily extended to accept "realtime" control input messages via STDIN, socket, or MIDI connections. The Messager class constructor takes an optional argument consisting of a bitmask of the following options: <TT>STK_PIPE</TT>, <TT>STK_SOCKET</TT>, and/or <TT>STK_MIDI</TT>.
|
||||
|
||||
[<A HREF="multichannel.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
*/
|
||||
@@ -1,14 +1,26 @@
|
||||
/*! \page download Download and Release Notes
|
||||
|
||||
<B>Version 4.1, 8 October 2002</B><P>
|
||||
<A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.tar.gz">STK Version 4.1: Source distribution</A> (1.2 MB tar/gzipped)<BR>
|
||||
<A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1.binaries.tar.gz">STK Version 4.1: Source distribution with precompiled windows binaries</A> (1.7 MB tar/gzipped)<BR>
|
||||
<A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.1-1.i386.rpm">STK Version 4.1: Linux RPM using ALSA API</A> (1.2 MB)<BR>
|
||||
<A HREF="http://www-ccrma.stanford.edu/software/stk/release/stkmanual.pdf">STK Manual (PDF)</A> (1.2 MB) Note: HTML version in /doc/html/ directory of distribution<BR>
|
||||
<P>
|
||||
<B>Version 4.1.1, 24 October 2002</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>
|
||||
</UL>
|
||||
|
||||
|
||||
\section notes Release Notes:
|
||||
|
||||
\subsection v4dot1dot3 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>
|
||||
@@ -27,7 +39,6 @@
|
||||
<LI>Multivoice flag (-n NUMBER) added as command line option to demo program.</LI>
|
||||
<LI>Sample rate flag added as command line option to example programs.</LI>
|
||||
<LI>Socket port number added as command line option to example programs.</LI>
|
||||
|
||||
</UL>
|
||||
|
||||
\subsection v4 Version 4.0
|
||||
|
||||
104
doc/doxygen/hello.txt
Normal file
104
doc/doxygen/hello.txt
Normal file
@@ -0,0 +1,104 @@
|
||||
/*! \page hello Hello Sine!
|
||||
|
||||
We'll begin our introduction to the Synthesis ToolKit with a simple sine-wave oscillator program. STK does not provide a specific oscillator for sine waves. Instead, it provides a generic waveform oscillator class, WaveLoop, which can load a variety of common file types. In this example, we load a sine "table" from an STK RAW file (defined as monophonic, 16-bit, big-endian data). We use the class WvOut to write the result to a 16-bit, WAV formatted audio file.
|
||||
|
||||
\code
|
||||
|
||||
// sineosc.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
// Define and load the sine wave file
|
||||
WaveLoop *input = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
input->setFrequency( 440.0 );
|
||||
|
||||
// Define and open a 16-bit, one-channel WAV formatted output file
|
||||
output = new WvOut( "hellosine.wav", 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
|
||||
|
||||
// Run the oscillator for 40000 samples, writing to the output file
|
||||
int i;
|
||||
for ( i=0; i<40000; i++ ) {
|
||||
output->tick( input->tick() );
|
||||
}
|
||||
|
||||
// Clean up
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
WaveLoop is a subclass of WvIn, which supports WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. WvIn provides interpolating, read once ("oneshot") functionality, as well as methods for setting the read rate and read position.
|
||||
|
||||
The WvIn and WvOut classes are complementary, both supporting WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. However, WvOut does not perform data interpolation.
|
||||
|
||||
Nearly all STK classes implement <TT>tick()</TT> functions which take and/or return sample values. Within the <TT>tick()</TT> function, the fundamental sample calculations are performed for a given class. Most STK classes consume/generate a single sample per operation and their <TT>tick()</TT> method takes/returns each sample "by value". In addition, every class implementing a <TT>tick()</TT> function also provides an overloaded <TT>tick()</TT> function taking pointer and size arguments which can be used for vectorized computations.
|
||||
|
||||
The WvIn and WvOut classes support multi-channel sample frames. To distinguish single-sample frame operations from multi-channel frame operations, these classes also implement <TT>tickFrame()</TT> functions. When a <TT>tick()</TT> method is called for multi-channel data, frame averages are returned or the input sample is distributed across all channels of a sample frame.
|
||||
|
||||
Nearly all STK classes inherit from the Stk base class. Stk provides a static sample rate which is queried by subclasses as needed. Because many classes use the current sample rate value during instantiation, it is important that the desired value be set at the beginning of a program. The default STK sample rate is 22050 Hz.
|
||||
|
||||
Another primary concept that is somewhat obscurred in this example concerns the data format in which sample values are passed and received. Audio and control signals throughout STK use a floating-point data type, the exact precision of which can be controlled via the <TT>MY_FLOAT</TT> \#define statement in Stk.h. Thus, the ToolKit can use any normalization scheme desired. The base instruments and algorithms are implemented with a general audio sample dynamic maximum of +/-1.0, and the WvIn and WvOut classes and subclasses scale appropriately for DAC or soundfile input and output.
|
||||
|
||||
\section error Error Handling
|
||||
|
||||
The ToolKit has some basic C++ error handling functionality built in. Classes which access files and/or hardware are most prone to runtime errors. To properly "catch" such errors, the above example should be rewritten as shown below.
|
||||
|
||||
\code
|
||||
// sineosc.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *input = 0;
|
||||
WvOut *output = 0;
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
input = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
|
||||
// Define and open a 16-bit, one-channel WAV formatted output file
|
||||
output = new WvOut( "hellosine.wav", 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
|
||||
}
|
||||
catch ( StkError & ) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
input->setFrequency( 440.0 );
|
||||
|
||||
// Run the oscillator for 40000 samples, writing to the output file
|
||||
for ( int i=0; i<40000; i++ ) {
|
||||
|
||||
try {
|
||||
output->tick( input->tick() );
|
||||
}
|
||||
catch ( StkError & ) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
In this particular case, we simply exit the program if an error occurs (an error message is automatically printed to stderr). A more refined program might attempt to recover from or fix a particular problem and, if successful, continue processing. See the \ref classes to determine which constructors and functions can throw an error.
|
||||
|
||||
[<A HREF="compile.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
*/
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
|
||||
The <B>Synthesis ToolKit in C++ (STK)</B> is a set of audio signal processing and synthesis classes and algorithms written in C++. You can use these classes to create programs that make sounds with a variety of synthesis techniques. This is not a terribly novel concept, except that the Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (no libraries, no hidden drivers, and all source code is included). 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, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
|
||||
The <B>Synthesis ToolKit in C++ (STK)</B> is a set of open source audio signal processing and algorithmic synthesis classes written in 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
|
||||
- \ref classes
|
||||
@@ -14,3 +14,8 @@ The <B>Synthesis ToolKit in C++ (STK)</B> is a set of audio signal processing an
|
||||
- \ref tutorial
|
||||
|
||||
*/
|
||||
|
||||
<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>
|
||||
@@ -18,7 +18,7 @@ This is a link to Perry Cook's STK Web page. He has information about the \ref
|
||||
|
||||
<H4>What is the <I>Synthesis ToolKit</I>?</H4>
|
||||
|
||||
The Synthesis ToolKit in C++ (STK) is a set of audio signal processing and synthesis classes and algorithms written in C++. You can use these classes to create programs that make sounds with a variety of synthesis techniques. This is not a terribly novel concept, except that the Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (no unusual libraries, no hidden drivers, and all source code is included). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
|
||||
The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in C++. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 8 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
|
||||
|
||||
The Synthesis ToolKit is free for non-commercial use. The only parts of the Synthesis ToolKit that are platform-dependent concern real-time audio and MIDI input and output, and that is taken care of with a few special classes. The interface for MIDI input and the simple <A HREF="http://dev.scriptics.com">Tcl/Tk</A> graphical user interfaces (GUIs) provided is the same, so it's easy to experiment in real time using either the GUIs or MIDI. The Synthesis ToolKit can generate simultaneous SND (AU), WAV, AIFF, and MAT-file output soundfile formats (as well as realtime sound output), so you can view your results using one of a large variety of sound/signal analysis tools already available (e.g. <A HREF="http://www-ccrma.stanford.edu/software/snd/">Snd</A>, Cool Edit, Matlab).
|
||||
|
||||
|
||||
73
doc/doxygen/instruments.txt
Normal file
73
doc/doxygen/instruments.txt
Normal file
@@ -0,0 +1,73 @@
|
||||
/*! \page instruments Instruments
|
||||
|
||||
The ToolKit comes with a wide variety of synthesis algorithms, all of which inherit from the Instrmnt class. In this example, we'll fire up an instance of the BeeThree FM synthesis class and show how it's frequency can be modified over time.
|
||||
|
||||
\code
|
||||
// bethree.cpp
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
Instrmnt *instrument = 0;
|
||||
RtWvOut *output = 0;
|
||||
MY_FLOAT frequency, amplitude, scaler;
|
||||
long counter, i;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instrument
|
||||
instrument = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
scaler = 1.0;
|
||||
frequency = 220.0;
|
||||
amplitude = 0.5;
|
||||
instrument->noteOn( frequency, amplitude );
|
||||
|
||||
// Play the instrument for 80000 samples, changing the frequency every 2000 samples
|
||||
counter = 0;
|
||||
while ( counter < 80000 ) {
|
||||
for ( i=0; i<2000; i++ ) {
|
||||
try {
|
||||
output->tick( instrument->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
counter += 2000;
|
||||
scaler += 0.025;
|
||||
instrument->setFrequency( frequency * scaler );
|
||||
}
|
||||
|
||||
// Turn the instrument off with maximum decay envelope.
|
||||
instrument->noteOff( 1.0 );
|
||||
|
||||
cleanup:
|
||||
delete instrument;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
We have used an Instrmnt pointer when referencing the BeeThree instance above, so it would be simple to replace the BeeThree class with any other STK instrument class. It should be noted, however, that a few classes do not respond to the setFrequency() function (e.g., Shakers, Drummer).
|
||||
|
||||
The noteOn() function initiates an instrument attack. Instruments which are continuously excited (e.g., Clarinet, BeeThree) will continue to sound until stopped with a noteOff(). Impulsively excited instrument sounds (e.g., Plucked, Wurley) typically decay within a few seconds time, requiring subsequent noteOn() messages for re-attack.
|
||||
|
||||
Instrument parameters can be precisely controlled as demonstrated above. A more flexible approach to instrument control, allowing arbitrary scorefile or realtime updates, is described in the next tutorial chapter.
|
||||
|
||||
[<A HREF="controlin.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
*/
|
||||
|
||||
70
doc/doxygen/multichannel.txt
Normal file
70
doc/doxygen/multichannel.txt
Normal file
@@ -0,0 +1,70 @@
|
||||
/*! \page multichannel Multi-Channel I/O
|
||||
|
||||
The ToolKit WvIn and WvOut classes (and their subclasses) support multi-channel audio data input and output. A set of interleaved audio samples representing a single time "slice" is referred to as a <I>sample frame</I>. At a sample rate of 44.1 kHz, a four-channel audio stream will have 44100 sample frames per second and a total of 176400 individual samples per second.
|
||||
|
||||
Most STK classes process single-sample data streams via their <TT>tick()</TT> function. In order to distinguish single-sample and sample frame calculations, the WvIn and WvOut classes implement both <TT>tick()</TT> and <TT>tickFrame()</TT> functions. The <TT>tickFrame()</TT> functions take or return a pointer to an array of audio data representing one or more sample frames. For single-channel streams, the <TT>tick()</TT> and <TT>tickFrame()</TT> functions produce equivalent results. When <TT>tick()</TT> is called for a multi-channel stream, however, the function either returns a sample frame average (WvIn) or writes a single sample argument to all channels (WvOut).
|
||||
|
||||
Multi-channel support for realtime audio input and output is dependent on the audio device(s) available on your system.
|
||||
|
||||
The following example demonstrates the use of the WvOut class for creating a four channel, 16-bit AIFF formatted audio file. We will use four sinewaves of different frequencies for the first two seconds and then a single sinewave for the last two seconds.
|
||||
|
||||
\code
|
||||
// foursine.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
int i, j;
|
||||
WvOut *output = 0;
|
||||
WaveLoop *inputs[4];
|
||||
for ( i=0; i<4; i++ ) inputs[i] = 0;
|
||||
|
||||
// Define and load the sine waves
|
||||
try {
|
||||
for ( i=0; i<4; i++ ) {
|
||||
inputs[i] = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
inputs[i]->setFrequency( 220.0 * (i+1) );
|
||||
}
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Define and open a 16-bit, four-channel AIFF formatted output file
|
||||
try {
|
||||
output = new WvOut( "foursine.aif", 4, WvOut::WVOUT_AIF, Stk::STK_SINT16 );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Write two seconds of four sines to the output file
|
||||
MY_FLOAT frame[4];
|
||||
for ( j=0; j<88200; j++ ) {
|
||||
for ( i=0; i<4; i++ )
|
||||
frame[i] = inputs[i]->tick();
|
||||
|
||||
output->tickFrame( frame );
|
||||
}
|
||||
|
||||
// Now write the first sine to all four channels for two seconds
|
||||
for ( j=0; j<88200; j++ ) {
|
||||
output->tick( inputs[0]->tick() );
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for ( i=0; i<4; i++ ) delete inputs[i];
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
||||
[<A HREF="polyvoices.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
*/
|
||||
122
doc/doxygen/polyvoices.txt
Normal file
122
doc/doxygen/polyvoices.txt
Normal file
@@ -0,0 +1,122 @@
|
||||
/*! \page polyvoices Voice Management
|
||||
|
||||
The previous tutorial chapters were concerned only with monophonic ToolKit instrument playback and control. At this point, it should be relatively clear that one can instantiate multiple instruments and perhaps sum together their sounds or even direct their sounds to separate output channels. It is less clear how one might go about controlling a group of instruments. The Voicer class is designed to serve just this purpose.
|
||||
|
||||
The STK Voicer class is a relatively simple voice manager. The user can dynamically add and delete instruments from its "control", with the option of controlling specific instruments via unique note tags and/or grouping sets of instruments via a "channel" number. All sounding instrument outputs are summed and returned via the <TT>tick()</TT> function. The Voicer class responds to noteOn, noteOff, setFrequency, pitchBend, and controlChange messages, automatically assigning incoming messages to the voices in its control. When all voices are sounding and a new noteOn is encountered, the Voicer interrupts the oldest sounding voice. The user is responsible for creating and deleting all instrument instances.
|
||||
|
||||
In the following example, we modify the <TT>controlbee.cpp</TT> program to make use of three BeeThree instruments, all controlled using a Voicer.
|
||||
|
||||
\code
|
||||
// threebees.cpp
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
#include "Messager.h"
|
||||
#include "Voicer.h"
|
||||
#include "SKINI.msg"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
int i;
|
||||
RtWvOut *output = 0;
|
||||
Messager *messager = 0;
|
||||
Voicer *voicer = 0;
|
||||
bool done = FALSE;
|
||||
Instrmnt *instrument[3];
|
||||
for ( i=0; i<3; i++ ) instrument[i] = 0;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instruments
|
||||
for ( i=0; i<3; i++ )
|
||||
instrument[i] = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a Messager instance to read from a redirected SKINI scorefile.
|
||||
messager = new Messager();
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Instantiate the voicer for a maximum of three voices.
|
||||
voicer = new Voicer( 3 );
|
||||
for ( i=0; i<3; i++ )
|
||||
voicer->addInstrument( instrument[i] );
|
||||
|
||||
// Play the instrument until the end of the scorefile.
|
||||
int nTicks, type;
|
||||
MY_FLOAT byte2, byte3;
|
||||
while (!done) {
|
||||
|
||||
// Look for new messages and return a delta time (in samples).
|
||||
type = messager->nextMessage();
|
||||
if (type < 0)
|
||||
done = TRUE;
|
||||
|
||||
nTicks = messager->getDelta();
|
||||
try {
|
||||
for ( i=0; i<nTicks; i++ )
|
||||
output->tick( voicer->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ( type > 0 ) {
|
||||
// Process the new control message.
|
||||
byte2 = messager->getByteTwo();
|
||||
byte3 = messager->getByteThree();
|
||||
|
||||
switch(type) {
|
||||
|
||||
case __SK_NoteOn_:
|
||||
voicer->noteOn( byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_NoteOff_:
|
||||
voicer->noteOff( byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_ControlChange_:
|
||||
voicer->controlChange( (int) byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_AfterTouch_:
|
||||
voicer->controlChange( 128, byte2 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for ( i=0; i<3; i++ ) delete instrument[i];
|
||||
delete output;
|
||||
delete messager;
|
||||
delete voicer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\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:
|
||||
|
||||
\code
|
||||
threebees < bachfugue.ski
|
||||
\endcode
|
||||
|
||||
For more fun, surf to <A HREF="http://kern.humdrum.net/">Kern Scores</A> for a huge assortment of other scorefiles which can be downloaded in the SKINI format.
|
||||
|
||||
Another easy extension would be to use the <TT>STK_MIDI</TT> constructor argument to the Messager class and then play the instruments via a MIDI keyboard.
|
||||
|
||||
[<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
*/
|
||||
72
doc/doxygen/realtime.txt
Normal file
72
doc/doxygen/realtime.txt
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \page realtime Realtime Audio
|
||||
|
||||
In this section, we modify the <TT>sineosc.cpp</TT> program in order to send the output to the default audio playback device on your system.
|
||||
|
||||
\code
|
||||
// rtsine.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *input = 0;
|
||||
RtWvOut *output = 0;
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
input = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
input->setFrequency(440.0);
|
||||
|
||||
// Play the oscillator for 40000 samples
|
||||
int i;
|
||||
for ( i=0; i<40000; i++ ) {
|
||||
try {
|
||||
output->tick(input->tick());
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
The class RtWvOut is a protected subclass of WvOut. A number of optional constructor arguments can be used to fine tune its performance for a given system.
|
||||
|
||||
Though not used here, an RtWvIn class exists as well which can be used to read realtime audio data from an input device. See the <TT>record.cpp</TT> example program in the <TT>examples</TT> project for more information.
|
||||
|
||||
It is possible to use an instance of RtWvOut and an instance of RtWvIn to simultaneously read and write realtime audio to and from a hardware device or devices. However, it is recommended to instead use a single instance of RtDuplex to achieve this behavior, in that it guarantees better synchronization between the input and output data. See the <TT>effects</TT> project or the <TT>io.cpp</TT> example program in the <TT>examples</TT> project for more information.
|
||||
|
||||
When using any realtime STK class (RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, TcpWvIn, TcpWvOut, Socket, and Thread), it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks. For example, the above program could be compiled on a Linux system using the GNU g++ compiler and the ALSA audio/MIDI API as follows (assuming all necessary files exist in the project directory):
|
||||
|
||||
\code
|
||||
g++ -Wall -D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ -o rtsine Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp \
|
||||
RtWvOut.cpp RtAudio.cpp rtsine.cpp -lpthread -lasound -lstk
|
||||
\endcode
|
||||
|
||||
On a Macintosh OS X system, the syntax would be:
|
||||
|
||||
\code
|
||||
CC -D__MACOSX_CORE__ -o rtsine Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp RtWvOut.cpp RtAudio.cpp \
|
||||
rtsine.cpp -lpthread -lstdc++ -lstk -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
|
||||
\endcode
|
||||
|
||||
[<A HREF="instruments.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
||||
*/
|
||||
@@ -1,6 +1,6 @@
|
||||
/*! \page skini Synthesis toolKit Instrument Network Interface (SKINI)
|
||||
|
||||
This describes the latest (version 1.1) implementation of SKINI for the Synthesis Toolkit in C++ (STK) by Perry R. Cook.
|
||||
This describes the latest (version 1.1) implementation of SKINI for the Synthesis ToolKit in C++ (STK) by Perry R. Cook.
|
||||
|
||||
\code
|
||||
Too good to be true?
|
||||
@@ -18,7 +18,7 @@ Differences from MIDI, and motivations, include:
|
||||
|
||||
- Text-based messages are used, with meaningful names wherever possible. This allows any language or system capable of formatted printing to generate SKINI. Similarly, any system capable of reading in a string and turning delimited fields into strings, floats, and ints can consume SKINI for control. More importantly, humans can actually read, and even write if they want, SKINI files and streams. Use an editor and search/replace or macros to change a channel or control number. Load a SKINI score into a spread sheet to apply transformations to time, control parameters, MIDI velocities, etc. Put a monkey on a special typewriter and get your next great work. Life's too short to debug bit/nybble packed variable length mumble messages. Disk space gets cheaper, available bandwidth increases, music takes up so little space and bandwidth compared to video and grapics. Live a little.
|
||||
|
||||
- Floating point numbers are used wherever possible. Note Numbers, Velocities, Controller Values, and Delta and Absolute Times are all represented and scanned as ASCII double-precision floats. MIDI byte values are preserved, so that incoming MIDI bytes from an interface can be put directly into SKINI messages. 60.0 or 60 is middle C, 127.0 or 127 is maximum velocity etc. But, unlike MIDI, 60.5 can cause a 50cent sharp middle C to be played. As with MIDI byte values like velocity, use of the integer and SKINI-added fractional parts is up to the implementor of the algorithm being controlled by SKINI messages. But the extra precision is there to be used or ignored.
|
||||
- Floating point numbers are used wherever possible. Note Numbers, Velocities, Controller Values, and Delta and Absolute Times are all represented and scanned as ASCII double-precision floats. MIDI byte values are preserved, so that incoming MIDI bytes from an interface can be put directly into SKINI messages. 60.0 or 60 is middle C, 127.0 or 127 is maximum velocity etc. But, unlike MIDI, 60.5 can cause a 50 cent sharp middle C to be played. As with MIDI byte values like velocity, use of the integer and SKINI-added fractional parts is up to the implementor of the algorithm being controlled by SKINI messages. But the extra precision is there to be used or ignored.
|
||||
|
||||
\section why Why SKINI?
|
||||
|
||||
|
||||
@@ -15,13 +15,17 @@
|
||||
<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 tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. Once installed, it is suggested that a link be made to the executable from a standard search path (/usr/bin/wish). In any event, it will not be possible to use the supplied startup scripts in the demo directory (i.e. StkDemo.bat) because the tcl/tk script startup sequence is slightly different than for all the other systems. Assuming you have made the link mentioned above, the STK demo program and tcl/tk script can be started by typing:
|
||||
<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:
|
||||
|
||||
\code
|
||||
wish tcl/Demo.tcl | demo Clarinet -or -ip
|
||||
\endcode
|
||||
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>
|
||||
|
||||
Initial tests have shown somewhat poor response between changes made in the tcl/tk script and the resulting audio updates.</LI>
|
||||
(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>
|
||||
|
||||
</UL>
|
||||
|
||||
|
||||
@@ -1,156 +1,23 @@
|
||||
/*! \page tutorial Tutorial
|
||||
|
||||
- \ref intro
|
||||
- \ref start
|
||||
- \ref compile
|
||||
- \ref rtvsnonrt
|
||||
|
||||
\section intro Introduction
|
||||
|
||||
First and foremost, the Synthesis ToolKit is a set of C++ classes. That means you need to know some basics about programming in C++ to make use of STK (beyond the example programs we provide). STK's "target audience" is people who:
|
||||
The Synthesis ToolKit is a set of C++ classes. In order to go beyond the simple example programs we provide, it is necessary to know some basics about programming in C or C++. STK's "target audience" includes people who:
|
||||
<UL>
|
||||
<LI>already know how to program in C and C++</LI>
|
||||
<LI>want to create audio DSP and/or synthesis programs</LI>
|
||||
<LI>want to save some time by using our unit generators and input/output routines</LI>
|
||||
<LI>know C, but want to learn about synthesis and processing algorithms</LI>
|
||||
<LI>want to learn about synthesis and processing algorithms</LI>
|
||||
<LI>wish to teach real-time synthesis and processing, and wish to use some of our classes and examples</LI>
|
||||
</UL>
|
||||
|
||||
Most ToolKit programmers will likely end up writing a class or two for their own particular needs, but this task is typically simplified by making use of pre-existing STK classes (filters, oscillators, etc.).
|
||||
|
||||
\section start Getting Started
|
||||
The following tutorial chapters describe many of the fundamental ToolKit concepts and classes. All tutorial programs are included in the <TT>projects/examples</TT> directory.
|
||||
|
||||
We'll begin our introduction to the Synthesis ToolKit with a simple sine-wave oscillator program. STK doesn't provide a specific oscillator for sine waves. Instead, it provides a generic waveform oscillator class, WaveLoop, which can load a variety of common file types. In this example, we load a sine "table" from an STK RAW file. The class RtWvOut will send "realtime" samples to the audio output hardware on your computer.
|
||||
-# \ref hello
|
||||
-# \ref compile
|
||||
-# \ref realtime
|
||||
-# \ref instruments
|
||||
-# \ref controlin
|
||||
-# \ref multichannel
|
||||
-# \ref polyvoices
|
||||
|
||||
\code
|
||||
|
||||
// sineosc.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
// Define and load the sine wave file
|
||||
WaveLoop *input = new WaveLoop("sinewave.raw", TRUE);
|
||||
input->setFrequency(440.0);
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
RtWvOut *output = new RtWvOut(1);
|
||||
|
||||
// Play the oscillator for 40000 samples
|
||||
for (int i=0; i<40000; i++) {
|
||||
output->tick( input->tick() );
|
||||
}
|
||||
|
||||
// Clean up
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
WaveLoop is a subclass of WvIn, which supports WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. WvIn provides interpolating, read once ("oneshot") functionality, as well as methods for setting the read rate and read position.
|
||||
|
||||
Nearly all STK classes implement tick() methods which take and/or return sample values. Within the tick() method, the fundamental sample calculations are performed for a given class. Most STK classes consume/generate a single sample per operation and their tick() method takes/returns each sample "by value". In addition, every class implementing a tick() method also provides an overloaded tick() function taking pointer and size arguments which can be used for vectorized computations.
|
||||
|
||||
The WvIn and WvOut classes support multi-channel sample frames. To distinguish single-sample frame operations from multi-channel frame operations, these classes also implement tickFrame() functions. When a tick() method is called for multi-channel data, frame averages are returned or the input sample is distributed across all channels of a sample frame.
|
||||
|
||||
Nearly all STK classes inherit from the Stk base class. Stk provides a static sample rate which is queried by subclasses as needed. Because many classes use the current sample rate value during instantiation, it is important that the desired value be set at the beginning of a program. The default STK sample rate is 22050 Hz.
|
||||
|
||||
Another primary concept that is somewhat obscurred in this example concerns the data format in which sample values are passed and received. Audio and control signals throughout STK use a floating-point data type, the exact precision of which can be controlled via the MY_FLOAT \#define statement in Stk.h. Thus, the ToolKit can use any normalization scheme desired. The base instruments and algorithms are implemented with a general audio sample dynamic maximum of +/-1.0, and the WvIn and WvOut classes and subclasses scale appropriately for DAC or soundfile input and output.
|
||||
|
||||
Finally, STK has some basic C++ error handling functionality built in. Classes which access files and/or hardware are most prone to runtime errors. To properly "catch" such errors, the above example should be rewritten as shown below.
|
||||
|
||||
\code
|
||||
// sineosc.cpp
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *input = 0;
|
||||
RtWvOut *output = 0;
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
input = new WaveLoop( "sinewave.raw", TRUE );
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
input->setFrequency(440.0);
|
||||
|
||||
// Play the oscillator for 40000 samples
|
||||
for (int i=0; i<40000; i++) {
|
||||
try {
|
||||
output->tick(input->tick());
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
In this particular case, we simply exit the program if an error occurs (an error message is automatically printed to stderr). A more refined program might attempt to recover from or fix a particular problem and, if successful, continue processing.
|
||||
|
||||
\section compile Compiling
|
||||
|
||||
\subsection compileLinux Linux
|
||||
|
||||
In general, you will probably want to use a <TT>Makefile</TT> for your STK programs and projects. For this particular program, however, the following will suffice (on a linux system):
|
||||
\code
|
||||
g++ -Wall -D__LINUX_OSS__ -D__LITTLE_ENDIAN__ -o sineosc Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp RtWvOut.cpp RtAudio.cpp sineosc.cpp -lpthread
|
||||
\endcode
|
||||
|
||||
This assumes you've set up a directory that includes the files <TT>sineosc.cpp</TT>, the rawwave file <TT>sinewave.raw</TT>, and the header and source files for the classes Stk, WvIn, WaveLoop, WvOut, RtWvOut, and RtAudio. There are other, more convenient, means for structuring projects that will be discussed later.
|
||||
|
||||
Most linux systems currently come installed with the OSS audio hardware drivers. If your system instead has ALSA audio drivers installed and you wish to make use of native ALSA API calls, a link to the ALSA library must be specified in the above compile statement (<TT>-lasound</TT>) and the preprocessor definition should instead be <TT>__LINUX_ALSA__</TT>.
|
||||
|
||||
\subsection compileIrix Irix
|
||||
|
||||
The irix (SGI) and linux operating systems are both flavors of unix and thus behave similarly. Making the same assumptions as in the linux case, the following compile statement should work:
|
||||
\code
|
||||
CC -Wall -D__IRIX_AL__ -o sineosc Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp RtWvOut.cpp RtAudio.cpp sineosc.cpp -lpthread
|
||||
\endcode
|
||||
|
||||
\subsection compileOSX Macintosh OS X
|
||||
|
||||
The Macintosh OS X operating systems is another flavor of unix and thus behaves similarly. Making the same assumptions as in the linux case, the following compile statement should work:
|
||||
\code
|
||||
CC -Wall -D__MACOSX_CORE__ -o sineosc Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp RtWvOut.cpp RtAudio.cpp sineosc.cpp -lpthread -framework CoreAudio
|
||||
\endcode
|
||||
|
||||
\subsection compileWin Windows
|
||||
|
||||
I have personally only worked with Visual C++ when compiling programs under windoze. I'll assume you've become familiar with Visual C+ and don't need a tutorial on its particular idiosyncrasies. In creating the VC++ project, add the Stk, WvIn, WaveLoop, WvOut, RtWvOut, and RtAudio class files, as well as the <TT>sineosc.cpp</TT> and <TT>sinewave.raw</TT> files. You will also need to link to the DirectSound library (<TT>dsound.lib</TT>), select the multithreaded library, and provide the <TT>__WINDOWS_DS__</TT> and <TT>__LITTLE_ENDIAN__</TT> preprocessor definitions.
|
||||
|
||||
|
||||
\section rtvsnonrt "Realtime" vs. "Non-Realtime"
|
||||
|
||||
Most of the Synthesis ToolKit classes are platform independent. That means that they should compile on any reasonably current C++ compiler. The functionality needed for realtime audio and MIDI input/output, as well as realtime control message acquistion, is inherently platform and operating-system (OS) <I>dependent</I>. STK classes which require specific platform/OS support include RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, TcpWvIn, TcpWvOut, Socket, and Thread. These classes currently can only be compiled on Linux, Irix, Macintosh OS X, and Windows (except Windows NT) systems using the <TT>__LINUX_OSS__</TT>, <TT>__LINUX_ALSA__</TT>, <TT>__IRIX_AL__</TT>, <TT>__MACOSX_CORE__</TT>, or <TT>__WINDOWS_DS__</TT> preprocessor definitions.
|
||||
|
||||
Without the "realtime" classes, it is still possible to read SKINI scorefiles for control input and to read and write to/from a variety of audio file formats (WAV, SND, AIFF, MAT-file, and RAW). If compiling for a "little-endian" host processor, the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition should be provided.
|
||||
|
||||
\section continued To Be Continued ...
|
||||
|
||||
*/
|
||||
*/
|
||||
@@ -3,7 +3,7 @@
|
||||
- \ref directory
|
||||
- \ref compiling
|
||||
- \ref control
|
||||
- \ref instruments
|
||||
- \ref voices
|
||||
- \ref nort
|
||||
- \ref rt
|
||||
- \ref tcl
|
||||
@@ -92,7 +92,7 @@ All STK programs in this distribution take input control data in the form of <A
|
||||
<A HREF="http://dev.scriptics.com">Tcl/Tk</A> graphical user interfaces (GUI) are provided with this distribution which can generate realtime SKINI messages. Note that the Messager class allows multiple simultaneous socket client connections, together with MIDI and/or piped input. The <I><B>Md2Skini</B></I> program (in the <I><B>demo</B></I> directory) is mostly obsolete but can be used to create SKINI scorefiles from realtime MIDI input.
|
||||
|
||||
|
||||
\section instruments Demo: STK Instruments
|
||||
\section voices Demo: STK Instruments
|
||||
|
||||
The <I><B>demo</B></I> project demonstrates the behavior of all the distributed STK instruments. The instruments available with this release include:
|
||||
<UL>
|
||||
|
||||
@@ -155,7 +155,7 @@ typedef double FLOAT64;
|
||||
|
||||
#define ONE_OVER_128 (MY_FLOAT) 0.0078125
|
||||
|
||||
#if defined(__WINDOWS_DS__)
|
||||
#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
|
||||
#define __OS_WINDOWS__
|
||||
#define __STK_REALTIME__
|
||||
#elif defined(__LINUX_OSS__) || defined(__LINUX_ALSA__)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
### STK examples Makefile - for various flavors of unix
|
||||
|
||||
PROGRAMS = sine play record io tcpIn tcpOut Moogy
|
||||
PROGRAMS = sine play record io tcpIn tcpOut sineosc rtsine bethree controlbee foursine threebees
|
||||
RM = /bin/rm
|
||||
SRC_PATH = ../../src
|
||||
OBJECT_PATH = @object_path@
|
||||
@@ -64,5 +64,20 @@ tcpIn: tcpIn.cpp Stk.o WvIn.o TcpWvIn.o WvOut.o RtWvOut.o RtAudio.o Socket.o Thr
|
||||
tcpOut: tcpOut.cpp Stk.o WvIn.o WvOut.o TcpWvOut.o Socket.o Thread.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o tcpOut tcpOut.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/TcpWvOut.o $(LIBRARY)
|
||||
|
||||
Moogy: Moogy.cpp Stk.o WvIn.o WaveLoop.o WvOut.o RtWvOut.o RtAudio.o Instrmnt.o Sampler.o FormSwep.o Filter.o BiQuad.o Envelope.o ADSR.o OnePole.o Moog.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o Moogy Moogy.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Sampler.o $(OBJECT_PATH)/FormSwep.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/BiQuad.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/OnePole.o $(OBJECT_PATH)/Moog.o $(LIBRARY)
|
||||
sineosc: sineosc.cpp Stk.o WvIn.o WvOut.o WaveLoop.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o sineosc sineosc.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/WaveLoop.o $(LIBRARY)
|
||||
|
||||
rtsine: rtsine.cpp Stk.o WvIn.o WaveLoop.o WvOut.o RtWvOut.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o rtsine rtsine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
|
||||
bethree: bethree.cpp Stk.o WvIn.o WaveLoop.o FM.o WvOut.o RtWvOut.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Envelope.o ADSR.o BeeThree.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o bethree bethree.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(LIBRARY)
|
||||
|
||||
controlbee: controlbee.cpp Stk.o WvIn.o WaveLoop.o FM.o WvOut.o RtWvOut.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Envelope.o ADSR.o BeeThree.o Messager.o RtMidi.o Socket.o Thread.o SKINI.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o controlbee controlbee.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(OBJECT_PATH)/Messager.o $(OBJECT_PATH)/RtMidi.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/SKINI.o $(LIBRARY)
|
||||
|
||||
foursine: foursine.cpp Stk.o WvIn.o WvOut.o WaveLoop.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o foursine foursine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/WaveLoop.o $(LIBRARY)
|
||||
|
||||
threebees: threebees.cpp Stk.o WvIn.o WaveLoop.o FM.o WvOut.o RtWvOut.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Envelope.o ADSR.o BeeThree.o Messager.o RtMidi.o Socket.o Thread.o SKINI.o Voicer.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o threebees threebees.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(OBJECT_PATH)/Messager.o $(OBJECT_PATH)/RtMidi.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/SKINI.o $(OBJECT_PATH)/Voicer.o $(LIBRARY)
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/******************************************/
|
||||
/*
|
||||
A very basic example program which
|
||||
demonstrates how to play STK's Moog
|
||||
instrument.
|
||||
|
||||
By Gary P. Scavone, 2001.
|
||||
Thanks to Dirk Heise for the suggestion.
|
||||
|
||||
This particular program uses the Moog
|
||||
class, though any Instrmnt subclass will
|
||||
work. If you use a different instrument,
|
||||
however, you may need to update the O_FILES
|
||||
dependencies in the Makefile to successfully
|
||||
compile it.
|
||||
*/
|
||||
/******************************************/
|
||||
|
||||
#include "WvOut.h"
|
||||
#include "RtWvOut.h"
|
||||
#include "Instrmnt.h"
|
||||
#include "Moog.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Instrmnt* instrument = new Moog();
|
||||
RtWvOut* output = new RtWvOut(1);
|
||||
|
||||
// Start the instrument with note number 60 and
|
||||
// a normalized velocity of 0.9.
|
||||
instrument->noteOn(70, 0.9);
|
||||
|
||||
// Run the instrument for 80000/SRATE seconds.
|
||||
MY_FLOAT *vector = new MY_FLOAT[16];
|
||||
for (int i=0; i<80000; i++) {
|
||||
output->tick(instrument->tick());
|
||||
}
|
||||
|
||||
delete vector;
|
||||
delete output;
|
||||
delete instrument;
|
||||
return 0;
|
||||
}
|
||||
57
projects/examples/bethree.cpp
Normal file
57
projects/examples/bethree.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// bethree.cpp STK tutorial program
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
Instrmnt *instrument = 0;
|
||||
RtWvOut *output = 0;
|
||||
MY_FLOAT frequency, amplitude, scaler;
|
||||
long counter, i;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instrument
|
||||
instrument = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
scaler = 1.0;
|
||||
frequency = 220.0;
|
||||
amplitude = 0.5;
|
||||
instrument->noteOn( frequency, amplitude );
|
||||
|
||||
// Play the instrument for 80000 samples, changing the frequency every 2000 samples
|
||||
counter = 0;
|
||||
while ( counter < 80000 ) {
|
||||
for ( i=0; i<2000; i++ ) {
|
||||
try {
|
||||
output->tick( instrument->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
counter += 2000;
|
||||
scaler += 0.025;
|
||||
instrument->setFrequency( frequency * scaler );
|
||||
}
|
||||
|
||||
// Turn the instrument off with maximum decay envelope.
|
||||
instrument->noteOff( 1.0 );
|
||||
|
||||
cleanup:
|
||||
delete instrument;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
92
projects/examples/Moogy.dsp → projects/examples/bethree.dsp
Normal file → Executable file
92
projects/examples/Moogy.dsp → projects/examples/bethree.dsp
Normal file → Executable file
@@ -1,24 +1,24 @@
|
||||
# Microsoft Developer Studio Project File - Name="Moogy" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Project File - Name="bethree" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=Moogy - Win32 Debug
|
||||
CFG=bethree - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Moogy.mak".
|
||||
!MESSAGE NMAKE /f "bethree.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Moogy.mak" CFG="Moogy - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "bethree.mak" CFG="bethree - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Moogy - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "Moogy - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "bethree - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "bethree - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
@@ -28,60 +28,60 @@ CFG=Moogy - Win32 Debug
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Moogy - Win32 Release"
|
||||
!IF "$(CFG)" == "bethree - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Output_Dir "bethree___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "bethree___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_DS__" /D "__LITTLE_ENDIAN__" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "Moogy - Win32 Debug"
|
||||
!ELSEIF "$(CFG)" == "bethree - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Moogy___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "Moogy___Win32_Debug"
|
||||
# PROP BASE Output_Dir "bethree___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "bethree___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_DS__" /D "__LITTLE_ENDIAN__" /YX /FD /GZ /c
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Moogy - Win32 Release"
|
||||
# Name "Moogy - Win32 Debug"
|
||||
# Name "bethree - Win32 Release"
|
||||
# Name "bethree - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
@@ -91,7 +91,11 @@ SOURCE=..\..\src\ADSR.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\BiQuad.cpp
|
||||
SOURCE=..\..\src\BeeThree.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bethree.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -103,7 +107,7 @@ SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FormSwep.cpp
|
||||
SOURCE=..\..\src\FM.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -111,18 +115,6 @@ SOURCE=..\..\src\Instrmnt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Moog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Moogy.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\OnePole.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtAudio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -131,11 +123,11 @@ SOURCE=..\..\src\RtWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Sampler.cpp
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
SOURCE=..\..\src\TwoZero.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -159,7 +151,7 @@ SOURCE=..\..\include\ADSR.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\BiQuad.h
|
||||
SOURCE=..\..\include\BeeThree.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -171,7 +163,7 @@ SOURCE=..\..\include\Filter.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FormSwep.h
|
||||
SOURCE=..\..\include\FM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -179,19 +171,7 @@ SOURCE=..\..\include\Instrmnt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Moog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\OnePole.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Sampler.h
|
||||
SOURCE=..\..\include\RtAudio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -199,10 +179,18 @@ SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TwoZero.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WaveLoop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvOut.h
|
||||
# End Source File
|
||||
# End Group
|
||||
90
projects/examples/controlbee.cpp
Normal file
90
projects/examples/controlbee.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
// controlbee.cpp STK tutorial program
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
#include "Messager.h"
|
||||
#include "SKINI.msg"
|
||||
#include <math.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
Instrmnt *instrument = 0;
|
||||
RtWvOut *output = 0;
|
||||
Messager *messager = 0;
|
||||
bool done = FALSE;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instrument
|
||||
instrument = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a Messager instance to read from a redirected SKINI scorefile.
|
||||
messager = new Messager();
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Play the instrument until the end of the scorefile.
|
||||
int i, nTicks, type;
|
||||
MY_FLOAT byte2, byte3, frequency;
|
||||
while (!done) {
|
||||
|
||||
// Look for new messages and return a delta time (in samples).
|
||||
type = messager->nextMessage();
|
||||
if (type < 0)
|
||||
done = TRUE;
|
||||
|
||||
nTicks = messager->getDelta();
|
||||
try {
|
||||
for ( i=0; i<nTicks; i++ )
|
||||
output->tick( instrument->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ( type > 0 ) {
|
||||
// Process the new control message.
|
||||
byte2 = messager->getByteTwo();
|
||||
byte3 = messager->getByteThree();
|
||||
|
||||
switch(type) {
|
||||
|
||||
case __SK_NoteOn_:
|
||||
frequency = (MY_FLOAT) 220.0 * pow( 2.0, (byte2 - 57.0) / 12.0 );
|
||||
instrument->noteOn( frequency, byte3 * ONE_OVER_128 );
|
||||
break;
|
||||
|
||||
case __SK_NoteOff_:
|
||||
instrument->noteOff( byte3 * ONE_OVER_128 );
|
||||
break;
|
||||
|
||||
case __SK_ControlChange_:
|
||||
instrument->controlChange( (int) byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_AfterTouch_:
|
||||
instrument->controlChange( 128, byte2 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete instrument;
|
||||
delete output;
|
||||
delete messager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
239
projects/examples/controlbee.dsp
Executable file
239
projects/examples/controlbee.dsp
Executable file
@@ -0,0 +1,239 @@
|
||||
# Microsoft Developer Studio Project File - Name="controlbee" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=controlbee - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "controlbee.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "controlbee.mak" CFG="controlbee - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "controlbee - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "controlbee - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "controlbee - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "controlbee___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "controlbee___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib Wsock32.lib winmm.lib /nologo /subsystem:console /machine:I386
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "controlbee - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "controlbee___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "controlbee___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib Wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "controlbee - Win32 Release"
|
||||
# Name "controlbee - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\ADSR.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\BeeThree.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\controlbee.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Envelope.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FM.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Instrmnt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Messager.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtAudio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtMidi.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SKINI.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Socket.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TwoZero.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WaveLoop.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvOut.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ADSR.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\BeeThree.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Envelope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Filter.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Instrmnt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Messager.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtAudio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtMidi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\SKINI.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TwoZero.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WaveLoop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvOut.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -3,7 +3,31 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Moogy"=".\Moogy.dsp" - Package Owner=<4>
|
||||
Project: "bethree"=".\bethree.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "controlbee"=".\controlbee.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "foursine"=".\foursine.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
@@ -51,6 +75,18 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "rtsine"=".\rtsine.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "sine"=".\sine.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
@@ -63,6 +99,18 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "sineosc"=".\sineosc.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "tcpIn"=".\tcpIn.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
@@ -87,6 +135,18 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "threebees"=".\threebees.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
|
||||
54
projects/examples/foursine.cpp
Normal file
54
projects/examples/foursine.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
// foursine.cpp STK tutorial program
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
int i, j;
|
||||
WvOut *output = 0;
|
||||
WaveLoop *inputs[4];
|
||||
for ( i=0; i<4; i++ ) inputs[i] = 0;
|
||||
|
||||
// Define and load the sine waves
|
||||
try {
|
||||
for ( i=0; i<4; i++ ) {
|
||||
inputs[i] = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
inputs[i]->setFrequency( 220.0 * (i+1) );
|
||||
}
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Define and open a 16-bit, four-channel AIFF formatted output file
|
||||
try {
|
||||
output = new WvOut( "foursine.aif", 4, WvOut::WVOUT_AIF, Stk::STK_SINT16 );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Write two seconds of four sines to the output file
|
||||
MY_FLOAT frame[4];
|
||||
for ( j=0; j<88200; j++ ) {
|
||||
for ( i=0; i<4; i++ )
|
||||
frame[i] = inputs[i]->tick();
|
||||
|
||||
output->tickFrame( frame );
|
||||
}
|
||||
|
||||
// Now write the first sine to all four channels for two seconds
|
||||
for ( j=0; j<88200; j++ ) {
|
||||
output->tick( inputs[0]->tick() );
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for ( i=0; i<4; i++ ) delete inputs[i];
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
132
projects/examples/foursine.dsp
Executable file
132
projects/examples/foursine.dsp
Executable file
@@ -0,0 +1,132 @@
|
||||
# Microsoft Developer Studio Project File - Name="foursine" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=foursine - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "foursine.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "foursine.mak" CFG="foursine - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "foursine - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "foursine - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "foursine - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "foursine___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "foursine___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "foursine - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "foursine___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "foursine___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "foursine - Win32 Release"
|
||||
# Name "foursine - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\foursine.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WaveLoop.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvOut.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WaveLoop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvOut.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
BIN
projects/examples/rawwaves/sinewave.raw
Normal file
BIN
projects/examples/rawwaves/sinewave.raw
Normal file
Binary file not shown.
43
projects/examples/rtsine.cpp
Normal file
43
projects/examples/rtsine.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// rtsine.cpp STK tutorial program
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *input = 0;
|
||||
RtWvOut *output = 0;
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
input = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
input->setFrequency(440.0);
|
||||
|
||||
// Play the oscillator for 40000 samples
|
||||
int i;
|
||||
for ( i=0; i<40000; i++ ) {
|
||||
try {
|
||||
output->tick(input->tick());
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
150
projects/examples/rtsine.dsp
Executable file
150
projects/examples/rtsine.dsp
Executable file
@@ -0,0 +1,150 @@
|
||||
# Microsoft Developer Studio Project File - Name="rtsine" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=rtsine - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "rtsine.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "rtsine.mak" CFG="rtsine - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "rtsine - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "rtsine - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "rtsine - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "rtsine___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "rtsine___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "rtsine - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "rtsine___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "rtsine___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "rtsine - Win32 Release"
|
||||
# Name "rtsine - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtAudio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\rtsine.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WaveLoop.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvOut.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtAudio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WaveLoop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvOut.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
1601
projects/examples/scores/bachfugue.ski
Normal file
1601
projects/examples/scores/bachfugue.ski
Normal file
File diff suppressed because it is too large
Load Diff
90
projects/examples/scores/bookert.ski
Normal file
90
projects/examples/scores/bookert.ski
Normal file
@@ -0,0 +1,90 @@
|
||||
/* Howdy!! SKINI File, Perry Cook */
|
||||
NoteOn 0.000000 1 60 114.299997
|
||||
NoteOff 0.380000 1 60 63.500000
|
||||
NoteOn 0.020000 1 60 101.600002
|
||||
NoteOff 0.100000 1 60 63.500000
|
||||
NoteOn 0.100000 1 48 63.500000
|
||||
NoteOff 0.200000 1 48 63.500000
|
||||
NoteOn 0.200000 1 48 88.899998
|
||||
NoteOff 0.190023 1 48 63.500000
|
||||
NoteOn 0.010023 1 51 101.600002
|
||||
NoteOff 0.570023 1 51 63.500000
|
||||
NoteOn 0.030023 1 53 88.899998
|
||||
NoteOff 0.570023 1 53 63.500000
|
||||
NoteOn 0.030023 1 48 38.100002
|
||||
NoteOff 0.300000 1 48 63.500000
|
||||
NoteOn 0.300000 1 67 101.600002
|
||||
NoteOff 0.570023 1 67 63.500000
|
||||
NoteOn 0.030023 1 66 76.200003
|
||||
NoteOff 0.190023 1 66 63.500000
|
||||
NoteOn 0.010023 1 65 63.500000
|
||||
NoteOff 0.190023 1 65 63.500000
|
||||
NoteOn 0.010023 1 63 50.800001
|
||||
NoteOff 0.190023 1 63 63.500000
|
||||
NoteOn 0.010023 1 60 76.200003
|
||||
NoteOff 0.380000 1 60 63.500000
|
||||
NoteOn 0.020000 1 58 50.800001
|
||||
NoteOff 0.190023 1 58 63.500000
|
||||
NoteOn 0.010023 1 48 114.299997
|
||||
NoteOff 0.380000 1 48 63.500000
|
||||
NoteOn 0.020000 1 48 101.600002
|
||||
NoteOff 0.100000 1 48 63.500000
|
||||
NoteOn 0.100000 1 36 63.500000
|
||||
NoteOff 0.200000 1 36 63.500000
|
||||
NoteOn 0.200000 1 36 88.899998
|
||||
NoteOff 0.190023 1 36 63.500000
|
||||
NoteOn 0.010023 1 39 101.600002
|
||||
NoteOff 0.570023 1 39 63.500000
|
||||
NoteOn 0.030023 1 41 88.899998
|
||||
NoteOff 0.570023 1 41 63.500000
|
||||
NoteOn 0.030023 1 84 127.000000
|
||||
NoteOff 0.475011 1 84 63.500000
|
||||
NoteOn 0.025034 1 83 120.649998
|
||||
NoteOff 0.066531 1 83 63.500000
|
||||
NoteOn 0.003537 1 82 114.299997
|
||||
NoteOff 0.057007 1 82 63.500000
|
||||
NoteOn 0.003039 1 81 107.950003
|
||||
NoteOff 0.047528 1 81 63.500000
|
||||
NoteOn 0.002540 1 80 101.600002
|
||||
NoteOff 0.047528 1 80 63.500000
|
||||
NoteOn 0.002540 1 78 95.250000
|
||||
NoteOff 0.038005 1 78 63.500000
|
||||
NoteOn 0.002041 1 78 88.899998
|
||||
NoteOff 0.028526 1 78 63.500000
|
||||
NoteOn 0.001542 1 77 82.549997
|
||||
NoteOff 0.019002 1 77 63.500000
|
||||
NoteOn 0.001043 1 76 76.200003
|
||||
NoteOff 0.019002 1 76 63.500000
|
||||
NoteOn 0.001043 1 75 69.850002
|
||||
NoteOff 0.019002 1 75 63.500000
|
||||
NoteOn 0.001043 1 74 63.500000
|
||||
NoteOff 0.019002 1 74 63.500000
|
||||
NoteOn 0.001043 1 73 63.500000
|
||||
NoteOff 0.028526 1 73 63.500000
|
||||
NoteOn 0.001542 1 72 63.500000
|
||||
NoteOff 0.019002 1 72 63.500000
|
||||
NoteOn 0.001043 1 71 57.149998
|
||||
NoteOff 0.028526 1 71 63.500000
|
||||
NoteOn 0.001542 1 70 50.800001
|
||||
NoteOff 0.038005 1 70 63.500000
|
||||
NoteOn 0.002041 1 69 44.449999
|
||||
NoteOff 0.047528 1 69 63.500000
|
||||
NoteOn 0.002540 1 68 38.100002
|
||||
NoteOff 0.057007 1 68 63.500000
|
||||
NoteOn 0.003039 1 67 31.750000
|
||||
NoteOff 0.057007 1 67 63.500000
|
||||
NoteOn 0.003039 1 66 25.400000
|
||||
NoteOff 0.057007 1 66 63.500000
|
||||
NoteOn 0.003039 1 65 31.750000
|
||||
NoteOff 0.066531 1 65 63.500000
|
||||
NoteOn 0.003537 1 64 25.400000
|
||||
NoteOff 0.076009 1 64 63.500000
|
||||
NoteOn 0.004036 1 63 19.050001
|
||||
NoteOff 0.085533 1 63 63.500000
|
||||
NoteOn 0.004535 1 62 31.750000
|
||||
NoteOff 0.095011 1 62 63.500000
|
||||
NoteOn 0.005034 1 61 44.449999
|
||||
NoteOff 0.104535 1 61 63.500000
|
||||
ControlChange 0.005533 1 1 127.000000
|
||||
NoteOn 0.000000 1 60 63.500000
|
||||
NoteOff 1.500000 1 60 63.500000
|
||||
@@ -63,6 +63,7 @@ LINK32=link.exe
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /YX /FD /GZ /c
|
||||
|
||||
45
projects/examples/sineosc.cpp
Normal file
45
projects/examples/sineosc.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
// sineosc.cpp STK tutorial program
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *input = 0;
|
||||
WvOut *output = 0;
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
input = new WaveLoop( "rawwaves/sinewave.raw", TRUE );
|
||||
|
||||
// Define and open a 16-bit, one-channel WAV formatted output file
|
||||
output = new WvOut( "hellosine.wav", 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
|
||||
}
|
||||
catch ( StkError & ) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
input->setFrequency( 440.0 );
|
||||
|
||||
// Run the oscillator for 40000 samples, writing to the output file
|
||||
int i;
|
||||
for ( i=0; i<40000; i++ ) {
|
||||
|
||||
try {
|
||||
output->tick( input->tick() );
|
||||
}
|
||||
catch ( StkError & ) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
133
projects/examples/sineosc.dsp
Executable file
133
projects/examples/sineosc.dsp
Executable file
@@ -0,0 +1,133 @@
|
||||
# Microsoft Developer Studio Project File - Name="sineosc" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=sineosc - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "sineosc.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "sineosc.mak" CFG="sineosc - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "sineosc - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "sineosc - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "sineosc - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "sineosc - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "sineosc___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "sineosc___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 2
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "_AFXDLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "sineosc - Win32 Release"
|
||||
# Name "sineosc - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sineosc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WaveLoop.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvOut.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WaveLoop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvOut.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_DS__" /D "__LITTLE_ENDIAN__" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_DS__" /D "__LITTLE_ENDIAN__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
||||
99
projects/examples/threebees.cpp
Normal file
99
projects/examples/threebees.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
// threebees.cpp STK tutorial program
|
||||
|
||||
#include "BeeThree.h"
|
||||
#include "RtWvOut.h"
|
||||
#include "Messager.h"
|
||||
#include "Voicer.h"
|
||||
#include "SKINI.msg"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
int i;
|
||||
RtWvOut *output = 0;
|
||||
Messager *messager = 0;
|
||||
Voicer *voicer = 0;
|
||||
bool done = FALSE;
|
||||
Instrmnt *instrument[3];
|
||||
for ( i=0; i<3; i++ ) instrument[i] = 0;
|
||||
|
||||
try {
|
||||
// Define and load the BeeThree instruments
|
||||
for ( i=0; i<3; i++ )
|
||||
instrument[i] = new BeeThree();
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
output = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a Messager instance to read from a redirected SKINI scorefile.
|
||||
messager = new Messager();
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Instantiate the voicer for a maximum of three voices.
|
||||
voicer = new Voicer( 3 );
|
||||
for ( i=0; i<3; i++ )
|
||||
voicer->addInstrument( instrument[i] );
|
||||
|
||||
// Play the instrument until the end of the scorefile.
|
||||
int nTicks, type;
|
||||
MY_FLOAT byte2, byte3;
|
||||
while (!done) {
|
||||
|
||||
// Look for new messages and return a delta time (in samples).
|
||||
type = messager->nextMessage();
|
||||
if (type < 0)
|
||||
done = TRUE;
|
||||
|
||||
nTicks = messager->getDelta();
|
||||
try {
|
||||
for ( i=0; i<nTicks; i++ )
|
||||
output->tick( voicer->tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ( type > 0 ) {
|
||||
// Process the new control message.
|
||||
byte2 = messager->getByteTwo();
|
||||
byte3 = messager->getByteThree();
|
||||
|
||||
switch(type) {
|
||||
|
||||
case __SK_NoteOn_:
|
||||
voicer->noteOn( byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_NoteOff_:
|
||||
voicer->noteOff( byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_ControlChange_:
|
||||
voicer->controlChange( (int) byte2, byte3 );
|
||||
break;
|
||||
|
||||
case __SK_AfterTouch_:
|
||||
voicer->controlChange( 128, byte2 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for ( i=0; i<3; i++ ) delete instrument[i];
|
||||
delete output;
|
||||
delete messager;
|
||||
delete voicer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
254
projects/examples/threebees.dsp
Executable file
254
projects/examples/threebees.dsp
Executable file
@@ -0,0 +1,254 @@
|
||||
# Microsoft Developer Studio Project File - Name="threebees" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=threebees - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "threebees.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "threebees.mak" CFG="threebees - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "threebees - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "threebees - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "threebees - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "threebees___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "threebees___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib winmm.lib dsound.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "threebees - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "threebees___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "threebees___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib winmm.lib dsound.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "threebees - Win32 Release"
|
||||
# Name "threebees - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\ADSR.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\BeeThree.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Envelope.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FM.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Instrmnt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Messager.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtAudio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtMidi.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SKINI.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Socket.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\threebees.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TwoZero.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Voicer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WaveLoop.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvOut.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ADSR.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\BeeThree.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Envelope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Filter.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Instrmnt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Messager.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtAudio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtMidi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\SKINI.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Socket.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Thread.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TwoZero.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Voicer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WaveLoop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvOut.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -42,7 +42,7 @@ CFLAGS += @warn@ $(INCLUDE)
|
||||
|
||||
REALTIME = @realtime@
|
||||
ifeq ($(REALTIME),yes)
|
||||
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o RtWvIn.o TcpWvOut.o TcpWvIn.o Thread.o Socket.o
|
||||
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o RtWvIn.o RtDuplex.o TcpWvOut.o TcpWvIn.o Thread.o Socket.o
|
||||
DEFS += @sound_api@
|
||||
DEFS += @midiator@
|
||||
endif
|
||||
|
||||
135
src/RtAudio.cpp
135
src/RtAudio.cpp
@@ -37,6 +37,7 @@
|
||||
*/
|
||||
/************************************************************************/
|
||||
|
||||
// RtAudio: Version 2.1.1, 24 October 2002
|
||||
|
||||
#include "RtAudio.h"
|
||||
#include <vector>
|
||||
@@ -1261,44 +1262,10 @@ void RtAudio :: callbackEvent( int streamId, DEVICE_ID deviceId, void *inData, v
|
||||
|
||||
MUTEX_LOCK(&stream->mutex);
|
||||
|
||||
if ( stream->mode == INPUT || ( stream->mode == DUPLEX && deviceId == info->device[1] ) ) {
|
||||
|
||||
if (stream->doConvertBuffer[1]) {
|
||||
|
||||
if ( stream->deInterleave[1] ) {
|
||||
stream->deviceBuffer = (char *) stream->callbackInfo.buffers;
|
||||
int bufferBytes = inBufferList->mBuffers[stream->handle[1]].mDataByteSize;
|
||||
for ( int i=0; i<stream->nDeviceChannels[1]; i++ ) {
|
||||
memcpy(&stream->deviceBuffer[i*bufferBytes],
|
||||
inBufferList->mBuffers[stream->handle[1]+i].mData, bufferBytes );
|
||||
}
|
||||
}
|
||||
else
|
||||
stream->deviceBuffer = (char *) inBufferList->mBuffers[stream->handle[1]].mData;
|
||||
|
||||
if ( stream->doByteSwap[1] )
|
||||
byteSwapBuffer(stream->deviceBuffer,
|
||||
stream->bufferSize * stream->nDeviceChannels[1],
|
||||
stream->deviceFormat[1]);
|
||||
convertStreamBuffer(stream, INPUT);
|
||||
|
||||
}
|
||||
else {
|
||||
memcpy(stream->userBuffer,
|
||||
inBufferList->mBuffers[stream->handle[1]].mData,
|
||||
inBufferList->mBuffers[stream->handle[1]].mDataByteSize );
|
||||
|
||||
if (stream->doByteSwap[1])
|
||||
byteSwapBuffer(stream->userBuffer,
|
||||
stream->bufferSize * stream->nUserChannels[1],
|
||||
stream->userFormat);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't invoke the user callback if duplex mode, the input/output
|
||||
// devices are different, and this function is called for the output
|
||||
// device.
|
||||
if ( info->usingCallback && (stream->mode != DUPLEX || deviceId == info->device[1] ) ) {
|
||||
// Invoke user callback first, to get fresh output data. Don't
|
||||
// invoke the user callback if duplex mode, the input/output devices
|
||||
// are different, and this function is called for the input device.
|
||||
if ( info->usingCallback && (stream->mode != DUPLEX || deviceId == info->device[0] ) ) {
|
||||
RTAUDIO_CALLBACK callback = (RTAUDIO_CALLBACK) info->callback;
|
||||
info->stopStream = callback(stream->userBuffer, stream->bufferSize, info->userData);
|
||||
}
|
||||
@@ -1339,6 +1306,40 @@ void RtAudio :: callbackEvent( int streamId, DEVICE_ID deviceId, void *inData, v
|
||||
}
|
||||
}
|
||||
|
||||
if ( stream->mode == INPUT || ( stream->mode == DUPLEX && deviceId == info->device[1] ) ) {
|
||||
|
||||
if (stream->doConvertBuffer[1]) {
|
||||
|
||||
if ( stream->deInterleave[1] ) {
|
||||
stream->deviceBuffer = (char *) stream->callbackInfo.buffers;
|
||||
int bufferBytes = inBufferList->mBuffers[stream->handle[1]].mDataByteSize;
|
||||
for ( int i=0; i<stream->nDeviceChannels[1]; i++ ) {
|
||||
memcpy(&stream->deviceBuffer[i*bufferBytes],
|
||||
inBufferList->mBuffers[stream->handle[1]+i].mData, bufferBytes );
|
||||
}
|
||||
}
|
||||
else
|
||||
stream->deviceBuffer = (char *) inBufferList->mBuffers[stream->handle[1]].mData;
|
||||
|
||||
if ( stream->doByteSwap[1] )
|
||||
byteSwapBuffer(stream->deviceBuffer,
|
||||
stream->bufferSize * stream->nDeviceChannels[1],
|
||||
stream->deviceFormat[1]);
|
||||
convertStreamBuffer(stream, INPUT);
|
||||
|
||||
}
|
||||
else {
|
||||
memcpy(stream->userBuffer,
|
||||
inBufferList->mBuffers[stream->handle[1]].mData,
|
||||
inBufferList->mBuffers[stream->handle[1]].mDataByteSize );
|
||||
|
||||
if (stream->doByteSwap[1])
|
||||
byteSwapBuffer(stream->userBuffer,
|
||||
stream->bufferSize * stream->nUserChannels[1],
|
||||
stream->userFormat);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !info->usingCallback && (stream->mode != DUPLEX || deviceId == info->device[1] ) )
|
||||
info->blockTick = false;
|
||||
|
||||
@@ -4130,41 +4131,17 @@ void RtAudio :: callbackEvent(int streamId, int bufferIndex, void *inData, void
|
||||
}
|
||||
|
||||
MUTEX_LOCK(&stream->mutex);
|
||||
int nChannels = stream->nDeviceChannels[0] + stream->nDeviceChannels[1];
|
||||
int bufferBytes;
|
||||
ASIOBufferInfo *bufferInfos = (ASIOBufferInfo *) info->buffers;
|
||||
if ( stream->mode == INPUT || stream->mode == DUPLEX ) {
|
||||
|
||||
bufferBytes = stream->bufferSize * formatBytes(stream->deviceFormat[1]);
|
||||
if (stream->doConvertBuffer[1]) {
|
||||
|
||||
// Always interleave ASIO input data.
|
||||
for ( int i=0; i<stream->nDeviceChannels[1]; i++, bufferInfos++ )
|
||||
memcpy(&stream->deviceBuffer[i*bufferBytes], bufferInfos->buffers[bufferIndex], bufferBytes );
|
||||
|
||||
if ( stream->doByteSwap[1] )
|
||||
byteSwapBuffer(stream->deviceBuffer,
|
||||
stream->bufferSize * stream->nDeviceChannels[1],
|
||||
stream->deviceFormat[1]);
|
||||
convertStreamBuffer(stream, INPUT);
|
||||
|
||||
}
|
||||
else { // single channel only
|
||||
memcpy(stream->userBuffer, bufferInfos->buffers[bufferIndex], bufferBytes );
|
||||
|
||||
if (stream->doByteSwap[1])
|
||||
byteSwapBuffer(stream->userBuffer,
|
||||
stream->bufferSize * stream->nUserChannels[1],
|
||||
stream->userFormat);
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke user callback first, to get fresh output data.
|
||||
if ( info->usingCallback ) {
|
||||
RTAUDIO_CALLBACK callback = (RTAUDIO_CALLBACK) info->callback;
|
||||
if ( callback(stream->userBuffer, stream->bufferSize, info->userData) )
|
||||
info->stopStream = true;
|
||||
}
|
||||
|
||||
int nChannels = stream->nDeviceChannels[0] + stream->nDeviceChannels[1];
|
||||
int bufferBytes;
|
||||
ASIOBufferInfo *bufferInfos = (ASIOBufferInfo *) info->buffers;
|
||||
if ( stream->mode == OUTPUT || stream->mode == DUPLEX ) {
|
||||
|
||||
bufferBytes = stream->bufferSize * formatBytes(stream->deviceFormat[0]);
|
||||
@@ -4193,6 +4170,32 @@ void RtAudio :: callbackEvent(int streamId, int bufferIndex, void *inData, void
|
||||
}
|
||||
}
|
||||
|
||||
if ( stream->mode == INPUT || stream->mode == DUPLEX ) {
|
||||
|
||||
bufferBytes = stream->bufferSize * formatBytes(stream->deviceFormat[1]);
|
||||
if (stream->doConvertBuffer[1]) {
|
||||
|
||||
// Always interleave ASIO input data.
|
||||
for ( int i=0; i<stream->nDeviceChannels[1]; i++, bufferInfos++ )
|
||||
memcpy(&stream->deviceBuffer[i*bufferBytes], bufferInfos->buffers[bufferIndex], bufferBytes );
|
||||
|
||||
if ( stream->doByteSwap[1] )
|
||||
byteSwapBuffer(stream->deviceBuffer,
|
||||
stream->bufferSize * stream->nDeviceChannels[1],
|
||||
stream->deviceFormat[1]);
|
||||
convertStreamBuffer(stream, INPUT);
|
||||
|
||||
}
|
||||
else { // single channel only
|
||||
memcpy(stream->userBuffer, bufferInfos->buffers[bufferIndex], bufferBytes );
|
||||
|
||||
if (stream->doByteSwap[1])
|
||||
byteSwapBuffer(stream->userBuffer,
|
||||
stream->bufferSize * stream->nUserChannels[1],
|
||||
stream->userFormat);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !info->usingCallback )
|
||||
info->blockTick = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user