Mercurial > hg > audio_effects_textbook_code
comparison effects/distortion/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 |
comparison
equal
deleted
inserted
replaced
0:e32fe563e124 | 1:04e171d2a747 |
---|---|
33 along with this program. If not, see <http://www.gnu.org/licenses/>. | 33 along with this program. If not, see <http://www.gnu.org/licenses/>. |
34 */ | 34 */ |
35 | 35 |
36 #include "PluginProcessor.h" | 36 #include "PluginProcessor.h" |
37 #include "PluginEditor.h" | 37 #include "PluginEditor.h" |
38 | |
39 const float DENORMAL_THRESH = 1e-6f; | |
40 | 38 |
41 #if JUCE_INTEL | 39 #if JUCE_INTEL |
42 #define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8 || n > 1.0e-8)) n = 0; | 40 #define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8 || n > 1.0e-8)) n = 0; |
43 #else | 41 #else |
44 #define JUCE_SNAP_TO_ZERO(n) | 42 #define JUCE_SNAP_TO_ZERO(n) |
88 // Apply gain | 86 // Apply gain |
89 buffer.applyGain(channel, 0, buffer.getNumSamples(), gain); | 87 buffer.applyGain(channel, 0, buffer.getNumSamples(), gain); |
90 | 88 |
91 // Put track audio data into _currentTrackBuffer | 89 // Put track audio data into _currentTrackBuffer |
92 float * originalData = new float; | 90 float * originalData = new float; |
93 originalData = buffer.getSampleData(channel); | 91 originalData = buffer.getWritePointer(channel); |
94 | 92 |
95 // Apply distortion (sample per sample) | 93 // Apply distortion (sample per sample) |
96 switch (_typeNumber) { | 94 switch (_typeNumber) { |
97 case _hardClipping: | 95 case _hardClipping: |
98 { | 96 { |