changeset 2:e621e794011f

* VST build fixes
author Chris Cannam
date Fri, 11 Jun 2010 11:44:45 +0100
parents 0d2126c32309
children 8b79175c9f02
files Devuvuzelator.vcproj devuvuzelator-vst.cpp devuvuzelator.cpp
diffstat 3 files changed, 257 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Devuvuzelator.vcproj	Fri Jun 11 11:44:45 2010 +0100
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="Devuvuzelator"
+	ProjectGUID="{9AE2D105-56E5-45D8-A886-5D6247F45416}"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;D:\win32-builds\devuvuzelator\vstsdk2.4&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DEVUVUZELATOR_EXPORTS;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/EXPORT:VSTPluginMain&#x0D;&#x0A;/EXPORT:main=VSTPluginMain"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;D:\win32-builds\devuvuzelator\vstsdk2.4&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DEVUVUZELATOR_EXPORTS;"
+				RuntimeLibrary="0"
+				FloatingPointModel="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/EXPORT:VSTPluginMain&#x0D;&#x0A;/EXPORT:main=VSTPluginMain&#x0D;&#x0A;"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\vstsdk2.4\pluginterfaces\vst2.x\aeffect.h"
+				>
+			</File>
+			<File
+				RelativePath=".\vstsdk2.4\pluginterfaces\vst2.x\aeffectx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\vstsdk2.4\public.sdk\source\vst2.x\aeffeditor.h"
+				>
+			</File>
+			<File
+				RelativePath=".\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.h"
+				>
+			</File>
+			<File
+				RelativePath=".\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\vstsdk2.4\pluginterfaces\vst2.x\vstfxstore.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\devuvuzelator-vst.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\vstsdk2.4\public.sdk\source\vst2.x\vstplugmain.cpp"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- 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;
 
--- a/devuvuzelator.cpp	Fri Jun 11 10:31:29 2010 +0100
+++ b/devuvuzelator.cpp	Fri Jun 11 11:44:45 2010 +0100
@@ -11,28 +11,10 @@
         mags[i] = sqrt(m_real[i] * m_real[i] + m_imag[i] * m_imag[i]);
     }
 
-    double low = -35;
-    double high = -20;
+    double lowfun = m_fundamental - m_bandwidth/2;
+    double highfun = m_fundamental + m_bandwidth/2;
 
-    if (m_low) low = *m_low;
-    if (m_high) high = *m_high;
-
-    int harmonics = 3;
-    if (m_harmonics) harmonics = int(*m_harmonics + 0.5);
-
-    double fun = 200;
-    if (m_fundamental) fun = *m_fundamental;
-
-    double bw = 40;
-    if (m_bandwidth) bw = *m_bandwidth;
-        
-    double lowfun = fun - bw/2;
-    double highfun = fun + bw/2;
-
-    double reduction = 10;
-    if (m_reduction) reduction = *m_reduction;
-
-    for (int h = 1; h <= harmonics; ++h) {
+    for (int h = 1; h <= m_harmonics; ++h) {
 
         double lowfreq = lowfun * h;
         double highfreq = highfun * h;
@@ -47,8 +29,8 @@
 //            std::cerr << "bin " << i << " freq " << (m_sampleRate * i) / m_fftsize << std::endl;
             ratios[i] = 1.0;
             double db = 10 * log10(mags[i]);
-            if (db > low && db < high) {
-                double r = reduction;
+            if (db > m_low && db < m_high) {
+                double r = m_reduction;
                 ratios[i] = pow(10, -r / 10);
             }
         }