本文整理汇总了C++中SoundChannel::isPlaying方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundChannel::isPlaying方法的具体用法?C++ SoundChannel::isPlaying怎么用?C++ SoundChannel::isPlaying使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundChannel
的用法示例。
在下文中一共展示了SoundChannel::isPlaying方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void SoundDevice::update(float timeElapsed)
{
std::vector<SoundChannel*>::iterator it = m_activeChannels.begin();
while(it != m_activeChannels.end())
{
SoundChannel* channel = *it;
if (channel->isPlaying() == false)
{
++it;
continue;
}
channel->update();
if (channel->getActiveBuffersCount() < m_numBuffersUsed)
{
channel->loadNextSample();
}
if (channel->getActiveBuffersCount() == 0)
{
channel->stop();
it = m_activeChannels.erase(it);
delete channel;
}
else
{
++it;
}
}
}
示例2: pos
void test_playWith3D()
{
xtime xt;
Ogre::ResourceManager::ResourceMapIterator it =
SoundManager::getSingleton().getResourceIterator();
while (it.hasMoreElements())
{
SoundResourcePtr soundres = it.getNext();
SoundStream *sound = new SoundStream(soundres);
SoundChannel *channel = new SoundChannel(sound, soundres->getName());
if (channel)
{
channel->play();
float angle = 0.0f;
xtime_get(&xt, TIME_UTC);
xt.sec++;
thread::sleep(xt);
while (channel->isPlaying()) {
xtime_get(&xt, TIME_UTC);
xt.nsec+=100000;
thread::sleep(xt);
Vector3 pos(1.0f*sinf(angle), 20.0f*cosf(angle), 0.0f);
channel->setPosition(pos);
angle += 0.005;
if (angle > 2 * M_PI)
{
angle = 0.0f;
}
FSOUND_Update();
}
delete channel;
}
}
}