Permalink
Browse files

VST stuff

  • Loading branch information...
spencersalazar committed Oct 16, 2012
1 parent 598b8a4 commit 9b7b8897b579b57109c51893bcc43de1f8acb30c
Showing with 450 additions and 0 deletions.
  1. +171 −0 VST/VST.cpp
  2. +117 −0 VST/VST.dsp
  3. +29 −0 VST/VST.dsw
  4. +110 −0 VST/makefile
  5. +8 −0 VST/makefile.linux
  6. +9 −0 VST/makefile.osx
  7. +6 −0 VST/makefile.win32
View
@@ -0,0 +1,171 @@
+//-----------------------------------------------------------------------------
+// Entaro ChucK Developer!
+// This is a Chugin boilerplate, generated by chugerate!
+//-----------------------------------------------------------------------------
+
+// this should align with the correct versions of these ChucK files
+#include "chuck_dl.h"
+#include "chuck_def.h"
+
+// general includes
+#include <stdio.h>
+#include <limits.h>
+
+// declaration of chugin constructor
+CK_DLL_CTOR(vst_ctor);
+// declaration of chugin desctructor
+CK_DLL_DTOR(vst_dtor);
+
+// example of getter/setter
+CK_DLL_MFUN(vst_setParam);
+CK_DLL_MFUN(vst_getParam);
+
+// for Chugins extending UGen, this is mono synthesis function for 1 sample
+CK_DLL_TICK(vst_tick);
+
+// this is a special offset reserved for Chugin internal data
+t_CKINT vst_data_offset = 0;
+
+
+// class definition for internal Chugin data
+// (note: this isn't strictly necessary, but serves as example
+// of one recommended approach)
+class VST
+{
+public:
+ // constructor
+ VST( t_CKFLOAT fs)
+ {
+ m_param = 0;
+ }
+
+ // for Chugins extending UGen
+ SAMPLE tick( SAMPLE in )
+ {
+ // default: this passes whatever input is patched into Chugin
+ return in;
+ }
+
+ // set parameter example
+ float setParam( t_CKFLOAT p )
+ {
+ m_param = p;
+ return p;
+ }
+
+ // get parameter example
+ float getParam() { return m_param; }
+
+private:
+ // instance data
+ float m_param;
+};
+
+
+// query function: chuck calls this when loading the Chugin
+// NOTE: developer will need to modify this function to
+// add additional functions to this Chugin
+CK_DLL_QUERY( VST )
+{
+ // hmm, don't change this...
+ QUERY->setname(QUERY, "VST");
+
+ // begin the class definition
+ // can change the second argument to extend a different ChucK class
+ QUERY->begin_class(QUERY, "VST", "UGen");
+
+ // register the constructor (probably no need to change)
+ QUERY->add_ctor(QUERY, vst_ctor);
+ // register the destructor (probably no need to change)
+ QUERY->add_dtor(QUERY, vst_dtor);
+
+ // for UGen's only: add tick function
+ QUERY->add_ugen_func(QUERY, vst_tick, NULL, 1, 1);
+
+ // NOTE: if this is to be a UGen with more than 1 channel,
+ // e.g., a multichannel UGen -- will need to use add_ugen_funcf()
+ // and declare a tickf function using CK_DLL_TICKF
+
+ // example of adding setter method
+ QUERY->add_mfun(QUERY, vst_setParam, "float", "param");
+ // example of adding argument to the above method
+ QUERY->add_arg(QUERY, "float", "arg");
+
+ // example of adding getter method
+ QUERY->add_mfun(QUERY, vst_getParam, "float", "param");
+
+ // this reserves a variable in the ChucK internal class to store
+ // referene to the c++ class we defined above
+ vst_data_offset = QUERY->add_mvar(QUERY, "int", "@vst_data", false);
+
+ // end the class definition
+ // IMPORTANT: this MUST be called!
+ QUERY->end_class(QUERY);
+
+ // wasn't that a breeze?
+ return TRUE;
+}
+
+
+// implementation for the constructor
+CK_DLL_CTOR(vst_ctor)
+{
+ // get the offset where we'll store our internal c++ class pointer
+ OBJ_MEMBER_INT(SELF, vst_data_offset) = 0;
+
+ // instantiate our internal c++ class representation
+ VST * bcdata = new VST(API->vm->get_srate());
+
+ // store the pointer in the ChucK object member
+ OBJ_MEMBER_INT(SELF, vst_data_offset) = (t_CKINT) bcdata;
+}
+
+
+// implementation for the destructor
+CK_DLL_DTOR(vst_dtor)
+{
+ // get our c++ class pointer
+ VST * bcdata = (VST *) OBJ_MEMBER_INT(SELF, vst_data_offset);
+ // check it
+ if( bcdata )
+ {
+ // clean up
+ delete bcdata;
+ OBJ_MEMBER_INT(SELF, vst_data_offset) = 0;
+ bcdata = NULL;
+ }
+}
+
+
+// implementation for tick function
+CK_DLL_TICK(vst_tick)
+{
+ // get our c++ class pointer
+ VST * c = (VST *) OBJ_MEMBER_INT(SELF, vst_data_offset);
+
+ // invoke our tick function; store in the magical out variable
+ if(c) *out = c->tick(in);
+
+ // yes
+ return TRUE;
+}
+
+
+// example implementation for setter
+CK_DLL_MFUN(vst_setParam)
+{
+ // get our c++ class pointer
+ VST * bcdata = (VST *) OBJ_MEMBER_INT(SELF, vst_data_offset);
+ // set the return value
+ RETURN->v_float = bcdata->setParam(GET_NEXT_FLOAT(ARGS));
+}
+
+
+// example implementation for getter
+CK_DLL_MFUN(vst_getParam)
+{
+ // get our c++ class pointer
+ VST * bcdata = (VST *) OBJ_MEMBER_INT(SELF, vst_data_offset);
+ // set the return value
+ RETURN->v_float = bcdata->getParam();
+}
View
@@ -0,0 +1,117 @@
+# Microsoft Developer Studio Project File - Name="VST" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=VST - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "VST.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "VST.mak" CFG="VST - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "VST - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "VST - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "VST - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VST_EXPORTS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\chuck\src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "__PLATFORM_WIN32__" /D "__WINDOWS_DS__" /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/VST.chug"
+
+!ELSEIF "$(CFG)" == "VST - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VST_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\chuck\src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "__PLATFORM_WIN32__" /D "__WINDOWS_DS__" /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/VST.chug" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "VST - Win32 Release"
+# Name "VST - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\VST.cpp
+
+!IF "$(CFG)" == "VST - Win32 Release"
+
+!ELSEIF "$(CFG)" == "VST - Win32 Debug"
+
+# ADD CPP /D "__WINDOWS_DS__"
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
View
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "VST"=.\VST.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
Oops, something went wrong.

0 comments on commit 9b7b889

Please sign in to comment.