mirror of
https://github.com/thestk/stk
synced 2026-01-14 21:41:53 +00:00
Version 4.4.4
This commit is contained in:
committed by
Stephen Sinclair
parent
0aec39260a
commit
fc877b87bf
@@ -9,7 +9,7 @@
|
||||
the ADSR::RELEASE state. All rate, target and level settings must
|
||||
be non-negative. All time settings must be positive.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
- Vibrato Gain = 1
|
||||
- Volume = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
- Register State = 1
|
||||
- Breath Pressure = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
- Frequency = 101
|
||||
- Volume = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
Contributions by Esteban Maestre, 2011.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
- Vibrato Gain = 1
|
||||
- Volume = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
- Vibrato Gain = 1
|
||||
- Breath Pressure = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -52,11 +52,6 @@ void Delay :: setDelay( unsigned long delay )
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( delay < 0 ) {
|
||||
oStream_ << "Delay::setDelay: argument (" << delay << ") less than zero!\n";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
// read chases write
|
||||
if ( inPoint_ >= delay ) outPoint_ = inPoint_ - delay;
|
||||
else outPoint_ = inputs_.size() + inPoint_ - delay;
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
of simultaneous voices) via a #define in the
|
||||
Drummer.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
This class implements an echo effect.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -34,6 +34,7 @@ void Echo :: setMaximumDelay( unsigned long delay )
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
length_ = delay;
|
||||
delayLine_.setMaximumDelay( delay );
|
||||
}
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
14
src/FM.cpp
14
src/FM.cpp
@@ -19,7 +19,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -105,11 +105,7 @@ void FM :: setFrequency( StkFloat frequency )
|
||||
|
||||
void FM :: setRatio( unsigned int waveIndex, StkFloat ratio )
|
||||
{
|
||||
if ( waveIndex < 0 ) {
|
||||
oStream_ << "FM::setRatio: waveIndex parameter is less than zero!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
else if ( waveIndex >= nOperators_ ) {
|
||||
if ( waveIndex >= nOperators_ ) {
|
||||
oStream_ << "FM:setRatio: waveIndex parameter is greater than the number of operators!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
@@ -123,11 +119,7 @@ void FM :: setRatio( unsigned int waveIndex, StkFloat ratio )
|
||||
|
||||
void FM :: setGain( unsigned int waveIndex, StkFloat gain )
|
||||
{
|
||||
if ( waveIndex < 0 ) {
|
||||
oStream_ << "FM::setGain: waveIndex parameter is less than zero!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
else if ( waveIndex >= nOperators_ ) {
|
||||
if ( waveIndex >= nOperators_ ) {
|
||||
oStream_ << "FM::setGain: waveIndex parameter is greater than the number of operators!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
type, the data type will automatically be modified. Compressed
|
||||
data types are not supported.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -35,7 +35,8 @@ const FileWrite::FILE_TYPE FileWrite :: FILE_SND = 3;
|
||||
const FileWrite::FILE_TYPE FileWrite :: FILE_AIF = 4;
|
||||
const FileWrite::FILE_TYPE FileWrite :: FILE_MAT = 5;
|
||||
|
||||
// WAV header structure. See ftp://ftp.isi.edu/in-notes/rfc2361.txt
|
||||
// WAV header structure. See
|
||||
// http://www-mmsp.ece.mcgill.ca/documents/audioformats/WAVE/Docs/rfc2361.txt
|
||||
// for information regarding format codes.
|
||||
struct WaveHeader {
|
||||
char riff[4]; // "RIFF"
|
||||
@@ -214,7 +215,6 @@ bool FileWrite :: setRawFile( std::string fileName )
|
||||
|
||||
bool FileWrite :: setWavFile( std::string fileName )
|
||||
{
|
||||
std::string name( fileName );
|
||||
if ( fileName.find( ".wav" ) == std::string::npos ) fileName += ".wav";
|
||||
fd_ = fopen( fileName.c_str(), "wb" );
|
||||
if ( !fd_ ) {
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
- Vibrato Gain = 1
|
||||
- Breath Pressure = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
227
src/FreeVerb.cpp
Normal file
227
src/FreeVerb.cpp
Normal file
@@ -0,0 +1,227 @@
|
||||
/***********************************************************************/
|
||||
/*! \class FreeVerb
|
||||
\brief Jezar at Dreampoint's FreeVerb, implemented in STK.
|
||||
|
||||
Freeverb is a free and open-source Schroeder reverberator
|
||||
originally implemented in C++. The parameters of the reverberation
|
||||
model are exceptionally well tuned. FreeVerb uses 8
|
||||
lowpass-feedback-comb-filters in parallel, followed by 4 Schroeder
|
||||
allpass filters in series. The input signal can be either mono or
|
||||
stereo, and the output signal is stereo. The delay lengths are
|
||||
optimized for a sample rate of 44100 Hz.
|
||||
|
||||
Ported to STK by Gregory Burlet, 2012.
|
||||
*/
|
||||
/***********************************************************************/
|
||||
|
||||
#include "FreeVerb.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
using namespace stk;
|
||||
|
||||
// Set static delay line lengths
|
||||
const StkFloat FreeVerb::fixedGain = 0.015;
|
||||
const StkFloat FreeVerb::scaleWet = 3;
|
||||
const StkFloat FreeVerb::scaleDry = 2;
|
||||
const StkFloat FreeVerb::scaleDamp = 0.4;
|
||||
const StkFloat FreeVerb::scaleRoom = 0.28;
|
||||
const StkFloat FreeVerb::offsetRoom = 0.7;
|
||||
int FreeVerb::cDelayLengths[] = {1617, 1557, 1491, 1422, 1356, 1277, 1188, 1116};
|
||||
int FreeVerb::aDelayLengths[] = {225, 556, 441, 341};
|
||||
|
||||
FreeVerb::FreeVerb( void )
|
||||
{
|
||||
// Resize lastFrame_ for stereo output
|
||||
lastFrame_.resize( 1, 2, 0.0 );
|
||||
|
||||
// Initialize parameters
|
||||
Effect::setEffectMix( 0.75 ); // set initially to 3/4 wet 1/4 dry signal (different than original freeverb)
|
||||
roomSizeMem_ = (0.75 * scaleRoom) + offsetRoom; // feedback attenuation in LBFC
|
||||
dampMem_ = 0.25 * scaleDamp; // pole of lowpass filters in the LBFC
|
||||
width_ = 1.0;
|
||||
frozenMode_ = false;
|
||||
update();
|
||||
|
||||
gain_ = fixedGain; // input gain before sending to filters
|
||||
g_ = 0.5; // allpass coefficient, immutable in FreeVerb
|
||||
|
||||
// Scale delay line lengths according to the current sampling rate
|
||||
double fsScale = Stk::sampleRate() / 44100.0;
|
||||
if ( fsScale != 1.0 ) {
|
||||
// scale comb filter delay lines
|
||||
for ( int i = 0; i < nCombs; i++ ) {
|
||||
cDelayLengths[i] = (int) floor(fsScale * cDelayLengths[i]);
|
||||
}
|
||||
|
||||
// Scale allpass filter delay lines
|
||||
for ( int i = 0; i < nAllpasses; i++ ) {
|
||||
aDelayLengths[i] = (int) floor(fsScale * aDelayLengths[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize delay lines for the LBFC filters
|
||||
for ( int i = 0; i < nCombs; i++ ) {
|
||||
combDelayL_[i].setMaximumDelay( cDelayLengths[i] );
|
||||
combDelayL_[i].setDelay( cDelayLengths[i] );
|
||||
combDelayR_[i].setMaximumDelay( cDelayLengths[i] + stereoSpread );
|
||||
combDelayR_[i].setDelay( cDelayLengths[i] + stereoSpread );
|
||||
}
|
||||
|
||||
// initialize delay lines for the allpass filters
|
||||
for (int i = 0; i < nAllpasses; i++) {
|
||||
allPassDelayL_[i].setMaximumDelay( aDelayLengths[i] );
|
||||
allPassDelayL_[i].setDelay( aDelayLengths[i] );
|
||||
allPassDelayR_[i].setMaximumDelay( aDelayLengths[i] + stereoSpread );
|
||||
allPassDelayR_[i].setDelay( aDelayLengths[i] + stereoSpread );
|
||||
}
|
||||
}
|
||||
|
||||
FreeVerb::~FreeVerb()
|
||||
{
|
||||
}
|
||||
|
||||
void FreeVerb::setEffectMix( StkFloat mix )
|
||||
{
|
||||
Effect::setEffectMix( mix );
|
||||
update();
|
||||
}
|
||||
|
||||
void FreeVerb::setRoomSize( StkFloat roomSize )
|
||||
{
|
||||
roomSizeMem_ = (roomSize * scaleRoom) + offsetRoom;
|
||||
update();
|
||||
}
|
||||
|
||||
StkFloat FreeVerb::getRoomSize()
|
||||
{
|
||||
return (roomSizeMem_ - offsetRoom) / scaleRoom;
|
||||
}
|
||||
|
||||
void FreeVerb::setDamping( StkFloat damping )
|
||||
{
|
||||
dampMem_ = damping * scaleDamp;
|
||||
update();
|
||||
}
|
||||
|
||||
StkFloat FreeVerb::getDamping()
|
||||
{
|
||||
return dampMem_ / scaleDamp;
|
||||
}
|
||||
|
||||
void FreeVerb::setWidth( StkFloat width )
|
||||
{
|
||||
width_ = width;
|
||||
update();
|
||||
}
|
||||
|
||||
StkFloat FreeVerb::getWidth()
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
void FreeVerb::setMode( bool isFrozen )
|
||||
{
|
||||
frozenMode_ = isFrozen;
|
||||
update();
|
||||
}
|
||||
|
||||
StkFloat FreeVerb::getMode()
|
||||
{
|
||||
return frozenMode_;
|
||||
}
|
||||
|
||||
void FreeVerb::update()
|
||||
{
|
||||
StkFloat wet = scaleWet * effectMix_;
|
||||
dry_ = scaleDry * (1.0-effectMix_);
|
||||
|
||||
// Use the L1 norm so the output gain will sum to one while still
|
||||
// preserving the ratio of scalings in original FreeVerb
|
||||
wet /= (wet + dry_);
|
||||
dry_ /= (wet + dry_);
|
||||
|
||||
wet1_ = wet * (width_/2.0 + 0.5);
|
||||
wet2_ = wet * (1.0 - width_)/2.0;
|
||||
|
||||
if ( frozenMode_ ) {
|
||||
// put into freeze mode
|
||||
roomSize_ = 1.0;
|
||||
damp_ = 0.0;
|
||||
gain_ = 0.0;
|
||||
}
|
||||
else {
|
||||
roomSize_ = roomSizeMem_;
|
||||
damp_ = dampMem_;
|
||||
gain_ = fixedGain;
|
||||
}
|
||||
|
||||
for ( int i=0; i<nCombs; i++ ) {
|
||||
// set low pass filter for delay output
|
||||
combLPL_[i].setCoefficients(1.0 - damp_, -damp_);
|
||||
combLPR_[i].setCoefficients(1.0 - damp_, -damp_);
|
||||
}
|
||||
}
|
||||
|
||||
void FreeVerb::clear()
|
||||
{
|
||||
// Clear LBFC delay lines
|
||||
for ( int i = 0; i < nCombs; i++ ) {
|
||||
combDelayL_[i].clear();
|
||||
combDelayR_[i].clear();
|
||||
}
|
||||
|
||||
// Clear allpass delay lines
|
||||
for ( int i = 0; i < nAllpasses; i++ ) {
|
||||
allPassDelayL_[i].clear();
|
||||
allPassDelayR_[i].clear();
|
||||
}
|
||||
|
||||
lastFrame_[0] = 0.0;
|
||||
lastFrame_[1] = 0.0;
|
||||
}
|
||||
|
||||
StkFrames& FreeVerb::tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( channel >= frames.channels() - 1 ) {
|
||||
oStream_ << "FreeVerb::tick(): channel and StkFrames arguments are incompatible!";
|
||||
handleError( StkError::FUNCTION_ARGUMENT );
|
||||
}
|
||||
#endif
|
||||
|
||||
StkFloat *samples = &frames[channel];
|
||||
unsigned int hop = frames.channels();
|
||||
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
|
||||
*samples = tick( *samples, *(samples+1) );
|
||||
*(samples+1) = lastFrame_[1];
|
||||
}
|
||||
|
||||
return frames;
|
||||
}
|
||||
|
||||
StkFrames& FreeVerb::tick( StkFrames& iFrames, StkFrames &oFrames, unsigned int iChannel, unsigned int oChannel )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() - 1 ) {
|
||||
oStream_ << "FreeVerb::tick(): channel and StkFrames arguments are incompatible!";
|
||||
handleError( StkError::FUNCTION_ARGUMENT );
|
||||
}
|
||||
#endif
|
||||
|
||||
StkFloat *iSamples = &iFrames[iChannel];
|
||||
StkFloat *oSamples = &oFrames[oChannel];
|
||||
unsigned int iHop = iFrames.channels();
|
||||
unsigned int oHop = oFrames.channels();
|
||||
bool stereoInput = ( iFrames.channels() > iChannel+1 ) ? true : false;
|
||||
for ( unsigned int i=0; i<iFrames.frames(); i++, iSamples += iHop, oSamples += oHop) {
|
||||
if ( stereoInput )
|
||||
*oSamples = tick( *iSamples, *(iSamples+1) );
|
||||
else
|
||||
*oSamples = tick( *iSamples );
|
||||
|
||||
*(oSamples+1) = lastFrame_[1];
|
||||
}
|
||||
|
||||
return oFrames;
|
||||
}
|
||||
244
src/Guitar.cpp
Normal file
244
src/Guitar.cpp
Normal file
@@ -0,0 +1,244 @@
|
||||
/***************************************************/
|
||||
/*! \class Guitar
|
||||
\brief STK guitar model class.
|
||||
|
||||
This class implements a guitar model with an arbitrary number of
|
||||
strings (specified during instantiation). Each string is
|
||||
represented by an stk::Twang object. The model supports commuted
|
||||
synthesis, as discussed by Smith and Karjalainen. It also includes
|
||||
a basic body coupling model and supports feedback.
|
||||
|
||||
This class does not attempt voice management. Rather, most
|
||||
functions support a parameter to specify a particular string
|
||||
number and string (voice) management is assumed to occur
|
||||
externally. Note that this class does not inherit from
|
||||
stk::Instrmnt because of API inconsistencies.
|
||||
|
||||
This is a digital waveguide model, making its use possibly subject
|
||||
to patents held by Stanford University, Yamaha, and others.
|
||||
|
||||
Control Change Numbers:
|
||||
- Bridge Coupling Gain = 2
|
||||
- Pluck Position = 4
|
||||
- Loop Gain = 11
|
||||
- Coupling Filter Pole = 1
|
||||
- Pick Filter Pole = 128
|
||||
|
||||
by Gary P. Scavone, 2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#include "Guitar.h"
|
||||
#include "FileWvIn.h"
|
||||
#include "Noise.h"
|
||||
#include "SKINI.msg"
|
||||
#include <cmath>
|
||||
|
||||
namespace stk {
|
||||
|
||||
#define BASE_COUPLING_GAIN 0.01
|
||||
|
||||
Guitar :: Guitar( unsigned int nStrings, std::string bodyfile )
|
||||
{
|
||||
strings_.resize( nStrings );
|
||||
stringState_.resize( nStrings, 0 );
|
||||
decayCounter_.resize( nStrings, 0 );
|
||||
filePointer_.resize( nStrings, 0 );
|
||||
pluckGains_.resize( nStrings, 0 );
|
||||
|
||||
setBodyFile( bodyfile );
|
||||
|
||||
couplingGain_ = BASE_COUPLING_GAIN;
|
||||
couplingFilter_.setPole( 0.9 );
|
||||
pickFilter_.setPole( 0.95 );
|
||||
lastFrame_.resize(1, 1, 0.0);
|
||||
}
|
||||
|
||||
void Guitar :: clear( void )
|
||||
{
|
||||
for ( unsigned int i=0; i<strings_.size(); i++ ) {
|
||||
strings_[i].clear();
|
||||
stringState_[i] = 0;
|
||||
filePointer_[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Guitar :: setBodyFile( std::string bodyfile )
|
||||
{
|
||||
bool fileLoaded = false;
|
||||
if ( bodyfile != "" ) {
|
||||
try {
|
||||
FileWvIn file( bodyfile );
|
||||
|
||||
// Fill the StkFrames variable with the (possibly interpolated)
|
||||
// file data.
|
||||
excitation_.resize( (unsigned long) ( 0.5 + ( file.getSize() * Stk::sampleRate() / file.getFileRate() ) ) );
|
||||
file.tick( excitation_ );
|
||||
fileLoaded = true;
|
||||
}
|
||||
catch ( StkError &error ) {
|
||||
oStream_ << "Guitar::setBodyFile: file error (" << error.getMessage() << ") ... using noise excitation.";
|
||||
handleError( StkError::WARNING );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !fileLoaded ) {
|
||||
unsigned int M = 200; // arbitrary value
|
||||
excitation_.resize( M );
|
||||
Noise noise;
|
||||
noise.tick( excitation_ );
|
||||
// Smooth the start and end of the noise.
|
||||
unsigned int N = (unsigned int) M * 0.2; // arbitrary value
|
||||
for ( unsigned int n=0; n<N; n++ ) {
|
||||
StkFloat weight = 0.5 * ( 1.0 - cos( n * PI / (N-1) ) );
|
||||
excitation_[n] *= weight;
|
||||
excitation_[M-n-1] *= weight;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the excitation to simulate pick hardness
|
||||
pickFilter_.tick( excitation_ );
|
||||
|
||||
// Compute file mean and remove (to avoid DC bias).
|
||||
StkFloat mean = 0.0;
|
||||
for ( unsigned int i=0; i<excitation_.frames(); i++ )
|
||||
mean += excitation_[i];
|
||||
mean /= excitation_.frames();
|
||||
|
||||
for ( unsigned int i=0; i<excitation_.frames(); i++ )
|
||||
excitation_[i] -= mean;
|
||||
|
||||
// Reset all the file pointers.
|
||||
for ( unsigned int i=0; i<strings_.size(); i++ )
|
||||
filePointer_[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
void Guitar :: setPluckPosition( StkFloat position, int string )
|
||||
{
|
||||
if ( position < 0.0 || position > 1.0 ) {
|
||||
std::cerr << "Guitar::setPluckPosition: position parameter out of range!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( string >= (int) strings_.size() ) {
|
||||
oStream_ << "Guitar::setPluckPosition: string parameter is greater than number of strings!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( string < 0 ) // set all strings
|
||||
for ( unsigned int i=0; i<strings_.size(); i++ )
|
||||
strings_[i].setPluckPosition( position );
|
||||
else
|
||||
strings_[string].setPluckPosition( position );
|
||||
}
|
||||
|
||||
void Guitar :: setLoopGain( StkFloat gain, int string )
|
||||
{
|
||||
if ( gain < 0.0 || gain > 1.0 ) {
|
||||
std::cerr << "Guitar::setLoopGain: gain parameter out of range!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( string >= (int) strings_.size() ) {
|
||||
oStream_ << "Guitar::setLoopGain: string parameter is greater than number of strings!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( string < 0 ) // set all strings
|
||||
for ( unsigned int i=0; i<strings_.size(); i++ )
|
||||
strings_[i].setLoopGain( gain );
|
||||
else
|
||||
strings_[string].setLoopGain( gain );
|
||||
}
|
||||
|
||||
void Guitar :: setFrequency( StkFloat frequency, unsigned int string )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( frequency <= 0.0 ) {
|
||||
oStream_ << "Guitar::setFrequency: frequency parameter is less than or equal to zero!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( string >= strings_.size() ) {
|
||||
oStream_ << "Guitar::setFrequency: string parameter is greater than number of strings!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
#endif
|
||||
|
||||
strings_[string].setFrequency( frequency );
|
||||
}
|
||||
|
||||
void Guitar :: noteOn( StkFloat frequency, StkFloat amplitude, unsigned int string )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( string >= strings_.size() ) {
|
||||
oStream_ << "Guitar::noteOn: string parameter is greater than number of strings!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( Stk::inRange( amplitude, 0.0, 1.0 ) == false ) {
|
||||
oStream_ << "Guitar::noteOn: amplitude parameter is outside range 0.0 - 1.0!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
#endif
|
||||
|
||||
this->setFrequency( frequency, string );
|
||||
stringState_[string] = 2;
|
||||
filePointer_[string] = 0;
|
||||
strings_[string].setLoopGain( 0.995 );
|
||||
pluckGains_[string] = amplitude;
|
||||
}
|
||||
|
||||
void Guitar :: noteOff( StkFloat amplitude, unsigned int string )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( string >= strings_.size() ) {
|
||||
oStream_ << "Guitar::noteOff: string parameter is greater than number of strings!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( Stk::inRange( amplitude, 0.0, 1.0 ) == false ) {
|
||||
oStream_ << "Guitar::noteOff: amplitude parameter is outside range 0.0 - 1.0!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
#endif
|
||||
|
||||
strings_[string].setLoopGain( (1.0 - amplitude) * 0.9 );
|
||||
stringState_[string] = 1;
|
||||
}
|
||||
|
||||
void Guitar :: controlChange( int number, StkFloat value, int string )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( Stk::inRange( value, 0.0, 128.0 ) == false ) {
|
||||
oStream_ << "Guitar::controlChange: value (" << value << ") is out of range!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if ( string > 0 && string >= (int) strings_.size() ) {
|
||||
oStream_ << "Guitar::controlChange: string parameter is greater than number of strings!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
#endif
|
||||
|
||||
StkFloat normalizedValue = value * ONE_OVER_128;
|
||||
if ( number == 2 )
|
||||
couplingGain_ = 1.5 * BASE_COUPLING_GAIN * normalizedValue;
|
||||
else if ( number == __SK_PickPosition_ ) // 4
|
||||
this->setPluckPosition( normalizedValue, string );
|
||||
else if ( number == __SK_StringDamping_ ) // 11
|
||||
this->setLoopGain( 0.97 + (normalizedValue * 0.03), string );
|
||||
else if ( number == __SK_ModWheel_ ) // 1
|
||||
couplingFilter_.setPole( 0.98 * normalizedValue );
|
||||
else if (number == __SK_AfterTouch_Cont_) // 128
|
||||
pickFilter_.setPole( 0.95 * normalizedValue );
|
||||
#if defined(_STK_DEBUG_)
|
||||
else {
|
||||
oStream_ << "Guitar::controlChange: undefined control number (" << number << ")!";
|
||||
handleError( StkError::WARNING );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // stk namespace
|
||||
@@ -22,7 +22,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -242,8 +242,6 @@ int InetWvIn :: readData( void )
|
||||
if ( readPoint_ == bufferBytes_ )
|
||||
readPoint_ = 0;
|
||||
bytesFilled_ -= bytes;
|
||||
if ( bytesFilled_ < 0 )
|
||||
bytesFilled_ = 0;
|
||||
|
||||
mutex_.unlock();
|
||||
return samples / data_.channels();
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
one-pole lowpass filters have been added inside
|
||||
the feedback comb filters.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -34,7 +34,6 @@ JCRev :: JCRev( StkFloat T60 )
|
||||
lastFrame_.resize( 1, 2, 0.0 ); // resize lastFrame_ for stereo output
|
||||
|
||||
// Delay lengths for 44100 Hz sample rate.
|
||||
// {1116, 1188, 1356, 1277, 1422, 1491, 1617, 1557} // FreeVerb comb delays
|
||||
int lengths[9] = {1116, 1356, 1422, 1617, 225, 341, 441, 211, 179};
|
||||
double scaler = Stk::sampleRate() / 44100.0;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
STATICLIB = libstk.a
|
||||
SHAREDLIB = @sharedlib@
|
||||
MAJOR = 4
|
||||
RELEASE = 4.4.3
|
||||
RELEASE = 4.4.4
|
||||
|
||||
AR = ar -rsc
|
||||
RM = /bin/rm
|
||||
@@ -18,10 +18,10 @@ OBJECTS = Stk.o Generator.o Noise.o Blit.o BlitSaw.o BlitSquare.o Granulate.o \
|
||||
Filter.o Fir.o Iir.o OneZero.o OnePole.o PoleZero.o TwoZero.o TwoPole.o \
|
||||
BiQuad.o FormSwep.o Delay.o DelayL.o DelayA.o \
|
||||
\
|
||||
Effect.o PRCRev.o JCRev.o NRev.o \
|
||||
Effect.o PRCRev.o JCRev.o NRev.o FreeVerb.o \
|
||||
Chorus.o Echo.o PitShift.o LentPitShift.o \
|
||||
Function.o ReedTable.o JetTable.o BowTable.o Cubic.o \
|
||||
Voicer.o Vector3D.o Sphere.o Twang.o \
|
||||
Voicer.o Vector3D.o Sphere.o Twang.o Guitar.o \
|
||||
\
|
||||
Instrmnt.o Clarinet.o BlowHole.o Saxofony.o Flute.o Brass.o BlowBotl.o \
|
||||
Bowed.o Plucked.o StifKarp.o Sitar.o Mandolin.o Mesh2D.o \
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
- String Detuning = 1
|
||||
- Microphone Position = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
(non-sweeping BiQuad filters), where N is set
|
||||
during instantiation.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
- Two Fixed = 7
|
||||
- Clump = 8
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
modulations to give a nice, natural human
|
||||
modulation function.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
- Vibrato Gain = 1
|
||||
- Gain = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
two series allpass units and two parallel comb
|
||||
filters.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
This class implements a simple pitch shifter
|
||||
using delay lines.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
Stanford, bearing the names of Karplus and/or
|
||||
Strong.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
coefficient. Another method is provided to create a DC blocking
|
||||
filter.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
- Zero Radii = 1
|
||||
- Envelope Gain = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
665
src/RtAudio.cpp
665
src/RtAudio.cpp
File diff suppressed because it is too large
Load Diff
2999
src/RtMidi.cpp
2999
src/RtMidi.cpp
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
||||
that takes an StkFrames object for multi-channel and/or
|
||||
multi-frame data.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
- Vibrato Gain = 1
|
||||
- Breath Pressure = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
1587
src/Shakers.cpp
1587
src/Shakers.cpp
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@
|
||||
- Envelope Rate = 11
|
||||
- Gain = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
Stanford, bearing the names of Karplus and/or
|
||||
Strong.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
See also SKINI.txt.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
This class implements a spherical ball with
|
||||
radius, mass, position, and velocity parameters.
|
||||
|
||||
by Perry R. Cook, 1995-2011.
|
||||
by Perry R. Cook, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
- String Sustain = 11
|
||||
- String Stretch = 1
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
12
src/Stk.cpp
12
src/Stk.cpp
@@ -22,7 +22,7 @@
|
||||
STK WWW site: http://ccrma.stanford.edu/software/stk/
|
||||
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
Copyright (c) 1995-2011 Perry R. Cook and Gary P. Scavone
|
||||
Copyright (c) 1995-2012 Perry R. Cook and Gary P. Scavone
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
@@ -51,6 +51,7 @@
|
||||
/***************************************************/
|
||||
|
||||
#include "Stk.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace stk {
|
||||
|
||||
@@ -228,7 +229,7 @@ void Stk :: handleError( std::string message, StkError::Type type )
|
||||
//
|
||||
|
||||
StkFrames :: StkFrames( unsigned int nFrames, unsigned int nChannels )
|
||||
: nFrames_( nFrames ), nChannels_( nChannels )
|
||||
: data_( 0 ), nFrames_( nFrames ), nChannels_( nChannels )
|
||||
{
|
||||
size_ = nFrames_ * nChannels_;
|
||||
bufferSize_ = size_;
|
||||
@@ -242,13 +243,12 @@ StkFrames :: StkFrames( unsigned int nFrames, unsigned int nChannels )
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else data_ = 0;
|
||||
|
||||
dataRate_ = Stk::sampleRate();
|
||||
}
|
||||
|
||||
StkFrames :: StkFrames( const StkFloat& value, unsigned int nFrames, unsigned int nChannels )
|
||||
: nFrames_( nFrames ), nChannels_( nChannels )
|
||||
: data_( 0 ), nFrames_( nFrames ), nChannels_( nChannels )
|
||||
{
|
||||
size_ = nFrames_ * nChannels_;
|
||||
bufferSize_ = size_;
|
||||
@@ -262,7 +262,6 @@ StkFrames :: StkFrames( const StkFloat& value, unsigned int nFrames, unsigned in
|
||||
#endif
|
||||
for ( long i=0; i<(long)size_; i++ ) data_[i] = value;
|
||||
}
|
||||
else data_ = 0;
|
||||
|
||||
dataRate_ = Stk::sampleRate();
|
||||
}
|
||||
@@ -273,7 +272,7 @@ StkFrames :: ~StkFrames()
|
||||
}
|
||||
|
||||
StkFrames :: StkFrames( const StkFrames& f )
|
||||
: size_(0), bufferSize_(0)
|
||||
: data_(0), size_(0), bufferSize_(0)
|
||||
{
|
||||
resize( f.frames(), f.channels() );
|
||||
dataRate_ = Stk::sampleRate();
|
||||
@@ -282,6 +281,7 @@ StkFrames :: StkFrames( const StkFrames& f )
|
||||
|
||||
StkFrames& StkFrames :: operator= ( const StkFrames& f )
|
||||
{
|
||||
data_ = 0;
|
||||
size_ = 0;
|
||||
bufferSize_ = 0;
|
||||
resize( f.frames(), f.channels() );
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -69,7 +69,7 @@ void TapDelay :: setTapDelays( std::vector<unsigned long> taps )
|
||||
}
|
||||
|
||||
if ( taps[i] < 0 ) {
|
||||
error << "TapDelay::setDelay: argument (" << taps[i] << ") less than zero!\n";
|
||||
oStream_ << "TapDelay::setDelay: argument (" << taps[i] << ") less than zero!\n";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THREAD_RETURN THREAD_TYPE thread_function(void *ptr)
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use possibly subject to patents held by Stanford
|
||||
University, Yamaha, and others.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -37,23 +37,17 @@ Twang :: Twang( StkFloat lowestFrequency )
|
||||
std::vector<StkFloat> coefficients( 2, 0.5 );
|
||||
loopFilter_.setCoefficients( coefficients );
|
||||
|
||||
lastFrame_.resize( 1, 1, 0.0 );
|
||||
|
||||
loopGain_ = 0.995;
|
||||
pluckPosition_ = 0.4;
|
||||
this->setFrequency( 220.0 );
|
||||
}
|
||||
|
||||
Twang :: ~Twang( void )
|
||||
{
|
||||
}
|
||||
|
||||
void Twang :: clear( void )
|
||||
{
|
||||
delayLine_.clear();
|
||||
combDelay_.clear();
|
||||
loopFilter_.clear();
|
||||
lastFrame_[0] = 0.0;
|
||||
lastOutput_ = 0.0;
|
||||
}
|
||||
|
||||
void Twang :: setLowestFrequency( StkFloat frequency )
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
- Vibrato Gain = 1
|
||||
- Loudness (Spectral Tilt) = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -106,7 +106,7 @@ bool VoicForm :: setPhoneme( const char *phoneme )
|
||||
|
||||
void VoicForm :: setFilterSweepRate( unsigned int whichOne, StkFloat rate )
|
||||
{
|
||||
if ( whichOne < 0 || whichOne > 3 ) {
|
||||
if ( whichOne > 3 ) {
|
||||
oStream_ << "VoicForm::setFilterSweepRate: filter select argument outside range 0-3!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
@@ -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-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
- Blowing Frequency Modulation = 2
|
||||
- Volume = 128
|
||||
|
||||
by Perry R. Cook 1995-2011.
|
||||
by Perry R. Cook 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -115,7 +115,8 @@
|
||||
// We only need IASIOThiscallResolver at all if we are on Win32. For other
|
||||
// platforms we simply bypass the IASIOThiscallResolver definition to allow us
|
||||
// to be safely #include'd whatever the platform to keep client code portable
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
//#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(_WIN64)
|
||||
|
||||
|
||||
// If microsoft compiler we can call IASIO directly so IASIOThiscallResolver
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user