merge 🤦

This commit is contained in:
2017-06-26 23:37:32 -04:00
7 changed files with 44 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
#include "PluginProcessor.h"
#include "PluginEditor.h"
#include <math.h>
LampshadeAudioProcessor::LampshadeAudioProcessor()
#ifndef JucePlugin_PreferredChannelConfigurations
@@ -93,6 +94,7 @@ bool LampshadeAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts
void LampshadeAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
static float incrementer;
const int totalNumInputChannels = getTotalNumInputChannels();
const int totalNumOutputChannels = getTotalNumOutputChannels();
@@ -106,11 +108,17 @@ void LampshadeAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffe
buffer.clear(i, 0, buffer.getNumSamples());
float pitch = myYin.getPitch(buffer.getWritePointer (0)); // returns Pitch in Hertz
static float myPitch;
if(pitch > 0) { myPitch = pitch; }
for (int channel = 0; channel < totalNumInputChannels; ++channel) {
//float* channelData = buffer.getWritePointer (channel);
float* channel1Data = buffer.getWritePointer (0);
float* channel2Data = buffer.getWritePointer (1);
for(int i=0; i < buffer.getNumSamples(); i++){
incrementer += (myPitch / 4000);
channel1Data[i] = sin(incrementer) * 0.1;
channel2Data[i] = channel1Data[i];
}
printf("%f\n",channel1Data[0]);
}
bool LampshadeAudioProcessor::hasEditor() const

View File

@@ -1,12 +1,13 @@
#include "Yin.h"
#include <stdlib.h>
#include <stdio.h>
//#include "WProgram.h"
void Yin::initialize(float yinSampleRate,int yinBufferSize){
bufferSize = yinBufferSize;
sampleRate = yinSampleRate;
halfBufferSize = bufferSize / 2;
threshold = 0.15;
threshold = 0.01;
probability = 0.0;
//initialize array and set it to zero
yinBuffer = (float *) malloc(sizeof(float)* halfBufferSize);
@@ -137,6 +138,7 @@ int Yin::absoluteThreshold(){
break;
}
}
// if no pitch found, tau => -1
if (tau == halfBufferSize || yinBuffer[tau] >= threshold) {
tau = -1;