mirror of
https://github.com/thestk/stk
synced 2026-02-04 00:26:15 +00:00
Version 4.4.0
This commit is contained in:
committed by
Stephen Sinclair
parent
d199342e86
commit
eccd8c9981
@@ -1,3 +1,10 @@
|
||||
#ifndef STK_WVIN_H
|
||||
#define STK_WVIN_H
|
||||
|
||||
#include "Stk.h"
|
||||
|
||||
namespace stk {
|
||||
|
||||
/***************************************************/
|
||||
/*! \class WvIn
|
||||
\brief STK audio input abstract base class.
|
||||
@@ -5,83 +12,32 @@
|
||||
This class provides common functionality for a variety of audio
|
||||
data input subclasses.
|
||||
|
||||
WvIn supports multi-channel data. It is important to distinguish
|
||||
the tick() methods, which return samples produced by averaging
|
||||
across sample frames, from the tickFrame() methods, which return
|
||||
references or pointers to multi-channel sample frames.
|
||||
|
||||
Both interleaved and non-interleaved data is supported via the use
|
||||
of StkFrames objects.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#ifndef STK_WVIN_H
|
||||
#define STK_WVIN_H
|
||||
|
||||
#include "Stk.h"
|
||||
#include <vector>
|
||||
|
||||
class WvIn : public Stk
|
||||
{
|
||||
public:
|
||||
//! Default constructor.
|
||||
WvIn();
|
||||
//! Return the number of audio channels in the data or stream.
|
||||
unsigned int channelsOut( void ) const { return data_.channels(); };
|
||||
|
||||
//! Class destructor.
|
||||
virtual ~WvIn();
|
||||
|
||||
//! Return the number of audio channels in the data.
|
||||
unsigned int getChannels( void ) const { return data_.channels(); };
|
||||
|
||||
//! Return the average across the last output sample frame.
|
||||
/*!
|
||||
If no file data is loaded, the returned value is 0.0.
|
||||
*/
|
||||
StkFloat lastOut( void ) const;
|
||||
|
||||
//! Return an StkFrames reference to the last output sample frame.
|
||||
//! Return an StkFrames reference to the last computed sample frame.
|
||||
/*!
|
||||
If no file data is loaded, an empty container is returned.
|
||||
*/
|
||||
const StkFrames& lastFrame( void ) const { return lastOutputs_; };
|
||||
const StkFrames& lastFrame( void ) const { return lastFrame_; };
|
||||
|
||||
//! Read out the average across one sample frame of data.
|
||||
/*!
|
||||
If no file data is loaded, the returned value is 0.0.
|
||||
*/
|
||||
StkFloat tick( void );
|
||||
|
||||
//! Fill a channel of the StkFrames object with averaged sample frames.
|
||||
/*!
|
||||
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 greater than or equal to the number of
|
||||
channels in the StkFrames object. If no file data is loaded, the
|
||||
container is filled with zeroes.
|
||||
*/
|
||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||
|
||||
//! Fill the StkFrames argument with data and return the same reference.
|
||||
/*!
|
||||
An StkError will be thrown if there is an incompatability
|
||||
between the number of channels in the loaded data and that in the
|
||||
StkFrames argument. If no file data is loaded, the container is
|
||||
filled with zeroes.
|
||||
*/
|
||||
StkFrames& tickFrame( StkFrames& frames );
|
||||
//! Compute one sample frame and return the specified \c channel value.
|
||||
virtual StkFloat tick( unsigned int channel = 0 ) = 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 void computeFrame( void ) = 0;
|
||||
|
||||
StkFrames data_;
|
||||
StkFrames lastOutputs_;
|
||||
StkFrames lastFrame_;
|
||||
|
||||
};
|
||||
|
||||
} // stk namespace
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user