当前位置: 首页>>代码示例>>C++>>正文


C++ SoundChannel::stop方法代码示例

本文整理汇总了C++中SoundChannel::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundChannel::stop方法的具体用法?C++ SoundChannel::stop怎么用?C++ SoundChannel::stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoundChannel的用法示例。


在下文中一共展示了SoundChannel::stop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
      }
   }
}
开发者ID:chenwenbin928,项目名称:tamy,代码行数:29,代码来源:SoundDevice.cpp

示例2: test_loadPlayWithFade

 void test_loadPlayWithFade()
 {
     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();
             
             xtime_get(&xt, boost::TIME_UTC);
             xt.sec += 10;
             thread::sleep(xt);
             
             channel->stop();
             
             xtime_get(&xt, boost::TIME_UTC);
             xt.sec += 5;
             thread::sleep(xt);
         }            
     }
     
     CPPUNIT_ASSERT(true);
 }
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:28,代码来源:SoundStreamTest.cpp

示例3: releaseAllChannels

void SoundDevice::releaseAllChannels()
{
   while(m_activeChannels.size() > 0)
   {
      SoundChannel* channel = m_activeChannels.back();
      channel->stop();
      delete channel;
      m_activeChannels.pop_back();
   }
}
开发者ID:chenwenbin928,项目名称:tamy,代码行数:10,代码来源:SoundDevice.cpp

示例4:

/**
 * @author JoSch
 * @date 03-11-2005
 */   
SoundObject::~SoundObject()
{
    if (mMovableObject)
    {
        SoundChannel *sc = dynamic_cast<SoundChannel*>(mMovableObject);
        if (sc)
        {
            sc->stop();
        }
        delete mMovableObject;
    }
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:16,代码来源:SoundObject.cpp

示例5: stop

void SoundPool::stop(int channelID)
{
    ALOGV("stop(%d)", channelID);
    Mutex::Autolock lock(&mLock);
    SoundChannel* channel = findChannel(channelID);
    if (channel) {
        channel->stop();
    } else {
        channel = findNextChannel(channelID);
        if (channel)
            channel->clearNextEvent();
    }
}
开发者ID:tempbottle,项目名称:InDashNet.Open.UN2000,代码行数:13,代码来源:SoundPool.cpp

示例6: run

int SoundPool::run()
{
    mRestartLock.lock();
    while (!mQuit) {
        mCondition.wait(mRestartLock);
        ALOGV("awake");
        if (mQuit) break;

        while (!mStop.empty()) {
            SoundChannel* channel;
            ALOGV("Getting channel from stop list");
            List<SoundChannel* >::iterator iter = mStop.begin();
            channel = *iter;
            mStop.erase(iter);
            mRestartLock.unlock();
            if (channel != 0) {
                Mutex::Autolock lock(&mLock);
                channel->stop();
            }
            mRestartLock.lock();
            if (mQuit) break;
        }

        while (!mRestart.empty()) {
            SoundChannel* channel;
            ALOGV("Getting channel from list");
            List<SoundChannel*>::iterator iter = mRestart.begin();
            channel = *iter;
            mRestart.erase(iter);
            mRestartLock.unlock();
            if (channel != 0) {
                Mutex::Autolock lock(&mLock);
                channel->nextEvent();
            }
            mRestartLock.lock();
            if (mQuit) break;
        }
    }

    mStop.clear();
    mRestart.clear();
    mCondition.signal();
    mRestartLock.unlock();
    ALOGV("goodbye");
    return 0;
}
开发者ID:tempbottle,项目名称:InDashNet.Open.UN2000,代码行数:46,代码来源:SoundPool.cpp


注:本文中的SoundChannel::stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。