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


C++ IEntitySoundProxy::SetStaticSound方法代码示例

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


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

示例1: StopSound

//------------------------------------------------------------------------
void CItem::StopSound(tSoundID id)
{
	if(id == INVALID_SOUNDID)
		return;

	bool synchSound = false;
	IEntitySoundProxy *pSoundProxy = GetSoundProxy(false);

	if(pSoundProxy)
	{
		for(TInstanceActionMap::iterator it = m_instanceActions.begin(); it != m_instanceActions.end(); ++it)
		{
			SInstanceAction &action = it->second;

			for(int i=0; i<2; i++)
			{
				if(action.sound[i].id == id)
				{
					pSoundProxy->SetStaticSound(id, false);
					action.sound[i].id = INVALID_SOUNDID;
					synchSound = action.sound[i].synch;
					break;
				}
			}
		}

		if(synchSound)
			pSoundProxy->StopSound(id, ESoundStopMode_OnSyncPoint);
		else
			pSoundProxy->StopSound(id);
	}
}
开发者ID:Hellraiser666,项目名称:CryGame,代码行数:33,代码来源:ItemResource.cpp

示例2: ReleaseStaticSound

//------------------------------------------------------------------------
void CItem::ReleaseStaticSound(SInstanceAudio *sound)
{
	if (sound->id != INVALID_SOUNDID)
	{
		IEntitySoundProxy *pSoundProxy = GetSoundProxy(false);
		if (pSoundProxy)
		{
			pSoundProxy->SetStaticSound(sound->id, false);
			if(sound->synch)
				pSoundProxy->StopSound(sound->id,ESoundStopMode_OnSyncPoint);
			else
				pSoundProxy->StopSound(sound->id);
			sound->id = INVALID_SOUNDID;
#ifndef ITEM_USE_SHAREDSTRING
			sound->static_name.resize(0);
#else
			sound->static_name.reset();
#endif
		}
	}
}
开发者ID:kitnet,项目名称:project-o,代码行数:22,代码来源:ItemResource.cpp

示例3: Quiet

//------------------------------------------------------------------------
void CItem::Quiet()
{
	IEntitySoundProxy *pSoundProxy = GetSoundProxy(false);
	if (pSoundProxy)
	{
		for (TInstanceActionMap::iterator it = m_instanceActions.begin(); it != m_instanceActions.end(); ++it)
		{
			SInstanceAction &action = it->second;
			for (int i=0;i<2;i++)
			{
				if (action.sound[i].id != INVALID_SOUNDID)
				{
					pSoundProxy->SetStaticSound(action.sound[i].id, false);
					action.sound[i].id = INVALID_SOUNDID;
				}
			}
		}

		pSoundProxy->StopAllSounds();
	}
}
开发者ID:kitnet,项目名称:project-o,代码行数:22,代码来源:ItemResource.cpp

示例4: PlayAction


//.........这里部分代码省略.........
			else
			{
				SInstanceAudio *pInstanceAudio=0;

				if(action.sound[sid].isstatic)
				{
					TInstanceActionMap::iterator iit = m_instanceActions.find(CONST_TEMPITEM_STRING(actionName));

					if(iit == m_instanceActions.end())
					{
						std::pair<TInstanceActionMap::iterator, bool> insertion=m_instanceActions.insert(TInstanceActionMap::value_type(actionName, SInstanceAction()));
						pInstanceAudio=&insertion.first->second.sound[sid];
					}
					else
						pInstanceAudio=&iit->second.sound[sid];
				}

				if(pInstanceAudio && (pInstanceAudio->id != INVALID_SOUNDID) && (name != pInstanceAudio->static_name))
					ReleaseStaticSound(pInstanceAudio);

				if(!pInstanceAudio || pInstanceAudio->id == INVALID_SOUNDID)
				{
					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);
				}

				if(action.sound[sid].isstatic)
				{
					if(pInstanceAudio->id == INVALID_SOUNDID)
					{
						if(pSoundProxy->SetStaticSound(result, true))
						{
							pInstanceAudio->id = result;
							pInstanceAudio->static_name = name;
							pInstanceAudio->synch = action.sound[sid].issynched;
						}
					}
					else
					{
						ISound *pSound = pSoundProxy->GetSound(pInstanceAudio->id);

						if(pSound)
							pSound->Play(1.0, true, true, pSoundProxy);
					}
				}
			}

			if(gEnv->pAISystem && action.sound[sid].airadius > 0.0f)
			{
				EntityId ownerId = GetOwner() ? GetOwner()->GetId() : 0;

				// associate sound event with vehicle if the shooter is in a vehicle (tank cannon shot, etc)
				if(CActor *pOwnerActor = GetOwnerActor())
				{
					IVehicle *pOwnerVehicle = pOwnerActor->GetLinkedVehicle();

					if(pOwnerVehicle && pOwnerVehicle->GetEntityId())
						ownerId = pOwnerVehicle->GetEntityId();
				}

				SAIStimulus stim(AISTIM_SOUND, AISOUND_WEAPON, ownerId?ownerId:GetEntityId() , 0,
								 GetEntity()->GetWorldPos(), ZERO, action.sound[sid].airadius);
开发者ID:Hellraiser666,项目名称:CryGame,代码行数:66,代码来源:ItemResource.cpp


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