本文整理汇总了C++中LLAudioChannel::cleanup方法的典型用法代码示例。如果您正苦于以下问题:C++ LLAudioChannel::cleanup方法的具体用法?C++ LLAudioChannel::cleanup怎么用?C++ LLAudioChannel::cleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLAudioChannel
的用法示例。
在下文中一共展示了LLAudioChannel::cleanup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeAudioData
// <FS:Ansariel> Asset blacklisting
void LLAudioEngine::removeAudioData(const LLUUID& audio_uuid)
{
if (audio_uuid.isNull())
{
return;
}
data_map::iterator iter = mAllData.find(audio_uuid);
if (iter != mAllData.end())
{
uuid_vec_t delete_list;
source_map::iterator iter2;
for (iter2 = mAllSources.begin(); iter2 != mAllSources.end(); ++iter2)
{
LLAudioSource* sourcep = iter2->second;
if (sourcep && sourcep->getCurrentData() && sourcep->getCurrentData()->getID() == audio_uuid)
{
delete_list.push_back(iter2->first);
}
}
uuid_vec_t::iterator delete_list_end = delete_list.end();
for (uuid_vec_t::iterator del_it = delete_list.begin(); del_it != delete_list_end; ++del_it)
{
LLUUID source_id = *del_it;
LLAudioSource* sourcep = mAllSources[source_id];
LLAudioChannel* chan = sourcep->getChannel();
delete sourcep;
mAllSources.erase(source_id);
if (chan)
{
chan->cleanup();
}
}
LLAudioData* data = iter->second;
if (data)
{
LLAudioBuffer* buf = data->getBuffer();
if (buf)
{
S32 i;
for (i = 0; i < MAX_BUFFERS; ++i)
{
if (mBuffers[i] == buf)
{
mBuffers[i] = NULL;
}
}
delete buf;
}
delete data;
}
mAllData.erase(audio_uuid);
}
}
示例2: createBuffer
LLAudioBuffer * LLAudioEngine::getFreeBuffer()
{
//checkStates(); //Fails
S32 i;
for (i = 0; i < MAX_BUFFERS; i++)
{
if (!mBuffers[i])
{
mBuffers[i] = createBuffer();
return mBuffers[i];
}
}
//checkStates(); // Fails
// Grab the oldest unused buffer
F32 max_age = -1.f;
S32 buffer_id = -1;
for (i = 0; i < MAX_BUFFERS; i++)
{
if (mBuffers[i])
{
if (!mBuffers[i]->mInUse)
{
if (mBuffers[i]->mLastUseTimer.getElapsedTimeF32() > max_age)
{
max_age = mBuffers[i]->mLastUseTimer.getElapsedTimeF32();
buffer_id = i;
}
}
}
}
//checkStates(); //Fails
if (buffer_id >= 0)
{
LL_DEBUGS("AudioEngine") << "Taking over unused buffer! max_age=" << max_age << LL_ENDL;
mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL;
for (U32 i = 0; i < MAX_CHANNELS; i++)
{
LLAudioChannel* channelp = mChannels[i];
if(channelp && channelp->mCurrentBufferp == mBuffers[buffer_id])
{
channelp->cleanup();
llassert(channelp->mCurrentBufferp == NULL);
}
}
delete mBuffers[buffer_id];
mBuffers[buffer_id] = createBuffer();
return mBuffers[buffer_id];
}
//checkStates(); //Fails
return NULL;
}