Plug-ins

Interested in writing Object Studio plug-ins?

It is fairly easy. The interface is already implemented. What you have to do is to call the AddParameter and AddJack functions from your code and write the DSP routine. Send an e-mail if you have a good idea for a plug-in.

Here is the complete source of the Amplifier plug-in written in C++ Builder.

//---------------------------------------------------------------------------

#include <vcl.h>
#include <windows.h>
#include "..\SoftSynthsClasses.h"
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused

enum JackNames
{jnIn,jnOut,jnModulation};

enum ParameterNames
{pnModulation};

class CDevice : public IDevice
{
        private:
        float ModFactor;
        float CurrentMod;
        int LastMod;
        void inline CalcParams()
        {
                ModFactor = (float)m_ParameterValues[pnModulation] * 0.01;
        };
        public:
        void __fastcall Init(int Index,HWND CallingApp)
        {
                m_Name="Amplifier";
                IDevice::Init(Index,CallingApp);
                AddJack("In",Wave,In,0);
                AddJack("Out",Wave,Out,0);
                AddJack("Modulation In",(AttachModes)(Amplitude | Pitch),In,0);
                AddParameter(Numeric,"Modulation","%",0,100,0,"",100);
                LastMod=0;
                CurrentMod=0;
                CalcParams();
        };
        float* __fastcall GetNextA(int ProcIndex)
        {
                float Mod= Fetch[jnModulation]();
                if (!Mod)
                {
                        return NULL;
                }
                float* Signal=FetchA[jnIn]();
                if (!Signal)
                {
                        return NULL;
                }
                if (Mod != LastMod)
                {
                        LastMod = Mod;
                        CurrentMod = (float)Mod * ModFactor;
                }
                for (int i=0;i<m_BufferSize;i++)
                {
                        *(AudioBuffer[ProcIndex]+i)=Signal[i] * CurrentMod;
                }
                return AudioBuffer[ProcIndex];
        };
};

extern "C" __declspec(dllexport) IDevice* CreateInstance(void)
{
        return new CDevice();
};

extern "C" __declspec(dllexport) const char* Name(void)
{
        return "Amplifier";
};

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
        return 1;
};