本文整理汇总了C++中StkFrames::interleaved方法的典型用法代码示例。如果您正苦于以下问题:C++ StkFrames::interleaved方法的具体用法?C++ StkFrames::interleaved怎么用?C++ StkFrames::interleaved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StkFrames
的用法示例。
在下文中一共展示了StkFrames::interleaved方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void WvOut :: tick( const StkFrames& frames, unsigned int channel )
{
if ( channel >= frames.channels() ) {
errorString_ << "WvOut::tick(): channel argument (" << channel << ") is incompatible with StkFrames argument!";
handleError( StkError::FUNCTION_ARGUMENT );
}
if ( frames.channels() == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++ )
computeSample( frames[i] );
}
else if ( frames.interleaved() ) {
unsigned int hop = frames.channels();
unsigned int index = channel;
for ( unsigned int i=0; i<frames.frames(); i++ ) {
computeSample( frames[index] );
index += hop;
}
}
else {
unsigned int iStart = channel * frames.frames();
for ( unsigned int i=0; i<frames.frames(); i++ )
computeSample( frames[iStart++] );
}
}
示例2: if
void RtWvOut :: tick( const StkFrames& frames, unsigned int channel )
{
if ( channel == 0 || frames.channels() < channel ) {
errorString_ << "RtWvOut::tick(): channel argument (" << channel << ") is zero or > channels in StkFrames argument!";
handleError( StkError::FUNCTION_ARGUMENT );
}
if ( stopped_ )
start();
if ( frames.channels() == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++ )
tick( frames[i] );
}
else if ( frames.interleaved() ) {
unsigned int hop = frames.channels();
unsigned int index = channel - 1;
for ( unsigned int i=0; i<frames.frames(); i++ ) {
tick( frames[index] );
index += hop;
}
}
else {
unsigned int iStart = (channel - 1) * frames.frames();
for ( unsigned int i=0; i<frames.frames(); i++ )
tick( frames[iStart + i] );
}
}
示例3: tickFrame
void RtWvOut :: tickFrame( const StkFrames& frames )
{
if ( channels_ != frames.channels() ) {
errorString_ << "RtWvOut::tickFrame(): incompatible channel value in StkFrames argument!";
handleError( StkError::FUNCTION_ARGUMENT );
}
if ( stopped_ )
start();
unsigned int j;
StkFloat sample;
if ( channels_ == 1 || frames.interleaved() ) {
unsigned long iFrames = 0, iData = counter_;
for ( unsigned int i=0; i<frames.frames(); i++ ) {
for ( j=0; j<channels_; j++ ) {
sample = frames[iFrames++];
this->clipTest( sample );
dataPtr_[iData++] = sample;
}
counter_++;
totalCount_++;
if ( counter_ >= (unsigned int)bufferSize_ ) {
try {
audio_->tickStream();
}
catch (RtError &error) {
handleError( error.getMessageString(), StkError::AUDIO_SYSTEM );
}
counter_ = 0;
}
}
}
else {
unsigned int hop = frames.frames();
unsigned long iData = counter_;
for ( unsigned int i=0; i<frames.frames(); i++ ) {
for ( j=0; j<channels_; j++ ) {
sample = frames[i + j*hop];
this->clipTest( sample );
dataPtr_[iData++] = sample;
}
counter_++;
totalCount_++;
if ( counter_ >= (unsigned int)bufferSize_ ) {
try {
audio_->tickStream();
}
catch (RtError &error) {
handleError( error.getMessageString(), StkError::AUDIO_SYSTEM );
}
counter_ = 0;
}
}
}
}
示例4: tickFrame
void WvOut :: tickFrame( const StkFrames& frames )
{
if ( !fd_ ) {
errorString_ << "WvOut::tickFrame(): no file open!";
handleError( StkError::WARNING );
return;
}
if ( channels_ != frames.channels() ) {
errorString_ << "WvOut::tickFrame(): incompatible channel value in StkFrames argument!";
handleError( StkError::FUNCTION_ARGUMENT );
}
unsigned int j;
if ( channels_ == 1 || frames.interleaved() ) {
unsigned long iFrames = 0, iData = counter_;
for ( unsigned int i=0; i<frames.frames(); i++ ) {
for ( j=0; j<channels_; j++ ) {
data_[iData++] = frames[iFrames++];
}
counter_++;
totalCount_++;
if ( counter_ == BUFFER_SIZE ) {
this->writeData( BUFFER_SIZE );
counter_ = 0;
}
}
}
else {
unsigned int hop = frames.frames();
unsigned long iData = counter_;
for ( unsigned int i=0; i<frames.frames(); i++ ) {
for ( j=0; j<channels_; j++ ) {
data_[iData++] = frames[i + j*hop];
}
counter_++;
totalCount_++;
if ( counter_ == BUFFER_SIZE ) {
this->writeData( BUFFER_SIZE );
counter_ = 0;
}
}
}
}
示例5: computeFrames
void FileWvOut :: computeFrames( const StkFrames& frames )
{
if ( !file_.isOpen() ) {
errorString_ << "FileWvOut::computeFrames(): no file open!";
handleError( StkError::WARNING );
return;
}
if ( data_.channels() != frames.channels() ) {
errorString_ << "FileWvOut::computeFrames(): incompatible channel value in StkFrames argument!";
handleError( StkError::FUNCTION_ARGUMENT );
}
unsigned int j, nChannels = data_.channels();
if ( nChannels == 1 || frames.interleaved() ) {
unsigned int iFrames = 0;
for ( unsigned int i=0; i<frames.frames(); i++ ) {
for ( j=0; j<nChannels; j++ ) {
data_[iData_] = frames[iFrames++];
clipTest( data_[iData_++] );
}
this->incrementFrame();
}
}
else { // non-interleaved frames
unsigned long hop = frames.frames();
unsigned int index;
for ( unsigned int i=0; i<frames.frames(); i++ ) {
index = i;
for ( j=0; j<nChannels; j++ ) {
data_[iData_] = frames[index];
clipTest( data_[iData_++] );
index += hop;
}
this->incrementFrame();
}
}
}