diff devuvuzelator-vst.cpp @ 2:e621e794011f

* VST build fixes
author Chris Cannam
date Fri, 11 Jun 2010 11:44:45 +0100
parents 0d2126c32309
children 8b79175c9f02
line wrap: on
line diff
--- a/devuvuzelator-vst.cpp	Fri Jun 11 10:31:29 2010 +0100
+++ b/devuvuzelator-vst.cpp	Fri Jun 11 11:44:45 2010 +0100
@@ -1,10 +1,16 @@
 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
 
-#include <alloca.h>
+#define _USE_MATH_DEFINES
+
 #include <iostream>
 #include <cmath>
+#include <cstdio>
+#include <malloc.h>
 
-#include <vst2.x/audioeffect.h>
+#include "public.sdk/source/vst2.x/audioeffect.h"
+
+#define snprintf _snprintf
+#define alloca _alloca
 
 #define FFTSIZE 1024
 
@@ -60,7 +66,7 @@
     static void fft(unsigned int n, bool inverse,
                     double *ri, double *ii, double *ro, double *io);
 
-    int m_sampleRate;
+    float m_sampleRate;
     float *m_input;
     float *m_output;
 
@@ -68,7 +74,7 @@
     float m_high;
     float m_fundamental;
     float m_bandwidth;
-    float m_harmonics;
+    int m_harmonics;
     float m_reduction;
 
     const int m_fftsize;
@@ -105,9 +111,10 @@
     case 1: return (m_high + 80) / 80;
     case 2: return (m_fundamental - 110) / 440;
     case 3: return (m_bandwidth - 20) / 80;
-    case 4: return (m_harmonics / 6.0);
+    case 4: return (m_harmonics / 6.f);
     case 5: return m_reduction / 20;
     }
+	return 0;
 }
 
 // NB! The max name length for VST parameter names, labels
@@ -132,16 +139,14 @@
 void
 Devuvuzelator::getParameterDisplay(VstInt32 index, char *label)
 {
-    float *params[NumParams] = {
-        m_low,
-        m_high,
-        m_fundamental,
-        m_bandwidth,
-        m_harmonics,
-        m_reduction,
-    };
-
-    snprintf(label, kVstMaxParamStrLen, "%f", *params[index]);
+	switch (index) {
+		case 0: snprintf(label, kVstMaxParamStrLen, "%f", m_low); break;
+		case 1: snprintf(label, kVstMaxParamStrLen, "%f", m_high); break;
+		case 2: snprintf(label, kVstMaxParamStrLen, "%f", m_fundamental); break;
+		case 3: snprintf(label, kVstMaxParamStrLen, "%f", m_bandwidth); break;
+		case 4: snprintf(label, kVstMaxParamStrLen, "%d", m_harmonics); break;
+		case 5: snprintf(label, kVstMaxParamStrLen, "%f", m_reduction); break;
+	}
 }
 
 void
@@ -188,7 +193,7 @@
     m_harmonics = 3;
     m_reduction = 10;
     
-    setUniqueID("qmvz");
+    setUniqueID('qmvz');
     setNumInputs(1);
     setNumOutputs(1);
     canProcessReplacing(true);
@@ -226,8 +231,9 @@
 
     int ii = 0;
     int oi = 0;
+	const int sc = sampleCount;
 
-    while (ii < sampleCount) {
+    while (ii < sc) {
 
         m_output[oi++] = m_outacc[m_read++] / 1.5f;