Mercurial > hg > audio_effects_textbook_code
diff effects/compressor/Source/PluginProcessor.cpp @ 1:04e171d2a747 tip
JUCE 4 compatible. Standardised paths on Mac: modules '../../juce/modules'; VST folder '~/SDKs/vstsdk2.4' (JUCE default). Replaced deprecated 'getSampleData(channel)'; getToggleState(...); setToggleState(...); setSelectedId(...). Removed unused variables. Ignore JUCE code and build files.
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Sun, 22 Nov 2015 15:23:40 +0000 |
parents | e32fe563e124 |
children |
line wrap: on
line diff
--- a/effects/compressor/Source/PluginProcessor.cpp Fri Oct 10 15:41:23 2014 +0100 +++ b/effects/compressor/Source/PluginProcessor.cpp Sun Nov 22 15:23:40 2015 +0000 @@ -29,7 +29,6 @@ #include "PluginProcessor.h" #include "PluginEditor.h" -const float tau = 200; CompressorAudioProcessor::CompressorAudioProcessor() // Initializer List : @@ -84,8 +83,8 @@ // apply control voltage to the audio signal for (int i = 0 ; i < bufferSize ; ++i) { - buffer.getSampleData(2*m+0)[i] *= c[i]; - buffer.getSampleData(2*m+1)[i] *= c[i]; + buffer.getWritePointer(2*m+0)[i] *= c[i]; + buffer.getWritePointer(2*m+1)[i] *= c[i]; } inputBuffer.clear(m,0,bufferSize); // Mix down left-right to analyse the output @@ -103,8 +102,8 @@ for (int i = 0 ; i < bufferSize ; ++i) { //Level detection- estimate level using peak detector - if (fabs(buffer.getSampleData(m)[i]) < 0.000001) x_g[i] =-120; - else x_g[i] =20*log10(fabs(buffer.getSampleData(m)[i])); + if (fabs(buffer.getWritePointer(m)[i]) < 0.000001) x_g[i] =-120; + else x_g[i] =20*log10(fabs(buffer.getWritePointer(m)[i])); //Gain computer- static apply input/output curve if (x_g[i] >= threshold) y_g[i] = threshold+ (x_g[i] - threshold) / ratio; else y_g[i] = x_g[i];