| 1 |
/*************************************************************************** |
| 2 |
* Copyright (C) 2005-2019 by the FIFE team * |
| 3 |
* http://www.fifengine.net * |
| 4 |
* This file is part of FIFE. * |
| 5 |
* * |
| 6 |
* FIFE is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Lesser General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2.1 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 14 |
* Lesser General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Lesser General Public * |
| 17 |
* License along with this library; if not, write to the * |
| 18 |
* Free Software Foundation, Inc., * |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
| 20 |
***************************************************************************/ |
| 21 |
|
| 22 |
// Standard C++ library includes |
| 23 |
|
| 24 |
// Platform specific includes |
| 25 |
|
| 26 |
// 3rd party library includes |
| 27 |
|
| 28 |
// FIFE includes |
| 29 |
// These includes are split up in two parts, separated by one empty line |
| 30 |
// First block: files included from the FIFE root src directory |
| 31 |
// Second block: files included from the same folder |
| 32 |
#include "util/log/logger.h" |
| 33 |
#include "util/base/exception.h" |
| 34 |
|
| 35 |
#include "actionaudio.h" |
| 36 |
|
| 37 |
namespace FIFE { |
| 38 |
static Logger _log(LM_AUDIO); |
| 39 |
|
| 40 |
ActionAudio::ActionAudio() : |
| 41 |
m_name(""), |
| 42 |
m_group(""), |
| 43 |
m_volume(1.0), |
| 44 |
m_maxVolume(1.0), |
| 45 |
m_minVolume(0.0), |
| 46 |
m_refDistance(1.0), |
| 47 |
m_maxDistance(1000000.0), |
| 48 |
m_rolloff(1.0), |
| 49 |
m_pitch(1.0), |
| 50 |
m_coneInnerAngle(360.0), |
| 51 |
m_coneOuterAngle(360.0), |
| 52 |
m_coneOuterGain(0.0), |
| 53 |
m_looping(false), |
| 54 |
m_positioning(false), |
| 55 |
m_direction(false) { |
| 56 |
|
| 57 |
m_velocity = AudioSpaceCoordinate(0.0, 0.0, 0.0); |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
ActionAudio::~ActionAudio() { |
| 62 |
} |
| 63 |
|
| 64 |
void ActionAudio::setSoundFileName(const std::string& name) { |
| 65 |
m_name = name; |
| 66 |
} |
| 67 |
|
| 68 |
const std::string& ActionAudio::getSoundFileName() const { |
| 69 |
return m_name; |
| 70 |
} |
| 71 |
|
| 72 |
void ActionAudio::setGroupName(const std::string& name) { |
| 73 |
m_group = name; |
| 74 |
} |
| 75 |
|
| 76 |
const std::string& ActionAudio::getGroupName() const { |
| 77 |
return m_group; |
| 78 |
} |
| 79 |
|
| 80 |
void ActionAudio::setGain(float gain) { |
| 81 |
m_volume = gain; |
| 82 |
} |
| 83 |
|
| 84 |
float ActionAudio::getGain() const { |
| 85 |
return m_volume; |
| 86 |
} |
| 87 |
|
| 88 |
void ActionAudio::setMaxGain(float gain) { |
| 89 |
m_maxVolume = gain; |
| 90 |
} |
| 91 |
|
| 92 |
float ActionAudio::getMaxGain() const { |
| 93 |
return m_maxVolume; |
| 94 |
} |
| 95 |
|
| 96 |
void ActionAudio::setMinGain(float gain) { |
| 97 |
m_minVolume = gain; |
| 98 |
} |
| 99 |
|
| 100 |
float ActionAudio::getMinGain() const { |
| 101 |
return m_minVolume; |
| 102 |
} |
| 103 |
|
| 104 |
void ActionAudio::setReferenceDistance(float distance) { |
| 105 |
m_refDistance = distance; |
| 106 |
} |
| 107 |
|
| 108 |
float ActionAudio::getReferenceDistance() const { |
| 109 |
return m_refDistance; |
| 110 |
} |
| 111 |
|
| 112 |
void ActionAudio::setMaxDistance(float distance) { |
| 113 |
m_maxDistance = distance; |
| 114 |
} |
| 115 |
|
| 116 |
float ActionAudio::getMaxDistance() const { |
| 117 |
return m_maxDistance; |
| 118 |
} |
| 119 |
|
| 120 |
void ActionAudio::setRolloff(float rolloff) { |
| 121 |
m_rolloff = rolloff; |
| 122 |
} |
| 123 |
|
| 124 |
float ActionAudio::getRolloff() const { |
| 125 |
return m_rolloff; |
| 126 |
} |
| 127 |
|
| 128 |
void ActionAudio::setPitch(float pitch) { |
| 129 |
m_pitch = pitch; |
| 130 |
} |
| 131 |
|
| 132 |
float ActionAudio::getPitch() const { |
| 133 |
return m_pitch; |
| 134 |
} |
| 135 |
|
| 136 |
void ActionAudio::setConeInnerAngle(float inner) { |
| 137 |
m_coneInnerAngle = inner; |
| 138 |
} |
| 139 |
|
| 140 |
float ActionAudio::getConeInnerAngle() const { |
| 141 |
return m_coneInnerAngle; |
| 142 |
} |
| 143 |
|
| 144 |
void ActionAudio::setConeOuterAngle(float outer) { |
| 145 |
m_coneOuterAngle = outer; |
| 146 |
} |
| 147 |
|
| 148 |
float ActionAudio::getConeOuterAngle() const { |
| 149 |
return m_coneOuterAngle; |
| 150 |
} |
| 151 |
|
| 152 |
void ActionAudio::setConeOuterGain(float gain) { |
| 153 |
m_coneOuterGain = gain; |
| 154 |
} |
| 155 |
|
| 156 |
float ActionAudio::getConeOuterGain() const { |
| 157 |
return m_coneOuterGain; |
| 158 |
} |
| 159 |
|
| 160 |
void ActionAudio::setVelocity(const AudioSpaceCoordinate& velocity) { |
| 161 |
m_velocity = velocity; |
| 162 |
} |
| 163 |
|
| 164 |
const AudioSpaceCoordinate& ActionAudio::getVelocity() const { |
| 165 |
return m_velocity; |
| 166 |
} |
| 167 |
|
| 168 |
void ActionAudio::setLooping(bool loop) { |
| 169 |
m_looping = loop; |
| 170 |
} |
| 171 |
|
| 172 |
bool ActionAudio::isLooping() const { |
| 173 |
return m_looping; |
| 174 |
} |
| 175 |
|
| 176 |
void ActionAudio::setRelativePositioning(bool relative) { |
| 177 |
m_positioning = relative; |
| 178 |
} |
| 179 |
|
| 180 |
bool ActionAudio::isRelativePositioning() const { |
| 181 |
return m_positioning; |
| 182 |
} |
| 183 |
|
| 184 |
void ActionAudio::setDirection(bool direction) { |
| 185 |
m_direction = direction; |
| 186 |
} |
| 187 |
|
| 188 |
bool ActionAudio::isDirection() const { |
| 189 |
return m_direction; |
| 190 |
} |
| 191 |
} |