FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
soundeffect.cpp
Go to the documentation of this file.
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 #include <algorithm>
24 
25 // Platform specific includes
26 
27 // 3rd party library includes
28 
29 // FIFE includes
30 // These includes are split up in two parts, separated by one empty line
31 // First block: files included from the FIFE root src directory
32 // Second block: files included from the same folder
33 #include "util/log/logger.h"
34 #include "util/base/exception.h"
35 
36 #include "soundeffect.h"
37 
38 namespace FIFE {
42  static Logger _log(LM_AUDIO);
43 
44 
46  m_effect(0),
47  m_slot(0),
48  m_effectType(SE_EFFECT_NULL),
49  m_enabled(false),
50  m_filter(NULL) {
51 
53  }
54 
57  }
58 
59  ALuint SoundEffect::getEffectId() const {
60  return m_effect;
61  }
62 
63  void SoundEffect::setSlotId(ALuint slot) {
64  m_slot = slot;
65  }
66 
68  return m_slot;
69  }
70 
72  return m_effectType;
73  }
74 
75  void SoundEffect::setEnabled(bool enabled) {
76  m_enabled = enabled;
77  }
78 
79  bool SoundEffect::isEnabled() const {
80  return m_enabled;
81  }
82 
84  m_filter = filter;
85  }
86 
88  return m_filter;
89  }
90 
91 
93  m_density(1.0f),
94  m_diffusion(1.0f),
95  m_gain(0.32f),
96  m_gainHf(0.89f),
97  m_decayTime(1.49f),
98  m_decayHfRatio(0.83f),
99  m_reflectionsGain(0.05f),
100  m_reflectionsDelay(0.007f),
101  m_lateReverbGain(1.26f),
102  m_lateReverbDelay(0.011f),
103  m_airAbsorptionGainHf(0.994f),
104  m_roomRolloffFactor(0.0f),
105  m_decayHfLimit(true) {
106 
108  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB);
109  }
110 
111  void Reverb::setDensity(float value) {
112  value = std::min(value, 1.0f);
113  value = std::max(value, 0.0f);
114  m_density = value;
115  alEffectf(m_effect, AL_REVERB_DENSITY, m_density);
116  }
117 
118  float Reverb::getDensity() const {
119  return m_density;
120  }
121 
122  void Reverb::setDiffusion(float value) {
123  value = std::min(value, 1.0f);
124  value = std::max(value, 0.0f);
125  m_diffusion = value;
126  alEffectf(m_effect, AL_REVERB_DIFFUSION, m_diffusion);
127  }
128 
129  float Reverb::getDiffusion() const {
130  return m_diffusion;
131  }
132 
133  void Reverb::setGain(float value) {
134  value = std::min(value, 1.0f);
135  value = std::max(value, 0.0f);
136  m_gain = value;
137  alEffectf(m_effect, AL_REVERB_GAIN, m_gain);
138  }
139 
140  float Reverb::getGain() const {
141  return m_gain;
142  }
143 
144  void Reverb::setGainHf(float value) {
145  value = std::min(value, 1.0f);
146  value = std::max(value, 0.0f);
147  m_gainHf = value;
148  alEffectf(m_effect, AL_REVERB_GAINHF, m_gainHf);
149  }
150 
151  float Reverb::getGainHf() const {
152  return m_gainHf;
153  }
154 
155  void Reverb::setDecayTime(float value) {
156  value = std::min(value, 20.0f);
157  value = std::max(value, 0.1f);
158  m_decayTime = value;
159  alEffectf(m_effect, AL_REVERB_DECAY_TIME, m_decayTime);
160  }
161 
162  float Reverb::getDecayTime() const {
163  return m_decayTime;
164  }
165 
166  void Reverb::setDecayHfRatio(float value) {
167  value = std::min(value, 2.0f);
168  value = std::max(value, 0.1f);
169  m_decayHfRatio = value;
170  alEffectf(m_effect, AL_REVERB_DECAY_HFRATIO, m_decayHfRatio);
171  }
172 
173  float Reverb::getDecayHfRatio() const {
174  return m_decayHfRatio;
175  }
176 
177  void Reverb::setReflectionsGain(float value) {
178  value = std::min(value, 3.16f);
179  value = std::max(value, 0.0f);
180  m_reflectionsGain = value;
181  alEffectf(m_effect, AL_REVERB_REFLECTIONS_GAIN, m_reflectionsGain);
182  }
183 
185  return m_reflectionsGain;
186  }
187 
188  void Reverb::setReflectionsDelay(float value) {
189  value = std::min(value, 0.3f);
190  value = std::max(value, 0.0f);
191  m_reflectionsDelay = value;
192  alEffectf(m_effect, AL_REVERB_REFLECTIONS_DELAY, m_reflectionsDelay);
193  }
194 
196  return m_reflectionsDelay;
197  }
198 
199  void Reverb::setLateReverbGain(float value) {
200  value = std::min(value, 10.0f);
201  value = std::max(value, 0.0f);
202  m_lateReverbGain = value;
203  alEffectf(m_effect, AL_REVERB_LATE_REVERB_GAIN, m_lateReverbGain);
204  }
205 
207  return m_lateReverbGain;
208  }
209 
210  void Reverb::setLateReverbDelay(float value) {
211  value = std::min(value, 0.1f);
212  value = std::max(value, 0.0f);
213  m_reflectionsDelay = value;
214  alEffectf(m_effect, AL_REVERB_LATE_REVERB_DELAY, m_reflectionsDelay);
215  }
216 
218  return m_reflectionsDelay;
219  }
220 
221  void Reverb::setAirAbsorptionGainHf(float value) {
222  value = std::min(value, 1.0f);
223  value = std::max(value, 0.892f);
224  m_airAbsorptionGainHf = value;
225  alEffectf(m_effect, AL_REVERB_AIR_ABSORPTION_GAINHF, m_airAbsorptionGainHf);
226  }
227 
229  return m_airAbsorptionGainHf;
230  }
231 
232  void Reverb::setRoomRolloffFactor(float value) {
233  value = std::min(value, 10.0f);
234  value = std::max(value, 0.0f);
235  m_roomRolloffFactor = value;
236  alEffectf(m_effect, AL_REVERB_ROOM_ROLLOFF_FACTOR, m_roomRolloffFactor);
237  }
238 
240  return m_roomRolloffFactor;
241  }
242 
243  void Reverb::setDecayHfLimit(bool value) {
244  m_decayHfLimit = value;
245  alEffecti(m_effect, AL_REVERB_DECAY_HFLIMIT, m_decayHfLimit ? AL_TRUE : AL_FALSE);
246  }
247 
248  bool Reverb::isDecayHfLimit() const {
249  return m_decayHfLimit;
250  }
251 
252 
254  m_waveformTriangle(true),
255  m_phase(90),
256  m_rate(1.1f),
257  m_depth(0.1f),
258  m_feedback(0.25f),
259  m_delay(0.016f) {
261  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_CHORUS);
262  }
263 
264  void Chorus::setWaveformTriangle(bool value) {
265  m_waveformTriangle = value;
266  if (m_waveformTriangle) {
267  alEffecti(m_effect, AL_CHORUS_WAVEFORM, AL_CHORUS_WAVEFORM_TRIANGLE);
268  } else {
269  alEffecti(m_effect, AL_CHORUS_WAVEFORM, AL_CHORUS_WAVEFORM_SINUSOID);
270  }
271  }
272 
274  return m_waveformTriangle;
275  }
276 
277  void Chorus::setPhase(int32_t value) {
278  value = std::min(value, 180);
279  value = std::max(value, -180);
280  m_phase = value;
281  alEffecti(m_effect, AL_CHORUS_PHASE, m_phase);
282  }
283 
284  int32_t Chorus::getPhase() const {
285  return m_phase;
286  }
287 
288  void Chorus::setRate(float value) {
289  value = std::min(value, 10.0f);
290  value = std::max(value, 0.0f);
291  m_rate = value;
292  alEffectf(m_effect, AL_CHORUS_RATE, m_rate);
293  }
294 
295  float Chorus::getRate() const {
296  return m_rate;
297  }
298 
299  void Chorus::setDepth(float value) {
300  value = std::min(value, 1.0f);
301  value = std::max(value, 0.0f);
302  m_depth = value;
303  alEffectf(m_effect, AL_CHORUS_DEPTH, m_depth);
304  }
305 
306  float Chorus::getDepth() const {
307  return m_depth;
308  }
309 
310  void Chorus::setFeedback(float value) {
311  value = std::min(value, 1.0f);
312  value = std::max(value, -1.0f);
313  m_feedback = value;
314  alEffectf(m_effect, AL_CHORUS_FEEDBACK, m_feedback);
315  }
316 
317  float Chorus::getFeedback() const {
318  return m_feedback;
319  }
320 
321  void Chorus::setDelay(float value) {
322  value = std::min(value, 0.016f);
323  value = std::max(value, 0.0f);
324  m_delay = value;
325  alEffectf(m_effect, AL_CHORUS_DELAY, m_delay);
326  }
327 
328  float Chorus::getDelay() const {
329  return m_delay;
330  }
331 
332 
334  m_edge(0.2f),
335  m_gain(0.05f),
336  m_lowpassCutoff(8000.0f),
337  m_eqCenter(3600.0f),
338  m_eqBandwidth(3600.0f) {
340  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_DISTORTION);
341  }
342 
343  void Distortion::setEdge(float value) {
344  value = std::min(value, 1.0f);
345  value = std::max(value, 0.0f);
346  m_edge = value;
347  alEffectf(m_effect, AL_DISTORTION_EDGE, m_edge);
348  }
349 
350  float Distortion::getEdge() const {
351  return m_edge;
352  }
353 
354  void Distortion::setGain(float value) {
355  value = std::min(value, 1.0f);
356  value = std::max(value, 0.01f);
357  m_gain = value;
358  alEffectf(m_effect, AL_DISTORTION_GAIN, m_gain);
359  }
360 
361  float Distortion::getGain() const {
362  return m_gain;
363  }
364 
365  void Distortion::setLowpassCutoff(float value) {
366  value = std::min(value, 24000.0f);
367  value = std::max(value, 80.0f);
368  m_lowpassCutoff = value;
369  alEffectf(m_effect, AL_DISTORTION_LOWPASS_CUTOFF, m_lowpassCutoff);
370  }
371 
373  return m_lowpassCutoff;
374  }
375 
376  void Distortion::setEqCenter(float value) {
377  value = std::min(value, 24000.0f);
378  value = std::max(value, 80.0f);
379  m_eqCenter = value;
380  alEffectf(m_effect, AL_DISTORTION_EQCENTER, m_eqCenter);
381  }
382 
383  float Distortion::getEqCenter() const {
384  return m_eqCenter;
385  }
386 
387  void Distortion::setEqBandwidth(float value) {
388  value = std::min(value, 24000.0f);
389  value = std::max(value, 80.0f);
390  m_eqBandwidth = value;
391  alEffectf(m_effect, AL_DISTORTION_EQBANDWIDTH, m_eqBandwidth);
392  }
393 
395  return m_eqBandwidth;
396  }
397 
398 
400  m_delay(0.1f),
401  m_lrDelay(0.1f),
402  m_damping(0.5f),
403  m_feedback(0.5f),
404  m_spread(-1.0f) {
406  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_ECHO);
407  }
408 
409  void Echo::setDelay(float value) {
410  value = std::min(value, 0.207f);
411  value = std::max(value, 0.0f);
412  m_delay = value;
413  alEffectf(m_effect, AL_ECHO_DELAY, m_delay);
414  }
415 
416  float Echo::getDelay() const {
417  return m_delay;
418  }
419 
420  void Echo::setLrDelay(float value) {
421  value = std::min(value, 0.404f);
422  value = std::max(value, 0.0f);
423  m_lrDelay = value;
424  alEffectf(m_effect, AL_ECHO_LRDELAY, m_lrDelay);
425  }
426 
427  float Echo::getLrDelay() const {
428  return m_lrDelay;
429  }
430 
431  void Echo::setDamping(float value) {
432  value = std::min(value, 0.99f);
433  value = std::max(value, 0.0f);
434  m_damping = value;
435  alEffectf(m_effect, AL_ECHO_DAMPING, m_damping);
436  }
437 
438  float Echo::getDamping() const {
439  return m_damping;
440  }
441 
442  void Echo::setFeedback(float value) {
443  value = std::min(value, 1.0f);
444  value = std::max(value, 0.0f);
445  m_feedback = value;
446  alEffectf(m_effect, AL_ECHO_FEEDBACK, m_feedback);
447  }
448 
449  float Echo::getFeedback() const {
450  return m_feedback;
451  }
452 
453  void Echo::setSpread(float value) {
454  value = std::min(value, 1.0f);
455  value = std::max(value, -1.0f);
456  m_spread = value;
457  alEffectf(m_effect, AL_ECHO_SPREAD, m_spread);
458  }
459 
460  float Echo::getSpread() const {
461  return m_spread;
462  }
463 
464 
466  m_waveformTriangle(true),
467  m_phase(0),
468  m_rate(0.27f),
469  m_depth(1.0f),
470  m_feedback(-0.5f),
471  m_delay(0.002f) {
473  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_FLANGER);
474  }
475 
476  void Flanger::setWaveformTriangle(bool value) {
477  m_waveformTriangle = value;
478  if (m_waveformTriangle) {
479  alEffecti(m_effect, AL_FLANGER_WAVEFORM, AL_FLANGER_WAVEFORM_TRIANGLE);
480  } else {
481  alEffecti(m_effect, AL_FLANGER_WAVEFORM, AL_FLANGER_WAVEFORM_SINUSOID);
482  }
483  }
484 
486  return m_waveformTriangle;
487  }
488 
489  void Flanger::setPhase(int32_t value) {
490  value = std::min(value, 180);
491  value = std::max(value, -180);
492  m_phase = value;
493  alEffecti(m_effect, AL_FLANGER_PHASE, m_phase);
494  }
495 
496  int32_t Flanger::getPhase() const {
497  return m_phase;
498  }
499 
500  void Flanger::setRate(float value) {
501  value = std::min(value, 10.0f);
502  value = std::max(value, 0.0f);
503  m_rate = value;
504  alEffectf(m_effect, AL_FLANGER_RATE, m_rate);
505  }
506 
507  float Flanger::getRate() const {
508  return m_rate;
509  }
510 
511  void Flanger::setDepth(float value) {
512  value = std::min(value, 1.0f);
513  value = std::max(value, 0.0f);
514  m_depth = value;
515  alEffectf(m_effect, AL_FLANGER_DEPTH, m_depth);
516  }
517 
518  float Flanger::getDepth() const {
519  return m_depth;
520  }
521 
522  void Flanger::setFeedback(float value) {
523  value = std::min(value, 1.0f);
524  value = std::max(value, -1.0f);
525  m_feedback = value;
526  alEffectf(m_effect, AL_FLANGER_FEEDBACK, m_feedback);
527  }
528 
529  float Flanger::getFeedback() const {
530  return m_feedback;
531  }
532 
533  void Flanger::setDelay(float value) {
534  value = std::min(value, 0.004f);
535  value = std::max(value, 0.0f);
536  m_delay = value;
537  alEffectf(m_effect, AL_FLANGER_DELAY, m_delay);
538  }
539 
540  float Flanger::getDelay() const {
541  return m_delay;
542  }
543 
544 
546  m_frequency(0.0f),
547  m_leftDirection(0),
548  m_rightDirection(0) {
550  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_FREQUENCY_SHIFTER);
551  }
552 
553  void FrequencyShifter::setFrequency(float value) {
554  value = std::min(value, 24000.0f);
555  value = std::max(value, 0.0f);
556  m_frequency = value;
557  alEffectf(m_effect, AL_FREQUENCY_SHIFTER_FREQUENCY, m_frequency);
558  }
559 
561  return m_frequency;
562  }
563 
565  value = std::min(value, uint8_t(2));
566  value = std::max(value, uint8_t(0));
567  m_leftDirection = value;
568  alEffecti(m_effect, AL_FREQUENCY_SHIFTER_LEFT_DIRECTION, m_leftDirection);
569  }
570 
572  return m_leftDirection;
573  }
574 
576  value = std::min(value, uint8_t(2));
577  value = std::max(value, uint8_t(0));
578  m_rightDirection = value;
579  alEffecti(m_effect, AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION, m_rightDirection);
580  }
581 
583  return m_rightDirection;
584  }
585 
586 
588  m_phonemeA(0),
589  m_phonemeB(10),
590  m_phonemeCoarseA(0),
591  m_phonemeCoarseB(0),
592  m_waveform(0),
593  m_rate(1.41f) {
595  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_VOCAL_MORPHER);
596  }
597 
599  value = std::min(value, uint16_t(29));
600  value = std::max(value, uint16_t(0));
601  m_phonemeA = value;
602  alEffecti(m_effect, AL_VOCAL_MORPHER_PHONEMEA, m_phonemeA);
603  }
604 
606  return m_phonemeA;
607  }
608 
610  value = std::min(value, uint16_t(29));
611  value = std::max(value, uint16_t(0));
612  m_phonemeB = value;
613  alEffecti(m_effect, AL_VOCAL_MORPHER_PHONEMEB, m_phonemeB);
614  }
615 
617  return m_phonemeB;
618  }
619 
620  void VocalMorpher::setPhonemeCoarseA(int16_t value) {
621  value = std::min(value, int16_t(24));
622  value = std::max(value, int16_t(-24));
623  m_phonemeCoarseA = value;
624  alEffecti(m_effect, AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING, m_phonemeCoarseA);
625  }
626 
628  return m_phonemeCoarseA;
629  }
630 
631  void VocalMorpher::setPhonemeCoarseB(int16_t value) {
632  value = std::min(value, int16_t(24));
633  value = std::max(value, int16_t(-24));
634  m_phonemeCoarseB = value;
635  alEffecti(m_effect, AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING, m_phonemeCoarseB);
636  }
637 
639  return m_phonemeCoarseB;
640  }
641 
643  value = std::min(value, uint8_t(2));
644  value = std::max(value, uint8_t(0));
645  m_waveform = value;
646  alEffecti(m_effect, AL_VOCAL_MORPHER_WAVEFORM, m_waveform);
647  }
648 
650  return m_waveform;
651  }
652 
653  void VocalMorpher::setRate(float value) {
654  value = std::min(value, 10.0f);
655  value = std::max(value, 0.0f);
656  m_rate = value;
657  alEffectf(m_effect, AL_VOCAL_MORPHER_RATE, m_rate);
658  }
659 
660  float VocalMorpher::getRate() const {
661  return m_rate;
662  }
663 
664 
666  m_coarseTune(12),
667  m_fineTune(0) {
669  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_PITCH_SHIFTER);
670  }
671 
672  void PitchShifter::setCoarseTune(int16_t value) {
673  value = std::min(value, int16_t(12));
674  value = std::max(value, int16_t(-12));
675  m_coarseTune = value;
676  alEffecti(m_effect, AL_PITCH_SHIFTER_COARSE_TUNE, m_coarseTune);
677  }
678 
679  int16_t PitchShifter::getCoarseTune() const {
680  return m_coarseTune;
681  }
682 
683  void PitchShifter::setFineTune(int16_t value) {
684  value = std::min(value, int16_t(50));
685  value = std::max(value, int16_t(-50));
686  m_fineTune = value;
687  alEffecti(m_effect, AL_PITCH_SHIFTER_FINE_TUNE, m_fineTune);
688  }
689 
690  int16_t PitchShifter::getFineTune() const {
691  return m_fineTune;
692  }
693 
694 
696  m_frequency(440.0f),
697  m_highpassCutoff(800.0f),
698  m_waveform(0) {
700  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_RING_MODULATOR);
701  }
702 
703  void RingModulator::setFrequency(float value) {
704  value = std::min(value, 8000.0f);
705  value = std::max(value, 0.0f);
706  m_frequency = value;
707  alEffectf(m_effect, AL_RING_MODULATOR_FREQUENCY, m_frequency);
708  }
709 
711  return m_frequency;
712  }
713 
715  value = std::min(value, 24000.0f);
716  value = std::max(value, 0.0f);
717  m_highpassCutoff = value;
718  alEffectf(m_effect, AL_RING_MODULATOR_HIGHPASS_CUTOFF, m_highpassCutoff);
719  }
720 
722  return m_highpassCutoff;
723  }
724 
726  value = std::min(value, uint8_t(2));
727  value = std::max(value, uint8_t(0));
728  m_waveform = value;
729  alEffecti(m_effect, AL_RING_MODULATOR_WAVEFORM, m_waveform);
730  }
731 
733  return m_waveform;
734  }
735 
736 
738  m_attackTime(0.06f),
739  m_releaseTime(0.06f),
740  m_resonance(1000.0f),
741  m_peakGain(11.22f) {
743  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_AUTOWAH);
744  }
745 
746  void Autowah::setAttackTime(float value) {
747  value = std::min(value, 1.0f);
748  value = std::max(value, 0.0001f);
749  m_attackTime = value;
750  alEffectf(m_effect, AL_AUTOWAH_ATTACK_TIME, m_attackTime);
751  }
752 
753  float Autowah::getAttackTime() const {
754  return m_attackTime;
755  }
756 
757  void Autowah::setReleaseTime(float value) {
758  value = std::min(value, 1.0f);
759  value = std::max(value, 0.0001f);
760  m_releaseTime = value;
761  alEffectf(m_effect, AL_AUTOWAH_RELEASE_TIME, m_releaseTime);
762  }
763 
764  float Autowah::getReleaseTime() const {
765  return m_releaseTime;
766  }
767 
768  void Autowah::setResonance(float value) {
769  value = std::min(value, 1000.0f);
770  value = std::max(value, 2.0f);
771  m_resonance = value;
772  alEffectf(m_effect, AL_AUTOWAH_RESONANCE, m_resonance);
773  }
774 
775  float Autowah::getResonance() const {
776  return m_resonance;
777  }
778 
779  void Autowah::setPeakGain(float value) {
780  value = std::min(value, 31621.0f);
781  value = std::max(value, 0.00003f);
782  m_peakGain = value;
783  alEffectf(m_effect, AL_AUTOWAH_PEAK_GAIN, m_peakGain);
784  }
785 
786  float Autowah::getPeakGain() const {
787  return m_peakGain;
788  }
789 
790 
792  m_active(true) {
794  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_COMPRESSOR);
795  }
796 
797  void Compressor::setCompressor(bool value) {
798  m_active = value;
799  alEffecti(m_effect, AL_COMPRESSOR_ONOFF, m_active ? AL_TRUE : AL_FALSE);
800  }
801 
803  return m_active;
804  }
805 
806 
808  m_lowGain(1.0f),
809  m_lowCutoff(200.0f),
810  m_mid1Gain(1.0f),
811  m_mid1Center(500.0f),
812  m_mid1Width(1.0f),
813  m_mid2Gain(1.0f),
814  m_mid2Center(3000.0f),
815  m_mid2Width(1.0f),
816  m_highGain(1.0f),
817  m_highCutoff(6000.0f) {
819  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_EQUALIZER);
820  }
821 
822  void Equalizer::setLowGain(float value) {
823  value = std::min(value, 7.943f);
824  value = std::max(value, 0.126f);
825  m_lowGain = value;
826  alEffectf(m_effect, AL_EQUALIZER_LOW_GAIN, m_lowGain);
827  }
828 
829  float Equalizer::getLowGain() const {
830  return m_lowGain;
831  }
832 
833  void Equalizer::setLowCutoff(float value) {
834  value = std::min(value, 800.0f);
835  value = std::max(value, 50.0f);
836  m_lowCutoff = value;
837  alEffectf(m_effect, AL_EQUALIZER_LOW_CUTOFF, m_lowCutoff);
838  }
839 
840  float Equalizer::getLowCutoff() const {
841  return m_lowCutoff;
842  }
843 
844  void Equalizer::setMid1Gain(float value) {
845  value = std::min(value, 7.943f);
846  value = std::max(value, 0.126f);
847  m_mid1Gain = value;
848  alEffectf(m_effect, AL_EQUALIZER_MID1_GAIN, m_mid1Gain);
849  }
850 
851  float Equalizer::getMid1Gain() const {
852  return m_mid1Gain;
853  }
854 
855  void Equalizer::setMid1Center(float value) {
856  value = std::min(value, 3000.0f);
857  value = std::max(value, 200.0f);
858  m_mid1Center = value;
859  alEffectf(m_effect, AL_EQUALIZER_MID1_CENTER, m_mid1Center);
860  }
861 
862  float Equalizer::getMid1Center() const {
863  return m_mid1Center;
864  }
865 
866  void Equalizer::setMid1Width(float value) {
867  value = std::min(value, 1.0f);
868  value = std::max(value, 0.01f);
869  m_mid1Width = value;
870  alEffectf(m_effect, AL_EQUALIZER_MID1_WIDTH, m_mid1Width);
871  }
872 
873  float Equalizer::getMid1Width() const {
874  return m_mid1Width;
875  }
876 
877  void Equalizer::setMid2Gain(float value) {
878  value = std::min(value, 7.943f);
879  value = std::max(value, 0.126f);
880  m_mid2Gain = value;
881  alEffectf(m_effect, AL_EQUALIZER_MID2_GAIN, m_mid2Gain);
882  }
883 
884  float Equalizer::getMid2Gain() const {
885  return m_mid2Gain;
886  }
887 
888  void Equalizer::setMid2Center(float value) {
889  value = std::min(value, 8000.0f);
890  value = std::max(value, 1000.0f);
891  m_mid2Center = value;
892  alEffectf(m_effect, AL_EQUALIZER_MID2_CENTER, m_mid2Center);
893  }
894 
895  float Equalizer::getMid2Center() const {
896  return m_mid2Center;
897  }
898 
899  void Equalizer::setMid2Width(float value) {
900  value = std::min(value, 1.0f);
901  value = std::max(value, 0.01f);
902  m_mid2Width = value;
903  alEffectf(m_effect, AL_EQUALIZER_MID2_WIDTH, m_mid2Width);
904  }
905 
906  float Equalizer::getMid2Width() const {
907  return m_mid2Width;
908  }
909 
910  void Equalizer::setHighGain(float value) {
911  value = std::min(value, 7.943f);
912  value = std::max(value, 0.126f);
913  m_highGain = value;
914  alEffectf(m_effect, AL_EQUALIZER_HIGH_GAIN, m_highGain);
915  }
916 
917  float Equalizer::getHighGain() const {
918  return m_highGain;
919  }
920 
921  void Equalizer::setHighCutoff(float value) {
922  value = std::min(value, 16000.0f);
923  value = std::max(value, 4000.0f);
924  m_highCutoff = value;
925  alEffectf(m_effect, AL_EQUALIZER_HIGH_CUTOFF, m_highCutoff);
926  }
927 
928  float Equalizer::getHighCutoff() const {
929  return m_highCutoff;
930  }
931 
932 
934  m_density(1.0f),
935  m_diffusion(1.0f),
936  m_gain(0.32f),
937  m_gainHf(0.89f),
938  m_gainLf(0.0f),
939  m_decayTime(1.49f),
940  m_decayHfRatio(0.83f),
941  m_decayLfRatio(1.0f),
942  m_reflectionsGain(0.05f),
943  m_reflectionsDelay(0.007f),
944  m_reflectionsPan(AudioSpaceCoordinate(0.0, 0.0, 0.0)),
945  m_lateReverbGain(1.26f),
946  m_lateReverbDelay(0.011f),
947  m_lateReverbPan(AudioSpaceCoordinate(0.0, 0.0, 0.0)),
948  m_echoTime(0.25f),
949  m_echoDepth(0.0f),
950  m_modulationTime(0.25f),
951  m_modulationDepth(0.0f),
952  m_airAbsorptionGainHf(0.994f),
953  m_hfReference(5000.0f),
954  m_lfReference(250.0f),
955  m_roomRolloffFactor(0.0f),
956  m_decayHfLimit(true) {
957 
959  alEffecti(m_effect, AL_EFFECT_TYPE, AL_EFFECT_EAXREVERB);
960  }
961 
962  void EaxReverb::setDensity(float value) {
963  value = std::min(value, 1.0f);
964  value = std::max(value, 0.0f);
965  m_density = value;
966  alEffectf(m_effect, AL_EAXREVERB_DENSITY, m_density);
967  }
968 
969  float EaxReverb::getDensity() const {
970  return m_density;
971  }
972 
973  void EaxReverb::setDiffusion(float value) {
974  value = std::min(value, 1.0f);
975  value = std::max(value, 0.0f);
976  m_diffusion = value;
977  alEffectf(m_effect, AL_EAXREVERB_DIFFUSION, m_diffusion);
978  }
979 
980  float EaxReverb::getDiffusion() const {
981  return m_diffusion;
982  }
983 
984  void EaxReverb::setGain(float value) {
985  value = std::min(value, 1.0f);
986  value = std::max(value, 0.0f);
987  m_gain = value;
988  alEffectf(m_effect, AL_EAXREVERB_GAIN, m_gain);
989  }
990 
991  float EaxReverb::getGain() const {
992  return m_gain;
993  }
994 
995  void EaxReverb::setGainHf(float value) {
996  value = std::min(value, 1.0f);
997  value = std::max(value, 0.0f);
998  m_gainHf = value;
999  alEffectf(m_effect, AL_EAXREVERB_GAINHF, m_gainHf);
1000  }
1001 
1002  float EaxReverb::getGainHf() const {
1003  return m_gainHf;
1004  }
1005 
1006  void EaxReverb::setGainLf(float value) {
1007  value = std::min(value, 1.0f);
1008  value = std::max(value, 0.0f);
1009  m_gainLf = value;
1010  alEffectf(m_effect, AL_EAXREVERB_GAINLF, m_gainLf);
1011  }
1012 
1013  float EaxReverb::getGainLf() const {
1014  return m_gainLf;
1015  }
1016 
1017  void EaxReverb::setDecayTime(float value) {
1018  value = std::min(value, 20.0f);
1019  value = std::max(value, 0.1f);
1020  m_decayTime = value;
1021  alEffectf(m_effect, AL_EAXREVERB_DECAY_TIME, m_decayTime);
1022  }
1023 
1024  float EaxReverb::getDecayTime() const {
1025  return m_decayTime;
1026  }
1027 
1028  void EaxReverb::setDecayHfRatio(float value) {
1029  value = std::min(value, 2.0f);
1030  value = std::max(value, 0.1f);
1031  m_decayHfRatio = value;
1032  alEffectf(m_effect, AL_EAXREVERB_DECAY_HFRATIO, m_decayHfRatio);
1033  }
1034 
1036  return m_decayHfRatio;
1037  }
1038 
1039  void EaxReverb::setDecayLfRatio(float value) {
1040  value = std::min(value, 2.0f);
1041  value = std::max(value, 0.1f);
1042  m_decayLfRatio = value;
1043  alEffectf(m_effect, AL_EAXREVERB_DECAY_LFRATIO, m_decayLfRatio);
1044  }
1045 
1047  return m_decayLfRatio;
1048  }
1049 
1050  void EaxReverb::setReflectionsGain(float value) {
1051  value = std::min(value, 3.16f);
1052  value = std::max(value, 0.0f);
1053  m_reflectionsGain = value;
1054  alEffectf(m_effect, AL_EAXREVERB_REFLECTIONS_GAIN, m_reflectionsGain);
1055  }
1056 
1058  return m_reflectionsGain;
1059  }
1060 
1062  value = std::min(value, 0.3f);
1063  value = std::max(value, 0.0f);
1064  m_reflectionsDelay = value;
1065  alEffectf(m_effect, AL_EAXREVERB_REFLECTIONS_DELAY, m_reflectionsDelay);
1066  }
1067 
1069  return m_reflectionsDelay;
1070  }
1071 
1073  m_reflectionsPan.x = std::min(coordinate.x, double(1.0));
1074  m_reflectionsPan.x = std::max(coordinate.x, double(-1.0));
1075  m_reflectionsPan.y = std::min(coordinate.y, double(1.0));
1076  m_reflectionsPan.y = std::max(coordinate.y, double(-1.0));
1077  m_reflectionsPan.z = std::min(coordinate.z, double(1.0));
1078  m_reflectionsPan.z = std::max(coordinate.z, double(-1.0));
1079 
1080  ALfloat vec[3] = { static_cast<ALfloat>(m_reflectionsPan.x),
1081  static_cast<ALfloat>(m_reflectionsPan.y), static_cast<ALfloat>(m_reflectionsPan.z)};
1082  alEffectfv(m_effect, AL_EAXREVERB_REFLECTIONS_PAN, vec);
1083  }
1084 
1086  return m_reflectionsPan;
1087  }
1088 
1089  void EaxReverb::setLateReverbGain(float value) {
1090  value = std::min(value, 10.0f);
1091  value = std::max(value, 0.0f);
1092  m_lateReverbGain = value;
1093  alEffectf(m_effect, AL_EAXREVERB_LATE_REVERB_GAIN, m_lateReverbGain);
1094  }
1095 
1097  return m_lateReverbGain;
1098  }
1099 
1100  void EaxReverb::setLateReverbDelay(float value) {
1101  value = std::min(value, 0.1f);
1102  value = std::max(value, 0.0f);
1103  m_reflectionsDelay = value;
1104  alEffectf(m_effect, AL_EAXREVERB_LATE_REVERB_DELAY, m_reflectionsDelay);
1105  }
1106 
1108  return m_reflectionsDelay;
1109  }
1110 
1112  m_lateReverbPan.x = std::min(coordinate.x, double(1.0));
1113  m_lateReverbPan.x = std::max(coordinate.x, double(-1.0));
1114  m_lateReverbPan.y = std::min(coordinate.y, double(1.0));
1115  m_lateReverbPan.y = std::max(coordinate.y, double(-1.0));
1116  m_lateReverbPan.z = std::min(coordinate.z, double(1.0));
1117  m_lateReverbPan.z = std::max(coordinate.z, double(-1.0));
1118 
1119  ALfloat vec[3] = { static_cast<ALfloat>(m_lateReverbPan.x),
1120  static_cast<ALfloat>(m_lateReverbPan.y), static_cast<ALfloat>(m_lateReverbPan.z) };
1121  alEffectfv(m_effect, AL_EAXREVERB_LATE_REVERB_PAN, vec);
1122  }
1123 
1125  return m_lateReverbPan;
1126  }
1127 
1128  void EaxReverb::setEchoTime(float value) {
1129  value = std::min(value, 0.25f);
1130  value = std::max(value, 0.075f);
1131  m_echoTime = value;
1132  alEffectf(m_effect, AL_EAXREVERB_ECHO_TIME, m_echoTime);
1133  }
1134 
1135  float EaxReverb::getEchoTime() const {
1136  return m_echoTime;
1137  }
1138 
1139  void EaxReverb::setEchoDepth(float value) {
1140  value = std::min(value, 1.0f);
1141  value = std::max(value, 0.0f);
1142  m_echoDepth = value;
1143  alEffectf(m_effect, AL_EAXREVERB_ECHO_DEPTH, m_echoDepth);
1144  }
1145 
1146  float EaxReverb::getEchoDepth() const {
1147  return m_echoDepth;
1148  }
1149 
1150  void EaxReverb::setModulationTime(float value) {
1151  value = std::min(value, 4.0f);
1152  value = std::max(value, 0.04f);
1153  m_modulationTime = value;
1154  alEffectf(m_effect, AL_EAXREVERB_MODULATION_TIME, m_modulationTime);
1155  }
1156 
1158  return m_modulationTime;
1159  }
1160 
1161  void EaxReverb::setModulationDepth(float value) {
1162  value = std::min(value, 1.0f);
1163  value = std::max(value, 0.0f);
1164  m_modulationDepth = value;
1165  alEffectf(m_effect, AL_EAXREVERB_MODULATION_DEPTH, m_modulationDepth);
1166  }
1167 
1169  return m_modulationDepth;
1170  }
1171 
1173  value = std::min(value, 1.0f);
1174  value = std::max(value, 0.892f);
1175  m_airAbsorptionGainHf = value;
1176  alEffectf(m_effect, AL_EAXREVERB_AIR_ABSORPTION_GAINHF, m_airAbsorptionGainHf);
1177  }
1178 
1180  return m_airAbsorptionGainHf;
1181  }
1182 
1183  void EaxReverb::setHfReference(float value) {
1184  value = std::min(value, 20000.0f);
1185  value = std::max(value, 1000.0f);
1186  m_hfReference = value;
1187  alEffectf(m_effect, AL_EAXREVERB_HFREFERENCE, m_hfReference);
1188  }
1189 
1191  return m_hfReference;
1192  }
1193 
1194  void EaxReverb::setLfReference(float value) {
1195  value = std::min(value, 1000.0f);
1196  value = std::max(value, 20.0f);
1197  m_lfReference = value;
1198  alEffectf(m_effect, AL_EAXREVERB_LFREFERENCE, m_lfReference);
1199  }
1200 
1202  return m_lfReference;
1203  }
1204 
1206  value = std::min(value, 10.0f);
1207  value = std::max(value, 0.0f);
1208  m_roomRolloffFactor = value;
1209  alEffectf(m_effect, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, m_roomRolloffFactor);
1210  }
1211 
1213  return m_roomRolloffFactor;
1214  }
1215 
1216  void EaxReverb::setDecayHfLimit(bool value) {
1217  m_decayHfLimit = value;
1218  alEffecti(m_effect, AL_EAXREVERB_DECAY_HFLIMIT, m_decayHfLimit ? AL_TRUE : AL_FALSE);
1219  }
1220 
1222  return m_decayHfLimit;
1223  }
1224 
1225  void EaxReverb::loadPreset(const EFXEAXREVERBPROPERTIES& prop) {
1226  // reflections and reverb pans are always 0 vectors, skip it
1227  setDensity(prop.flDensity);
1228  setDiffusion(prop.flDiffusion);
1229  setGain(prop.flGain);
1230  setGainHf(prop.flGainHF);
1231  setGainLf(prop.flGainLF);
1232  setDecayTime(prop.flDecayTime);
1233  setDecayHfRatio(prop.flDecayHFRatio);
1234  setDecayLfRatio(prop.flDecayLFRatio);
1235  setReflectionsGain(prop.flReflectionsGain);
1236  setReflectionsDelay(prop.flReflectionsDelay);
1237  setLateReverbGain(prop.flLateReverbGain);
1238  setLateReverbDelay(prop.flLateReverbDelay);
1239  setEchoTime(prop.flEchoTime);
1240  setEchoDepth(prop.flEchoDepth);
1241  setModulationTime(prop.flModulationTime);
1242  setModulationDepth(prop.flModulationDepth);
1243  setAirAbsorptionGainHf(prop.flAirAbsorptionGainHF);
1244  setHfReference(prop.flHFReference);
1245  setLfReference(prop.flLFReference);
1246  setRoomRolloffFactor(prop.flRoomRolloffFactor);
1247  setDecayHfLimit(prop.iDecayHFLimit ? true : false);
1248  }
1249 
1250 } //FIFE
float getAirAbsorptionGainHf() const
Return air absorption gain hf.
float getRoomRolloffFactor() const
Return room rolloff factor.
float getDelay() const
Return delay.
void setAirAbsorptionGainHf(float value)
Sets air absorption gain hf, the distance-dependent attenuation at high frequencies caused by the pro...
void setDensity(float value)
Sets density, controls the coloration of the late reverb.
void setPhonemeCoarseA(int16_t value)
Sets phoneme coarse A, used to adjust the pitch of phoneme filters A and B in 1-semitone increments...
void setEnabled(bool enabled)
Enables or disables the effect.
Definition: soundeffect.cpp:75
void setEchoTime(float value)
Sets echo time, the rate at which the cyclic echo repeats itself along the reverberation decay...
void setWaveform(uint8_t value)
Sets waveform used as the carrier signal.
float getGainLf() const
Return lf gain.
void setRate(float value)
Sets rate, the frequency of the low-frequency oscillator used to morph between the two phoneme filter...
void setLrDelay(float value)
Sets the delay between the first ‘tap’ and the second ‘tap’.
VocalMorpher()
Constructor.
float getHfReference() const
Return hf reference.
float m_releaseTime
Definition: soundeffect.h:780
void setFeedback(float value)
Sets feedback, the amount of feedback the output signal fed back into the input.
int32_t m_phase
Definition: soundeffect.h:523
LPALEFFECTF alEffectf
float getLateReverbDelay() const
Return late reverb delay.
float getDamping() const
Return damping.
float getDiffusion() const
Return diffusion value.
Equalizer()
Constructor.
float m_decayHfRatio
Definition: soundeffect.h:243
void setWaveformTriangle(bool value)
Sets the waveform to triangle or sinus.
void setFeedback(float value)
Sets feedback, the amount of the output signal level fed back into the effect’s input.
float getMid2Center() const
Return mid2 center frequency.
uint8_t getWaveform() const
float getReflectionsDelay() const
Return reflections delay.
uint16_t getPhonemeB() const
Return phoneme B.
void setLowCutoff(float value)
Sets low cutoff, the low frequency below which signal will be cut off.
float getDensity() const
Return density value.
float getMid2Gain() const
Return mid1 gain.
Autowah()
Constructor.
ALuint m_slot
Effect slot id;.
Definition: soundeffect.h:95
float getEchoTime() const
Return the echo time.
void setDecayHfRatio(float value)
Sets decay hf ratio, the spectral quality of the Decay Time parameter.
bool m_waveformTriangle
Definition: soundeffect.h:522
float getLfReference() const
Return lf reference.
float getRate() const
Return rate.
float getAttackTime() const
Return attack time.
float getReflectionsGain() const
Return reflections gain.
EaxReverb()
Constructor.
float m_airAbsorptionGainHf
Definition: soundeffect.h:248
float getDepth() const
Return the depth.
float getRate() const
Return rate.
float getGainHf() const
Return hf gain.
void setGain(float value)
Sets gain, is the master volume control for the reflected sound.
void setWaveform(uint8_t value)
Sets waveform, the shape of the low-frequency oscillator used to morph between the two phoneme filter...
float getEdge() const
Return edge.
SoundEffectType m_effectType
Sound effect type.
Definition: soundeffect.h:97
SoundFilter * getFilter()
Return sound filter or NULL.
Definition: soundeffect.cpp:87
AudioSpaceCoordinate m_reflectionsPan
Definition: soundeffect.h:1171
void setEqBandwidth(float value)
Sets EQ bandwidth, the bandwidth of the post-distortion attenuation.
void setHighGain(float value)
Sets high gain, cut / boost signal on the “high” range.
float getMid1Gain() const
Return mid1 gain.
void setEdge(float value)
Sets edge, the shape of the distortion.
The class defines filters.
Definition: soundfilter.h:43
float m_reflectionsGain
Definition: soundeffect.h:1169
float m_roomRolloffFactor
Definition: soundeffect.h:1182
void setDecayHfLimit(bool value)
If decay hf limit is enabled, the high-frequency decay time automatically stays below a limit value t...
void setEchoDepth(float value)
Sets echo depth, the cyclic echo in the reverberation decay, which will be noticeable with transient ...
float getPeakGain() const
Return peak gain.
float m_reflectionsDelay
Definition: soundeffect.h:245
float getFrequency() const
Return carrier frequency.
float getFeedback() const
Return feedback.
float getGain() const
Return gain value.
static Logger _log(LM_AUDIO)
int16_t getPhonemeCoarseA() const
Return phoneme coarse A.
int16_t getCoarseTune() const
Return coarse tune.
float m_peakGain
Definition: soundeffect.h:782
void setReflectionsDelay(float value)
Sets the reflections delay, the amount of delay between the arrival time of the direct path from the ...
float getLowpassCutoff() const
Return lowpass cutoff.
int16_t getPhonemeCoarseB() const
Return phoneme coarse B.
void setLateReverbDelay(float value)
Sets late reverb delay, the begin time of the late reverberation relative to the time of the initial ...
void setModulationDepth(float value)
Sets modulation depth, the amount of pitch change.
void setLateReverbGain(float value)
Sets late reverb gain, the overall amount of later reverberation relative to gain.
float getDecayTime() const
Return decay time.
void setReflectionsGain(float value)
Sets reflections gain, the overall amount of initial reflections relative to the Gain property...
float m_modulationDepth
Definition: soundeffect.h:1178
void setCoarseTune(int16_t value)
Sets coarse tune, the number of semitones by which the pitch is shifted.
ALuint getEffectId() const
Return the OpenAL effect handle.
Definition: soundeffect.cpp:59
void setLowGain(float value)
Sets low gain, the amount of cut or boost on the low frequency range.
bool isDecayHfLimit() const
Return if decay hf limit is enabled.
void setPhonemeB(uint16_t value)
Sets phoneme B.
int16_t getFineTune() const
Return fine tune.
float getReflectionsGain() const
Return reflections gain.
float getDelay() const
Return delay.
float m_reflectionsDelay
Definition: soundeffect.h:1170
void setLeftDirection(uint8_t value)
Sets left direction, selects which internal signals are added together to produce the output...
bool isWaveformTriangle() const
Return if wavefrom is triangle.
float m_lateReverbGain
Definition: soundeffect.h:246
float getDecayLfRatio() const
Return decay lf ratio.
float getDiffusion() const
Return diffusion value.
float m_airAbsorptionGainHf
Definition: soundeffect.h:1179
float getDelay() const
Return delay.
float getFeedback() const
Return feedback.
ALuint getSlotId()
Return the OpenAL auxiliary slot handle.
Definition: soundeffect.cpp:67
float getDensity() const
Return density value.
void setEqCenter(float value)
Sets EQ center, the frequency at which the post-distortion attenuation (Distortion Gain) is active...
void setPhonemeA(uint16_t value)
Sets phoneme A.
float getReleaseTime() const
Return release time.
SoundEffectType getEffectType() const
Return sound effect type.
Definition: soundeffect.cpp:71
bool m_waveformTriangle
Definition: soundeffect.h:320
uint8_t getRightDirection() const
Return left direction.
float getLateReverbGain() const
Return late reverb gain.
void setDensity(float value)
Sets density, controls the coloration of the late reverb.
void setDecayTime(float value)
The reverberation decay time.
unsigned char uint8_t
Definition: core.h:38
bool m_enabled
Effect enabled.
Definition: soundeffect.h:99
void setPeakGain(float value)
Sets peak gain, the input signal level at which the band-pass filter will be fully opened...
LPALGENEFFECTS alGenEffects
float getHighGain() const
Return high gain.
float getMid1Width() const
Return mid1 width.
bool isWaveformTriangle() const
Return if waveform is triangle or sinus.
float getGain() const
Return gain value.
float getEqCenter() const
Return EQ center.
uint16_t getPhonemeA() const
Return phoneme A.
float m_lrDelay
Definition: soundeffect.h:448
AudioSpaceCoordinate getLateReverbPan() const
Return late reverb pan.
void setDecayHfLimit(bool value)
If decay hf limit is enabled, the high-frequency decay time automatically stays below a limit value t...
float m_gainHf
Definition: soundeffect.h:241
void setRightDirection(uint8_t value)
Sets right direction, selects which internal signals are added together to produce the output...
void setMid2Width(float value)
Sets mid2 width, the width of the “mid2” range.
void setGain(float value)
Sets gain, to attenuate the distorted sound.
float getFrequency() const
Return carrier frequency.
void setRoomRolloffFactor(float value)
Sets room rolloff factor, similar to rolloff factor it attenuate the reflected sound (containing both...
RingModulator()
Constructor.
void setDiffusion(float value)
Sets diffusion, controls the echo density in the reverberation decay.
float getMid2Width() const
Return mid2 width.
void setDepth(float value)
Sets depth, the ratio by which the delay time is modulated by the LFO.
void setFilter(SoundFilter *filter)
Sets the additional sound filter.
Definition: soundeffect.cpp:83
void setDelay(float value)
Sets the delay between the original sound and the first ‘tap’, or echo instance.
void setLowpassCutoff(float value)
Sets lowpass cutoff, to limit the amount of high frequency signal feeding into the distortion effect...
float m_density
Definition: soundeffect.h:238
void setDecayHfRatio(float value)
Sets decay hf ratio, the spectral quality of the Decay Time parameter.
void setAttackTime(float value)
Sets attack time, the time the filtering effect takes to sweep from minimum to maximum center frequen...
void setReflectionsGain(float value)
Sets reflections gain, the overall amount of initial reflections relative to the Gain property...
Chorus()
Constructor.
float getGain() const
Return gain.
float m_lateReverbGain
Definition: soundeffect.h:1172
void setFeedback(float value)
Sets the feedback, the amount of processed signal that is fed back to the input of the chorus effect...
void setResonance(float value)
Sets resonance, the peak, some times known as emphasis or Q, of the auto-wah band-pass filter...
SoundFilter * m_filter
Additional filter effect.
Definition: soundeffect.h:101
void setDiffusion(float value)
Sets diffusion, controls the echo density in the reverberation decay.
SoundEffect()
Constructor.
Definition: soundeffect.cpp:45
void setAirAbsorptionGainHf(float value)
Sets air absorption gain hf, the distance-dependent attenuation at high frequencies caused by the pro...
void setRate(float value)
Sets the rate, the modulation rate of the LFO that controls the delay time of the delayed signals...
float getLowGain() const
Return low gain.
void setFrequency(float value)
Sets the carrier signal frequency.
float getRate() const
Return the rate.
Echo()
Constructor.
int16_t m_phonemeCoarseA
Definition: soundeffect.h:649
float m_feedback
Definition: soundeffect.h:526
float getMid1Center() const
Return mid1 center frequency.
LPALDELETEEFFECTS alDeleteEffects
unsigned short uint16_t
Definition: core.h:39
void setSpread(float value)
Sets spread, that defines how hard panned the individual echoes are.
void setDecayTime(float value)
The reverberation decay time.
float m_decayTime
Definition: soundeffect.h:242
float getLateReverbGain() const
Return late reverb gain.
void setDepth(float value)
Sets the depth, the amount by which the delay time is modulated by the LFO.
void setLateReverbDelay(float value)
Sets late reverb delay, the begin time of the late reverberation relative to the time of the initial ...
void setFineTune(int16_t value)
Sets fine tune, the number of cents between Semitones a pitch is shifted.
void setHfReference(float value)
Sets hf reference, determine respectively the frequencies at which the high-frequency effects created...
void setLateReverbGain(float value)
Sets late reverb gain, the overall amount of later reverberation relative to gain.
float m_modulationTime
Definition: soundeffect.h:1177
void setDelay(float value)
Sets delay, the average amount of time the sample is delayed before it is played back.
AudioSpaceCoordinate getReflectionsPan() const
Return reflections pan.
void setReflectionsPan(const AudioSpaceCoordinate &coordinate)
Sets reflections pan, the 3D vector that controls the spatial distribution of the cluster of early re...
void setGainHf(float value)
Sets gain hf, tweaks reflected sound by attenuating it at high frequencies.
ALuint m_effect
Effect object id.
Definition: soundeffect.h:93
void setRoomRolloffFactor(float value)
Sets room rolloff factor, similar to rolloff factor it attenuate the reflected sound (containing both...
float m_reflectionsGain
Definition: soundeffect.h:244
float getDecayTime() const
Return decay time.
float m_roomRolloffFactor
Definition: soundeffect.h:249
void setGainLf(float value)
Sets gain lf, tweaks reflected sound by attenuating it at low frequencies.
void setRate(float value)
Sets rate, the number of times per second the LFO controlling the amount of delay repeats...
bool isCompressor() const
Return true if compressor is on, false otherwise.
void setPhonemeCoarseB(int16_t value)
Sets phoneme coarse B, used to adjust the pitch of phoneme filters A and B in 1-semitone increments...
SoundEffectType
Sound effect type.
Definition: soundconfig.h:48
Flanger()
Constructor.
float getAirAbsorptionGainHf() const
Return air absorption gain hf.
int32_t getPhase() const
Return phase.
float m_feedback
Definition: soundeffect.h:450
LPALEFFECTI alEffecti
float getModulationDepth() const
Return modulation depth.
void setMid1Center(float value)
Sets mid1 center, the center frequency for the “mid1” range.
float getHighpassCutoff() const
Return highpass cutoff frequency.
float getHighCutoff() const
Return high cutoff frequency.
float getDecayHfRatio() const
Return decay hf ratio.
AudioSpaceCoordinate m_lateReverbPan
Definition: soundeffect.h:1174
float getDecayHfRatio() const
Return decay hf ratio.
void setGain(float value)
Sets gain, is the master volume control for the reflected sound.
void setHighCutoff(float value)
Sets high cutoff, the high frequency above which signal will be cut off.
float getLowCutoff() const
Return low cutoff.
void setModulationTime(float value)
Sets modulation time, the speed of the vibrato (rate of periodic changes in pitch).
float m_attackTime
Definition: soundeffect.h:779
float m_spread
Definition: soundeffect.h:451
float getResonance() const
Return resonance.
void setPhase(int32_t value)
Sets the phase, difference between the left and right LFO’s.
void setReleaseTime(float value)
Sets relase time, the time the filtering effect takes to sweep from maximum back to base center frequ...
float m_diffusion
Definition: soundeffect.h:239
float m_resonance
Definition: soundeffect.h:781
bool isEnabled() const
Return true if the effect is enabled, false otherwise.
Definition: soundeffect.cpp:79
bool isDecayHfLimit() const
Return if decay hf limit is enabled.
void setLateReverbPan(const AudioSpaceCoordinate &coordinate)
Sets late reverb pan, the 3D vector that controls the spatial distribution of the late reverb...
void setHighpassCutoff(float value)
Sets highpass cutoff at which the input signal is high-pass filtered before being ring modulated...
Compressor()
Constructor.
void setMid2Center(float value)
Sets mid2 center, the center frequency for the “mid2” range.
float getEqBandwidth() const
Return EQ bandwidth.
void setSlotId(ALuint slot)
Sets the OpenAL auxiliary slot handle.
Definition: soundeffect.cpp:63
float getLrDelay() const
Return LR delay.
uint8_t getLeftDirection() const
Return left direction.
float getFeedback() const
Return feedback.
int32_t getPhase() const
Return the phase.
float m_damping
Definition: soundeffect.h:449
Reverb()
Constructor.
Definition: soundeffect.cpp:92
void setWaveformTriangle(bool value)
Sets waveform to triangle or sinus.
LPALEFFECTFV alEffectfv
FrequencyShifter()
Constructor.
float m_delay
Definition: soundeffect.h:447
void setGainHf(float value)
Sets gain hf, tweaks reflected sound by attenuating it at high frequencies.
float getReflectionsDelay() const
Return reflections delay.
void setFrequency(float value)
Sets the carrier frequency.
float getEchoDepth() const
Return echo depth.
void setCompressor(bool value)
Sets compressor on or off.
bool m_decayHfLimit
Definition: soundeffect.h:250
void loadPreset(const EFXEAXREVERBPROPERTIES &prop)
Load presets into the EAX reverb.
void setPhase(int32_t value)
Sets phase, difference between the left and right LFO’s.
Distortion()
Constructor.
void setMid2Gain(float value)
Sets mid2 gain, cut / boost signal on the “mid2” range.
void setLfReference(float value)
Sets lf reference, determine respectively the frequencies at which the low-frequency effects created ...
float getSpread() const
Return spread.
float getLateReverbDelay() const
Return late reverb delay.
int32_t m_phase
Definition: soundeffect.h:321
void setDamping(float value)
Sets damping, the amount of high frequency damping applied to each echo.
float m_feedback
Definition: soundeffect.h:324
void setMid1Width(float value)
Sets mid1 width, the width of the “mid1” range.
float getGainHf() const
Return hf gain.
void setDecayLfRatio(float value)
Sets decay lf ratio, the spectral quality of the Decay Time parameter.
PitchShifter()
Constructor.
float getModulationTime() const
Return modulation time.
float getRoomRolloffFactor() const
Return room rolloff factor.
float getDepth() const
Return depth.
int16_t m_phonemeCoarseB
Definition: soundeffect.h:650
void setMid1Gain(float value)
Sets mid1 gain, cut / boost signal on the “mid1” range.
void setReflectionsDelay(float value)
Sets the reflections delay, the amount of delay between the arrival time of the direct path from the ...
void setDelay(float value)
Sets the delay, the average amount of time the sample is delayed before it is played back...
uint8_t getWaveform() const
Return waveform.
virtual ~SoundEffect()
Destructor.
Definition: soundeffect.cpp:55