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


C++ Sound::set3DMinMaxDistance方法代码示例

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


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

示例1:

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

示例2: getSound

FMOD::Sound* Sltn::getSound(const char* ptr)
{
    string str(ptr);

    // Check if the sound is already loaded
    std::map<std::string, FMOD::Sound*>::const_iterator it = m_Sounds.find(str); //map<string,sf::Texture>::const_iterator
    if (it != m_Sounds.end()) return (*it).second;

    // We don't wan't' fmod to concern about errors
    if (!FileExists(str)) {
        cerr << "File sound not found: " << str << "\n";
        return nullptr;
    }

    // Realy load the stuff:
    FMOD_RESULT      result;
    FMOD::Sound* pSound;
    result = system->createSound(Common_MediaPath(ptr), FMOD_3D, 0, &pSound);
    ERRCHECK(result);
    result = pSound->set3DMinMaxDistance(0.5f * FMOD_DistanceFactor, 5000.0f * FMOD_DistanceFactor);
    ERRCHECK(result);
    // result = ptr->setMode(FMOD_LOOP_NORMAL);
    // ERRCHECK(result);

    m_Sounds.insert(std::pair<std::string, FMOD::Sound*>(str, pSound));
    return pSound;
}
开发者ID:EmileSonneveld,项目名称:SpaceGame,代码行数:27,代码来源:sltn.cpp

示例3: TDSFX

//Method for loading 3D SFX
TDSFX* AudioManager::load3D(string filename, string name, Position* position, FMOD::System *system){
	FMOD::Sound *sound;

	FMOD_RESULT result = system->createSound(filename.c_str(), FMOD_3D, 0, &sound);

	checkProblem(result);

	result = sound->set3DMinMaxDistance(0.5f * DISTANCE_FACTOR, 5000.0f * DISTANCE_FACTOR);

	checkProblem(result);

	TDSFX *sound2 = new TDSFX(name, sound, position);

	return sound2;
}
开发者ID:Jbtyson,项目名称:EmawEngine,代码行数:16,代码来源:AudioManager.cpp

示例4: ERRCHECK

FMOD::Sound* AudioManager::PlaySound3D(FMOD::Channel** pChannel, const char* filename, vec3 position, bool looping, bool stream)
{
    if (m_audioEnabled)
    {
        FMOD::Sound* sound;
        *pChannel = NULL;
        FMOD::ChannelGroup *channelGroup = NULL;

        if (stream)
        {
            m_FMODResult = m_FMODSystem->createStream(filename, FMOD_DEFAULT | FMOD_3D, 0, &sound);
        }
        else
        {
            m_FMODResult = m_FMODSystem->createSound(filename, FMOD_DEFAULT | FMOD_3D, 0, &sound);
        }
        ERRCHECK(m_FMODResult);

        float distanceFactor = 1.0f;
        m_FMODResult = sound->set3DMinMaxDistance(1.0f * distanceFactor, 300.0f * distanceFactor);
        ERRCHECK(m_FMODResult);

        m_FMODResult = sound->setMode(looping == true ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF);
        ERRCHECK(m_FMODResult);

        m_FMODResult = m_FMODSystem->playSound(sound, channelGroup, false, pChannel);
        ERRCHECK(m_FMODResult);

        FMOD_VECTOR pos = { position.x, position.y, position.z };
        FMOD_VECTOR vel = { 0.0f, 0.0f, 0.0f };

        m_FMODResult = (*pChannel)->set3DAttributes(&pos, &vel);
        ERRCHECK(m_FMODResult);

        return sound;
    }

    return NULL;
}
开发者ID:AlwaysGeeky,项目名称:Vox,代码行数:39,代码来源:AudioManager.cpp

示例5:

SkySound* KSoundManager::play3DSound(std::string name, float volume, float x, float y, float z, bool loop, float fallOffStart, float delay)
{
	if(mSilent) return NULL;
	if ("" == name) return NULL;
	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);
	bool delayed = (delay > 0);
	mSystem->playSound(FMOD_CHANNEL_FREE, sound, delayed, &soundChannel);

	FMOD_VECTOR pos = {x, y, z};
	FMOD_VECTOR vel = {0, 0, 0};
	soundChannel->setVolume(volume);
	soundChannel->set3DAttributes(&pos, &vel);
	mSystem->update();
	
	//if this sound is delayed, queue it up
	if(delayed)
	{
		DelayedSound s;
		s.delay = delay;
		s.sound = soundChannel;
		mDelayedSounds.push_back(s);
	}
	return soundChannel;
}
开发者ID:allegrocm,项目名称:Falcon,代码行数:37,代码来源:KSoundManager.cpp


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