Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# stk::BowTable Class Reference

STK bowed string table class. More...

`#include <BowTable.h>`

Inheritance diagram for stk::BowTable:

List of all members.

## Public Member Functions
| BowTable (void)
| Default constructor.
void | setOffset (StkFloat offset)
| Set the table offset value.
void | setSlope (StkFloat slope)
| Set the table slope value.
void | setMinOutput (StkFloat minimum)
| Set the minimum table output value (0.0 - 1.0).
void | setMaxOutput (StkFloat maximum)
| Set the maximum table output value (0.0 - 1.0).
StkFloat | tick (StkFloat input)
| Take one sample input and map to one sample of output.
StkFrames & | tick (StkFrames &frames, unsigned int channel=0)
| Take a channel of the StkFrames object as inputs to the table and replace with corresponding outputs.
StkFrames & | tick (StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0, unsigned int oChannel=0)
| Take a channel of the `iFrames` object as inputs to the table and write outputs to the `oFrames` object.

## Detailed Description

STK bowed string table class.

This class implements a simple bowed string non-linear function, as described by Smith (1986). The output is an instantaneous reflection coefficient value.

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

## Member Function Documentation

void stk::BowTable::setOffset | ( | StkFloat | offset | ) | `[inline]`

Set the table offset value.

The table offset is a bias which controls the symmetry of the friction. If you want the friction to vary with direction, use a non-zero value for the offset. The default value is zero.

    00035 { offset_ = offset; };

void stk::BowTable::setSlope | ( | StkFloat | slope | ) | `[inline]`

Set the table slope value.

The table slope controls the width of the friction pulse, which is related to bow force.

    00042 { slope_ = slope; };

StkFrames & stk::BowTable::tick | ( | StkFrames & | frames,
|  | unsigned int | channel = `0` |
| ) |  |  | `[inline]`

Take a channel of the StkFrames object as inputs to the table and replace with corresponding outputs.

The StkFrames argument reference is returned. The `channel` argument must be less than the number of channels in 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.

    00102 {
    00103 #if defined(_STK_DEBUG_)
    00104   if ( channel >= frames.channels() ) {
    00105     oStream_ << "BowTable::tick(): channel and StkFrames arguments are incompatible!";
    00106     handleError( StkError::FUNCTION_ARGUMENT );
    00107   }
    00108 #endif
    00109
    00110   StkFloat *samples = &frames[channel];
    00111   unsigned int hop = frames.channels();
    00112   for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
    00113     *samples = *samples + offset_;
    00114     *samples *= slope_;
    00115     *samples = (StkFloat) fabs( (double) *samples ) + 0.75;
    00116     *samples = (StkFloat) pow( *samples, (StkFloat) -4.0 );
    00117     if ( *samples > 1.0) *samples = 1.0;
    00118   }
    00119
    00120   lastFrame_[0] = *(samples-hop);
    00121   return frames;
    00122 }

StkFrames & stk::BowTable::tick | ( | StkFrames & | iFrames,
|  | StkFrames & | oFrames,
|  | unsigned int | iChannel = `0`,
|  | unsigned int | oChannel = `0` |
| ) |  |  | `[inline]`

Take a channel of the `iFrames` object as inputs to the table and write outputs to the `oFrames` object.

The `iFrames` object reference is returned. Each channel argument must be less than the number of channels in the corresponding 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.

    00125 {
    00126 #if defined(_STK_DEBUG_)
    00127   if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
    00128     oStream_ << "BowTable::tick(): channel and StkFrames arguments are incompatible!";
    00129     handleError( StkError::FUNCTION_ARGUMENT );
    00130   }
    00131 #endif
    00132
    00133   StkFloat *iSamples = &iFrames[iChannel];
    00134   StkFloat *oSamples = &oFrames[oChannel];
    00135   unsigned int iHop = iFrames.channels(), oHop = oFrames.channels();
    00136   for ( unsigned int i=0; i<iFrames.frames(); i++, iSamples += iHop, oSamples += oHop ) {
    00137     *oSamples = *iSamples + offset_;
    00138     *oSamples *= slope_;
    00139     *oSamples = (StkFloat) fabs( (double) *oSamples ) + 0.75;
    00140     *oSamples = (StkFloat) pow( *oSamples, (StkFloat) -4.0 );
    00141     if ( *oSamples > 1.0) *oSamples = 1.0;
    00142   }
    00143
    00144   lastFrame_[0] = *(oSamples-oHop);
    00145   return iFrames;
    00146 }

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

- BowTable.h

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