Changeset View
Changeset View
Standalone View
Standalone View
source/soundmanager/scripting/SoundGroup.cpp
/* Copyright (C) 2015 Wildfire Games. | /* Copyright (C) 2017 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 29 Lines | |||||
#include "soundmanager/items/ISoundItem.h" | #include "soundmanager/items/ISoundItem.h" | ||||
#include "soundmanager/SoundManager.h" | #include "soundmanager/SoundManager.h" | ||||
#include <algorithm> | #include <algorithm> | ||||
extern CGame *g_Game; | extern CGame *g_Game; | ||||
#define PI 3.14126f | #define PI 3.14126f | ||||
Imarok: As noticed by bb, this should set to something sane like 3.14159f | |||||
vladislavbelovUnsubmitted Not Done Inline ActionsIns't better to have const float PI = ... or even use boost/cmath PI? vladislavbelov: Ins't better to have const float PI = ... or even use boost/cmath PI? | |||||
ImarokUnsubmitted Not Done Inline Actionstrue. Imarok: true.
(but everything is better than defining PI to the wrong number ;) | |||||
leperAuthorUnsubmitted Not Done Inline Actionscmath does not define pi, well it might do, but it isn't required to define it. Most implementations have M_PI because POSIX says that they should. MSVC has it hidden behind some define. I guess just defining it to something sane as another patch would be nice. leper: cmath does not define pi, well it might do, but it isn't required to define it. Most… | |||||
ImarokUnsubmitted Not Done Inline ActionsSounds good. Imarok: Sounds good. | |||||
StanUnsubmitted Not Done Inline ActionsSee patch(es) in above comment. Stan: See patch(es) in above comment. | |||||
leperAuthorUnsubmitted Not Done Inline Actions
Then again why those casts for M_PI? Also why not 0.f? leper: > [...] another patch [...]
Then again why those casts for M_PI? Also why not 0.f? | |||||
static const bool DISABLE_INTENSITY = true; // disable for now since it's broken | |||||
void CSoundGroup::SetGain(float gain) | void CSoundGroup::SetGain(float gain) | ||||
{ | { | ||||
gain = std::min(gain, 1.0f); | gain = std::min(gain, 1.0f); | ||||
m_Gain = gain; | m_Gain = gain; | ||||
} | } | ||||
void CSoundGroup::SetDefaultValues() | void CSoundGroup::SetDefaultValues() | ||||
{ | { | ||||
Show All 10 Lines | void CSoundGroup::SetDefaultValues() | ||||
m_PitchLower = 0.9f; | m_PitchLower = 0.9f; | ||||
m_GainUpper = 1.0f; | m_GainUpper = 1.0f; | ||||
m_GainLower = 0.8f; | m_GainLower = 0.8f; | ||||
m_ConeOuterGain = 0.0f; | m_ConeOuterGain = 0.0f; | ||||
m_ConeInnerAngle = 360.0f; | m_ConeInnerAngle = 360.0f; | ||||
m_ConeOuterAngle = 360.0f; | m_ConeOuterAngle = 360.0f; | ||||
m_Decay = 3.0f; | m_Decay = 3.0f; | ||||
m_IntensityThreshold = 3; | m_IntensityThreshold = 3; | ||||
// WARNING: m_TimeWindow is currently unused and uninitialized | |||||
} | } | ||||
CSoundGroup::CSoundGroup() | CSoundGroup::CSoundGroup() | ||||
{ | { | ||||
SetDefaultValues(); | SetDefaultValues(); | ||||
} | } | ||||
CSoundGroup::CSoundGroup(const VfsPath& pathnameXML) | CSoundGroup::CSoundGroup(const VfsPath& pathnameXML) | ||||
▲ Show 20 Lines • Show All 339 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
As noticed by bb, this should set to something sane like 3.14159f