The Synthesis ToolKit in C++ (STK)

Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# stk::Instrmnt Class Reference

STK instrument abstract base class. More...

`#include <Instrmnt.h>`

Inheritance diagram for stk::Instrmnt:

List of all members.

## Public Member Functions
| Instrmnt (void)
| Class constructor.
virtual void | noteOn (StkFloat frequency, StkFloat amplitude)=0
| Start a note with the given frequency and amplitude.
virtual void | noteOff (StkFloat amplitude)=0
| Stop a note with the given amplitude (speed of decay).
virtual void | setFrequency (StkFloat frequency)
| Set instrument parameters for a particular frequency.
virtual void | controlChange (int number, StkFloat value)
| Perform the control change specified by number and value (0.0 - 128.0).
unsigned int | channelsOut (void) const
| Return the number of output channels for the class.
const StkFrames & | lastFrame (void) const
| Return an StkFrames reference to the last output sample frame.
StkFloat | lastOut (unsigned int channel=0)
| Return the specified channel value of the last computed frame.
virtual StkFloat | tick (unsigned int channel=0)=0
| Compute one sample frame and return the specified `channel` value.
virtual StkFrames & | tick (StkFrames &frames, unsigned int channel=0)=0
| Fill the StkFrames object with computed sample frames, starting at the specified channel.

## Detailed Description

STK instrument abstract base class.

This class provides a common interface for all STK instruments.

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

## Member Function Documentation

StkFloat stk::Instrmnt::lastOut | ( | unsigned int | channel = `0` | ) | `[inline]`

Return the specified channel value of the last computed frame.

The `channel` argument must be less than the number of output channels, which can be determined with the channelsOut() function (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.

See also:
  lastFrame()

    00083 {
    00084 #if defined(_STK_DEBUG_)
    00085   if ( channel >= lastFrame_.channels() ) {
    00086     oStream_ << "Instrmnt::lastOut(): channel argument is invalid!";
    00087     handleError( StkError::FUNCTION_ARGUMENT );
    00088   }
    00089 #endif
    00090
    00091   return lastFrame_[channel];
    00092 }

virtual StkFloat stk::Instrmnt::tick | ( | unsigned int | channel = `0` | ) | `[pure virtual]`

Compute one sample frame and return the specified `channel` value.

For monophonic instruments, the `channel` argument is ignored.

Implemented in stk::BandedWG, stk::BeeThree, stk::BlowBotl, stk::BlowHole, stk::Bowed, stk::Brass, stk::Clarinet, stk::Drummer, stk::Flute, stk::FM, stk::FMVoices, stk::HevyMetl, stk::Mandolin, stk::Mesh2D, stk::Modal, stk::Moog, stk::PercFlut, stk::Plucked, stk::Resonate, stk::Rhodey, stk::Sampler, stk::Saxofony, stk::Shakers, stk::Simple, stk::Sitar, stk::StifKarp, stk::TubeBell, stk::VoicForm, stk::Whistle, and stk::Wurley.

virtual StkFrames& stk::Instrmnt::tick | ( | StkFrames & | frames,
|  | unsigned int | channel = `0` |
| ) |  |  | `[pure virtual]`

Fill the StkFrames object with computed sample frames, starting at the specified channel.

The `channel` argument plus the number of output channels 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.

Implemented in stk::BandedWG, stk::BeeThree, stk::BlowBotl, stk::BlowHole, stk::Bowed, stk::Brass, stk::Clarinet, stk::Drummer, stk::Flute, stk::FM, stk::FMVoices, stk::HevyMetl, stk::Mandolin, stk::Mesh2D, stk::Modal, stk::Moog, stk::PercFlut, stk::Plucked, stk::Resonate, stk::Rhodey, stk::Sampler, stk::Saxofony, stk::Shakers, stk::Simple, stk::Sitar, stk::StifKarp, stk::TubeBell, stk::VoicForm, stk::Whistle, and stk::Wurley.

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

- Instrmnt.h

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