Version 4.4.2

This commit is contained in:
Gary Scavone
2013-09-29 23:15:24 +02:00
committed by Stephen Sinclair
parent b6a2202011
commit baca57040b
221 changed files with 1281 additions and 913 deletions

View File

@@ -7,7 +7,7 @@
messages, keeping track of its state. The \e state = ADSR::DONE
after the envelope value reaches 0.0 in the ADSR::RELEASE state.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -19,7 +19,7 @@
to \e keyOn and \e keyOff messages by ramping to
1.0 on keyOn and to 0.0 on keyOff.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -28,7 +28,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
Methods are provided for creating a resonance or notch in the
frequency response while maintaining a constant filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -26,7 +26,7 @@
in the presence of significant aliasing.
Based on initial code of Robin Davies, 2005
Modified algorithm code by Gary Scavone, 2005 - 2009.
Modified algorithm code by Gary Scavone, 2005 - 2010.
*/
/***************************************************/

View File

@@ -12,7 +12,7 @@
- Vibrato Gain = 1
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -29,7 +29,7 @@
- Register State = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -17,7 +17,7 @@
- Vibrato Gain = 1
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -16,7 +16,7 @@
- Vibrato Gain = 1
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -5,7 +5,7 @@
This class implements a chorus effect. It takes a monophonic
input signal and produces a stereo output signal.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -18,7 +18,7 @@
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -10,7 +10,7 @@
A non-interpolating delay line is typically used in fixed
delay-length applications, such as for reverberation.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
@@ -118,4 +118,13 @@ StkFloat Delay :: contentsAt( unsigned long tapDelay )
return inputs_[tap];
}
StkFloat Delay :: addTo( unsigned long tapDelay, StkFloat value )
{
long tap = inPoint_ - tapDelay - 1;
while ( tap < 0 ) // Check for wraparound.
tap += inputs_.size();
return inputs_[tap]+= value;
}
} // stk namespace

View File

@@ -14,7 +14,7 @@
minimum delay possible in this implementation is limited to a
value of 0.5.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@
delay setting. The use of higher order Lagrange interpolators can
typically improve (minimize) this attenuation characteristic.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -11,7 +11,7 @@
of simultaneous voices) via a #define in the
Drummer.h.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -4,7 +4,7 @@
This class implements an echo effect.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -7,7 +7,7 @@
specified \e rate. It also responds to simple \e keyOn and \e
keyOff messages, ramping to 1.0 on keyOn and to 0.0 on keyOff.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -19,7 +19,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -26,7 +26,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -12,7 +12,7 @@
the overloaded one that takes an StkFrames object for
multi-channel and/or multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -32,8 +32,9 @@
#include "FileRead.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <cstdio>
namespace stk {

View File

@@ -17,12 +17,13 @@
type, the data type will automatically be modified. Compressed
data types are not supported.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
#include "FileWrite.h"
#include <string.h>
#include <cstring>
#include <cstdio>
#include <cmath>
namespace stk {

View File

@@ -27,7 +27,7 @@
See the FileRead class for a description of the supported audio
file formats.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -17,7 +17,7 @@
Currently, FileWvOut is non-interpolating and the output rate is
always Stk::sampleRate().
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -16,7 +16,7 @@
This structure results in one extra multiply per computed sample,
but allows easy control of the overall filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -18,7 +18,7 @@
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
over time from one frequency setting to another. It provides
methods for controlling the sweep rate and target frequency.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -11,7 +11,7 @@
Chris Rolfe and Damian Keller, though there are likely to be a
number of differences in the actual implementation.
by Gary Scavone, 2005 - 2009.
by Gary Scavone, 2005 - 2010.
*/
/***************************************************/

View File

@@ -22,7 +22,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -20,7 +20,7 @@
This structure results in one extra multiply per computed sample,
but allows easy control of the overall filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -20,7 +20,7 @@
data type for the incoming stream is signed 16-bit integers,
though any of the defined StkFormats are permissible.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -17,7 +17,7 @@
data type is signed 16-bit integers but any of the defined
StkFormats are permissible.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -9,7 +9,7 @@
followed by four parallel comb filters, and two decorrelation
delay lines in parallel at the output.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

52
src/LentPitShift.cpp Normal file
View File

@@ -0,0 +1,52 @@
/***************************************************/
/*! \class LentPitShift
\brief Pitch shifter effect class based on the Lent algorithm.
This class implements a pitch shifter using pitch
tracking and sample windowing and shifting.
by Francois Germain, 2009.
*/
/***************************************************/
#include "LentPitShift.h"
namespace stk {
LentPitShift::LentPitShift( StkFloat periodRatio, int tMax )
: inputFrames(0.,tMax,1), outputFrames(0.,tMax,1), ptrFrames(0), inputPtr(0), outputPtr(0.), tMax_(tMax), periodRatio_(periodRatio), zeroFrame(0., tMax, 1)
{
window = new StkFloat[2*tMax_]; // Allocation of the array for the hamming window
threshold_ = 0.1; // Default threshold for pitch tracking
dt = new StkFloat[tMax+1]; // Allocation of the euclidian distance coefficient array. The first one is never used.
cumDt = new StkFloat[tMax+1]; // Allocation of the cumulative sum array
cumDt[0] = 0.; // Initialization of the first coefficient of the cumulative sum
dpt = new StkFloat[tMax+1]; // Allocation of the pitch tracking function coefficient array
dpt[0] = 1.; // Initialization of the first coefficient of dpt which is always the same
// Initialisation of the input and output delay lines
inputLine_.setMaximumDelay( 3 * tMax_ );
// The delay is choosed such as the coefficients are not read before being finalised.
outputLine_.setMaximumDelay( 3 * tMax_ );
outputLine_.setDelay( 3 * tMax_ );
//Initialization of the delay line of pitch tracking coefficients
//coeffLine_ = new Delay[512];
//for(int i=0;i<tMax_;i++)
// coeffLine_[i] = new Delay( tMax_, tMax_ );
}
void LentPitShift :: clear()
{
inputLine_.clear();
outputLine_.clear();
}
void LentPitShift :: setShift( StkFloat shift )
{
if ( shift <= 0.0 ) periodRatio_ = 1.0;
periodRatio_ = 1.0 / shift;
}
} // stk namespace

View File

@@ -2,8 +2,13 @@
### libstk Makefile - for various flavors of unix
LIBRARY = libstk.a
SHAREDLIB = libstk.so
MAJOR = 4
RELEASE = 4.4.2
AR = ar -rsc
RM = /bin/rm
LN = /bin/ln
OBJECT_PATH = @object_path@
vpath %.o $(OBJECT_PATH)
@@ -14,7 +19,7 @@ OBJECTS = Stk.o Generator.o Noise.o Blit.o BlitSaw.o BlitSquare.o Granulate.o \
BiQuad.o FormSwep.o Delay.o DelayL.o DelayA.o \
\
Effect.o PRCRev.o JCRev.o NRev.o \
Chorus.o Echo.o PitShift.o \
Chorus.o Echo.o PitShift.o LentPitShift.o \
Function.o ReedTable.o JetTable.o BowTable.o \
Voicer.o Vector3D.o Sphere.o \
\
@@ -39,7 +44,8 @@ CC = @CXX@
DEFS = @CPPFLAGS@
DEFS += @byte_order@
CFLAGS = @CXXFLAGS@
CFLAGS += $(INCLUDE) -Iinclude
CFLAGS += $(INCLUDE) -Iinclude -fPIC
LIBS = @LIBS@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
@@ -61,12 +67,24 @@ DEFS += -DRAWWAVE_PATH=\"$(RAWWAVES)\"
all : $(LIBRARY)
$(LIBRARY) : $(OBJECTS)
/bin/rm -f $(LIBRARY)
$(RM) -f $(LIBRARY)
$(AR) $(LIBRARY) $(OBJECT_PATH)/*.o
$(SHAREDLIB).$(RELEASE) : $(OBJECTS)
$(RM) -f $(@) $(SHAREDLIB).$(MAJOR) $(SHAREDLIB)
$(CC) $(LDFLAGS) -fPIC -shared -o $(@) $(OBJECT_PATH)/*.o $(LIBS)
$(LN) -s $(SHAREDLIB).$(RELEASE) $(SHAREDLIB).$(MAJOR)
$(LN) -s $(SHAREDLIB).$(RELEASE) $(SHAREDLIB)
# $(CC) $(LDFLAGS) -fPIC -shared -Wl,-soname,$(SHAREDLIB).$(MAJOR) -o $(@) $(OBJECT_PATH)/*.o $(LIBS)
$(OBJECTS) : Stk.h
clean :
-rm $(OBJECT_PATH)/*.o
-rm $(LIBRARY)
-rm -fR *.dSYM
$(RM) -f $(OBJECT_PATH)/*.o
$(RM) -f $(LIBRARY)
$(RM) -f $(SHAREDLIB)*
$(RM) -f *~
$(RM) -fR *.dSYM
distclean: clean
$(RM) Makefile

View File

@@ -23,7 +23,7 @@
- String Detuning = 1
- Microphone Position = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -28,7 +28,7 @@
This class is primarily for use in STK example programs but it is
generic enough to work in many other contexts.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
@@ -162,8 +162,6 @@ bool Messager :: startStdInput()
return true;
}
//} // stk namespace
THREAD_RETURN THREAD_TYPE stdinHandler(void *ptr)
{
Messager::MessagerData *data = (Messager::MessagerData *) ptr;
@@ -220,8 +218,6 @@ void midiHandler( double timeStamp, std::vector<unsigned char> *bytes, void *ptr
data->mutex.unlock();
}
//namespace stk {
bool Messager :: startMidiInput( int port )
{
if ( data_.sources == STK_FILE ) {
@@ -304,8 +300,6 @@ bool Messager :: startSocketInput( int port )
return true;
}
//} // stk namespace
#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))
#include <sys/time.h>
#include <errno.h>
@@ -428,7 +422,7 @@ THREAD_RETURN THREAD_TYPE socketHandler(void *ptr)
return NULL;
}
} // stk namespace
#endif
} // stk namespace

View File

@@ -11,12 +11,12 @@
Tempo changes are internally tracked by the class and reflected in
the values returned by the function getTickSeconds().
by Gary P. Scavone, 2003 - 2009.
by Gary P. Scavone, 2003 - 2010.
*/
/**********************************************************************/
#include "MidiFileIn.h"
#include <string.h>
#include <cstring>
#include <iostream>
namespace stk {

View File

@@ -7,11 +7,12 @@
(non-sweeping BiQuad filters), where N is set
during instantiation.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
#include "Modal.h"
#include <cstdlib>
namespace stk {

View File

@@ -24,7 +24,7 @@
- Two Fixed = 7
- Clump = 8
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
modulations to give a nice, natural human
modulation function.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -14,7 +14,7 @@
- Vibrato Gain = 1
- Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -7,7 +7,7 @@
systems, the pthread library is used. Under
Windows, critical sections are used.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -10,7 +10,7 @@
another allpass in series, followed by two allpass filters in
parallel with corresponding right and left outputs.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
C rand() function. The quality of the rand()
function varies from one OS to another.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
provided for setting the pole position along the real axis of the
z-plane while maintaining a constant peak filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
provided for setting the zero position along the real axis of the
z-plane while maintaining a constant filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -10,7 +10,7 @@
two series allpass units and two parallel comb
filters.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -22,7 +22,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
set of 32 static phoneme formant parameters
and provide access to those values.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -5,7 +5,7 @@
This class implements a simple pitch shifter
using delay lines.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -14,7 +14,7 @@
use possibly subject to patents held by
Stanford University, Yamaha, and others.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@
Stanford, bearing the names of Karplus and/or
Strong.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -7,7 +7,7 @@
coefficient. Another method is provided to create a DC blocking
filter.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@
- Zero Radii = 1
- Envelope Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -26,7 +26,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
RtMidi: realtime MIDI i/o C++ classes
Copyright (c) 2003-2009 Gary P. Scavone
Copyright (c) 2003-2010 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -35,7 +35,7 @@
*/
/**********************************************************************/
// RtMidi: Version 1.0.10
// RtMidi: Version 1.0.11
#include "RtMidi.h"
#include <sstream>
@@ -166,6 +166,7 @@ RtMidiOut :: RtMidiOut( const std::string clientName ) : RtMidi()
// OS-X CoreMIDI header files.
#include <CoreMIDI/CoreMIDI.h>
#include <CoreAudio/HostTime.h>
#include <CoreServices/CoreServices.h>
// A structure to hold variables related to the CoreMIDI API
// implementation.
@@ -226,7 +227,7 @@ void midiInputCallback( const MIDIPacketList *list, void *procRef, void *srcRef
// We have a continuing, segmented sysex message.
if ( !( data->ignoreFlags & 0x01 ) ) {
// If we're not ignoring sysex messages, copy the entire packet.
for ( unsigned int j=0; j<nBytes; j++ )
for ( unsigned int j=0; j<nBytes; ++j )
message.bytes.push_back( packet->data[j] );
}
continueSysex = packet->data[nBytes-1] != 0xF7;
@@ -368,7 +369,7 @@ void RtMidiIn :: openPort( unsigned int portNumber, const std::string portName )
// Get the desired input source identifier.
MIDIEndpointRef endpoint = MIDIGetSource( portNumber );
if ( endpoint == NULL ) {
if ( endpoint == 0 ) {
MIDIPortDispose( port );
MIDIClientDispose( data->client );
errorString_ = "RtMidiIn::openPort: error getting MIDI input source reference.";
@@ -451,7 +452,7 @@ CFStringRef EndpointName( MIDIEndpointRef endpoint, bool isExternal )
MIDIEntityRef entity = NULL;
MIDIEndpointGetEntity( endpoint, &entity );
if ( entity == NULL )
if ( entity == 0 )
// probably virtual
return result;
@@ -465,9 +466,9 @@ CFStringRef EndpointName( MIDIEndpointRef endpoint, bool isExternal )
}
}
// now consider the device's name
MIDIDeviceRef device = NULL;
MIDIDeviceRef device = 0;
MIDIEntityGetDevice( entity, &device );
if ( device == NULL )
if ( device == 0 )
return result;
str = NULL;
@@ -665,7 +666,7 @@ void RtMidiOut :: openPort( unsigned int portNumber, const std::string portName
// Get the desired output port identifier.
MIDIEndpointRef destination = MIDIGetDestination( portNumber );
if ( destination == NULL ) {
if ( destination == 0 ) {
MIDIPortDispose( port );
MIDIClientDispose( data->client );
errorString_ = "RtMidiOut::openPort: error getting MIDI output destination reference.";
@@ -1042,7 +1043,7 @@ unsigned int portInfo( snd_seq_t *seq, snd_seq_port_info_t *pinfo, unsigned int
unsigned int caps = snd_seq_port_info_get_capability( pinfo );
if ( ( caps & type ) != type ) continue;
if ( count == portNumber ) return 1;
count++;
++count;
}
}
@@ -1225,8 +1226,8 @@ RtMidiIn :: ~RtMidiIn()
if ( data->vport >= 0 ) snd_seq_delete_port( data->seq, data->vport );
#ifndef AVOID_TIMESTAMPING
snd_seq_free_queue( data->seq, data->queue_id );
snd_seq_close( data->seq );
#endif
snd_seq_close( data->seq );
delete data;
}
@@ -1458,7 +1459,7 @@ void RtMidiOut :: sendMessage( std::vector<unsigned char> *message )
snd_seq_ev_set_source(&ev, data->vport);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_direct(&ev);
for ( unsigned int i=0; i<nBytes; i++ ) data->buffer[i] = message->at(i);
for ( unsigned int i=0; i<nBytes; ++i ) data->buffer[i] = message->at(i);
result = snd_midi_event_encode( data->coder, data->buffer, (long)nBytes, &ev );
if ( result < (int)nBytes ) {
errorString_ = "RtMidiOut::sendMessage: event parsing error!";
@@ -1564,7 +1565,7 @@ extern "C" void *irixMidiHandler( void *ptr )
if ( continueSysex ) {
// We have a continuing, segmented sysex message. Append
// the new bytes to our existing message.
for ( int i=0; i<event.msglen; i++ )
for ( int i=0; i<event.msglen; ++i )
message.bytes.push_back( event.sysexmsg[i] );
if ( event.sysexmsg[event.msglen-1] == 0xF7 ) continueSysex = false;
if ( !continueSysex ) {
@@ -1858,11 +1859,11 @@ void RtMidiOut :: sendMessage( std::vector<unsigned char> *message )
event.msg[0] = 0xF0;
event.msglen = nBytes;
buffer = (char *) malloc( nBytes );
for ( int i=0; i<nBytes; i++ ) buffer[i] = message->at(i);
for ( int i=0; i<nBytes; ++i ) buffer[i] = message->at(i);
event.sysexmsg = buffer;
}
else {
for ( int i=0; i<nBytes; i++ )
for ( int i=0; i<nBytes; ++i )
event.msg[i] = message->at(i);
}
@@ -1897,6 +1898,9 @@ void RtMidiOut :: sendMessage( std::vector<unsigned char> *message )
#include <windows.h>
#include <mmsystem.h>
#define RT_SYSEX_BUFFER_SIZE 1024
#define RT_SYSEX_BUFFER_COUNT 4
// A structure to hold variables related to the CoreMIDI API
// implementation.
struct WinMidiData {
@@ -1904,11 +1908,9 @@ struct WinMidiData {
HMIDIOUT outHandle; // Handle to Midi Output Device
DWORD lastTime;
RtMidiIn::MidiMessage message;
LPMIDIHDR sysexBuffer;
LPMIDIHDR sysexBuffer[RT_SYSEX_BUFFER_COUNT];
};
#define RT_SYSEX_BUFFER_SIZE 1024
//*********************************************************************//
// API: Windows MM
// Class Definitions: RtMidiIn
@@ -1920,7 +1922,7 @@ static void CALLBACK midiInputCallback( HMIDIOUT hmin,
DWORD midiMessage,
DWORD timestamp )
{
if ( inputStatus != MIM_DATA && inputStatus != MIM_LONGDATA ) return;
if ( inputStatus != MIM_DATA && inputStatus != MIM_LONGDATA && inputStatus != MIM_LONGERROR ) return;
//RtMidiIn::RtMidiInData *data = static_cast<RtMidiIn::RtMidiInData *> (instancePtr);
RtMidiIn::RtMidiInData *data = (RtMidiIn::RtMidiInData *)instancePtr;
@@ -1960,13 +1962,13 @@ static void CALLBACK midiInputCallback( HMIDIOUT hmin,
// Copy bytes to our MIDI message.
unsigned char *ptr = (unsigned char *) &midiMessage;
for ( int i=0; i<nBytes; i++ ) apiData->message.bytes.push_back( *ptr++ );
for ( int i=0; i<nBytes; ++i ) apiData->message.bytes.push_back( *ptr++ );
}
else { // Sysex message ( MIM_LONGDATA )
else { // Sysex message ( MIM_LONGDATA or MIM_LONGERROR )
MIDIHDR *sysex = ( MIDIHDR *) midiMessage;
if ( !( data->ignoreFlags & 0x01 ) ) {
if ( !( data->ignoreFlags & 0x01 ) && inputStatus != MIM_LONGERROR ) {
// Sysex message and we're not ignoring it
for ( int i=0; i<(int)sysex->dwBytesRecorded; i++ )
for ( int i=0; i<(int)sysex->dwBytesRecorded; ++i )
apiData->message.bytes.push_back( sysex->lpData[i] );
}
@@ -1978,9 +1980,9 @@ static void CALLBACK midiInputCallback( HMIDIOUT hmin,
// buffer when an application closes and in this case, we should
// avoid requeueing it, else the computer suddenly reboots after
// one or two minutes.
if ( apiData->sysexBuffer->dwBytesRecorded > 0 ) {
//if ( sysex->dwBytesRecorded > 0 ) {
MMRESULT result = midiInAddBuffer( apiData->inHandle, apiData->sysexBuffer, sizeof(MIDIHDR) );
if ( apiData->sysexBuffer[sysex->dwUser]->dwBytesRecorded > 0 ) {
//if ( sysex->dwBytesRecorded > 0 ) {
MMRESULT result = midiInAddBuffer( apiData->inHandle, apiData->sysexBuffer[sysex->dwUser], sizeof(MIDIHDR) );
if ( result != MMSYSERR_NOERROR )
std::cerr << "\nRtMidiIn::midiInputCallback: error sending sysex to Midi device!!\n\n";
@@ -2054,25 +2056,28 @@ void RtMidiIn :: openPort( unsigned int portNumber, const std::string /*portName
error( RtError::DRIVER_ERROR );
}
// Allocate and init the sysex buffer.
data->sysexBuffer = (MIDIHDR*) new char[ sizeof(MIDIHDR) ];
data->sysexBuffer->lpData = new char[ RT_SYSEX_BUFFER_SIZE ];
data->sysexBuffer->dwBufferLength = RT_SYSEX_BUFFER_SIZE;
data->sysexBuffer->dwFlags = 0;
// Allocate and init the sysex buffers.
for ( int i=0; i<RT_SYSEX_BUFFER_COUNT; ++i ) {
data->sysexBuffer[i] = (MIDIHDR*) new char[ sizeof(MIDIHDR) ];
data->sysexBuffer[i]->lpData = new char[ RT_SYSEX_BUFFER_SIZE ];
data->sysexBuffer[i]->dwBufferLength = RT_SYSEX_BUFFER_SIZE;
data->sysexBuffer[i]->dwUser = i; // We use the dwUser parameter as buffer indicator
data->sysexBuffer[i]->dwFlags = 0;
result = midiInPrepareHeader( data->inHandle, data->sysexBuffer, sizeof(MIDIHDR) );
if ( result != MMSYSERR_NOERROR ) {
midiInClose( data->inHandle );
errorString_ = "RtMidiIn::openPort: error starting Windows MM MIDI input port (PrepareHeader).";
error( RtError::DRIVER_ERROR );
}
result = midiInPrepareHeader( data->inHandle, data->sysexBuffer[i], sizeof(MIDIHDR) );
if ( result != MMSYSERR_NOERROR ) {
midiInClose( data->inHandle );
errorString_ = "RtMidiIn::openPort: error starting Windows MM MIDI input port (PrepareHeader).";
error( RtError::DRIVER_ERROR );
}
// Register the buffer.
result = midiInAddBuffer( data->inHandle, data->sysexBuffer, sizeof(MIDIHDR) );
if ( result != MMSYSERR_NOERROR ) {
midiInClose( data->inHandle );
errorString_ = "RtMidiIn::openPort: error starting Windows MM MIDI input port (AddBuffer).";
error( RtError::DRIVER_ERROR );
// Register the buffer.
result = midiInAddBuffer( data->inHandle, data->sysexBuffer[i], sizeof(MIDIHDR) );
if ( result != MMSYSERR_NOERROR ) {
midiInClose( data->inHandle );
errorString_ = "RtMidiIn::openPort: error starting Windows MM MIDI input port (AddBuffer).";
error( RtError::DRIVER_ERROR );
}
}
result = midiInStart( data->inHandle );
@@ -2099,13 +2104,15 @@ void RtMidiIn :: closePort( void )
midiInReset( data->inHandle );
midiInStop( data->inHandle );
int result = midiInUnprepareHeader(data->inHandle, data->sysexBuffer, sizeof(MIDIHDR));
delete [] data->sysexBuffer->lpData;
delete [] data->sysexBuffer;
if ( result != MMSYSERR_NOERROR ) {
midiInClose( data->inHandle );
errorString_ = "RtMidiIn::openPort: error closing Windows MM MIDI input port (midiInUnprepareHeader).";
error( RtError::DRIVER_ERROR );
for ( int i=0; i<RT_SYSEX_BUFFER_COUNT; ++i ) {
int result = midiInUnprepareHeader(data->inHandle, data->sysexBuffer[i], sizeof(MIDIHDR));
delete [] data->sysexBuffer[i]->lpData;
delete [] data->sysexBuffer[i];
if ( result != MMSYSERR_NOERROR ) {
midiInClose( data->inHandle );
errorString_ = "RtMidiIn::openPort: error closing Windows MM MIDI input port (midiInUnprepareHeader).";
error( RtError::DRIVER_ERROR );
}
}
midiInClose( data->inHandle );
@@ -2145,7 +2152,7 @@ std::string RtMidiIn :: getPortName( unsigned int portNumber )
// UNICODE (thanks to Eduardo Coutinho!).
//std::string stringName = std::string( deviceCaps.szPname );
char nameString[MAXPNAMELEN];
for( int i=0; i<MAXPNAMELEN; i++ )
for( int i=0; i<MAXPNAMELEN; ++i )
nameString[i] = (char)( deviceCaps.szPname[i] );
std::string stringName( nameString );
@@ -2179,7 +2186,7 @@ std::string RtMidiOut :: getPortName( unsigned int portNumber )
// UNICODE (thanks to Eduardo Coutinho!).
//std::string stringName = std::string( deviceCaps.szPname );
char nameString[MAXPNAMELEN];
for( int i=0; i<MAXPNAMELEN; i++ )
for( int i=0; i<MAXPNAMELEN; ++i )
nameString[i] = (char)( deviceCaps.szPname[i] );
std::string stringName( nameString );
@@ -2284,7 +2291,7 @@ void RtMidiOut :: sendMessage( std::vector<unsigned char> *message )
}
// Copy data to buffer.
for ( unsigned int i=0; i<nBytes; i++ ) buffer[i] = message->at(i);
for ( unsigned int i=0; i<nBytes; ++i ) buffer[i] = message->at(i);
// Create and prepare MIDIHDR structure.
MIDIHDR sysex;
@@ -2323,9 +2330,9 @@ void RtMidiOut :: sendMessage( std::vector<unsigned char> *message )
// Pack MIDI bytes into double word.
DWORD packet;
unsigned char *ptr = (unsigned char *) &packet;
for ( unsigned int i=0; i<nBytes; i++ ) {
for ( unsigned int i=0; i<nBytes; ++i ) {
*ptr = message->at(i);
ptr++;
++ptr;
}
// Send the message immediately.

View File

@@ -15,12 +15,12 @@
that takes an StkFrames object for multi-channel and/or
multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
#include "RtWvIn.h"
#include <string.h>
#include <cstring>
namespace stk {

View File

@@ -14,12 +14,12 @@
that takes a reference to an StkFrames object for multi-channel
and/or multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
#include "RtWvOut.h"
#include <string.h>
#include <cstring>
namespace stk {

View File

@@ -5,7 +5,7 @@
This instrument provides an ADSR envelope, a one-pole filter, and
structures for an arbitrary number of attack and looped files.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -31,7 +31,7 @@
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -48,14 +48,15 @@
- Little Rocks = 21
- Tuned Bamboo Chimes = 22
by Perry R. Cook, 1996 - 2009.
by Perry R. Cook, 1996 - 2010.
*/
/***************************************************/
#include "Shakers.h"
#include "SKINI.msg"
#include <string.h>
#include <cstring>
#include <cmath>
#include <cstdlib>
namespace stk {

View File

@@ -13,7 +13,7 @@
- Envelope Rate = 11
- Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -9,7 +9,7 @@
The "table" length, set in SineWave.h, is 2048 samples by default.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -9,7 +9,7 @@
Within STK, it is used as an excitation source for other
instruments.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@
Stanford, bearing the names of Karplus and/or
Strong.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -19,12 +19,13 @@
See also SKINI.txt.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
#include "Skini.h"
#include "SKINI.tbl"
#include <cstdlib>
namespace stk {

View File

@@ -5,7 +5,7 @@
This class provides common functionality for TCP and UDP internet
socket server and client subclasses.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -5,7 +5,7 @@
This class implements a spherical ball with
radius, mass, position, and velocity parameters.
by Perry R. Cook, 1995 - 2009.
by Perry R. Cook, 1995 - 2010.
*/
/***************************************************/

View File

@@ -17,7 +17,7 @@
- String Sustain = 11
- String Stretch = 1
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -22,7 +22,7 @@
STK WWW site: http://ccrma.stanford.edu/software/stk/
The Synthesis ToolKit in C++ (STK)
Copyright (c) 1995-2009 Perry R. Cook and Gary P. Scavone
Copyright (c) 1995-2010 Perry R. Cook and Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files

View File

@@ -10,7 +10,7 @@
A non-interpolating delay line is typically used in fixed
delay-length applications, such as for reverberation.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -19,12 +19,12 @@
less than or equal to zero indicate a closed
or lost connection or the occurence of an error.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
#include "TcpClient.h"
#include <string.h>
#include <cstring>
namespace stk {

View File

@@ -19,7 +19,7 @@
less than or equal to zero indicate a closed
or lost connection or the occurence of an error.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -16,7 +16,7 @@
THREAD_RETURN THREAD_TYPE thread_function(void *ptr)
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -26,7 +26,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
provided for creating a resonance in the frequency response while
maintaining a nearly constant filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -6,7 +6,7 @@
provided for creating a "notch" in the frequency response while
maintaining a constant filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/

View File

@@ -17,12 +17,12 @@
read/write methods. Values less than or equal to zero indicate
the occurence of an error.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
#include "UdpSocket.h"
#include <string.h>
#include <cstring>
namespace stk {

View File

@@ -21,14 +21,14 @@
- Vibrato Gain = 1
- Loudness (Spectral Tilt) = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
#include "VoicForm.h"
#include "Phonemes.h"
#include "SKINI.msg"
#include <string.h>
#include <cstring>
#include <cmath>
namespace stk {

View File

@@ -19,7 +19,7 @@
Alternately, control changes can be sent to all voices in a given
group.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
@@ -165,10 +165,10 @@ void Voicer :: setFrequency( long tag, StkFloat noteNumber )
void Voicer :: pitchBend( StkFloat value, int group )
{
StkFloat pitchScaler;
if ( value < 64.0 )
pitchScaler = pow(0.5, (64.0-value)/64.0);
if ( value < 8192.0 )
pitchScaler = pow( 0.5, (8192.0-value) / 8192.0 );
else
pitchScaler = pow(2.0, (value-64.0)/64.0);
pitchScaler = pow( 2.0, (value-8192.0) / 8192.0 );
for ( unsigned int i=0; i<voices_.size(); i++ ) {
if ( voices_[i].group == group )
voices_[i].instrument->setFrequency( (StkFloat) (voices_[i].frequency * pitchScaler) );
@@ -178,10 +178,10 @@ void Voicer :: pitchBend( StkFloat value, int group )
void Voicer :: pitchBend( long tag, StkFloat value )
{
StkFloat pitchScaler;
if ( value < 64.0 )
pitchScaler = pow(0.5, (64.0-value)/64.0);
if ( value < 8192.0 )
pitchScaler = pow( 0.5, (8192.0-value) / 8192.0 );
else
pitchScaler = pow(2.0, (value-64.0)/64.0);
pitchScaler = pow( 2.0, (value-8192.0) / 8192.0 );
for ( unsigned int i=0; i<voices_.size(); i++ ) {
if ( voices_[i].tag == tag ) {
voices_[i].instrument->setFrequency( (StkFloat) (voices_[i].frequency * pitchScaler) );

View File

@@ -12,7 +12,7 @@
- Blowing Frequency Modulation = 2
- Volume = 128
by Perry R. Cook 1996 - 2009.
by Perry R. Cook 1996 - 2010.
*/
/***************************************************/

View File

@@ -26,7 +26,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/