27 #include "precompiled.h"
54 gain = std::min(gain, 1.0f);
101 return float(
rand(min*100.0f, max*100.0f) / 100.0f);
103 #endif // CONFIG2_AUDIO
111 float bufferSize = screenWidth * 0.10;
112 float yBufferSize = 15;
113 const size_t audioWidth = screenWidth;
114 float radianCap =
PI / 3;
125 else if (x > screenWidth + bufferSize)
132 if ((x < 0) || (x > screenWidth))
136 float pixPerRadian = audioWidth / (radianCap * 2);
137 answer = (x - (screenWidth/2)) / pixPerRadian;
140 if (y < -yBufferSize)
144 else if (y > screenHeight + yBufferSize)
148 else if ((y < 0) || (y > screenHeight))
162 bool isOnscreen =
false;
163 ALfloat initialRolllOff = 0.1f;
164 ALfloat itemRollOff = initialRolllOff;
170 if ( !shouldBePlayed )
180 if ( sndData == NULL )
184 if ( hSound == NULL )
190 float sndDist = origin.
Y;
191 float itemDist = ( position - origin ).
Length();
193 if ( (sndDist * 2) < itemDist )
218 #else // !CONFIG2_AUDIO
222 #endif // !CONFIG2_AUDIO
251 for (
size_t i = 0; i <
filenames.size(); i++)
256 if (itemData == NULL)
265 #endif // CONFIG2_AUDIO
271 for (
size_t i = 0; i <
snd_group.size(); i++)
276 #endif // CONFIG2_AUDIO
292 #define EL(x) int el_##x = XeroFile.GetElementID(#x)
293 #define AT(x) int at_##x = XeroFile.GetAttributeID(#x)
330 int child_name = child.GetNodeName();
332 if(child_name == el_gain)
334 SetGain(child.GetText().ToFloat());
336 else if(child_name == el_looping)
338 if(child.GetText().ToInt() == 1)
341 else if(child_name == el_omnipresent)
343 if(child.GetText().ToInt() == 1)
346 else if(child_name == el_heardby)
348 if(child.GetText().FindInsensitive(
"owner" ) == 0 )
351 else if(child_name == el_distanceless)
353 if(child.GetText().ToInt() == 1)
356 else if(child_name == el_pitch)
358 this->
m_Pitch = child.GetText().ToFloat();
360 else if(child_name == el_priority)
364 else if(child_name == el_randorder)
366 if(child.GetText().ToInt() == 1)
369 else if(child_name == el_randgain)
371 if(child.GetText().ToInt() == 1)
374 else if(child_name == el_gainupper)
378 else if(child_name == el_gainlower)
382 else if(child_name == el_randpitch)
384 if(child.GetText().ToInt() == 1)
387 else if(child_name == el_pitchupper)
391 else if(child_name == el_pitchlower)
395 else if(child_name == el_conegain)
399 else if(child_name == el_coneinner)
403 else if(child_name == el_coneouter)
407 else if(child_name == el_sound)
409 this->
filenames.push_back(child.GetText().FromUTF8());
411 else if(child_name == el_path)
415 else if(child_name == el_threshold)
419 else if(child_name == el_decay)
421 m_Decay = child.GetText().ToFloat();
The container that holds the rules, resources and attributes of the game.
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
virtual void SetLocation(const CVector3D &position)=0
virtual void SetPitch(float pitch)=0
PSRETURN Load(const PIVFS &vfs, const VfsPath &filename)
Load from an XML file (with invisible XMB caching).
const PSRETURN PSRETURN_OK
ISoundManager * g_SoundManager
size_t m_IntensityThreshold
void UploadPropertiesAndPlay(size_t theIndex, const CVector3D &position, entity_id_t source)
const wchar_t * ErrorString(int err)
std::vector< std::wstring > filenames
#define XERO_ITER_EL(parent_element, child_element)
static void HandleError(const CStrW &message, const VfsPath &pathname, Status err)
virtual void SetCone(float innerCone, float outerCone, float coneGain)=0
void Update(float TimeSinceLastFrame)
static CSoundData * SoundDataFromFile(const VfsPath &itemPath)
virtual Path * GetFileName()
static float RandFloat(float min, float max)
float RadiansOffCenter(const CVector3D &position, bool &onScreen, float &itemRollOff)
bool LoadSoundGroup(const VfsPath &pathnameXML)
virtual void SetRollOff(float gain)=0
#define UNUSED2(param)
mark a function local variable or parameter as unused and avoid the corresponding compiler warning...
CMatrix3D & GetOrientation()
CSoundData * IncrementCount()
const String & string() const
CGame * g_Game
Globally accessible pointer to the CGame object.
void GetScreenCoordinates(const CVector3D &world, float &x, float &y) const
i64 Status
Error handling system.
std::string GetElementString(const int ID) const
std::vector< CSoundData * > snd_group
CGameView * GetView()
Get the pointer to the game view object.
const SViewPort & GetViewPort() const
XMBElement GetRoot() const
size_t rand(size_t min_inclusive, size_t max_exclusive)
return random integer in [min, max).
CVector3D GetTranslation() const
static float Length(const SVec3 v)
u32 entity_id_t
Entity ID type.
static void ReleaseSoundData(CSoundData *theData)
static const bool DISABLE_INTENSITY
void PlayNext(const CVector3D &position, entity_id_t source)