Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


stk::JCRev Class Reference

John Chowning's reverberator class. More...

#include <JCRev.h>

Inheritance diagram for stk::JCRev:
stk::Effect stk::Stk

List of all members.

Public Member Functions

 JCRev (StkFloat T60=1.0)
 Class constructor taking a T60 decay time argument (one second default value).
void clear (void)
 Reset and clear all internal state.
void setT60 (StkFloat T60)
 Set the reverberation T60 decay time.
StkFloat lastOut (unsigned int channel=0)
 Return the specified channel value of the last computed stereo frame.
StkFloat tick (StkFloat input, unsigned int channel=0)
 Input one sample to the effect and return the specified channel value of the computed stereo frame.
StkFramestick (StkFrames &frames, unsigned int channel=0)
 Take a channel of the StkFrames object as inputs to the effect and replace with stereo outputs.
StkFramestick (StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0, unsigned int oChannel=0)
 Take a channel of the iFrames object as inputs to the effect and write stereo outputs to the oFrames object.

Detailed Description

John Chowning's reverberator class.

This class takes a monophonic input signal and produces a stereo output signal. It is derived from the CLM JCRev function, which is based on the use of networks of simple allpass and comb delay filters. This class implements three series allpass units, followed by four parallel comb filters, and two decorrelation delay lines in parallel at the output.

Although not in the original JC reverberator, one-pole lowpass filters have been added inside the feedback comb filters.

by Perry R. Cook and Gary P. Scavone, 1995-2012.


Member Function Documentation

StkFloat stk::JCRev::lastOut ( unsigned int  channel = 0  )  [inline]

Return the specified channel value of the last computed stereo frame.

Use the lastFrame() function to get both values of the last computed stereo frame. The channel argument must be 0 or 1 (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.

00101 {
00102 #if defined(_STK_DEBUG_)
00103   if ( channel > 1 ) {
00104     oStream_ << "JCRev::lastOut(): channel argument must be less than 2!";
00105     handleError( StkError::FUNCTION_ARGUMENT );
00106   }
00107 #endif
00108 
00109   return lastFrame_[channel];
00110 }

StkFloat stk::JCRev::tick ( StkFloat  input,
unsigned int  channel = 0 
) [inline]

Input one sample to the effect and return the specified channel value of the computed stereo frame.

Use the lastFrame() function to get both values of the computed stereo output frame. The channel argument must be 0 or 1 (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.

00113 {
00114 #if defined(_STK_DEBUG_)
00115   if ( channel > 1 ) {
00116     oStream_ << "JCRev::tick(): channel argument must be less than 2!";
00117     handleError( StkError::FUNCTION_ARGUMENT );
00118   }
00119 #endif
00120 
00121   StkFloat temp, temp0, temp1, temp2, temp3, temp4, temp5, temp6;
00122   StkFloat filtout;
00123 
00124   temp = allpassDelays_[0].lastOut();
00125   temp0 = allpassCoefficient_ * temp;
00126   temp0 += input;
00127   allpassDelays_[0].tick(temp0);
00128   temp0 = -(allpassCoefficient_ * temp0) + temp;
00129     
00130   temp = allpassDelays_[1].lastOut();
00131   temp1 = allpassCoefficient_ * temp;
00132   temp1 += temp0;
00133   allpassDelays_[1].tick(temp1);
00134   temp1 = -(allpassCoefficient_ * temp1) + temp;
00135     
00136   temp = allpassDelays_[2].lastOut();
00137   temp2 = allpassCoefficient_ * temp;
00138   temp2 += temp1;
00139   allpassDelays_[2].tick(temp2);
00140   temp2 = -(allpassCoefficient_ * temp2) + temp;
00141     
00142   temp3 = temp2 + ( combFilters_[0].tick( combCoefficient_[0] * combDelays_[0].lastOut() ) );
00143   temp4 = temp2 + ( combFilters_[1].tick( combCoefficient_[1] * combDelays_[1].lastOut() ) );
00144   temp5 = temp2 + ( combFilters_[2].tick( combCoefficient_[2] * combDelays_[2].lastOut() ) );
00145   temp6 = temp2 + ( combFilters_[3].tick( combCoefficient_[3] * combDelays_[3].lastOut() ) );
00146 
00147   combDelays_[0].tick(temp3);
00148   combDelays_[1].tick(temp4);
00149   combDelays_[2].tick(temp5);
00150   combDelays_[3].tick(temp6);
00151 
00152   filtout = temp3 + temp4 + temp5 + temp6;
00153 
00154   lastFrame_[0] = effectMix_ * (outLeftDelay_.tick(filtout));
00155   lastFrame_[1] = effectMix_ * (outRightDelay_.tick(filtout));
00156   temp = (1.0 - effectMix_) * input;
00157   lastFrame_[0] += temp;
00158   lastFrame_[1] += temp;
00159     
00160   return 0.7 * lastFrame_[channel];
00161 }

StkFrames& stk::JCRev::tick ( StkFrames frames,
unsigned int  channel = 0 
)

Take a channel of the StkFrames object as inputs to the effect and replace with stereo outputs.

The StkFrames argument reference is returned. The stereo outputs are written to the StkFrames argument starting at the specified channel. Therefore, the channel argument must be less than ( channels() - 1 ) of the StkFrames argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.

StkFrames& stk::JCRev::tick ( StkFrames iFrames,
StkFrames oFrames,
unsigned int  iChannel = 0,
unsigned int  oChannel = 0 
)

Take a channel of the iFrames object as inputs to the effect and write stereo outputs to the oFrames object.

The iFrames object reference is returned. The iChannel argument must be less than the number of channels in the iFrames argument (the first channel is specified by 0). The oChannel argument must be less than ( channels() - 1 ) of the oFrames argument. However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.


The documentation for this class was generated from the following file:

The Synthesis ToolKit in C++ (STK)
©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.