本文整理汇总了C++中LLAudioSource::getCurrentBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ LLAudioSource::getCurrentBuffer方法的具体用法?C++ LLAudioSource::getCurrentBuffer怎么用?C++ LLAudioSource::getCurrentBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLAudioSource
的用法示例。
在下文中一共展示了LLAudioSource::getCurrentBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: idle
void LLAudioEngine::idle(F32 max_decode_time)
{
if (max_decode_time <= 0.f)
{
max_decode_time = default_max_decode_time;
}
// "Update" all of our audio sources, clean up dead ones.
// Primarily does position updating, cleanup of unused audio sources.
// Also does regeneration of the current priority of each audio source.
S32 i;
for (i = 0; i < MAX_BUFFERS; i++)
{
if (mBuffers[i])
{
mBuffers[i]->mInUse = false;
}
}
F32 max_priority = -1.f;
LLAudioSource *max_sourcep = NULL; // Maximum priority source without a channel
source_map::iterator iter;
for (iter = mAllSources.begin(); iter != mAllSources.end();)
{
LLAudioSource *sourcep = iter->second;
// Update this source
sourcep->update();
sourcep->updatePriority();
if (sourcep->isDone())
{
// The source is done playing, clean it up.
delete sourcep;
mAllSources.erase(iter++);
continue;
}
if (sourcep->isMuted())
{
++iter;
continue;
}
if (!sourcep->getChannel() && sourcep->getCurrentBuffer())
{
// We could potentially play this sound if its priority is high enough.
if (sourcep->getPriority() > max_priority)
{
max_priority = sourcep->getPriority();
max_sourcep = sourcep;
}
}
// Move on to the next source
iter++;
}
// Now, do priority-based organization of audio sources.
// All channels used, check priorities.
// Find channel with lowest priority
if (max_sourcep)
{
LLAudioChannel *channelp = getFreeChannel(max_priority);
if (channelp)
{
//llinfos << "Replacing source in channel due to priority!" << llendl;
max_sourcep->setChannel(channelp);
channelp->setSource(max_sourcep);
if (max_sourcep->isSyncSlave())
{
// A sync slave, it doesn't start playing until it's synced up with the master.
// Flag this channel as waiting for sync, and return true.
channelp->setWaiting(true);
}
else
{
channelp->setWaiting(false);
channelp->play();
}
}
}
// Do this BEFORE we update the channels
// Update the channels to sync up with any changes that the source made,
// such as changing what sound was playing.
updateChannels();
// Update queued sounds (switch to next queued data if the current has finished playing)
for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
{
// This is lame, instead of this I could actually iterate through all the sources
// attached to each channel, since only those with active channels
// can have anything interesting happen with their queue? (Maybe not true)
LLAudioSource *sourcep = iter->second;
if (!sourcep->mQueuedDatap || sourcep->isMuted())
{
// Muted, or nothing queued, so we don't care.
//.........这里部分代码省略.........