/usr/include/stk/WvOut.h is in libstk0-dev 4.5.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #ifndef STK_WVOUT_H
#define STK_WVOUT_H
#include "Stk.h"
namespace stk {
/***************************************************/
/*! \class WvOut
\brief STK audio output abstract base class.
This class provides common functionality for a variety of audio
data output subclasses.
Currently, WvOut is non-interpolating and the output rate is
always Stk::sampleRate().
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
class WvOut : public Stk
{
public:
//! Default constructor.
WvOut( void ) : frameCounter_(0), clipping_(false) {};
//! Return the number of sample frames output.
unsigned long getFrameCount( void ) const { return frameCounter_; };
//! Return the number of seconds of data output.
StkFloat getTime( void ) const { return (StkFloat) frameCounter_ / Stk::sampleRate(); };
//! Returns \c true if clipping has been detected during output since instantiation or the last reset.
bool clipStatus( void ) { return clipping_; };
//! Reset the clipping status to \c false.
void resetClipStatus( void ) { clipping_ = false; };
//! Output a single sample to all channels in a sample frame.
/*!
An StkError is thrown if an output error occurs.
*/
virtual void tick( const StkFloat sample ) = 0;
//! Output the StkFrames data.
virtual void tick( const StkFrames& frames ) = 0;
protected:
// Check for sample clipping and clamp.
StkFloat& clipTest( StkFloat& sample );
StkFrames data_;
unsigned long frameCounter_;
bool clipping_;
};
inline StkFloat& WvOut :: clipTest( StkFloat& sample )
{
bool clip = false;
if ( sample > 1.0 ) {
sample = 1.0;
clip = true;
}
else if ( sample < -1.0 ) {
sample = -1.0;
clip = true;
}
if ( clip == true && clipping_ == false ) {
// First occurrence of clipping since instantiation or reset.
clipping_ = true;
oStream_ << "WvOut: data value(s) outside +-1.0 detected ... clamping at outer bound!";
handleError( StkError::WARNING );
}
return sample;
}
} // stk namespace
#endif
|