diff --git a/configure.ac b/configure.ac
index 2da42ec..de85421 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,7 +8,7 @@ AC_CONFIG_FILES(src/Makefile projects/demo/Makefile projects/effects/Makefile pr
AC_SUBST( GXX, ["no"] )
# Checks for programs.
-AC_PROG_CXX
+AC_PROG_CXX(g++ CC c++ cxx)
AC_PROG_RANLIB
AC_PATH_PROG(AR, ar, no)
if [[ $AR = "no" ]] ; then
diff --git a/doc/ReleaseNotes.txt b/doc/ReleaseNotes.txt
index b658a0c..f8ce588 100644
--- a/doc/ReleaseNotes.txt
+++ b/doc/ReleaseNotes.txt
@@ -2,6 +2,12 @@ The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2009.
+v4.4.1: (3 June 2009)
+- added multi-channel/frame tick() virtual function to WvIn and WvOut abstract base classes (required update to RtWvOut class)
+- updated configure script to select g++ compiler by default
+- in demo.cpp: removed voicer grouping for messages, fixing polyphony when messages are on the same MIDI/SKINI channel
+- updates to RtAudio and RtMidi
+
v4.4: (30 April 2009)
- all classes embedded in the "stk" namespace (except RtAudio, RtMidi, and RtError)
- class WaveLoop renamed FileLoop
diff --git a/doc/doxygen/Doxyfile b/doc/doxygen/Doxyfile
index 4075272..47fbc0a 100644
--- a/doc/doxygen/Doxyfile
+++ b/doc/doxygen/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = STK
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 4.4.0
+PROJECT_NUMBER = 4.4.1
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
diff --git a/doc/doxygen/download.txt b/doc/doxygen/download.txt
index d15e6c6..55a67dd 100644
--- a/doc/doxygen/download.txt
+++ b/doc/doxygen/download.txt
@@ -1,14 +1,23 @@
/*! \page download Download, Release Notes, and Bug Fixes
-\section down Download Version 4.4.0 (30 April 2009):
+\section down Download Version 4.4.1 (3 June 2009):
\section notes Release Notes:
+\subsection v4dot4dot1 Version 4.4.1
+
+
+- Added multi-channel/frame tick() virtual function to WvIn and WvOut abstract base classes (required update to RtWvOut class).
+- Updated configure script to select g++ compiler by default.
+- In demo.cpp: removed voicer grouping for messages, fixing polyphony when messages are on the same MIDI/SKINI channel.
+- Updates to RtAudio and RtMidi.
+
+
\subsection v4dot4dot0 Version 4.4.0
diff --git a/doc/hierarchy.txt b/doc/hierarchy.txt
index b766194..9e760ef 100644
--- a/doc/hierarchy.txt
+++ b/doc/hierarchy.txt
@@ -1,6 +1,6 @@
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
-By Perry R. Cook and Gary P. Scavone, 1995-2007.
+By Perry R. Cook and Gary P. Scavone, 1995-2009.
STK Classes - See the HTML documentation in the html directory for complete information.
diff --git a/include/RtAudio.h b/include/RtAudio.h
index 5c5fd6f..b9bab05 100644
--- a/include/RtAudio.h
+++ b/include/RtAudio.h
@@ -42,7 +42,7 @@
\file RtAudio.h
*/
-// RtAudio: Version 4.0.5
+// RtAudio: Version 4.0.6
#ifndef __RTAUDIO_H
#define __RTAUDIO_H
diff --git a/include/RtMidi.h b/include/RtMidi.h
index 2928eaf..eab4626 100644
--- a/include/RtMidi.h
+++ b/include/RtMidi.h
@@ -35,7 +35,7 @@
*/
/**********************************************************************/
-// RtMidi: Version 1.0.9
+// RtMidi: Version 1.0.10
#ifndef RTMIDI_H
#define RTMIDI_H
diff --git a/include/RtWvOut.h b/include/RtWvOut.h
index fdaa150..8a15f0e 100644
--- a/include/RtWvOut.h
+++ b/include/RtWvOut.h
@@ -73,7 +73,7 @@ class RtWvOut : public WvOut
checked if _STK_DEBUG_ is defined during compilation, in which
case an incompatibility will trigger an StkError exception.
*/
- void tick( StkFrames& frames );
+ void tick( const StkFrames& frames );
// This function is not intended for general use but must be
// public for access from the audio callback function.
diff --git a/include/WvIn.h b/include/WvIn.h
index 651bbc2..847973c 100644
--- a/include/WvIn.h
+++ b/include/WvIn.h
@@ -31,6 +31,9 @@ public:
//! Compute one sample frame and return the specified \c channel value.
virtual StkFloat tick( unsigned int channel = 0 ) = 0;
+ //! Fill the StkFrames argument with computed frames and return the same reference.
+ virtual StkFrames& tick( StkFrames& frames ) = 0;
+
protected:
StkFrames data_;
diff --git a/include/WvOut.h b/include/WvOut.h
index 1339319..ebfd013 100644
--- a/include/WvOut.h
+++ b/include/WvOut.h
@@ -44,6 +44,9 @@ class WvOut : public Stk
*/
virtual void tick( const StkFloat sample ) = 0;
+ //! Output the StkFrames data.
+ virtual void tick( const StkFrames& frames ) = 0;
+
protected:
// Check for sample clipping and clamp.
diff --git a/projects/demo/demo.cpp b/projects/demo/demo.cpp
index f7bcd63..b7c2b74 100644
--- a/projects/demo/demo.cpp
+++ b/projects/demo/demo.cpp
@@ -69,8 +69,8 @@ void processMessage( TickData* data )
register StkFloat value2 = data->message.floatValues[1];
// If only one instrument, allow messages from all channels to control it.
- int channel = 1;
- if ( data->nVoices > 1 ) channel = data->message.channel;
+ //int group = 1;
+ // if ( data->nVoices > 1 ) group = data->message.channel;
switch( data->message.type ) {
@@ -81,13 +81,13 @@ void processMessage( TickData* data )
case __SK_NoteOn_:
if ( value2 == 0.0 ) // velocity is zero ... really a NoteOff
- data->voicer->noteOff( value1, 64.0, channel );
+ data->voicer->noteOff( value1, 64.0 );
else // a NoteOn
- data->voicer->noteOn( value1, value2, channel );
+ data->voicer->noteOn( value1, value2 );
break;
case __SK_NoteOff_:
- data->voicer->noteOff( value1, value2, channel );
+ data->voicer->noteOff( value1, value2 );
break;
case __SK_ControlChange_:
@@ -96,34 +96,34 @@ void processMessage( TickData* data )
else if (value1 == 7.0)
data->volume = value2 * ONE_OVER_128;
else if (value1 == 49.0)
- data->voicer->setFrequency( value2, channel );
+ data->voicer->setFrequency( value2 );
else if (value1 == 50.0)
- data->voicer->controlChange( 128, value2, channel );
+ data->voicer->controlChange( 128, value2 );
else if (value1 == 51.0)
data->frequency = data->message.intValues[1];
else if (value1 == 52.0) {
data->frequency += ( data->message.intValues[1] << 7 );
// Convert to a fractional MIDI note value
StkFloat note = 12.0 * log( data->frequency / 220.0 ) / log( 2.0 ) + 57.0;
- data->voicer->setFrequency( note, channel );
+ data->voicer->setFrequency( note );
}
else
- data->voicer->controlChange( (int) value1, value2, channel );
+ data->voicer->controlChange( (int) value1, value2 );
break;
case __SK_AfterTouch_:
- data->voicer->controlChange( 128, value1, channel );
+ data->voicer->controlChange( 128, value1 );
break;
case __SK_PitchChange_:
- data->voicer->setFrequency( value1, channel );
+ data->voicer->setFrequency( value1 );
break;
case __SK_PitchBend_:
short temp;
temp = data->message.intValues[1] << 7;
temp += data->message.intValues[0];
- data->voicer->pitchBend( (StkFloat) temp, channel );
+ data->voicer->pitchBend( (StkFloat) temp );
break;
case __SK_Volume_:
@@ -143,7 +143,7 @@ void processMessage( TickData* data )
data->currentVoice = voiceByNumber( (int)value1, &data->instrument[i] );
if ( data->currentVoice < 0 )
data->currentVoice = voiceByNumber( 0, &data->instrument[i] );
- data->voicer->addInstrument( data->instrument[i], channel );
+ data->voicer->addInstrument( data->instrument[i] );
data->settling = false;
}
@@ -224,14 +224,14 @@ int main( int argc, char *argv[] )
// Check the command-line arguments for errors and to determine
// the number of WvOut objects to be instantiated (in utilities.cpp).
- data.nWvOuts = checkArgs(argc, argv);
- data.wvout = (WvOut **) calloc(data.nWvOuts, sizeof(WvOut *));
+ data.nWvOuts = checkArgs( argc, argv );
+ data.wvout = (WvOut **) calloc( data.nWvOuts, sizeof(WvOut *) );
// Instantiate the instrument(s) type from the command-line argument
// (in utilities.cpp).
- data.nVoices = countVoices(argc, argv);
- data.instrument = (Instrmnt **) calloc(data.nVoices, sizeof(Instrmnt *));
- data.currentVoice = voiceByName(argv[1], &data.instrument[0]);
+ data.nVoices = countVoices( argc, argv );
+ data.instrument = (Instrmnt **) calloc( data.nVoices, sizeof(Instrmnt *) );
+ data.currentVoice = voiceByName( argv[1], &data.instrument[0] );
if ( data.currentVoice < 0 ) {
free( data.wvout );
free( data.instrument );
@@ -239,16 +239,16 @@ int main( int argc, char *argv[] )
}
// If there was no error allocating the first voice, we should be fine for more.
for ( i=1; iaddInstrument( data.instrument[i], i+1 );
+ data.voicer->addInstrument( data.instrument[i] );
// Parse the command-line flags, instantiate WvOut objects, and
// instantiate the input message controller (in utilities.cpp).
try {
- data.realtime = parseArgs(argc, argv, data.wvout, data.messager);
+ data.realtime = parseArgs( argc, argv, data.wvout, data.messager );
}
catch (StkError &) {
goto cleanup;
diff --git a/projects/examples/test.cpp b/projects/examples/test.cpp
new file mode 100644
index 0000000..fa0d739
--- /dev/null
+++ b/projects/examples/test.cpp
@@ -0,0 +1,56 @@
+// sineosc.cpp STK tutorial program
+
+#include "FileWvIn.h"
+#include "RtWvOut.h"
+using namespace stk;
+
+int main()
+{
+ // Set the global sample rate before creating class instances.
+ Stk::setSampleRate( 44100.0 );
+
+ int nFrames = 100000;
+ WvIn *input;
+ // FileWvOut output;
+ WvOut *output;
+
+ try {
+ // Load the sine wave file.
+ input = new FileWvIn( "hellosine.wav" );
+
+ // Open a 16-bit, one-channel WAV formatted output file
+ // output = new FileWvOut( "hellosine.wav", 1, FileWrite::FILE_WAV, Stk::STK_SINT16 );
+ output = new RtWvOut();
+ }
+ catch ( StkError & ) {
+ exit( 1 );
+ }
+
+ //input.setFrequency( 440.0 );
+
+ // Option 1: Use StkFrames
+ /*
+ StkFrames frames( nFrames, 1 );
+ try {
+ output->tick( input->tick( frames ) );
+ }
+ catch ( StkError & ) {
+ exit( 1 );
+ }
+ */
+
+ // Option 2: Single-sample computations
+ for ( int i=0; itick( input->tick() );
+ }
+ catch ( StkError & ) {
+ exit( 1 );
+ }
+ }
+
+ delete output;
+ delete input;
+
+ return 0;
+}
diff --git a/src/Granulate.cpp b/src/Granulate.cpp
index eaeac34..482dbdc 100644
--- a/src/Granulate.cpp
+++ b/src/Granulate.cpp
@@ -260,7 +260,7 @@ StkFloat Granulate :: tick( unsigned int channel )
// Accumulate the grain outputs.
if ( grains_[i].state > 0 ) {
for ( j=0; j
@@ -403,7 +403,9 @@ unsigned int RtApi :: getStreamSampleRate( void )
// implementation.
struct CoreHandle {
AudioDeviceID id[2]; // device ids
+#if defined( MAC_OS_X_VERSION_10_5 ) && ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
AudioDeviceIOProcID procId[2];
+#endif
UInt32 iStream[2]; // device stream index (or first if using multiple)
UInt32 nStreams[2]; // number of streams to use
bool xrun[2];
@@ -5646,7 +5648,7 @@ bool RtApiAlsa :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
}
// Set the buffer number, which in ALSA is referred to as the "period".
- int totalSize, dir;
+ int totalSize, dir = 0;
unsigned int periods = 0;
if ( options ) periods = options->numberOfBuffers;
totalSize = *bufferSize * periods;
diff --git a/src/RtMidi.cpp b/src/RtMidi.cpp
index 8e05db9..4b73921 100644
--- a/src/RtMidi.cpp
+++ b/src/RtMidi.cpp
@@ -35,7 +35,7 @@
*/
/**********************************************************************/
-// RtMidi: Version 1.0.9
+// RtMidi: Version 1.0.10
#include "RtMidi.h"
#include
@@ -743,7 +743,7 @@ void RtMidiOut :: sendMessage( std::vector *message )
unsigned int packetBytes, bytesLeft = nBytes;
unsigned int messageIndex = 0;
- MIDITimeStamp timeStamp = 0;
+ MIDITimeStamp timeStamp = AudioGetCurrentHostTime();
CoreMidiData *data = static_cast (apiData_);
while ( bytesLeft > 0 ) {
diff --git a/src/RtWvOut.cpp b/src/RtWvOut.cpp
index d45ecb8..98ee3e5 100644
--- a/src/RtWvOut.cpp
+++ b/src/RtWvOut.cpp
@@ -165,7 +165,7 @@ void RtWvOut :: tick( const StkFloat sample )
writeIndex_ = 0;
}
-void RtWvOut :: tick( StkFrames& frames )
+void RtWvOut :: tick( const StkFrames& frames )
{
#if defined(_STK_DEBUG_)
if ( data_.channels() != frames.channels() ) {
@@ -195,7 +195,8 @@ void RtWvOut :: tick( StkFrames& frames )
nFrames = frames.frames() - framesWritten;
bytes = nFrames * nChannels * sizeof( StkFloat );
StkFloat *samples = &data_[writeIndex_ * nChannels];
- memcpy( samples, &frames[framesWritten * nChannels], bytes );
+ StkFrames *ins = (StkFrames *) &frames;
+ memcpy( samples, &(*ins)[framesWritten * nChannels], bytes );
for ( unsigned int i=0; i