本文整理汇总了C++中AudioBuffer::mergeBuffers方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioBuffer::mergeBuffers方法的具体用法?C++ AudioBuffer::mergeBuffers怎么用?C++ AudioBuffer::mergeBuffers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioBuffer
的用法示例。
在下文中一共展示了AudioBuffer::mergeBuffers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
//.........这里部分代码省略.........
{
BaseAudioEvent* audioEvent = audioEvents[ k ];
if ( !audioEvent->isLocked()) // make sure we are allowed to query the contents
{
audioEvent->lock(); // prevent buffer mutations during this read cycle
audioEvent->mixBuffer( channelBuffer, bufferPos, min_buffer_position,
maxBufferPosition, loopStarted, loopOffset, useChannelRange );
audioEvent->unlock(); // release lock
}
}
}
else
{
channel->readCachedBuffer( channelBuffer, bufferPos );
}
}
// perform live rendering for this instrument
if ( channel->hasLiveEvents )
{
int lAmount = channel->liveEvents.size();
// the volume of the live events is divided by the channel mix as a live event
// is played on the same instrument, but just as a different voice (note the
// events can have their own mix level)
float lAmp = channel->mixVolume > 0.0 ? MAX_PHASE / channel->mixVolume : MAX_PHASE;
for ( int k = 0; k < lAmount; ++k )
{
BaseAudioEvent* vo = channel->liveEvents[ k ];
channelBuffer->mergeBuffers( vo->synthesize( buffer_size ), 0, 0, lAmp );
}
}
// apply the processing chains processors / modulators
ProcessingChain* chain = channel->processingChain;
std::vector<BaseProcessor*> processors = chain->getActiveProcessors();
for ( int k = 0; k < processors.size(); k++ )
{
BaseProcessor* processor = processors[ k ];
bool canCacheProcessor = processor->isCacheable();
// only apply processor when we're not caching or cannot cache its output
if ( !isCached || !canCacheProcessor )
{
// cannot cache this processor and we're caching ? write all contents
// of the channelBuffer into the channels cache
if ( mustCache && !canCacheProcessor )
mustCache = !writeChannelCache( channel, channelBuffer, cacheReadPos );
processors[ k ]->process( channelBuffer, channel->isMono );
}
}
// write cache if it didn't happen yet ;) (bus processors are (currently) non-cacheable)
if ( mustCache )
mustCache = !writeChannelCache( channel, channelBuffer, cacheReadPos );
// write the channel buffer into the combined output buffer, apply channel volume
// note live events are always audible as their volume is relative to the instrument
if ( channel->hasLiveEvents && channelVolume == 0.0 ) channelVolume = MAX_PHASE;
inbuffer->mergeBuffers( channelBuffer, 0, 0, channelVolume );