9 #include "alc/effects/base.h"
10 #include "aloptional.h"
16 #include "alnumeric.h"
18 #include "al/eax_exception.h"
19 #include "al/eax_utils.h"
25 al::optional
<VMorpherPhenome
> PhenomeFromEnum(ALenum val
)
27 #define HANDLE_PHENOME(x) case AL_VOCAL_MORPHER_PHONEME_ ## x: \
28 return al::make_optional(VMorpherPhenome::x)
65 ALenum
EnumFromPhenome(VMorpherPhenome phenome
)
67 #define HANDLE_PHENOME(x) case VMorpherPhenome::x: return AL_VOCAL_MORPHER_PHONEME_ ## x
101 throw std::runtime_error
{"Invalid phenome: "+std::to_string(static_cast<int>(phenome
))};
102 #undef HANDLE_PHENOME
105 al::optional
<VMorpherWaveform
> WaveformFromEmum(ALenum value
)
109 case AL_VOCAL_MORPHER_WAVEFORM_SINUSOID
: return al::make_optional(VMorpherWaveform::Sinusoid
);
110 case AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE
: return al::make_optional(VMorpherWaveform::Triangle
);
111 case AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH
: return al::make_optional(VMorpherWaveform::Sawtooth
);
115 ALenum
EnumFromWaveform(VMorpherWaveform type
)
119 case VMorpherWaveform::Sinusoid
: return AL_VOCAL_MORPHER_WAVEFORM_SINUSOID
;
120 case VMorpherWaveform::Triangle
: return AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE
;
121 case VMorpherWaveform::Sawtooth
: return AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH
;
123 throw std::runtime_error
{"Invalid vocal morpher waveform: " +
124 std::to_string(static_cast<int>(type
))};
127 void Vmorpher_setParami(EffectProps
*props
, ALenum param
, int val
)
131 case AL_VOCAL_MORPHER_PHONEMEA
:
132 if(auto phenomeopt
= PhenomeFromEnum(val
))
133 props
->Vmorpher
.PhonemeA
= *phenomeopt
;
135 throw effect_exception
{AL_INVALID_VALUE
, "Vocal morpher phoneme-a out of range: 0x%04x", val
};
138 case AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING
:
139 if(!(val
>= AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING
&& val
<= AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING
))
140 throw effect_exception
{AL_INVALID_VALUE
, "Vocal morpher phoneme-a coarse tuning out of range"};
141 props
->Vmorpher
.PhonemeACoarseTuning
= val
;
144 case AL_VOCAL_MORPHER_PHONEMEB
:
145 if(auto phenomeopt
= PhenomeFromEnum(val
))
146 props
->Vmorpher
.PhonemeB
= *phenomeopt
;
148 throw effect_exception
{AL_INVALID_VALUE
, "Vocal morpher phoneme-b out of range: 0x%04x", val
};
151 case AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING
:
152 if(!(val
>= AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING
&& val
<= AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING
))
153 throw effect_exception
{AL_INVALID_VALUE
, "Vocal morpher phoneme-b coarse tuning out of range"};
154 props
->Vmorpher
.PhonemeBCoarseTuning
= val
;
157 case AL_VOCAL_MORPHER_WAVEFORM
:
158 if(auto formopt
= WaveformFromEmum(val
))
159 props
->Vmorpher
.Waveform
= *formopt
;
161 throw effect_exception
{AL_INVALID_VALUE
, "Vocal morpher waveform out of range: 0x%04x", val
};
165 throw effect_exception
{AL_INVALID_ENUM
, "Invalid vocal morpher integer property 0x%04x",
169 void Vmorpher_setParamiv(EffectProps
*, ALenum param
, const int*)
171 throw effect_exception
{AL_INVALID_ENUM
, "Invalid vocal morpher integer-vector property 0x%04x",
174 void Vmorpher_setParamf(EffectProps
*props
, ALenum param
, float val
)
178 case AL_VOCAL_MORPHER_RATE
:
179 if(!(val
>= AL_VOCAL_MORPHER_MIN_RATE
&& val
<= AL_VOCAL_MORPHER_MAX_RATE
))
180 throw effect_exception
{AL_INVALID_VALUE
, "Vocal morpher rate out of range"};
181 props
->Vmorpher
.Rate
= val
;
185 throw effect_exception
{AL_INVALID_ENUM
, "Invalid vocal morpher float property 0x%04x",
189 void Vmorpher_setParamfv(EffectProps
*props
, ALenum param
, const float *vals
)
190 { Vmorpher_setParamf(props
, param
, vals
[0]); }
192 void Vmorpher_getParami(const EffectProps
*props
, ALenum param
, int* val
)
196 case AL_VOCAL_MORPHER_PHONEMEA
:
197 *val
= EnumFromPhenome(props
->Vmorpher
.PhonemeA
);
200 case AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING
:
201 *val
= props
->Vmorpher
.PhonemeACoarseTuning
;
204 case AL_VOCAL_MORPHER_PHONEMEB
:
205 *val
= EnumFromPhenome(props
->Vmorpher
.PhonemeB
);
208 case AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING
:
209 *val
= props
->Vmorpher
.PhonemeBCoarseTuning
;
212 case AL_VOCAL_MORPHER_WAVEFORM
:
213 *val
= EnumFromWaveform(props
->Vmorpher
.Waveform
);
217 throw effect_exception
{AL_INVALID_ENUM
, "Invalid vocal morpher integer property 0x%04x",
221 void Vmorpher_getParamiv(const EffectProps
*, ALenum param
, int*)
223 throw effect_exception
{AL_INVALID_ENUM
, "Invalid vocal morpher integer-vector property 0x%04x",
226 void Vmorpher_getParamf(const EffectProps
*props
, ALenum param
, float *val
)
230 case AL_VOCAL_MORPHER_RATE
:
231 *val
= props
->Vmorpher
.Rate
;
235 throw effect_exception
{AL_INVALID_ENUM
, "Invalid vocal morpher float property 0x%04x",
239 void Vmorpher_getParamfv(const EffectProps
*props
, ALenum param
, float *vals
)
240 { Vmorpher_getParamf(props
, param
, vals
); }
242 EffectProps
genDefaultProps() noexcept
245 props
.Vmorpher
.Rate
= AL_VOCAL_MORPHER_DEFAULT_RATE
;
246 props
.Vmorpher
.PhonemeA
= *PhenomeFromEnum(AL_VOCAL_MORPHER_DEFAULT_PHONEMEA
);
247 props
.Vmorpher
.PhonemeB
= *PhenomeFromEnum(AL_VOCAL_MORPHER_DEFAULT_PHONEMEB
);
248 props
.Vmorpher
.PhonemeACoarseTuning
= AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING
;
249 props
.Vmorpher
.PhonemeBCoarseTuning
= AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING
;
250 props
.Vmorpher
.Waveform
= *WaveformFromEmum(AL_VOCAL_MORPHER_DEFAULT_WAVEFORM
);
256 DEFINE_ALEFFECT_VTABLE(Vmorpher
);
258 const EffectProps VmorpherEffectProps
{genDefaultProps()};
263 using EaxVocalMorpherEffectDirtyFlagsValue
= std::uint_least8_t;
265 struct EaxVocalMorpherEffectDirtyFlags
267 using EaxIsBitFieldStruct
= bool;
269 EaxVocalMorpherEffectDirtyFlagsValue ulPhonemeA
: 1;
270 EaxVocalMorpherEffectDirtyFlagsValue lPhonemeACoarseTuning
: 1;
271 EaxVocalMorpherEffectDirtyFlagsValue ulPhonemeB
: 1;
272 EaxVocalMorpherEffectDirtyFlagsValue lPhonemeBCoarseTuning
: 1;
273 EaxVocalMorpherEffectDirtyFlagsValue ulWaveform
: 1;
274 EaxVocalMorpherEffectDirtyFlagsValue flRate
: 1;
275 }; // EaxPitchShifterEffectDirtyFlags
278 class EaxVocalMorpherEffect final
:
282 EaxVocalMorpherEffect();
286 const EaxEaxCall
& eax_call
) override
;
289 EAXVOCALMORPHERPROPERTIES eax_
{};
290 EAXVOCALMORPHERPROPERTIES eax_d_
{};
291 EaxVocalMorpherEffectDirtyFlags eax_dirty_flags_
{};
294 void set_eax_defaults();
297 void set_efx_phoneme_a();
299 void set_efx_phoneme_a_coarse_tuning();
301 void set_efx_phoneme_b();
303 void set_efx_phoneme_b_coarse_tuning();
305 void set_efx_waveform();
309 void set_efx_defaults();
314 const EaxEaxCall
& eax_call
);
317 void validate_phoneme_a(
318 unsigned long ulPhonemeA
);
320 void validate_phoneme_a_coarse_tuning(
321 long lPhonemeACoarseTuning
);
323 void validate_phoneme_b(
324 unsigned long ulPhonemeB
);
326 void validate_phoneme_b_coarse_tuning(
327 long lPhonemeBCoarseTuning
);
329 void validate_waveform(
330 unsigned long ulWaveform
);
336 const EAXVOCALMORPHERPROPERTIES
& all
);
339 void defer_phoneme_a(
340 unsigned long ulPhonemeA
);
342 void defer_phoneme_a_coarse_tuning(
343 long lPhonemeACoarseTuning
);
345 void defer_phoneme_b(
346 unsigned long ulPhonemeB
);
348 void defer_phoneme_b_coarse_tuning(
349 long lPhonemeBCoarseTuning
);
352 unsigned long ulWaveform
);
358 const EAXVOCALMORPHERPROPERTIES
& all
);
361 void defer_phoneme_a(
362 const EaxEaxCall
& eax_call
);
364 void defer_phoneme_a_coarse_tuning(
365 const EaxEaxCall
& eax_call
);
367 void defer_phoneme_b(
368 const EaxEaxCall
& eax_call
);
370 void defer_phoneme_b_coarse_tuning(
371 const EaxEaxCall
& eax_call
);
374 const EaxEaxCall
& eax_call
);
377 const EaxEaxCall
& eax_call
);
380 const EaxEaxCall
& eax_call
);
384 bool apply_deferred();
388 const EaxEaxCall
& eax_call
);
389 }; // EaxVocalMorpherEffect
392 class EaxVocalMorpherEffectException
:
396 explicit EaxVocalMorpherEffectException(
399 EaxException
{"EAX_VOCAL_MORPHER_EFFECT", message
}
402 }; // EaxVocalMorpherEffectException
405 EaxVocalMorpherEffect::EaxVocalMorpherEffect()
406 : EaxEffect
{AL_EFFECT_VOCAL_MORPHER
}
413 bool EaxVocalMorpherEffect::dispatch(
414 const EaxEaxCall
& eax_call
)
416 return eax_call
.is_get() ? get(eax_call
) : set(eax_call
);
419 void EaxVocalMorpherEffect::set_eax_defaults()
421 eax_
.ulPhonemeA
= EAXVOCALMORPHER_DEFAULTPHONEMEA
;
422 eax_
.lPhonemeACoarseTuning
= EAXVOCALMORPHER_DEFAULTPHONEMEACOARSETUNING
;
423 eax_
.ulPhonemeB
= EAXVOCALMORPHER_DEFAULTPHONEMEB
;
424 eax_
.lPhonemeBCoarseTuning
= EAXVOCALMORPHER_DEFAULTPHONEMEBCOARSETUNING
;
425 eax_
.ulWaveform
= EAXVOCALMORPHER_DEFAULTWAVEFORM
;
426 eax_
.flRate
= EAXVOCALMORPHER_DEFAULTRATE
;
431 void EaxVocalMorpherEffect::set_efx_phoneme_a()
433 const auto phoneme_a
= clamp(
434 static_cast<ALint
>(eax_
.ulPhonemeA
),
435 AL_VOCAL_MORPHER_MIN_PHONEMEA
,
436 AL_VOCAL_MORPHER_MAX_PHONEMEA
);
438 const auto efx_phoneme_a
= PhenomeFromEnum(phoneme_a
);
439 assert(efx_phoneme_a
.has_value());
440 al_effect_props_
.Vmorpher
.PhonemeA
= *efx_phoneme_a
;
443 void EaxVocalMorpherEffect::set_efx_phoneme_a_coarse_tuning()
445 const auto phoneme_a_coarse_tuning
= clamp(
446 static_cast<ALint
>(eax_
.lPhonemeACoarseTuning
),
447 AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING
,
448 AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING
);
450 al_effect_props_
.Vmorpher
.PhonemeACoarseTuning
= phoneme_a_coarse_tuning
;
453 void EaxVocalMorpherEffect::set_efx_phoneme_b()
455 const auto phoneme_b
= clamp(
456 static_cast<ALint
>(eax_
.ulPhonemeB
),
457 AL_VOCAL_MORPHER_MIN_PHONEMEB
,
458 AL_VOCAL_MORPHER_MAX_PHONEMEB
);
460 const auto efx_phoneme_b
= PhenomeFromEnum(phoneme_b
);
461 assert(efx_phoneme_b
.has_value());
462 al_effect_props_
.Vmorpher
.PhonemeB
= *efx_phoneme_b
;
465 void EaxVocalMorpherEffect::set_efx_phoneme_b_coarse_tuning()
467 const auto phoneme_b_coarse_tuning
= clamp(
468 static_cast<ALint
>(eax_
.lPhonemeBCoarseTuning
),
469 AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING
,
470 AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING
);
472 al_effect_props_
.Vmorpher
.PhonemeBCoarseTuning
= phoneme_b_coarse_tuning
;
475 void EaxVocalMorpherEffect::set_efx_waveform()
477 const auto waveform
= clamp(
478 static_cast<ALint
>(eax_
.ulWaveform
),
479 AL_VOCAL_MORPHER_MIN_WAVEFORM
,
480 AL_VOCAL_MORPHER_MAX_WAVEFORM
);
482 const auto wfx_waveform
= WaveformFromEmum(waveform
);
483 assert(wfx_waveform
.has_value());
484 al_effect_props_
.Vmorpher
.Waveform
= *wfx_waveform
;
487 void EaxVocalMorpherEffect::set_efx_rate()
489 const auto rate
= clamp(
491 AL_VOCAL_MORPHER_MIN_RATE
,
492 AL_VOCAL_MORPHER_MAX_RATE
);
494 al_effect_props_
.Vmorpher
.Rate
= rate
;
497 void EaxVocalMorpherEffect::set_efx_defaults()
500 set_efx_phoneme_a_coarse_tuning();
502 set_efx_phoneme_b_coarse_tuning();
508 bool EaxVocalMorpherEffect::get(
509 const EaxEaxCall
& eax_call
)
511 switch (eax_call
.get_property_id())
513 case EAXVOCALMORPHER_NONE
:
516 case EAXVOCALMORPHER_ALLPARAMETERS
:
517 eax_call
.set_value
<EaxVocalMorpherEffectException
>(eax_
);
520 case EAXVOCALMORPHER_PHONEMEA
:
521 eax_call
.set_value
<EaxVocalMorpherEffectException
>(eax_
.ulPhonemeA
);
524 case EAXVOCALMORPHER_PHONEMEACOARSETUNING
:
525 eax_call
.set_value
<EaxVocalMorpherEffectException
>(eax_
.lPhonemeACoarseTuning
);
528 case EAXVOCALMORPHER_PHONEMEB
:
529 eax_call
.set_value
<EaxVocalMorpherEffectException
>(eax_
.ulPhonemeB
);
532 case EAXVOCALMORPHER_PHONEMEBCOARSETUNING
:
533 eax_call
.set_value
<EaxVocalMorpherEffectException
>(eax_
.lPhonemeBCoarseTuning
);
536 case EAXVOCALMORPHER_WAVEFORM
:
537 eax_call
.set_value
<EaxVocalMorpherEffectException
>(eax_
.ulWaveform
);
540 case EAXVOCALMORPHER_RATE
:
541 eax_call
.set_value
<EaxVocalMorpherEffectException
>(eax_
.flRate
);
545 throw EaxVocalMorpherEffectException
{"Unsupported property id."};
551 void EaxVocalMorpherEffect::validate_phoneme_a(
552 unsigned long ulPhonemeA
)
554 eax_validate_range
<EaxVocalMorpherEffectException
>(
557 EAXVOCALMORPHER_MINPHONEMEA
,
558 EAXVOCALMORPHER_MAXPHONEMEA
);
561 void EaxVocalMorpherEffect::validate_phoneme_a_coarse_tuning(
562 long lPhonemeACoarseTuning
)
564 eax_validate_range
<EaxVocalMorpherEffectException
>(
565 "Phoneme A Coarse Tuning",
566 lPhonemeACoarseTuning
,
567 EAXVOCALMORPHER_MINPHONEMEACOARSETUNING
,
568 EAXVOCALMORPHER_MAXPHONEMEACOARSETUNING
);
571 void EaxVocalMorpherEffect::validate_phoneme_b(
572 unsigned long ulPhonemeB
)
574 eax_validate_range
<EaxVocalMorpherEffectException
>(
577 EAXVOCALMORPHER_MINPHONEMEB
,
578 EAXVOCALMORPHER_MAXPHONEMEB
);
581 void EaxVocalMorpherEffect::validate_phoneme_b_coarse_tuning(
582 long lPhonemeBCoarseTuning
)
584 eax_validate_range
<EaxVocalMorpherEffectException
>(
585 "Phoneme B Coarse Tuning",
586 lPhonemeBCoarseTuning
,
587 EAXVOCALMORPHER_MINPHONEMEBCOARSETUNING
,
588 EAXVOCALMORPHER_MAXPHONEMEBCOARSETUNING
);
591 void EaxVocalMorpherEffect::validate_waveform(
592 unsigned long ulWaveform
)
594 eax_validate_range
<EaxVocalMorpherEffectException
>(
597 EAXVOCALMORPHER_MINWAVEFORM
,
598 EAXVOCALMORPHER_MAXWAVEFORM
);
601 void EaxVocalMorpherEffect::validate_rate(
604 eax_validate_range
<EaxVocalMorpherEffectException
>(
607 EAXVOCALMORPHER_MINRATE
,
608 EAXVOCALMORPHER_MAXRATE
);
611 void EaxVocalMorpherEffect::validate_all(
612 const EAXVOCALMORPHERPROPERTIES
& all
)
614 validate_phoneme_a(all
.ulPhonemeA
);
615 validate_phoneme_a_coarse_tuning(all
.lPhonemeACoarseTuning
);
616 validate_phoneme_b(all
.ulPhonemeB
);
617 validate_phoneme_b_coarse_tuning(all
.lPhonemeBCoarseTuning
);
618 validate_waveform(all
.ulWaveform
);
619 validate_rate(all
.flRate
);
622 void EaxVocalMorpherEffect::defer_phoneme_a(
623 unsigned long ulPhonemeA
)
625 eax_d_
.ulPhonemeA
= ulPhonemeA
;
626 eax_dirty_flags_
.ulPhonemeA
= (eax_
.ulPhonemeA
!= eax_d_
.ulPhonemeA
);
629 void EaxVocalMorpherEffect::defer_phoneme_a_coarse_tuning(
630 long lPhonemeACoarseTuning
)
632 eax_d_
.lPhonemeACoarseTuning
= lPhonemeACoarseTuning
;
633 eax_dirty_flags_
.lPhonemeACoarseTuning
= (eax_
.lPhonemeACoarseTuning
!= eax_d_
.lPhonemeACoarseTuning
);
636 void EaxVocalMorpherEffect::defer_phoneme_b(
637 unsigned long ulPhonemeB
)
639 eax_d_
.ulPhonemeB
= ulPhonemeB
;
640 eax_dirty_flags_
.ulPhonemeB
= (eax_
.ulPhonemeB
!= eax_d_
.ulPhonemeB
);
643 void EaxVocalMorpherEffect::defer_phoneme_b_coarse_tuning(
644 long lPhonemeBCoarseTuning
)
646 eax_d_
.lPhonemeBCoarseTuning
= lPhonemeBCoarseTuning
;
647 eax_dirty_flags_
.lPhonemeBCoarseTuning
= (eax_
.lPhonemeBCoarseTuning
!= eax_d_
.lPhonemeBCoarseTuning
);
650 void EaxVocalMorpherEffect::defer_waveform(
651 unsigned long ulWaveform
)
653 eax_d_
.ulWaveform
= ulWaveform
;
654 eax_dirty_flags_
.ulWaveform
= (eax_
.ulWaveform
!= eax_d_
.ulWaveform
);
657 void EaxVocalMorpherEffect::defer_rate(
660 eax_d_
.flRate
= flRate
;
661 eax_dirty_flags_
.flRate
= (eax_
.flRate
!= eax_d_
.flRate
);
664 void EaxVocalMorpherEffect::defer_all(
665 const EAXVOCALMORPHERPROPERTIES
& all
)
667 defer_phoneme_a(all
.ulPhonemeA
);
668 defer_phoneme_a_coarse_tuning(all
.lPhonemeACoarseTuning
);
669 defer_phoneme_b(all
.ulPhonemeB
);
670 defer_phoneme_b_coarse_tuning(all
.lPhonemeBCoarseTuning
);
671 defer_waveform(all
.ulWaveform
);
672 defer_rate(all
.flRate
);
675 void EaxVocalMorpherEffect::defer_phoneme_a(
676 const EaxEaxCall
& eax_call
)
678 const auto& phoneme_a
= eax_call
.get_value
<
679 EaxVocalMorpherEffectException
,
680 const decltype(EAXVOCALMORPHERPROPERTIES::ulPhonemeA
)
683 validate_phoneme_a(phoneme_a
);
684 defer_phoneme_a(phoneme_a
);
687 void EaxVocalMorpherEffect::defer_phoneme_a_coarse_tuning(
688 const EaxEaxCall
& eax_call
)
690 const auto& phoneme_a_coarse_tuning
= eax_call
.get_value
<
691 EaxVocalMorpherEffectException
,
692 const decltype(EAXVOCALMORPHERPROPERTIES::lPhonemeACoarseTuning
)
695 validate_phoneme_a_coarse_tuning(phoneme_a_coarse_tuning
);
696 defer_phoneme_a_coarse_tuning(phoneme_a_coarse_tuning
);
699 void EaxVocalMorpherEffect::defer_phoneme_b(
700 const EaxEaxCall
& eax_call
)
702 const auto& phoneme_b
= eax_call
.get_value
<
703 EaxVocalMorpherEffectException
,
704 const decltype(EAXVOCALMORPHERPROPERTIES::ulPhonemeB
)
707 validate_phoneme_b(phoneme_b
);
708 defer_phoneme_b(phoneme_b
);
711 void EaxVocalMorpherEffect::defer_phoneme_b_coarse_tuning(
712 const EaxEaxCall
& eax_call
)
714 const auto& phoneme_b_coarse_tuning
= eax_call
.get_value
<
715 EaxVocalMorpherEffectException
,
716 const decltype(EAXVOCALMORPHERPROPERTIES::lPhonemeBCoarseTuning
)
719 validate_phoneme_b_coarse_tuning(phoneme_b_coarse_tuning
);
720 defer_phoneme_b_coarse_tuning(phoneme_b_coarse_tuning
);
723 void EaxVocalMorpherEffect::defer_waveform(
724 const EaxEaxCall
& eax_call
)
726 const auto& waveform
= eax_call
.get_value
<
727 EaxVocalMorpherEffectException
,
728 const decltype(EAXVOCALMORPHERPROPERTIES::ulWaveform
)
731 validate_waveform(waveform
);
732 defer_waveform(waveform
);
735 void EaxVocalMorpherEffect::defer_rate(
736 const EaxEaxCall
& eax_call
)
738 const auto& rate
= eax_call
.get_value
<
739 EaxVocalMorpherEffectException
,
740 const decltype(EAXVOCALMORPHERPROPERTIES::flRate
)
747 void EaxVocalMorpherEffect::defer_all(
748 const EaxEaxCall
& eax_call
)
750 const auto& all
= eax_call
.get_value
<
751 EaxVocalMorpherEffectException
,
752 const EAXVOCALMORPHERPROPERTIES
760 bool EaxVocalMorpherEffect::apply_deferred()
762 if (eax_dirty_flags_
== EaxVocalMorpherEffectDirtyFlags
{})
769 if (eax_dirty_flags_
.ulPhonemeA
)
774 if (eax_dirty_flags_
.lPhonemeACoarseTuning
)
776 set_efx_phoneme_a_coarse_tuning();
779 if (eax_dirty_flags_
.ulPhonemeB
)
784 if (eax_dirty_flags_
.lPhonemeBCoarseTuning
)
786 set_efx_phoneme_b_coarse_tuning();
789 if (eax_dirty_flags_
.ulWaveform
)
794 if (eax_dirty_flags_
.flRate
)
799 eax_dirty_flags_
= EaxVocalMorpherEffectDirtyFlags
{};
805 bool EaxVocalMorpherEffect::set(
806 const EaxEaxCall
& eax_call
)
808 switch (eax_call
.get_property_id())
810 case EAXVOCALMORPHER_NONE
:
813 case EAXVOCALMORPHER_ALLPARAMETERS
:
817 case EAXVOCALMORPHER_PHONEMEA
:
818 defer_phoneme_a(eax_call
);
821 case EAXVOCALMORPHER_PHONEMEACOARSETUNING
:
822 defer_phoneme_a_coarse_tuning(eax_call
);
825 case EAXVOCALMORPHER_PHONEMEB
:
826 defer_phoneme_b(eax_call
);
829 case EAXVOCALMORPHER_PHONEMEBCOARSETUNING
:
830 defer_phoneme_b_coarse_tuning(eax_call
);
833 case EAXVOCALMORPHER_WAVEFORM
:
834 defer_waveform(eax_call
);
837 case EAXVOCALMORPHER_RATE
:
838 defer_rate(eax_call
);
842 throw EaxVocalMorpherEffectException
{"Unsupported property id."};
845 if (!eax_call
.is_deferred())
847 return apply_deferred();
856 EaxEffectUPtr
eax_create_eax_vocal_morpher_effect()
858 return std::make_unique
<EaxVocalMorpherEffect
>();