diff options
author | Chris Robinson <[email protected]> | 2019-08-08 15:13:47 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-08-08 15:22:22 -0700 |
commit | f900efa7f258563bfc5a50f925f834097dcee433 (patch) | |
tree | 88a7b0703500fd0f957a9a163cdb26fb6faa0d1e /alc/effects/vmorpher.cpp | |
parent | fb1fde9fb030116cdfc66af3ff7277d89a31953a (diff) |
Simplify and fix vocal morpher pitch calculations
Diffstat (limited to 'alc/effects/vmorpher.cpp')
-rw-r--r-- | alc/effects/vmorpher.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/alc/effects/vmorpher.cpp b/alc/effects/vmorpher.cpp index ad0f026b..bf144abb 100644 --- a/alc/effects/vmorpher.cpp +++ b/alc/effects/vmorpher.cpp @@ -223,8 +223,8 @@ void VmorpherState::update(const ALCcontext *context, const ALeffectslot *slot, else /*if(props->Vmorpher.Waveform == AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE)*/ mGetSamples = Oscillate<Triangle>; - const ALfloat pitchA{fastf2i(std::pow(2.0f, props->Vmorpher.PhonemeACoarseTuning*100.0f / 2400.0f)*FRACTIONONE) * (1.0f/FRACTIONONE)}; - const ALfloat pitchB{fastf2i(std::pow(2.0f, props->Vmorpher.PhonemeBCoarseTuning*100.0f / 2400.0f)*FRACTIONONE) * (1.0f/FRACTIONONE)}; + const ALfloat pitchA{std::pow(2.0f, props->Vmorpher.PhonemeACoarseTuning / 12.0f)}; + const ALfloat pitchB{std::pow(2.0f, props->Vmorpher.PhonemeBCoarseTuning / 12.0f)}; auto vowelA = getFiltersByPhoneme(props->Vmorpher.PhonemeA, frequency, pitchA); auto vowelB = getFiltersByPhoneme(props->Vmorpher.PhonemeB, frequency, pitchB); @@ -261,11 +261,8 @@ void VmorpherState::process(const ALsizei samplesToDo, const FloatBufferLine *RE ASSUME(numInput > 0); for(ALsizei c{0};c < numInput;c++) { - for (ALsizei i{0};i < td;i++) - { - mSampleBufferA[i] = 0.0f; - mSampleBufferB[i] = 0.0f; - } + std::fill_n(std::begin(mSampleBufferA), td, 0.0f); + std::fill_n(std::begin(mSampleBufferB), td, 0.0f); auto& vowelA = mChans[c].Formants[VOWEL_A_INDEX]; auto& vowelB = mChans[c].Formants[VOWEL_B_INDEX]; |