1
0
forked from 0ad/0ad

Remove trailing whitespace. Based on patch by otero, refs #3268.

This was SVN commit r17576.
This commit is contained in:
elexis 2015-12-31 11:45:13 +00:00
parent 8d9cfd66b8
commit f7a262fa4a
2 changed files with 22 additions and 28 deletions

View File

@ -19,8 +19,8 @@
* =========================================================================
* File : SoundGroup.cpp
* Project : 0 A.D.
* Description : Loads up a group of sound files with shared properties,
* and provides a simple interface for playing them.
* Description : Loads up a group of sound files with shared properties,
* and provides a simple interface for playing them.
* =========================================================================
*/
@ -112,9 +112,9 @@ float CSoundGroup::RadiansOffCenter(const CVector3D& position, bool& onScreen, f
float yBufferSize = 15;
const size_t audioWidth = screenWidth;
float radianCap = PI / 3;
g_Game->GetView()->GetCamera()->GetScreenCoordinates(position, x, y);
onScreen = true;
if (x < -bufferSize)
@ -162,7 +162,7 @@ void CSoundGroup::UploadPropertiesAndPlay(size_t theIndex, const CVector3D& posi
bool isOnscreen = false;
ALfloat initialRolllOff = 0.1f;
ALfloat itemRollOff = initialRolllOff;
float offSet = RadiansOffCenter(position, isOnscreen, itemRollOff);
bool shouldBePlayed = isOnscreen || TestFlag(eDistanceless) || TestFlag(eOmnipresent);
@ -195,7 +195,7 @@ void CSoundGroup::UploadPropertiesAndPlay(size_t theIndex, const CVector3D& posi
if (TestFlag(eDistanceless))
itemRollOff = 0;
if ( sndData->IsStereo() )
LOGWARNING("OpenAL: stereo sounds can't be positioned: %s", sndData->GetFileName().string8());
@ -235,7 +235,7 @@ void CSoundGroup::PlayNext(const CVector3D& position, entity_id_t source)
// if no sounds, return
if (filenames.size() == 0)
return;
m_index = rand(0, (size_t)filenames.size());
UploadPropertiesAndPlay(m_index, position, source);
}
@ -260,7 +260,7 @@ void CSoundGroup::Reload()
}
if (TestFlag(eRandOrder))
random_shuffle(snd_group.begin(), snd_group.end());
random_shuffle(snd_group.begin(), snd_group.end());
}
#endif // CONFIG2_AUDIO
}
@ -323,12 +323,11 @@ bool CSoundGroup::LoadSoundGroup(const VfsPath& pathnameXML)
LOGERROR("Invalid SoundGroup format (unrecognised root element '%s')", XeroFile.GetElementString(root.GetNodeName()).c_str());
return false;
}
XERO_ITER_EL(root, child)
{
int child_name = child.GetNodeName();
int child_name = child.GetNodeName();
if(child_name == el_gain)
{
SetGain(child.GetText().ToFloat());
@ -421,7 +420,6 @@ bool CSoundGroup::LoadSoundGroup(const VfsPath& pathnameXML)
m_Decay = child.GetText().ToFloat();
}
}
return true;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -19,15 +19,12 @@
* =========================================================================
* File : SoundGroup.h
* Project : 0 A.D.
* Description : Loads up a group of sound files with shared properties,
* and provides a simple interface for playing them.
* Description : Loads up a group of sound files with shared properties,
* and provides a simple interface for playing them.
* =========================================================================
*/
/*
Example usage:
Example SoundGroup.xml
<?xml version="1.0" encoding="utf-8"?>
<SoundGroup>
@ -46,7 +43,6 @@ Example SoundGroup.xml
<Sound>audio/voice/hellenes/soldier/Attack_Engagex.ogg</Sound>
<Sound>audio/voice/hellenes/soldier/Attack_ForMyFamily.ogg</Sound>
</SoundGroup>
*/
#ifndef INCLUDED_SOUNDGROUP_H
@ -105,7 +101,7 @@ public:
// Test flag, returns true if flag is set.
inline bool TestFlag(int flag) { return (m_Flags & flag) != 0; }
private:
void SetGain(float gain);
@ -114,7 +110,7 @@ private:
void SetDefaultValues();
size_t m_index; // index of the next sound to play
#if CONFIG2_AUDIO
std::vector<CSoundData*> snd_group; // we store the handles so we can load now and play later
#endif
@ -124,15 +120,15 @@ private:
float m_CurTime; // Time elapsed since soundgroup was created
float m_TimeWindow; // The Intensity Threshold Window
size_t m_IntensityThreshold; // the allowable intensity before a sound switch
size_t m_Intensity; // our current intensity(number of sounds played since m_CurTime - m_TimeWindow)
float m_Decay; //
size_t m_IntensityThreshold; // the allowable intensity before a sound switch
size_t m_Intensity; // our current intensity (number of sounds played since m_CurTime - m_TimeWindow)
float m_Decay;
unsigned char m_Flags; // up to eight individual parameters, use with eSndGrpFlags.
float m_Gain;
float m_Gain;
float m_Pitch;
float m_Priority;
float m_ConeOuterGain;
float m_ConeOuterGain;
float m_PitchUpper;
float m_PitchLower;
float m_GainUpper;