本文整理汇总了C++中ISound::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ ISound::GetFlags方法的具体用法?C++ ISound::GetFlags怎么用?C++ ISound::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISound
的用法示例。
在下文中一共展示了ISound::GetFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WhizSound
//------------------------------------------------------------------------
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;
}
}
示例2: 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();
}
}
}