From 27930cde64a958aca9f824801f3e6dd4403b9dc9 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 23 Apr 2015 23:24:40 +1000
Subject: Add stub for haiku


diff --git a/plugins/vst/src/bs2b_vst.cpp b/plugins/vst/src/bs2b_vst.cpp
index 09756ec..d11b454 100644
--- a/plugins/vst/src/bs2b_vst.cpp
+++ b/plugins/vst/src/bs2b_vst.cpp
@@ -26,6 +26,7 @@
 #include "bs2b_effect.h"
 #include "bs2b_editor.h"
 
+
 AudioEffect *createEffectInstance( audioMasterCallback audioMaster )
 {
 	return new bs2b_effect( audioMaster );
@@ -44,7 +45,7 @@ bs2b_effect::bs2b_effect( audioMasterCallback audioMaster )
 	vst_strncpy( m_programName, "Default", kVstMaxProgNameLen );
 
 	// EDITOR
-	editor = new bs2b_editor( this );
+	//editor = new bs2b_editor( this );
 }
 
 bs2b_effect::~bs2b_effect() {}
@@ -65,24 +66,24 @@ void bs2b_effect::setParameter( VstInt32 index, float value )
 	{
 	case PARAM_LEVEL_FEED:
 		if( ! param_defs )
-			bs2b.set_level_feed_norm( value );
+			_bs2b.set_level_feed_norm( value );
 		break;
 	case PARAM_LEVEL_FCUT:
 		if( ! param_defs )
-			bs2b.set_level_fcut_norm( value );
+			_bs2b.set_level_fcut_norm( value );
 		break;
 	case PARAM_LEVEL_DEFS:
 		param_defs = ( int )( value * PARAM_LEVEL_DEF__MAX - 0.01f );
 		switch( param_defs )
 		{
 		case PARAM_LEVEL_DEF_DEFAULT:
-			bs2b.set_level( BS2B_DEFAULT_CLEVEL );
+			_bs2b.set_level( BS2B_DEFAULT_CLEVEL );
 			break;
 		case PARAM_LEVEL_DEF_CMOY:
-			bs2b.set_level( BS2B_CMOY_CLEVEL );
+			_bs2b.set_level( BS2B_CMOY_CLEVEL );
 			break;
 		case PARAM_LEVEL_DEF_JMEIER:
-			bs2b.set_level( BS2B_JMEIER_CLEVEL );
+			_bs2b.set_level( BS2B_JMEIER_CLEVEL );
 			break;
 		default:
 			param_defs = 0;
@@ -91,8 +92,8 @@ void bs2b_effect::setParameter( VstInt32 index, float value )
 		break;
 	} // switch( index )
 
-	if( editor )
-		( ( AEffGUIEditor * )editor )->setParameter( index, value );
+	//if( editor )
+	//	( ( AEffGUIEditor * )editor )->setParameter( index, value );
 }
 
 float bs2b_effect::getParameter( VstInt32 index )
@@ -100,9 +101,9 @@ float bs2b_effect::getParameter( VstInt32 index )
 	switch( index )
 	{
 	case PARAM_LEVEL_FEED:
-		return bs2b.get_level_feed_norm();
+		return _bs2b.get_level_feed_norm();
 	case PARAM_LEVEL_FCUT:
-		return bs2b.get_level_fcut_norm();
+		return _bs2b.get_level_fcut_norm();
 	case PARAM_LEVEL_DEFS:
 		return ( float )param_defs / ( PARAM_LEVEL_DEF__MAX - 1 );
 	default:
@@ -134,7 +135,7 @@ void bs2b_effect::getParameterDisplay( VstInt32 index, char *text )
 	{
 	case PARAM_LEVEL_FEED:
 		{
-			int feed = bs2b.get_level_feed();
+			int feed = _bs2b.get_level_feed();
 			sprintf( string, "%d.%d", feed / 10, feed % 10 );
 			vst_strncpy( text, string, kVstMaxParamStrLen );
 		}
@@ -142,7 +143,7 @@ void bs2b_effect::getParameterDisplay( VstInt32 index, char *text )
 	case PARAM_LEVEL_FCUT:
 		{
 			sprintf( string, "%d/%d",
-				bs2b.get_level_fcut(), bs2b.get_level_delay() );
+				_bs2b.get_level_fcut(), _bs2b.get_level_delay() );
 			vst_strncpy( text, string, kVstMaxParamStrLen );
 		}
 		break;
@@ -172,7 +173,7 @@ void bs2b_effect::getParameterLabel( VstInt32 index, char *label )
 
 void bs2b_effect::setSampleRate( float sampleRate )
 {
-	bs2b.set_srate( ( uint32_t )sampleRate );
+	_bs2b.set_srate( ( uint32_t )sampleRate );
 }
 
 bool bs2b_effect::getEffectName( char *name )
@@ -222,7 +223,7 @@ void bs2b_effect::processReplacing( float **inputs, float **outputs,
 		sample[ 0 ] = *( in1++ );
 		sample[ 1 ] = *( in2++ );
 
-		bs2b.cross_feed( sample );
+		_bs2b.cross_feed( sample );
 
 		*( out1++ ) = sample[ 0 ];
 		*( out2++ ) = sample[ 1 ];
@@ -247,7 +248,7 @@ void bs2b_effect::processDoubleReplacing( double **inputs, double **outputs,
 		sample[ 0 ] = *( in1++ );
 		sample[ 1 ] = *( in2++ );
 
-		bs2b.cross_feed( sample );
+		_bs2b.cross_feed( sample );
 
 		*( out1++ ) = sample[ 0 ];
 		*( out2++ ) = sample[ 1 ];
diff --git a/plugins/vst/src/main.cpp b/plugins/vst/src/main.cpp
new file mode 100644
index 0000000..bd1f6be
--- /dev/null
+++ b/plugins/vst/src/main.cpp
@@ -0,0 +1,23 @@
+#include "aeffectx.h"
+#include "bs2b_effect.h"
+
+extern "C"
+{
+    extern AEffect * VSTPluginMain(audioMasterCallback audioMaster);
+    extern "C" __declspec(dllexport) AEffect * main_plugin (audioMasterCallback audioMaster);
+
+#define main main_plugin
+
+AEffect *main (audioMasterCallback audioMaster)
+{
+	if (!audioMaster (0, audioMasterVersion, 0, 0, 0, 0))
+		return 0;
+
+	bs2b_effect* effect = new bs2b_effect (audioMaster);
+	if (!effect)
+		return 0;
+
+	return effect->getAeffect ();
+}
+}
+
-- 
2.2.2


From 896767499c321a46421ba4543ef685c18802389b Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 23 Apr 2015 23:39:08 +1000
Subject: Fix object name


diff --git a/plugins/vst/src/bs2b_effect.h b/plugins/vst/src/bs2b_effect.h
index 528b28d..de14803 100644
--- a/plugins/vst/src/bs2b_effect.h
+++ b/plugins/vst/src/bs2b_effect.h
@@ -92,7 +92,7 @@ public:
 class bs2b_effect : public AudioEffectX
 {
 private:
-	bs2b bs2b;
+	bs2b _bs2b;
 
 public:
 	bs2b_effect( audioMasterCallback audioMaster );
-- 
2.2.2

