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


C++ SoundChannel类代码示例

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


在下文中一共展示了SoundChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: SoundInstance

SoundInstance * Sound::Play()
{
	if(TYPE_STREAMED == type && soundInstances.size())
	{
		return soundInstances.front();
	}

	SoundChannel * ch = SoundSystem::Instance()->FindChannel(priority);
	if(!ch)
	{
		return 0;
	}

	if(TYPE_STREAMED == type)
	{
		provider->Init();
		provider->Rewind();
		PrepareDynamicBuffers();
	}

	SoundInstance * inst = new SoundInstance();
	inst->buddyChannel = ch;
	AddSoundInstance(inst);
	ch->SetVolume(volume);
	ch->Play(this, looping);
	return inst;
}
开发者ID:dheerendra1,项目名称:dava.framework,代码行数:27,代码来源:Sound.cpp

示例3:

SoundChannel * SoundSystem::FindChannel(int32 priority)
{
	Deque<SoundChannel*>::iterator it;
	Deque<SoundChannel*>::iterator itEnd = channelsPool.end();
	for(it = channelsPool.begin(); it != itEnd; ++it)
	{
		SoundChannel * ch = *it;
		if(SoundChannel::STATE_FREE == ch->GetState())
		{
			return ch;
		}
	}

	for(it = channelsPool.begin(); it != itEnd; ++it)
	{
		SoundChannel * ch = *it;
		if(ch->GetProirity() < priority)
		{
			ch->Stop();
			return ch;
		}
	}

	return 0;
}
开发者ID:dheerendra1,项目名称:dava.framework,代码行数:25,代码来源:SoundSystem.cpp

示例4: Update

void SoundSystem::Update()
{
	Deque<SoundChannel*>::iterator it;
	Deque<SoundChannel*>::iterator itEnd = channelsPool.end();
	for(it = channelsPool.begin(); it != itEnd; ++it)
	{
		SoundChannel * ch = *it;
		if(SoundChannel::STATE_FREE != ch->GetState())
		{
			ch->Update();
		}
	}

	List<SoundInstance*>::iterator sit = soundInstances.begin();
	List<SoundInstance*>::iterator sEnd = soundInstances.end();
	while(sit != sEnd)
	{
		if(!(*sit)->Update())
		{
			sit = soundInstances.begin();
			continue;
		}
		++sit;
	}
}
开发者ID:dheerendra1,项目名称:dava.framework,代码行数:25,代码来源:SoundSystem.cpp

示例5: allocateChannel_l

SoundChannel* SoundPool::allocateChannel_l(int priority)
{
    List<SoundChannel*>::iterator iter;
    SoundChannel* channel = NULL;

    // allocate a channel
    if (!mChannels.empty()) {
        iter = mChannels.begin();
        if (priority >= (*iter)->priority()) {
            channel = *iter;
            mChannels.erase(iter);
            ALOGV("Allocated active channel");
        }
    }

    // update priority and put it back in the list
    if (channel) {
        channel->setPriority(priority);
        for (iter = mChannels.begin(); iter != mChannels.end(); ++iter) {
            if (priority < (*iter)->priority()) {
                break;
            }
        }
        mChannels.insert(iter, channel);
    }
    return channel;
}
开发者ID:tempbottle,项目名称:InDashNet.Open.UN2000,代码行数:27,代码来源:SoundPool.cpp

示例6: while

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

        while (!mRestart.empty()) {
            SoundChannel* channel;
            LOGV("Getting channel from list");
            List<SoundChannel*>::iterator iter = mRestart.begin();
            channel = *iter;
            mRestart.erase(iter);
            if (channel) channel->nextEvent();
            if (mQuit) break;
        }
    }

    mRestart.clear();
    mCondition.signal();
    mRestartLock.unlock();
    LOGV("goodbye");
    return 0;
}
开发者ID:embest-tech,项目名称:rowboat-frameworks-base,代码行数:25,代码来源:SoundPool.cpp

示例7: test_PlayLoop

    void test_PlayLoop()
    {
        xtime xt;
        
/*        Ogre::ResourceManager::ResourceMapIterator it =
            SoundManager::getSingleton().getResourceIterator();
        while (it.hasMoreElements()) */
        {
            SoundSample *sound = new SoundSample("test.ogg");
            sound->setLooping(true);
            sound->load();
            SoundChannel *channel = new SoundChannel(sound, sound->getName());
            if (channel)
            {
                channel->play();
                
                xtime_get(&xt, TIME_UTC);
                xt.sec+=10;
                thread::sleep(xt);
                
                delete sound;
            }            
        }
        CPPUNIT_ASSERT(true);
    }
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:25,代码来源:SoundStreamTest.cpp

示例8: lock

void SoundPool::setVolume(int channelID, float leftVolume, float rightVolume)
{
    Mutex::Autolock lock(&mLock);
    SoundChannel* channel = findChannel(channelID);
    if (channel) {
        channel->setVolume(leftVolume, rightVolume);
    }
}
开发者ID:tempbottle,项目名称:InDashNet.Open.UN2000,代码行数:8,代码来源:SoundPool.cpp

示例9: LOGV

void SoundPool::pause(int channelID)
{
    LOGV("pause(%d)", channelID);
    Mutex::Autolock lock(&mLock);
    SoundChannel* channel = findChannel(channelID);
    if (channel) {
        channel->pause();
    }
}
开发者ID:embest-tech,项目名称:rowboat-frameworks-base,代码行数:9,代码来源:SoundPool.cpp

示例10: ALOGV

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

示例11: while

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

示例12: callback

void SoundChannel::callback(int event, void* user, void *info)
{
    unsigned long toggle = (unsigned long)user & 1;
    SoundChannel* channel = static_cast<SoundChannel*>((void *)((unsigned long)user & ~1));
    
    if (channel->mToggle != toggle) {
        LOGV("callback with wrong toggle");
        return;
    }
    channel->process(event, info);
}
开发者ID:embest-tech,项目名称:rowboat-frameworks-base,代码行数:11,代码来源:SoundPool.cpp

示例13: DVASSERT

SoundInstance * Sound::Play()
{
#ifdef __DAVAENGINE_ANDROID__
    SLresult result;
    
    if(TYPE_STATIC == type)
    {
        result = (*playerBufferQueue)->Clear(playerBufferQueue);
        DVASSERT(SL_RESULT_SUCCESS == result);
        
        buffer->FullFill(provider, playerBufferQueue);
    }
    
    if(TYPE_STREAMED == type)
    {
        result = (*playerSeek)->SetPosition(playerSeek, 0, SL_SEEKMODE_FAST);
        DVASSERT(SL_RESULT_SUCCESS == result);
    }

    result = (*playerPlay)->SetPlayState(playerPlay, SL_PLAYSTATE_PLAYING);
    DVASSERT(SL_RESULT_SUCCESS == result);
    
    soundInstances.clear();
    
    SoundInstance * inst = new SoundInstance(this);
    AddSoundInstance(inst);
    
    return soundInstances.front();
#else
    
	if(TYPE_STREAMED == type && soundInstances.size())
	{
		return soundInstances.front();
	}

	SoundChannel * ch = SoundSystem::Instance()->FindChannel(priority);
	if(!ch)
	{
		return 0;
	}

	if(TYPE_STREAMED == type)
	{
		PrepareDynamicBuffers();
	}

	SoundInstance * inst = new SoundInstance();
	inst->buddyChannel = ch;
	AddSoundInstance(inst);
	ch->SetVolume(volume);
	ch->Play(this, looping);
	return inst;
#endif //#ifdef __DAVAENGINE_ANDROID__
}
开发者ID:dima-belsky,项目名称:dava.framework,代码行数:54,代码来源:Sound.cpp

示例14:

/**
 * @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

示例15: Suspend

void SoundSystem::Suspend()
{
	Deque<SoundChannel*>::iterator it;
	Deque<SoundChannel*>::iterator itEnd = channelsPool.end();
	for(it = channelsPool.begin(); it != itEnd; ++it)
	{
		SoundChannel * ch = *it;
		if(SoundChannel::STATE_PLAYING == ch->GetState())
		{
			ch->Pause(true);
		}
	}
#ifdef __DAVASOUND_AL__
	alcSuspendContext(context);
#endif
}
开发者ID:dheerendra1,项目名称:dava.framework,代码行数:16,代码来源:SoundSystem.cpp


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