mirror of
https://github.com/thestk/stk
synced 2026-04-23 15:48:37 +00:00
Version 4.4.0
This commit is contained in:
committed by
Stephen Sinclair
parent
d199342e86
commit
eccd8c9981
@@ -1,54 +1,41 @@
|
||||
#ifndef STK_FUNCTION_H
|
||||
#define STK_FUNCTION_H
|
||||
|
||||
#include "Stk.h"
|
||||
|
||||
namespace stk {
|
||||
|
||||
/***************************************************/
|
||||
/*! \class Function
|
||||
\brief STK abstract function parent class.
|
||||
|
||||
This class provides common functionality for STK classes which
|
||||
This class provides common functionality for STK classes that
|
||||
implement tables or other types of input to output function
|
||||
mappings.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#include "Stk.h"
|
||||
|
||||
#ifndef STK_FUNCTION_H
|
||||
#define STK_FUNCTION_H
|
||||
|
||||
class Function : public Stk
|
||||
{
|
||||
public:
|
||||
//! Class constructor.
|
||||
Function();
|
||||
Function( void ) { lastFrame_.resize( 1, 1, 0.0 ); };
|
||||
|
||||
//! Class destructor.
|
||||
virtual ~Function();
|
||||
|
||||
//! Return the last output value.
|
||||
virtual StkFloat lastOut() const { return lastOutput_; };
|
||||
//! Return the last computed output sample.
|
||||
StkFloat lastOut( void ) const { return lastFrame_[0]; };
|
||||
|
||||
//! Take one sample input and compute one sample of output.
|
||||
StkFloat tick( StkFloat input );
|
||||
|
||||
//! Take a channel of the StkFrames object as inputs to the function and replace with corresponding outputs.
|
||||
/*!
|
||||
The \c channel argument should be zero or greater (the first
|
||||
channel is specified by 0). An StkError will be thrown if the \c
|
||||
channel argument is equal to or greater than the number of
|
||||
channels in the StkFrames object.
|
||||
*/
|
||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||
virtual StkFloat tick( StkFloat input ) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
// This abstract function must be implemented in all subclasses.
|
||||
// It is used to get around a C++ problem with overloaded virtual
|
||||
// functions.
|
||||
virtual StkFloat computeSample( StkFloat input ) = 0;
|
||||
|
||||
StkFloat lastOutput_;
|
||||
StkFrames lastFrame_;
|
||||
|
||||
};
|
||||
|
||||
} // stk namespace
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user