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


C++ ISound类代码示例

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


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

示例1: switch

void AudioDevice::playSound2D(const std::string& soundfile, SoundType type) {
    if ((m_engine != NULL) && ! soundfile.empty()) {
        FileSystem::markFileUsed(soundfile);

        const bool loop = (type == MUSIC);
        ISound* sound = m_engine->play2D(soundfile.c_str(), loop, START_PAUSED, RETURN_REFERENCE);

        switch (type) {
        case MUSIC:
            sound->setVolume(m_musicVolume * MUSIC_VOLUME_CONSTANT);
            if (m_music) {
                // Stop the previous music and replace it with this
                m_music->stop();
                m_music->drop();
            }
            m_music = sound;
            sound->setIsPaused(false);
            break;

        case UI:
            sound->setVolume(m_uiVolume * UI_VOLUME_CONSTANT);
            sound->setIsPaused(false);
            sound->drop();
            break;

        case EFFECT:
            sound->setVolume(m_effectVolume * EFFECT_VOLUME_CONSTANT);
            sound->setPlaybackSpeed(speedAdjust(m_timeScaleAtListener));
            sound->setIsPaused(false);
            sound->drop();
            break;
        }
    }
}
开发者ID:jackpoz,项目名称:G3D-backup,代码行数:34,代码来源:AudioDevice.cpp

示例2: GetPreferredSound

    float CCE3SoundWrapper::GetPosition()
    {
        ISound* sound = GetPreferredSound();

        if ( sound )
        {
            unsigned int nSoundPos = sound->GetInterfaceExtended()->GetCurrentSamplePos( true );

            if ( nSoundPos )
            {
                // successfully got a position
                float fSoundPos = float( nSoundPos ) / MILLISECOND;

                // make loops possible so use float modulo with sync target end (loops in this FMOD integration don't reset position)
                float fEnd = m_pSyncTimesource->GetEnd();

                if ( fEnd >= VIDEO_EPSILON )
                {
                    bool bSeek = fSoundPos > fEnd;
                    fSoundPos = fmod( fSoundPos, fEnd );

                    if ( bSeek )
                    {
                        // if soundpos is beyond end then seek to normal starting position again
                        fSoundPos += m_pSyncTimesource->GetStart();
                        Seek( fSoundPos );
                    }
                }

                return fSoundPos;
            }
        }

        return -1;
    }
开发者ID:Aboutdept,项目名称:Plugin_Videoplayer,代码行数:35,代码来源:CCE3SoundWrapper.cpp

示例3: if

void MusicPlayer::AddSound(string filename) {
    IStreamingSoundResourcePtr resource = 
        ResourceManager<IStreamingSoundResource>::Create(filename);
	// ISoundResourcePtr resource =
    //     ResourceManager<ISoundResource>::Create(filename);
	ISound* sound = system->CreateSound(resource);
    
    // @todo: ugly cast only for testing
    if (sound->IsStereoSound()) {
        IMonoSound* left = ((IStereoSound*)sound)->GetLeft();
        left->SetRelativePosition(true);
        left->SetPosition(Vector<3,float>(-10.0,0.0,0.0));
        
        IMonoSound* right = ((IStereoSound*)sound)->GetRight();
        right->SetRelativePosition(true);
        right->SetPosition(Vector<3,float>(10.0,0.0,0.0));
    }
    else if (sound->IsMonoSound()) {
        IMonoSound* mono = ((IMonoSound*)sound);
        mono->SetRelativePosition(true);
        mono->SetPosition(Vector<3,float>(0.0,0.0,0.0));
    }
    
    playlist.push_back((ISound*) sound);
    sound->SetGain(gain);

    // if we are playing the last number and insert a new
    // one, then update which number should be next
    nextTrackNumber = NextNumber();

    //@todo: set the sound to be relative to the listener i openal
}
开发者ID:OpenEngineDK,项目名称:extensions-MusicPlayer,代码行数:32,代码来源:MusicPlayer.cpp

示例4: if

//------------------------------------------------------------------------
void CProjectile::WhizSound(bool enable, const Vec3 &pos, const Vec3 &dir)
{
	if(enable)
	{
		if(!m_pAmmoParams->pWhiz)
			return;

		ISound *pSound=gEnv->pSoundSystem->CreateSound(m_pAmmoParams->pWhiz->sound, FLAG_SOUND_DEFAULT_3D|FLAG_SOUND_SELFMOVING);

		if(pSound)
		{
			m_whizSoundId = pSound->GetId();

			pSound->SetSemantic(eSoundSemantic_Projectile);
			pSound->SetPosition(pos);
			pSound->SetDirection(dir*m_pAmmoParams->pWhiz->speed);
			pSound->Play();
		}
	}
	else if(m_whizSoundId!=INVALID_SOUNDID)
	{
		ISound *pSound = gEnv->pSoundSystem->GetSound(m_whizSoundId);

		// only stop looping sounds and oneshots does not get cut when hitting a surface
		if(pSound && pSound->GetFlags() & FLAG_SOUND_LOOP)
			pSound->Stop();

		m_whizSoundId=INVALID_SOUNDID;
	}
}
开发者ID:Hellraiser666,项目名称:CryGame,代码行数:31,代码来源:Projectile.cpp

示例5:

    ISound* CCE3SoundWrapper::GetPreferredSound()
    {
        // Return last preferred sound if he is still consistent, else search a new one
        ISound* pPreferredSound = NULL;
        ISound* pFallbackSound = NULL; // better then nothing...

        // last preferred source still there?
        if ( gEnv && gEnv->pSoundSystem )
        {
            pPreferredSound = gEnv->pSoundSystem->GetSound( m_nPreferredDataSource );
        }

        // is his playback state still consistent?
        if ( pPreferredSound && pPreferredSound->IsLoaded() && pPreferredSound->IsInitialized() && PLAYSTATE_CONSISTENT( pPreferredSound ) )
        {
            goto success;
        }

        // If not the check the 2d sound
        if ( Is2DSoundActive() && PLAYSTATE_CONSISTENT( m_p2DSound ) )
        {
            m_nPreferredDataSource = m_p2DSound->GetId();
            pPreferredSound = m_p2DSound;
            goto success;
        }

        pFallbackSound = m_p2DSound; // better then nothing...

        // Or one from the proxies
        for ( tEntitySoundProxyMap::iterator iterSound = m_SoundProxies.begin(); iterSound != m_SoundProxies.end(); ++iterSound )
        {
            if ( iterSound->second.IsActive() && PLAYSTATE_CONSISTENT( iterSound->second.GetSound() ) )
            {
                pPreferredSound = iterSound->second.GetSound();
                m_nPreferredDataSource = pPreferredSound->GetId();

                goto success;
            }

            // better then nothing...
            if ( !pFallbackSound && iterSound->second.IsExisting() )
            {
                pFallbackSound = iterSound->second.GetSound();
            }
        }

        // if nothing reliable was found
        m_nPreferredDataSource = INVALID_SOUNDID;

        if ( pFallbackSound )
        {
            return pFallbackSound;
        }

        return NULL;
success:
        // RefreshMaxDuration( pPreferredSound );
        return pPreferredSound;
    }
开发者ID:Aboutdept,项目名称:Plugin_Videoplayer,代码行数:59,代码来源:CCE3SoundWrapper.cpp

示例6: applyRocketsMoves

void Game::applyRocketsMoves()
{
	// Fly thier ways
	rockets->fly(timer.delta);
	effects->drawRocketUpEffect(timer.delta);
	effects->drawRocketDownEffect(timer.delta);
	
	// Getting all nodes rockets hited & indecies for rockets
	array<u32> *Findecies, *Eindecies;
	Findecies = new array<u32>();
	Eindecies = new array<u32>();
	array<ISceneNode *> nodes = rockets->checkRockets(Findecies, Eindecies);
	effects->deleteRocketUp(Findecies);
	effects->deleteRocketDown(Eindecies);

	for (u32 i = 0; i < nodes.size(); i++)
	{
		vector3df pos = IDLE_VECTOR;

		// Checking fot fighter damage and death
		if (nodes[i] == fighter->getNode())
		{
			fighter->damage(FIGHTER_DAMAGE);
			if (fighter->isDead())
			{
				if (soundPlay)
				{
					ISound *bang = sound->play2D("sounds/bang.wav", false, true);
					bang->setVolume(0.1f);
					bang->setIsPaused(false);
					bang->drop();
				}
				state = OVER;
				engine->hideCursor(false);
				drop();
				gui->lose(engine->getGUI(), texManager);
				return;
			}
		}

		// Checking for enemies damage and death
		else if (enemies->checkNode(nodes[i], engine->getManager(), &score, sound, soundPlay, &pos))
		{
			state = OVER;
			engine->hideCursor(false);
			drop();
			gui->win(engine->getGUI(), texManager);
			return;
		}

		if (pos != vector3df(IDLE_VECTOR))
			effects->addDeath(engine->getManager(), texManager->getEffectsTexture()[0], pos);
	}

	// Refrashing score and health
	gui->setScore(score);
	if (!fighter->isDead())
		gui->setHealth(fighter->getHealth());
}
开发者ID:getNick,项目名称:test,代码行数:59,代码来源:Game.cpp

示例7: Update

//------------------------------------------------------------------------
void CScan::Update(float frameTime, uint32 frameId)
{
	if (m_scanning && m_pWeapon->IsClient())
	{
		if (m_delayTimer>0.0f)
		{
			m_delayTimer -= frameTime;
			if (m_delayTimer>0.0f)
				return;

			m_delayTimer = 0.0f;

			int slot = m_pWeapon->GetStats().fp ?  eIGS_FirstPerson :  eIGS_ThirdPerson;
			int id = m_pWeapon->GetStats().fp ? 0 : 1;

			m_scanLoopId=m_pWeapon->PlayAction(m_scanactions.scan, 0, true, CItem::eIPAF_Default|CItem::eIPAF_CleanBlending);
			ISound *pSound = m_pWeapon->GetSoundProxy()->GetSound(m_scanLoopId);
			if (pSound)
				pSound->GetInterfaceDeprecated()->SetLoopMode(true);
		}

		if(m_delayTimer==0.0f)
		{
			if(m_tagEntitiesDelay>0.0f)
			{
				m_tagEntitiesDelay-=frameTime;
				if(m_tagEntitiesDelay<=0.0f)
				{
					m_tagEntitiesDelay = 0.0f;

					//Here is when entities are displayed on Radar
					if(gEnv->pGame->GetIGameFramework()->GetClientActor() == m_pWeapon->GetOwnerActor())
					{
						if(gEnv->bServer)
							NetShoot(ZERO, 0);
						else
							m_pWeapon->RequestShoot(0, ZERO, ZERO, ZERO, ZERO, 1.0f, 0, false);
					}
				}
			}

			if (m_durationTimer>0.0f)
			{
				m_durationTimer-=frameTime;
				if (m_durationTimer<=0.0f)
				{
					m_durationTimer=0.0f;	
					StopFire();
					//m_pWeapon->RequestShoot(0, ZERO, ZERO, ZERO, ZERO, 1.0f, 0, false);
				}
			}
		}

		m_pWeapon->RequireUpdate(eIUS_FireMode);
	}
}
开发者ID:Adi0927,项目名称:alecmercer-origins,代码行数:57,代码来源:Scan.cpp

示例8: NetStartFire

//------------------------------------------------------------------------
void CScan::NetStartFire()
{
	if (!m_pWeapon->IsClient())
		return;

	m_scanLoopId=m_pWeapon->PlayAction(m_scanactions.scan);
	ISound *pSound = m_pWeapon->GetSoundProxy()->GetSound(m_scanLoopId);
	if (pSound)
		pSound->GetInterfaceDeprecated()->SetLoopMode(true);
}
开发者ID:Adi0927,项目名称:alecmercer-origins,代码行数:11,代码来源:Scan.cpp

示例9: UpdateSound

//------------------------------------------------------------------------
void CRapid::UpdateSound(float frameTime)
{
	if (m_speed >= 0.00001f)
	{
		if (m_soundId == INVALID_SOUNDID)
		{
			m_soundId = m_pWeapon->PlayAction(m_pShared->rapidactions.rapid_fire, 0, true, CItem::eIPAF_Default & (~CItem::eIPAF_Animation));
		}

		if (m_soundId != INVALID_SOUNDID)
		{
			float rpm_scale = m_speed / m_pShared->rapidparams.min_speed;
			float ammo = 0;

			if (!OutOfAmmo())
			{
				ammo = 1.0f;
			}

			ISound *pSound = m_pWeapon->GetISound(m_soundId);

			if (pSound)
			{
				if (g_pGameCVars->i_debug_sounds)
				{
					float color[] = {1, 1, 1, 0.5};
					gEnv->pRenderer->Draw2dLabel(150, 500, 1.3f, color, false, "%s rpm_scale: %.2f", m_pWeapon->GetEntity()->GetName(), rpm_scale);
				}

				pSound->SetParam("rpm_scale", rpm_scale, false);
				pSound->SetParam("ammo", ammo, false);

				//Sound variations for FY71 (AI most common weapon)
				if(m_pShared->fireparams.sound_variation && !m_pWeapon->IsOwnerFP())
				{
					pSound->SetParam("variations", m_soundVariationParam, true);
				}
			}

			if (m_speed >= m_pShared->rapidparams.min_speed)
			{
				m_spinUpSoundId = INVALID_SOUNDID;
			}
		}
	}
	else if (m_soundId != INVALID_SOUNDID)
	{
		m_pWeapon->StopSound(m_soundId);
		m_soundId = INVALID_SOUNDID;
	}
}
开发者ID:Oliverreason,项目名称:bare-minimum-cryengine3,代码行数:52,代码来源:Rapid.cpp

示例10: if

void Entity::Knockback(Vector3 dir)
{
	kbVelocity.x += dir.x;
	if (velocity.y <= 0)
		velocity.y += 5;
	kbVelocity.z += dir.z;

	vector<char*> soundFileName;

	if (entityID == HORSE)
	{
		soundFileName.push_back("Assets/Media/Damage/horseCry1.mp3");
		soundFileName.push_back("Assets/Media/Damage/horseCry2.mp3");
		soundFileName.push_back("Assets/Media/Damage/horseCry3.mp3");
		soundFileName.push_back("Assets/Media/Damage/horseCry4.mp3");
	}
	//else if (entityID == SENTRY || entityID == ENEMY_2 || entityID == ENEMY_3)
	//{
	//	// Enemy Kenna Hit Sound
	//	soundFileName.push_back("Assets/Media/Damage/enemyCry1.mp3");
	//	soundFileName.push_back("Assets/Media/Damage/enemyCry2.mp3");
	//	soundFileName.push_back("Assets/Media/Damage/enemyCry3.mp3");
	//}
	else if (entityID == WOLF)
	{
		// Wolf Kenna Hit Sound
		soundFileName.push_back("Assets/Media/Damage/wolfCry1.mp3");
		soundFileName.push_back("Assets/Media/Damage/wolfCry2.mp3");
		soundFileName.push_back("Assets/Media/Damage/wolfCry3.mp3");
	}
	else
	{
		soundFileName.push_back("Assets/Media/Damage/hit1.mp3");
		soundFileName.push_back("Assets/Media/Damage/hit2.mp3");
		soundFileName.push_back("Assets/Media/Damage/hit3.mp3");
	}

	ISound* sound = engine->play3D(soundFileName[rand() % soundFileName.size()], vec3df(position.x, position.y, position.z), false, true);
	if (sound)
	{
		sound->setVolume(1.f);
		sound->setIsPaused(false);
	}

	health -= dir.LengthSquared() * 0.01f;
	if (health < 1)
		health = 0;
}
开发者ID:Dopelust,项目名称:SP3-13,代码行数:48,代码来源:Entity.cpp

示例11: g3dToirrKlang

void AudioDevice::playSound3D(const std::string& soundfile, const Point3& wsPosition, const Vector3& wsVelocity, const float timeScale) {
    if ((m_engine != NULL) && ! soundfile.empty()) {
        FileSystem::markFileUsed(soundfile);

        ISound* sound = m_engine->play3D(soundfile.c_str(), g3dToirrKlang(wsPosition), 
                                         ! PLAY_LOOPED, START_PAUSED, RETURN_REFERENCE);

        if (sound) {
            // Distance at which the sound plays at "full" volume
            sound->setMinDistance(200.0f);
            sound->setVelocity(g3dToirrKlang(wsVelocity * timeScale));
            sound->setVolume(m_effectVolume * EFFECT_3D_VOLUME_CONSTANT);

            m_active3D.append(sound);

            if (timeScale != 1.0f) {
                sound->setPlaybackSpeed(speedAdjust(m_timeScaleAtListener));
            }

            // Start playing the sound
            sound->setIsPaused(false);

            // Don't drop the reference; we're holding it in m_active3D
        }
    }
}
开发者ID:jackpoz,项目名称:G3D-backup,代码行数:26,代码来源:AudioDevice.cpp

示例12: TacWarning

int CScriptBind_HUD::TacWarning(IFunctionHandler *pH)
{
	CHUD *pHUD = g_pGame->GetHUD();
	if (!pHUD)
		return pH->EndFunction();
	std::vector<CHUDRadar::RadarEntity> buildings = *(pHUD->GetRadar()->GetBuildings());
	for(int i = 0; i < buildings.size(); ++i)
	{
		IEntity *pEntity = gEnv->pEntitySystem->GetEntity(buildings[i].m_id);
		if(!stricmp(pEntity->GetClass()->GetName(), "HQ"))
		{
			Vec3 pos = pEntity->GetWorldPos();
			pos.z += 10;
			ISound *pSound = gEnv->pSoundSystem->CreateSound("sounds/interface:multiplayer_interface:mp_tac_alarm_ambience", FLAG_SOUND_3D);
			if(pSound)
			{
				pSound->SetPosition(pos);
				pSound->Play();
			}
		}
	}
	return pH->EndFunction();
}
开发者ID:RenEvo,项目名称:dead6,代码行数:23,代码来源:ScriptBind_HUD.cpp

示例13: RicochetSound

//------------------------------------------------------------------------
void CProjectile::RicochetSound(const Vec3 &pos, const Vec3 &dir)
{
	if (!m_pAmmoParams->pRicochet)
		return;

	ISound *pSound = gEnv->pSoundSystem->CreateSound(m_pAmmoParams->pRicochet->sound, FLAG_SOUND_DEFAULT_3D|FLAG_SOUND_SELFMOVING);
	if (pSound)
	{
		pSound->GetId();
		pSound->SetSemantic(eSoundSemantic_Projectile);
		pSound->SetPosition(pos);
		pSound->SetDirection(dir*m_pAmmoParams->pRicochet->speed);
		pSound->Play();
	}
}
开发者ID:nhnam,项目名称:Seasons,代码行数:16,代码来源:Projectile.cpp

示例14: PlaySound

// add enum of sound you want to play, and add command to game code at appropiate spot
void CGameAudio::PlaySound(EGameAudioSounds eSound, IEntity *pEntity, float param, bool stopSound)
{
	int soundFlag = 0; //localActor will get 2D sounds
	ESoundSemantic eSemantic = eSoundSemantic_None;
	ISound *pSound = NULL;
	bool	setParam = false;
	static string soundName;
	soundName.resize(0);

	switch(eSound)
	{
	case EGameAudioSound_NOSOUND:
		break;

	case EGameAudioSound_LAST:
		break;

	default:
		break;
	}

	//if(!force3DSound && m_pOwner == m_pGameFramework->GetClientActor() && !m_pOwner->IsThirdPerson() && soundName.size())
	//{
	//	if (bAppendPostfix)
	//		soundName.append("_fp");
	//}

	IEntitySoundProxy *pSoundProxy = pEntity ? (IEntitySoundProxy *)pEntity->CreateProxy(ENTITY_PROXY_SOUND) : NULL;

	if(soundName.size() && eSound < EGameAudioSound_LAST)		//get / create or stop sound
	{
		if(m_sounds[eSound].ID != INVALID_SOUNDID)
		{
			if(pSoundProxy)
				pSound = pSoundProxy->GetSound(m_sounds[eSound].ID);
			else
				pSound = gEnv->pSoundSystem->GetSound(m_sounds[eSound].ID);

			if(stopSound)
			{
				if(pSound)
					pSound->Stop();

				m_sounds[eSound].ID = INVALID_SOUNDID;
				return;
			}
		}

		if(!pSound && !stopSound)
		{
			pSound = gEnv->pSoundSystem->CreateSound(soundName, soundFlag);

			if(pSound)
			{
				pSound->SetSemantic(eSemantic);
				//float fTemp = 0.0f;
				m_sounds[eSound].ID = pSound->GetId();
				m_sounds[eSound].bLooping = (pSound->GetFlags() & FLAG_SOUND_LOOP) != 0;
				m_sounds[eSound].b3D = (pSound->GetFlags() & FLAG_SOUND_3D) != 0;
				//m_sounds[eSound].nMassIndex = pSound->GetParam("mass", &fTemp, false);
				//m_sounds[eSound].nSpeedIndex = pSound->GetParam("speed", &fTemp, false);
				//m_sounds[eSound].nStrengthIndex = pSound->GetParam("strength", &fTemp, false);
			}
		}
	}

	if(pSound)		//set params and play
	{
		//pSound->SetPosition(m_pOwner->GetEntity()->GetWorldPos());

		if(setParam)
		{
			//if (m_sounds[eSound].nMassIndex != -1)
			//	pSound->SetParam(m_sounds[sound].nMassIndex, param);

			//if (m_sounds[eSound].nSpeedIndex != -1)
			//	pSound->SetParam(m_sounds[sound].nSpeedIndex, param);

			//if (m_sounds[eSound].nStrengthIndex != -1)
			//	pSound->SetParam(m_sounds[sound].nStrengthIndex, param);
		}

		if(!(m_sounds[eSound].bLooping && pSound->IsPlaying()))
		{
			if(pSoundProxy)
				pSoundProxy->PlaySound(pSound);
			else
				pSound->Play();
		}
	}
}
开发者ID:Hellraiser666,项目名称:CryGame,代码行数:92,代码来源:GameAudio.cpp

示例15: return

//------------------------------------------------------------------------
tSoundID CItem::PlayAction(const ItemString &actionName, int layer, bool loop, uint32 flags, float speedOverride)
{
	if(!m_enableAnimations || !IsOwnerInGame())
		return (tSoundID)-1;

	TActionMap::iterator it = m_sharedparams->actions.find(CONST_TEMPITEM_STRING(actionName));

	if(it == m_sharedparams->actions.end())
	{
//		GameWarning("Action '%s' not found on item '%s'!", actionName, GetEntity()->GetName());

		for(int i=0; i<eIGS_Last; i++)
		{
			m_animationTime[i]=0;
			m_animationSpeed[i]=1.0f;
			m_animationEnd[i]=0;
		}

		return 0;
	}

	bool fp = m_stats.fp;

	if(m_parentId)
	{
		CItem *pParent=static_cast<CItem *>(m_pItemSystem->GetItem(m_parentId));

		if(pParent)
			fp=pParent->GetStats().fp;
	}

	if(flags&eIPAF_ForceFirstPerson)
		fp = true;

	if(flags&eIPAF_ForceThirdPerson)
		fp = false;

	int sid=fp?eIGS_FirstPerson:eIGS_ThirdPerson;
	SAction &action = it->second;

	tSoundID result = INVALID_SOUNDID;

	if((flags&eIPAF_Sound) && !action.sound[sid].name.empty() && IsSoundEnabled() && g_pGameCVars->i_soundeffects)
	{
		int nSoundFlags = FLAG_SOUND_DEFAULT_3D;
		nSoundFlags |= flags&eIPAF_SoundStartPaused?FLAG_SOUND_START_PAUSED:0;
		IEntitySoundProxy *pSoundProxy = GetSoundProxy(true);

		//GetSound proxy from dualwield master if neccesary
		if(IsDualWieldSlave())
		{
			CItem *pMaster = static_cast<CItem *>(GetDualWieldMaster());

			if(pMaster)
			{
				pSoundProxy = pMaster->GetSoundProxy(true);
			}
		}

		EntityId pSkipEnts[3];
		int nSkipEnts = 0;

		// TODO for Marcio :)
		// check code changes

		// Skip the Item
		pSkipEnts[nSkipEnts] = GetEntity()->GetId();
		++nSkipEnts;

		// Skip the Owner
		if(GetOwner())
		{
			pSkipEnts[nSkipEnts] = GetOwner()->GetId();
			++nSkipEnts;
		}

		if(pSoundProxy)
		{

			TempResourceName name;
			FixResourceName(action.sound[sid].name, name, flags);
			//nSoundFlags = nSoundFlags | (fp?FLAG_SOUND_DEFAULT_3D|FLAG_SOUND_RELATIVE:FLAG_SOUND_DEFAULT_3D);
			Vec3 vOffset(0,0,0);

			if(fp)
				vOffset.x = 0.3f; // offset for first person weapon to the front

			if(!g_pGameCVars->i_staticfiresounds)
			{
				result = pSoundProxy->PlaySoundEx(name, vOffset, FORWARD_DIRECTION, nSoundFlags, 1.0f, 0, 0, eSoundSemantic_Weapon, pSkipEnts, nSkipEnts);
				ISound *pSound = pSoundProxy->GetSound(result);

				if(pSound && action.sound[sid].sphere>0.0f)
					pSound->SetSphereSpec(action.sound[sid].sphere);
			}
			else
			{
				SInstanceAudio *pInstanceAudio=0;

//.........这里部分代码省略.........
开发者ID:Hellraiser666,项目名称:CryGame,代码行数:101,代码来源:ItemResource.cpp


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