From 4c80d13e54f5421774a992c1f1ff1c1ae832c2fc Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sun, 31 Oct 2010 14:44:45 +0000 Subject: Audaspace: Disabling High- and Lowpass for Bake Sound to F-Curve Operator in case they're unused. --- intern/audaspace/intern/AUD_C-API.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'intern/audaspace') diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp index 2e7309bf5c9..5e4e45d4e1e 100644 --- a/intern/audaspace/intern/AUD_C-API.cpp +++ b/intern/audaspace/intern/AUD_C-API.cpp @@ -782,10 +782,20 @@ float* AUD_readSoundBuffer(const char* filename, float low, float high, AUD_Sound* sound; AUD_FileFactory file(filename); + + AUD_IReader* reader = file.createReader(); + AUD_SampleRate rate = reader->getSpecs().rate; + delete reader; + AUD_ChannelMapperFactory mapper(&file, specs); - AUD_LowpassFactory lowpass(&mapper, high); - AUD_HighpassFactory highpass(&lowpass, low); - AUD_EnvelopeFactory envelope(&highpass, attack, release, threshold, 0.1f); + sound = &mapper; + AUD_LowpassFactory lowpass(sound, high); + if(high < rate) + sound = &lowpass; + AUD_HighpassFactory highpass(sound, low); + if(low > 0) + sound = &highpass; + AUD_EnvelopeFactory envelope(sound, attack, release, threshold, 0.1f); AUD_LinearResampleFactory resampler(&envelope, specs); sound = &resampler; AUD_SquareFactory squaref(sound, sthreshold); @@ -798,7 +808,7 @@ float* AUD_readSoundBuffer(const char* filename, float low, float high, else if(additive) sound = ∑ - AUD_IReader* reader = sound->createReader(); + reader = sound->createReader(); if(reader == NULL) return NULL; -- cgit v1.2.3