| 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 |
%module soundeffect |
| 23 |
%{ |
| 24 |
#include "audio/effects/soundeffect.h" |
| 25 |
%} |
| 26 |
|
| 27 |
%include "model/metamodel/modelcoords.i" |
| 28 |
|
| 29 |
namespace FIFE { |
| 30 |
|
| 31 |
class SoundFilter; |
| 32 |
|
| 33 |
enum SoundEffectType { |
| 34 |
SE_EFFECT_NULL, |
| 35 |
SE_EFFECT_REVERB, |
| 36 |
SE_EFFECT_CHORUS, |
| 37 |
SE_EFFECT_DISTORTION, |
| 38 |
SE_EFFECT_ECHO, |
| 39 |
SE_EFFECT_FLANGER, |
| 40 |
SE_EFFECT_FREQUENCY_SHIFTER, |
| 41 |
SE_EFFECT_VOCAL_MORPHER, |
| 42 |
SE_EFFECT_PITCH_SHIFTER, |
| 43 |
SE_EFFECT_RING_MODULATOR, |
| 44 |
SE_EFFECT_AUTOWAH, |
| 45 |
SE_EFFECT_COMPRESSOR, |
| 46 |
SE_EFFECT_EQUALIZER, |
| 47 |
SE_EFFECT_EAXREVERB |
| 48 |
}; |
| 49 |
|
| 50 |
class SoundEffect { |
| 51 |
public: |
| 52 |
SoundEffectType getEffectType() const; |
| 53 |
bool isEnabled() const; |
| 54 |
protected: |
| 55 |
SoundEffect(); |
| 56 |
}; |
| 57 |
|
| 58 |
class Reverb : public SoundEffect { |
| 59 |
public: |
| 60 |
void setDensity(float value); |
| 61 |
float getDensity() const; |
| 62 |
void setDiffusion(float value); |
| 63 |
float getDiffusion() const; |
| 64 |
void setGain(float value); |
| 65 |
float getGain() const; |
| 66 |
void setGainHf(float value); |
| 67 |
float getGainHf() const; |
| 68 |
void setDecayTime(float value); |
| 69 |
float getDecayTime() const; |
| 70 |
void setDecayHfRatio(float value); |
| 71 |
float getDecayHfRatio() const; |
| 72 |
void setReflectionsGain(float value); |
| 73 |
float getReflectionsGain() const; |
| 74 |
void setReflectionsDelay(float value); |
| 75 |
float getReflectionsDelay() const; |
| 76 |
void setLateReverbGain(float value); |
| 77 |
float getLateReverbGain() const; |
| 78 |
void setLateReverbDelay(float value); |
| 79 |
float getLateReverbDelay() const; |
| 80 |
void setAirAbsorptionGainHf(float value); |
| 81 |
float getAirAbsorptionGainHf() const; |
| 82 |
void setRoomRolloffFactor(float value); |
| 83 |
float getRoomRolloffFactor() const; |
| 84 |
void setDecayHfLimit(bool value); |
| 85 |
bool isDecayHfLimit() const; |
| 86 |
private: |
| 87 |
Reverb(); |
| 88 |
}; |
| 89 |
|
| 90 |
class Chorus : public SoundEffect { |
| 91 |
public: |
| 92 |
void setWaveformTriangle(bool value); |
| 93 |
bool isWaveformTriangle() const; |
| 94 |
void setPhase(int32_t value); |
| 95 |
int32_t getPhase() const; |
| 96 |
void setRate(float value); |
| 97 |
float getRate() const; |
| 98 |
void setDepth(float value); |
| 99 |
float getDepth() const; |
| 100 |
void setFeedback(float value); |
| 101 |
float getFeedback() const; |
| 102 |
void setDelay(float value); |
| 103 |
float getDelay() const; |
| 104 |
private: |
| 105 |
Chorus(); |
| 106 |
}; |
| 107 |
|
| 108 |
class Distortion : public SoundEffect { |
| 109 |
public: |
| 110 |
void setEdge(float value); |
| 111 |
float getEdge() const; |
| 112 |
void setGain(float value); |
| 113 |
float getGain() const; |
| 114 |
void setLowpassCutoff(float value); |
| 115 |
float getLowpassCutoff() const; |
| 116 |
void setEqCenter(float value); |
| 117 |
float getEqCenter() const; |
| 118 |
void setEqBandwidth(float value); |
| 119 |
float getEqBandwidth() const; |
| 120 |
private: |
| 121 |
Distortion(); |
| 122 |
}; |
| 123 |
|
| 124 |
class Echo : public SoundEffect { |
| 125 |
public: |
| 126 |
void setDelay(float value); |
| 127 |
float getDelay() const; |
| 128 |
void setLrDelay(float value); |
| 129 |
float getLrDelay() const; |
| 130 |
void setDamping(float value); |
| 131 |
float getDamping() const; |
| 132 |
void setFeedback(float value); |
| 133 |
float getFeedback() const; |
| 134 |
void setSpread(float value); |
| 135 |
float getSpread() const; |
| 136 |
private: |
| 137 |
Echo(); |
| 138 |
}; |
| 139 |
|
| 140 |
class Flanger : public SoundEffect { |
| 141 |
public: |
| 142 |
void setWaveformTriangle(bool value); |
| 143 |
bool isWaveformTriangle() const; |
| 144 |
void setPhase(int32_t value); |
| 145 |
int32_t getPhase() const; |
| 146 |
void setRate(float value); |
| 147 |
float getRate() const; |
| 148 |
void setDepth(float value); |
| 149 |
float getDepth() const; |
| 150 |
void setFeedback(float value); |
| 151 |
float getFeedback() const; |
| 152 |
void setDelay(float value); |
| 153 |
float getDelay() const; |
| 154 |
private: |
| 155 |
Flanger(); |
| 156 |
}; |
| 157 |
|
| 158 |
class FrequencyShifter : public SoundEffect { |
| 159 |
public: |
| 160 |
void setFrequency(float value); |
| 161 |
float getFrequency() const; |
| 162 |
void setLeftDirection(uint8_t value); |
| 163 |
uint8_t getLeftDirection() const; |
| 164 |
void setRightDirection(uint8_t value); |
| 165 |
uint8_t getRightDirection() const; |
| 166 |
private: |
| 167 |
FrequencyShifter(); |
| 168 |
}; |
| 169 |
|
| 170 |
class VocalMorpher : public SoundEffect { |
| 171 |
public: |
| 172 |
void setPhonemeA(uint16_t value); |
| 173 |
uint16_t getPhonemeA() const; |
| 174 |
void setPhonemeB(uint16_t value); |
| 175 |
uint16_t getPhonemeB() const; |
| 176 |
void setPhonemeCoarseA(int16_t value); |
| 177 |
int16_t getPhonemeCoarseA() const; |
| 178 |
void setPhonemeCoarseB(int16_t value); |
| 179 |
int16_t getPhonemeCoarseB() const; |
| 180 |
void setWaveform(uint8_t value); |
| 181 |
uint8_t getWaveform() const; |
| 182 |
void setRate(float value); |
| 183 |
float getRate() const; |
| 184 |
private: |
| 185 |
VocalMorpher(); |
| 186 |
}; |
| 187 |
|
| 188 |
class PitchShifter : public SoundEffect { |
| 189 |
public: |
| 190 |
void setCoarseTune(int16_t value); |
| 191 |
int16_t getCoarseTune() const; |
| 192 |
void setFineTune(int16_t value); |
| 193 |
int16_t getFineTune() const; |
| 194 |
private: |
| 195 |
PitchShifter(); |
| 196 |
}; |
| 197 |
|
| 198 |
class RingModulator : public SoundEffect { |
| 199 |
public: |
| 200 |
void setFrequency(float value); |
| 201 |
float getFrequency() const; |
| 202 |
void setHighpassCutoff(float value); |
| 203 |
float getHighpassCutoff() const; |
| 204 |
void setWaveform(uint8_t value); |
| 205 |
uint8_t getWaveform() const; |
| 206 |
private: |
| 207 |
RingModulator(); |
| 208 |
}; |
| 209 |
|
| 210 |
class Autowah : public SoundEffect { |
| 211 |
public: |
| 212 |
void setAttackTime(float value); |
| 213 |
float getAttackTime() const; |
| 214 |
void setReleaseTime(float value); |
| 215 |
float getReleaseTime() const; |
| 216 |
void setResonance(float value); |
| 217 |
float getResonance() const; |
| 218 |
void setPeakGain(float value); |
| 219 |
float getPeakGain() const; |
| 220 |
private: |
| 221 |
Autowah(); |
| 222 |
}; |
| 223 |
|
| 224 |
class Compressor : public SoundEffect { |
| 225 |
public: |
| 226 |
void setCompressor(bool value); |
| 227 |
bool isCompressor() const; |
| 228 |
private: |
| 229 |
Compressor(); |
| 230 |
}; |
| 231 |
|
| 232 |
class Equalizer : public SoundEffect { |
| 233 |
public: |
| 234 |
void setLowGain(float value); |
| 235 |
float getLowGain() const; |
| 236 |
void setLowCutoff(float value); |
| 237 |
float getLowCutoff() const; |
| 238 |
void setMid1Gain(float value); |
| 239 |
float getMid1Gain() const; |
| 240 |
void setMid1Center(float value); |
| 241 |
float getMid1Center() const; |
| 242 |
void setMid1Width(float value); |
| 243 |
float getMid1Width() const; |
| 244 |
void setMid2Gain(float value); |
| 245 |
float getMid2Gain() const; |
| 246 |
void setMid2Center(float value); |
| 247 |
float getMid2Center() const; |
| 248 |
void setMid2Width(float value); |
| 249 |
float getMid2Width() const; |
| 250 |
void setHighGain(float value); |
| 251 |
float getHighGain() const; |
| 252 |
void setHighCutoff(float value); |
| 253 |
float getHighCutoff() const; |
| 254 |
private: |
| 255 |
Equalizer(); |
| 256 |
}; |
| 257 |
|
| 258 |
class EaxReverb : public SoundEffect { |
| 259 |
public: |
| 260 |
void setDensity(float value); |
| 261 |
float getDensity() const; |
| 262 |
void setDiffusion(float value); |
| 263 |
float getDiffusion() const; |
| 264 |
void setGain(float value); |
| 265 |
float getGain() const; |
| 266 |
void setGainHf(float value); |
| 267 |
float getGainHf() const; |
| 268 |
void setGainLf(float value); |
| 269 |
float getGainLf() const; |
| 270 |
void setDecayTime(float value); |
| 271 |
float getDecayTime() const; |
| 272 |
void setDecayHfRatio(float value); |
| 273 |
float getDecayHfRatio() const; |
| 274 |
void setDecayLfRatio(float value); |
| 275 |
float getDecayLfRatio() const; |
| 276 |
void setReflectionsGain(float value); |
| 277 |
float getReflectionsGain() const; |
| 278 |
void setReflectionsDelay(float value); |
| 279 |
float getReflectionsDelay() const; |
| 280 |
void setReflectionsPan(const AudioSpaceCoordinate& coordinate); |
| 281 |
AudioSpaceCoordinate getReflectionsPan() const; |
| 282 |
void setLateReverbGain(float value); |
| 283 |
float getLateReverbGain() const; |
| 284 |
void setLateReverbDelay(float value); |
| 285 |
float getLateReverbDelay() const; |
| 286 |
void setLateReverbPan(const AudioSpaceCoordinate& coordinate); |
| 287 |
AudioSpaceCoordinate getLateReverbPan() const; |
| 288 |
void setEchoTime(float value); |
| 289 |
float getEchoTime() const; |
| 290 |
void setEchoDepth(float value); |
| 291 |
float getEchoDepth() const; |
| 292 |
void setModulationTime(float value); |
| 293 |
float getModulationTime() const; |
| 294 |
void setModulationDepth(float value); |
| 295 |
float getModulationDepth() const; |
| 296 |
void setAirAbsorptionGainHf(float value); |
| 297 |
float getAirAbsorptionGainHf() const; |
| 298 |
void setHfReference(float value); |
| 299 |
float getHfReference() const; |
| 300 |
void setLfReference(float value); |
| 301 |
float getLfReference() const; |
| 302 |
void setRoomRolloffFactor(float value); |
| 303 |
float getRoomRolloffFactor() const; |
| 304 |
void setDecayHfLimit(bool value); |
| 305 |
bool isDecayHfLimit() const; |
| 306 |
private: |
| 307 |
EaxReverb(); |
| 308 |
}; |
| 309 |
} |
| 310 |
|