diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/src/Makefile b/src/Makefile index 5addb22..40ba3ee 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ include ../make/defaults.mk -NAME := Vitalisierer +NAME := Filter CONFIG ?= release -TARGET ?= JayVitalisierer.so +TARGET ?= JayFilter.so CFLAGS += -fPIC CXXFLAGS += -fPIC @@ -14,7 +14,7 @@ INCLUDES += -I $(VST2_SDK_PATH) DEFINES += -DVST_2_4_EXTENSIONS=0 -DVST_2_3_EXTENSIONS=1 GCC_SRCS := iir.c paramutils.c -CXX_SRCS := VitalisiererMain.cpp Vitalisierer2.cpp +CXX_SRCS := filter.cpp filterMain.cpp CXX_SRCS += $(VST2_SDK_PATH)/public.sdk/source/vst2.x/audioeffect.cpp CXX_SRCS += $(VST2_SDK_PATH)/public.sdk/source/vst2.x/audioeffectx.cpp diff --git a/src/filter.cpp b/src/filter.cpp index 6fde1f2..e2717a6 100755 --- a/src/filter.cpp +++ b/src/filter.cpp @@ -1,10 +1,12 @@ /*----------------------------------------------------------------------------- -© 1999, Steinberg Soft und Hardware GmbH, All Rights Reserved +� 1999, Steinberg Soft und Hardware GmbH, All Rights Reserved -----------------------------------------------------------------------------*/ +#ifdef WIN32 #include +#endif #include #include "iir.h" #include "filter.hpp" @@ -17,7 +19,7 @@ #define ALPHA 0.2f #define BETA (1.0f-ALPHA) -char *pFTypeString[] = +const char * const pFTypeString[8] = { "Unknown", "Lowpass", @@ -105,7 +107,7 @@ void Filter::setParameter(VstInt32 index, float value) forder = ParamQuantize(value,1.0f/(MAX_ORDER/2-1)); order = 2*(VstInt32)(1+forder*MAX_ORDER/2); sprintf(dbgStr, "value = %f, forder = %f, order = %d",value,forder,order); - OutputDebugString(dbgStr); +// OutputDebugString(dbgStr); IIRCalcFilterCoeff(filterCoeff_L, sampleRate, 0.5f*fg*sampleRate, q*MAX_Q, order, type); IIRCalcFilterCoeff(filterCoeff_R, sampleRate, 0.5f*fg*sampleRate, q*MAX_Q, order, type); break; @@ -129,7 +131,7 @@ void Filter::setParameter(VstInt32 index, float value) case TESTPARAM: testParam=ParamQuantize(value,1.0f/3); sprintf(dbgStr, "Set Param: %f",value); - OutputDebugString(dbgStr); +// OutputDebugString(dbgStr); break; } @@ -169,7 +171,7 @@ float Filter::getParameter(VstInt32 index) case TESTPARAM: value = testParam; sprintf(dbgStr, "Get Param: %f",value); - OutputDebugString(dbgStr); +// OutputDebugString(dbgStr); break; } return value; @@ -184,13 +186,14 @@ void Filter::getParameterName(VstInt32 index, char *label) //----------------------------------------------------------------------------------------- void Filter::getParameterDisplay(VstInt32 index, char *text) { + switch(index) { case TYPE: - strcpy(text,pFTypeString[type]); + strcpy(text, pFTypeString[type]); break; case ORDER: - int2string(order, text, kVstMaxParamStrLen); + snprintf(text, kVstMaxParamStrLen, "%d", order); break; case FMIN: float2string(0.5f*f_fmin*sampleRate,text, kVstMaxParamStrLen); @@ -263,7 +266,7 @@ void Filter::setSampleRate(float sampleRate) { this->sampleRate = sampleRate; sprintf(dbgStr, "Sample Rate = %f",sampleRate); - OutputDebugString(dbgStr); +// OutputDebugString(dbgStr); } //----------------------------------------------------------------------------------------- @@ -271,5 +274,5 @@ void Filter::setBlockSize(VstInt32 blockSize) { this->blockSize = blockSize; sprintf(dbgStr, "Block Size = %d",blockSize); - OutputDebugString(dbgStr); +// OutputDebugString(dbgStr); } diff --git a/src/filterMain.cpp b/src/filterMain.cpp index 565c318..edd1bbb 100755 --- a/src/filterMain.cpp +++ b/src/filterMain.cpp @@ -1,6 +1,6 @@ /*----------------------------------------------------------------------------- -© 1999, Steinberg Soft und Hardware GmbH, All Rights Reserved +� 1999, Steinberg Soft und Hardware GmbH, All Rights Reserved -----------------------------------------------------------------------------*/ #include @@ -10,20 +10,7 @@ static AudioEffect *effect = 0; bool oome = false; -#if MAC -#pragma export on -#endif - -// prototype of the export function main -#if BEOS -#define main main_plugin -extern "C" __declspec(dllexport) AEffect *main_plugin (audioMasterCallback audioMaster); - -#else -AEffect *main (audioMasterCallback audioMaster); -#endif - -AEffect *main (audioMasterCallback audioMaster) +AEffect *VSTPluginMain (audioMasterCallback audioMaster) { // get vst version if (!audioMaster (0, audioMasterVersion, 0, 0, 0, 0)) @@ -40,17 +27,8 @@ AEffect *main (audioMasterCallback audioMaster) return effect->getAeffect (); } -#if MAC -#pragma export off -#endif - - -#if WIN32 -#include -void* hInstance; -BOOL WINAPI DllMain (HINSTANCE hInst, DWORD dwReason, LPVOID lpvReserved) -{ - hInstance = hInst; - return 1; +extern "C" __cdecl AEffect* deprecated_main( + audioMasterCallback audioMaster) asm("main"); +__cdecl AEffect* deprecated_main(audioMasterCallback audioMaster) { + return VSTPluginMain(audioMaster); } -#endif diff --git a/src/paramutils.c b/src/paramutils.c old mode 100644 new mode 100755 index 2d9ae56..5c92966 --- a/src/paramutils.c +++ b/src/paramutils.c @@ -11,18 +11,3 @@ float ParamQuantize(float value, float quantization) return result; } - -float norm2quant(float minparm, float maxparm, float quant, float x) -{ - int y; - float step = (maxparm-minparm); - - y = (int)minparm + (int)quant * (int)((0.5 + x*step)/quant); - - return (float)y; -} - -float quant2norm(float minparm, float maxparm, float y) -{ - return (y-minparm)/(maxparm-minparm); -} diff --git a/src/paramutils.h b/src/paramutils.h old mode 100644 new mode 100755 index 575e186..0edff7e --- a/src/paramutils.h +++ b/src/paramutils.h @@ -1,6 +1,6 @@ -/*************************************************************** -** paramutils.h -****************************************************************/ +/***************************************************************/ +/* paramutils.h +/***************************************************************/ #ifndef PARAMUTILS_H #define PARAMUTILS_H #if defined(__cplusplus) @@ -9,8 +9,6 @@ extern "C" { /***************************************************************/ float ParamQuantize(float value, float quantization); -float norm2quant(float minparm, float maxparm, float quant, float x); -float quant2norm(float minparm, float maxparm, float y); /***************************************************************/