calling filter code from wrDsp

This commit is contained in:
Trent
2017-06-27 00:31:01 -04:00
parent 98a549dfe6
commit 6ecfb14f46
7 changed files with 34 additions and 3 deletions

View File

@@ -70,6 +70,8 @@ void LampshadeAudioProcessor::changeProgramName (int index, const String& newNam
void LampshadeAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) void LampshadeAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{ {
myYin = Yin(sampleRate, samplesPerBlock); myYin = Yin(sampleRate, samplesPerBlock);
aFilter = (filter_svf_t*)malloc(sizeof(filter_svf_t));
svf_init(aFilter, 0, sampleRate);
} }
void LampshadeAudioProcessor::releaseResources() void LampshadeAudioProcessor::releaseResources()
@@ -111,11 +113,13 @@ void LampshadeAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffe
static float myPitch; static float myPitch;
if(pitch > 0) { myPitch = pitch; } if(pitch > 0) { myPitch = pitch; }
svf_set_freq(aFilter, myPitch);
float* channel1Data = buffer.getWritePointer (0); float* channel1Data = buffer.getWritePointer (0);
float* channel2Data = buffer.getWritePointer (1); float* channel2Data = buffer.getWritePointer (1);
for(int i=0; i < buffer.getNumSamples(); i++){ for(int i=0; i < buffer.getNumSamples(); i++){
incrementer += (myPitch / 4000); incrementer += (myPitch / 4000);
channel1Data[i] = sin(incrementer) * 0.1; channel1Data[i] = svf_step(aFilter, channel1Data[i]);
channel2Data[i] = channel1Data[i]; channel2Data[i] = channel1Data[i];
} }
printf("%f\n",channel1Data[0]); printf("%f\n",channel1Data[0]);

View File

@@ -2,6 +2,10 @@
#include "../JuceLibraryCode/JuceHeader.h" #include "../JuceLibraryCode/JuceHeader.h"
#include "Yin.h" #include "Yin.h"
extern "C" {
#include "../wrDsp/wrFilter.h"
};
class LampshadeAudioProcessor : public AudioProcessor class LampshadeAudioProcessor : public AudioProcessor
{ {
@@ -39,4 +43,5 @@ public:
private: private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LampshadeAudioProcessor) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LampshadeAudioProcessor)
Yin myYin; Yin myYin;
filter_svf_t* aFilter;
}; };

Binary file not shown.

View File

@@ -1,4 +1,4 @@
<REAPER_PROJECT 0.1 "5.40/OSX64" 1498532532 <REAPER_PROJECT 0.1 "5.40/OSX64" 1498537701
RIPPLE 0 RIPPLE 0
GROUPOVERRIDE 0 0 0 GROUPOVERRIDE 0 0 0
AUTOXFADE 1 AUTOXFADE 1
@@ -13,7 +13,7 @@
TIMEMODE 1 5 -1 30 0 TIMEMODE 1 5 -1 30 0
VIDEO_CONFIG 0 0 256 VIDEO_CONFIG 0 0 256
PANMODE 3 PANMODE 3
CURSOR 0 CURSOR 2.5
ZOOM 100 0 0 ZOOM 100 0 0
VZOOMEX 6 VZOOMEX 6
USE_REC_CFG 0 USE_REC_CFG 0
@@ -148,5 +148,27 @@
FILE "test Project/Samples/Recorded/0001 3-Audio.wav" FILE "test Project/Samples/Recorded/0001 3-Audio.wav"
> >
> >
<ITEM
POSITION 2.5
SNAPOFFS 0
LENGTH 2.85605442176871
LOOP 1
ALLTAKES 0
FADEIN 1 0.01 0 1 0 0
FADEOUT 1 0.01 0 1 0 0
MUTE 0
SEL 0
IGUID {40AE50E4-88C5-B04D-BC5B-0252C25CB29D}
IID 2
NAME "0002 3-Audio-1.wav"
VOLPAN 1 0 1 -1
SOFFS 0
PLAYRATE 1 1 0 -1 0 0.0025
CHANMODE 0
GUID {5224CF49-4571-E246-A76E-9A2EA5058049}
<SOURCE WAVE
FILE "test Project/Samples/Recorded/0002 3-Audio-1.wav"
>
>
> >
> >