本文整理汇总了C++中AUD_Reference::pause方法的典型用法代码示例。如果您正苦于以下问题:C++ AUD_Reference::pause方法的具体用法?C++ AUD_Reference::pause怎么用?C++ AUD_Reference::pause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AUD_Reference
的用法示例。
在下文中一共展示了AUD_Reference::pause方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mix
void AUD_SoftwareDevice::mix(data_t* buffer, int length)
{
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));
lock();
{
AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound;
int len;
int pos;
bool eos;
std::list<AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> > stopSounds;
std::list<AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> > pauseSounds;
sample_t* buf = m_buffer.getBuffer();
m_mixer->clear(length);
// for all sounds
AUD_HandleIterator it = m_playingSounds.begin();
while(it != m_playingSounds.end())
{
sound = *it;
// increment the iterator to make sure it's valid,
// in case the sound gets deleted after stopping
++it;
// get the buffer from the source
pos = 0;
len = length;
// update 3D Info
sound->update();
sound->m_reader->read(len, eos, buf);
// in case of looping
while(pos + len < length && sound->m_loopcount && eos)
{
m_mixer->mix(buf, pos, len, sound->m_volume);
pos += len;
if(sound->m_loopcount > 0)
sound->m_loopcount--;
sound->m_reader->seek(0);
len = length - pos;
sound->m_reader->read(len, eos, buf);
// prevent endless loop
if(!len)
break;
}
m_mixer->mix(buf, pos, len, sound->m_volume);
// in case the end of the sound is reached
if(eos && !sound->m_loopcount)
{
if(sound->m_stop)
sound->m_stop(sound->m_stop_data);
if(sound->m_keep)
pauseSounds.push_back(sound);
else
stopSounds.push_back(sound);
}
}
// superpose
m_mixer->read(buffer, m_volume);
// cleanup
while(!stopSounds.empty())
{
sound = stopSounds.front();
stopSounds.pop_front();
sound->stop();
}
while(!pauseSounds.empty())
{
sound = pauseSounds.front();
pauseSounds.pop_front();
sound->pause();
}
}
unlock();
}