• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ fmod::Channel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bar

void SoundLooper::bar() {
	if(!(bars % 4) && bars > play_to){
		bars = 0;
	}
	if(bars == start_at){
		int status_was = status;
		// Play sound
		if (status == LOOPER_QUEUED){
			status = LOOPER_PLAYING;
		}
	
		if (status == LOOPER_STOPPING){
			status = LOOPER_IDLE;
			gui->intEvent(EVENT_CHANGE_TRG_COLOR, COLOR_TRG_IDLE);
		}
		if (status == LOOPER_PLAYING){
			FMOD::Channel *ch;
			ERRCHECK(sound->system->playSound(FMOD_CHANNEL_FREE, sample, false, &ch));
			ERRCHECK(ch->setChannelGroup(cg));
		}
		if(status_was != status) {
			gui->intEvent(EVENT_CHANGE_TRG_COLOR, status==LOOPER_PLAYING?COLOR_TRG_PLAYING:COLOR_TRG_IDLE);
		}
	}

	if(bars == play_to) {
		bars = 0;
	}
	else
		bars++;
}
开发者ID:BackupTheBerlios,项目名称:instigmata-svn,代码行数:31,代码来源:soundlooper.cpp


示例2: hatSpawn

void SoundEngine::hatSpawn(float x, float y, float z) {
	FMOD::Channel* channel = nullptr;
	FMOD_VECTOR position = { x, y, z };
	result_ = system_->playSound(hatSpawnSound_, 0, true, &channel);
	result_ = channel->set3DAttributes(&position, 0);
	result_ = channel->setPaused(false);
}
开发者ID:Atyansh,项目名称:deerstalker,代码行数:7,代码来源:SoundEngine.cpp


示例3: PlaySound

bool CSGD_FModManager::PlaySound( int nID )
{
	if( !m_pSystem ) return false;

	//	check that ID is in range
	assert( nID > -1 && nID < (int)m_SoundList.size() && "ID is out of range" );

	//	Address of a channel handle pointer that receives the newly playing channel
	FMOD::Channel *channel;
	//	used to catch fMod-specific error codes
	FMOD_RESULT result;

	if( ( result = m_pSystem->playSound(FMOD_CHANNEL_FREE, m_SoundList[ nID ].fmSound , false, &channel) ) != FMOD_OK )
	{
		FMODERR( result );
	}

	//  set the volume of this playing channel
	channel->setVolume(m_SoundList[nID].fVolume);

	//  set the pan of this playing channel
	channel->setPan(m_SoundList[nID].fPan);

	//  set the volume of this playing channel
	//channel->setFrequency(m_SoundList[nID].fFreq);

	//	hold on to channel pointer for late use
	m_SoundList[ nID ].m_SoundChannels.push_back( channel );

	//	return success
	return true;
}
开发者ID:BGCX261,项目名称:zombie-maul-svn-to-git,代码行数:32,代码来源:CSGD_FModManager.cpp


示例4:

SkySound SoundManager::play3DSound(std::string name, float volume, float x, float y, float z, bool echo, bool loop, float fallOffStart)
{
if(mSilent) return NULL;
	
	if ("" == name)
		return false;
	if(mInitFailed) return NULL;
	FMOD::Sound* sound = 0;
	FMOD::Channel* soundChannel;
	result = mSystem->createSound(name.c_str(), FMOD_SOFTWARE | FMOD_3D, 0, &sound); 
	
	if (!sound)
	{
		printf("FMOD Error loading %s!\n", name.c_str());
		checkErrors();
		return NULL;
	}
	sound->set3DMinMaxDistance(fallOffStart, 2000);
	sound->setMode(loop ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF);
	mSystem->playSound(FMOD_CHANNEL_FREE, sound, false, &soundChannel);
//	if(echo)
	//	soundChannel->addDSP(mReverb);


	FMOD_VECTOR pos = {x, y, z};
	FMOD_VECTOR vel = {0, 0, 0};
	soundChannel->setVolume(volume);
	soundChannel->set3DAttributes(&pos, &vel);

	mSystem->update();
//	printf("finished play3dsound\n");
	return soundChannel;
}
开发者ID:thoney,项目名称:MIRAGEvisApp,代码行数:33,代码来源:SoundManager.cpp


示例5: resume

bool AudioEngineImpl::resume(int audioID)
{
    try {
        if (!mapChannelInfo[audioID].channel) {
            FMOD::Channel *channel = nullptr;
            FMOD::ChannelGroup *channelgroup = nullptr;
            //starts the sound in pause mode, use the channel to unpause
            FMOD_RESULT result = pSystem->playSound(mapChannelInfo[audioID].sound, channelgroup, true, &channel);
            if (ERRCHECK(result)) {
                return false;
            }
            channel->setMode(mapChannelInfo[audioID].loop ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF);
            channel->setLoopCount(mapChannelInfo[audioID].loop ? -1 : 0);
            channel->setVolume(mapChannelInfo[audioID].volume);
            channel->setUserData(reinterpret_cast<void *>(static_cast<std::intptr_t>(mapChannelInfo[audioID].id)));
            mapChannelInfo[audioID].channel = channel;
        }

        mapChannelInfo[audioID].channel->setPaused(false);
        AudioEngine::_audioIDInfoMap[audioID].state = AudioEngine::AudioState::PLAYING;

        return true;
    }
    catch (const std::out_of_range& oor) {
        printf("AudioEngineImpl::resume: invalid audioID: %d\n", audioID);
        return false;
    }
}
开发者ID:zengzhining,项目名称:cocos2d-x,代码行数:28,代码来源:AudioEngine-linux.cpp


示例6: setSourcePitch

void MCFMODSourceManager::setSourcePitch(unsigned int SourceIndex, int Cents)
{
   FMOD::Channel* fmodChannel = reinterpret_cast<FMOD::Channel*>(sSources[SourceIndex].Source);

   float fFrequencyRatio = (float)pow(2, Cents / 1200.0f);
   fmodChannel->setFrequency(fFrequencies[SourceIndex] * fFrequencyRatio);
}
开发者ID:arturocepeda,项目名称:Modus,代码行数:7,代码来源:mxsoundgenfmod.cpp


示例7: unlinkSound

void SoundHolder::unlinkSound(void *channel)
{
	FMOD::Channel *pChannel = (FMOD::Channel*)channel;
	pChannel->setUserData(NULL);
	pChannel->setCallback(NULL);
	activeSounds.erase(channel);
}
开发者ID:AquariaOSE,项目名称:Aquaria,代码行数:7,代码来源:SoundManager.cpp


示例8: playEnvironment

	int Game::playEnvironment()
	{
			bool soundDone=false;
			FMOD::System* system;
			FMOD_RESULT result = FMOD::System_Create(&system);
			system->init(32, FMOD_INIT_NORMAL, NULL);
			FMOD::Sound* sound;
			
			result = system->createSound("Ocean.WAV",FMOD_LOOP_NORMAL,NULL, &sound);
			FMOD::Channel* channel = 0;
			bool pauseSound = false;


			channel->isPlaying(&pauseSound);

			result = system->playSound(FMOD_CHANNEL_FREE, sound,false, &channel);
			soundDone=true;


			while (soundDone!=true)
			{
			channel->setPaused(false);
			system->update();

			result = sound->release();
			result = system->close();
			result = system->release();
			}
			return 0;
	}
开发者ID:Acularius,项目名称:Pixel-Brother,代码行数:30,代码来源:Game.cpp


示例9: channelCallback

static FMOD_RESULT F_CALLBACK channelCallback(FMOD_CHANNEL* chanPtr,
                                              FMOD_CHANNEL_CALLBACKTYPE type,
                                              void* /*commanddata1*/,
                                              void* /*commanddata2*/)
{
    FMOD::Channel *channel = reinterpret_cast<FMOD::Channel*>(chanPtr);
    sfxbuffer_t *buf = 0;

    switch(type)
    {
    case FMOD_CHANNEL_CALLBACKTYPE_END:
        // The sound has ended, mark the channel.
        channel->getUserData(reinterpret_cast<void**>(&buf));
        if(buf)
        {
            DSFMOD_TRACE("channelCallback: sfxbuffer " << buf << " stops.");
            buf->flags &= ~SFXBF_PLAYING;
            // The channel becomes invalid after the sound stops.
            bufferInfo(buf).channel = 0;
        }
        channel->setCallback(0);
        channel->setUserData(0);
        break;

    default:
        break;
    }
    return FMOD_OK;
}
开发者ID:cmbruns,项目名称:Doomsday-Engine,代码行数:29,代码来源:fmod_sfx.cpp


示例10: update

void SoundEngine::update()
{
    if (system)
    {
        system->update();
        
        // ---
        
        vector<Event> completedEvents;
        
        for (auto &it : playingEffects)
        {
            int playingId = it.first;
            int channelId = it.second.first;
            EffectRef effect = it.second.second;
            
            FMOD::Channel *channel;
            system->getChannel(channelId, &channel);
            
            bool playing;
            channel->isPlaying(&playing);
            
            if (!playing)
            {
                completedEvents.emplace_back(EVENT_COMPLETED, effect, channelId, playingId);
            }
        }
        
        for (auto event : completedEvents)
        {
            playingEffects.erase(event.playingId);
            processEvent(event);
        }
    }
}
开发者ID:femmebot,项目名称:new-chronotext-toolkit,代码行数:35,代码来源:SoundEngine.cpp


示例11: StopSoundChannel

bool cgFMODSoundPlayerImpl::StopSoundChannel( cgID channel )
{
	FMOD::Channel * pkChannel = m_pkChannelStorage->Remove(channel);
	if (!pkChannel)
		return false;

	return pkChannel->stop();
}
开发者ID:cgcoolgame,项目名称:cg,代码行数:8,代码来源:cgFMODSoundPlayerImpl.cpp


示例12: isSourcePlaying

bool MCFMODSourceManager::isSourcePlaying(unsigned int SourceIndex)
{
   FMOD::Channel* fmodChannel = reinterpret_cast<FMOD::Channel*>(sSources[SourceIndex].Source);
   bool bChannelPlaying;

   fmodChannel->isPlaying(&bChannelPlaying);

   return bChannelPlaying;
}
开发者ID:arturocepeda,项目名称:Modus,代码行数:9,代码来源:mxsoundgenfmod.cpp


示例13: dead

void SoundEngine::dead(int playerId) {
	Player* player = dynamic_cast<Player*>(Globals::gameObjects.playerMap[playerId]);
	FMOD::Channel* channel = nullptr;
	glm::vec3 pos = player->getPosition();
	FMOD_VECTOR position = { pos.x, pos.y, pos.z };
	result_ = system_->playSound(deadSound_, 0, true, &channel);
	result_ = channel->set3DAttributes(&position, 0);
	result_ = channel->setPaused(false);
}
开发者ID:Atyansh,项目名称:deerstalker,代码行数:9,代码来源:SoundEngine.cpp


示例14: linkSound

void SoundHolder::linkSound(void *channel)
{
	if (!channel)
		return;
	FMOD::Channel *pChannel = (FMOD::Channel*)channel;
	pChannel->setUserData(this);
	pChannel->setCallback(s_soundHolderCallback);
	activeSounds.insert(channel);
}
开发者ID:AquariaOSE,项目名称:Aquaria,代码行数:9,代码来源:SoundManager.cpp


示例15: continueSound

//¼ÌÐøÉùÒô
bool SoundManager::continueSound(int *channelIndex)
{
	FMOD::Channel* channel;
	if (!channelIndex || *channelIndex == INVALID_SOUND_CHANNEL)
		return false;
	system->getChannel(*channelIndex, &channel);
	channel->setPaused(false);
	return true;
}
开发者ID:whztt07,项目名称:Ninth-World,代码行数:10,代码来源:SoundManager.cpp


示例16: setVolume

//ÉèÖÃÒôÁ¿
bool SoundManager::setVolume(float volume, int *channelIndex)
{
	FMOD::Channel* channel;
	if (!channelIndex || *channelIndex == INVALID_SOUND_CHANNEL)
		return false;

	system->getChannel(*channelIndex, &channel);
	channel->setVolume(volume);
	return true;
}
开发者ID:whztt07,项目名称:Ninth-World,代码行数:11,代码来源:SoundManager.cpp


示例17: SetVolume

bool cgFMODSoundPlayerImpl::SetVolume( cgID channel, float fVolume )
{
	FMOD::Channel * pkChannel = m_pkChannelStorage->Find(channel);
	if (!pkChannel)
		return false;

	pkChannel->setVolume(fVolume);

	return true;
}
开发者ID:cgcoolgame,项目名称:cg,代码行数:10,代码来源:cgFMODSoundPlayerImpl.cpp


示例18: PlayHit

void FmodSoundEngine::PlayHit(float factor)
{
	FMOD::Channel *channel;
	system->playSound(hitWav, NULL, false, &channel);
	float vol = systemIni.sndVolume*(0.5f+factor*0.25f);
	channel->setVolume(min(1.0f,vol)*defaultVolume);
	//channel->setPaused(false);
	//ERRCHECK(result);
	//ERRCHECK(result);
}
开发者ID:xuancong84,项目名称:ProjectDIVA,代码行数:10,代码来源:SoundEngine.cpp


示例19: setFinishCallback

void AudioEngineImpl::setFinishCallback(int audioID, const std::function<void (int, const std::string &)> &callback){
 try{
    FMOD::Channel * channel = mapChannelInfo[audioID].channel;
    mapChannelInfo[audioID].callback = callback; 
    FMOD_RESULT result = channel->setCallback(channelCallback);
    ERRCHECK(result);
    }catch(const std::out_of_range& oor){
      printf("AudioEngineImpl::setFinishCallback: invalid audioID: %d\n", audioID);
  }
};
开发者ID:1414648814,项目名称:AStar-Cocos2dx,代码行数:10,代码来源:AudioEngine-linux.cpp


示例20:

void SoundManager::Set3DMinMaxDistance(int channelIndex, float minDistance, float maxDistance) {
    FMOD_RESULT result;
    FMOD::Channel *channel;

    if (channelIndex == INVALID_SOUND_CHANNEL)
        return;

    result = system->getChannel(channelIndex, &channel);
    if (result == FMOD_OK)
        channel->set3DMinMaxDistance(minDistance, maxDistance);
}
开发者ID:DaHoC,项目名称:ogrefps,代码行数:11,代码来源:SoundManager.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ fmod::DSP类代码示例发布时间:2022-05-31
下一篇:
C++ flycapture2::Error类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap