mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Bugfix in DelayL::setDelay(); Updated tick() functions in RtWvIn and InetWvIn to support channel offset
This commit is contained in:
@@ -133,6 +133,33 @@ inline StkFloat DelayL :: nextOut( void )
|
||||
return nextOutput_;
|
||||
}
|
||||
|
||||
inline void DelayL :: setDelay( StkFloat delay )
|
||||
{
|
||||
if ( delay + 1 > inputs_.size() ) { // The value is too big.
|
||||
oStream_ << "DelayL::setDelay: argument (" << delay << ") greater than maximum!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
if (delay < 0 ) {
|
||||
oStream_ << "DelayL::setDelay: argument (" << delay << ") less than zero!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
StkFloat outPointer = inPoint_ - delay; // read chases write
|
||||
delay_ = delay;
|
||||
|
||||
while ( outPointer < 0 )
|
||||
outPointer += inputs_.size(); // modulo maximum length
|
||||
|
||||
outPoint_ = (long) outPointer; // integer part
|
||||
|
||||
alpha_ = outPointer - outPoint_; // fractional part
|
||||
omAlpha_ = (StkFloat) 1.0 - alpha_;
|
||||
|
||||
if ( outPoint_ == inputs_.size() ) outPoint_ = 0;
|
||||
doNextOut_ = true;
|
||||
}
|
||||
|
||||
inline StkFloat DelayL :: tick( StkFloat input )
|
||||
{
|
||||
inputs_[inPoint_++] = input * gain_;
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
|
||||
//! Fill the StkFrames object with computed sample frames, starting at the specified channel and return the same reference.
|
||||
/*!
|
||||
The \c channel argument plus the number of output channels must
|
||||
The \c channel argument plus the number of input 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
|
||||
|
||||
@@ -96,17 +96,18 @@ public:
|
||||
*/
|
||||
StkFloat tick( unsigned int channel = 0 );
|
||||
|
||||
//! Fill the StkFrames argument with computed frames and return the same reference.
|
||||
//! Fill the StkFrames object with computed sample frames, starting at the specified channel and return the same reference.
|
||||
/*!
|
||||
The number of channels in the StkFrames argument must equal the
|
||||
number of channels specified in the listen() function. However,
|
||||
this is only checked if _STK_DEBUG_ is defined during compilation,
|
||||
in which case an incompatibility will trigger an StkError
|
||||
exception. If no connection exists, the function does
|
||||
The \c channel argument plus the number of channels specified
|
||||
in the listen() function must be less than the number of channels
|
||||
in the StkFrames argument (the first channel is specified by 0).
|
||||
However, this is only checked if _STK_DEBUG_ is defined during
|
||||
compilation, in which case an incompatibility will trigger an
|
||||
StkError exception. If no connection exists, the function does
|
||||
nothing (a warning will be issued if _STK_DEBUG_ is defined during
|
||||
compilation).
|
||||
*/
|
||||
StkFrames& tick( StkFrames& frames );
|
||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||
|
||||
// Called by the thread routine to receive data via the socket connection
|
||||
// and fill the socket buffer. This is not intended for general use but
|
||||
|
||||
@@ -83,15 +83,16 @@ public:
|
||||
*/
|
||||
StkFloat tick( unsigned int channel = 0 );
|
||||
|
||||
//! Fill the StkFrames argument with computed frames and return the same reference.
|
||||
//! Fill the StkFrames object with computed sample frames, starting at the specified channel and return the same reference.
|
||||
/*!
|
||||
If the device is "stopped", it is "started". The number of
|
||||
channels in the StkFrames argument must equal the number of
|
||||
channels specified during instantiation. However, this is only
|
||||
checked if _STK_DEBUG_ is defined during compilation, in which
|
||||
case an incompatibility will trigger an StkError exception.
|
||||
If the device is "stopped", it is "started". The \c channel
|
||||
argument plus the number of input 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.
|
||||
*/
|
||||
StkFrames& tick( StkFrames& frames );
|
||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||
|
||||
// This function is not intended for general use but must be
|
||||
// public for access from the audio callback function.
|
||||
|
||||
Reference in New Issue
Block a user