Esempio n. 1
0
        public bool InitVST()
        {
            hostCallBack = new audioMasterCallbackDelegate(hostcallback);
            IntPtr eff = mainEntry(hostCallBack);

            effect = (AEffect)Marshal.PtrToStructure(eff, typeof(AEffect));

            effect.dispatcher(ref effect, (int)AEffectOpcodes.effOpen, 0, 0, IntPtr.Zero, 0);
            effect.dispatcher(ref effect, (int)AEffectOpcodes.effSetSampleRate, 0, 0, IntPtr.Zero, 44100.0F); //kSampleRate);
            effect.dispatcher(ref effect, (int)AEffectOpcodes.effSetBlockSize, 0, 512, IntPtr.Zero, 0);       //kBlockSize

            //checkEffectProperties(effect);
            IntPtr prop = Marshal.AllocHGlobal(256);

            effect.dispatcher(ref effect, (int)AEffectXOpcodes.effGetEffectName, 0, 0, prop, 0);
            _effectName = Marshal.PtrToStringAnsi(prop);
            effect.dispatcher(ref effect, (int)AEffectXOpcodes.effGetVendorString, 0, 0, prop, 0);
            _vendor = Marshal.PtrToStringAnsi(prop);
            effect.dispatcher(ref effect, (int)AEffectXOpcodes.effGetProductString, 0, 0, prop, 0);
            _product = Marshal.PtrToStringAnsi(prop);
            Marshal.FreeHGlobal(prop);

            // alloc buffer memory
            if (effect.numInputs != 2)
            {
                return(false);
            }
            if (effect.numOutputs != 2)
            {
                return(false);
            }

            bufInputs = new float[2 * 512];
            inputsPtr = Marshal.AllocCoTaskMem(sizeof(float) * 3 * 512);
            //            bufInputs = new float[2][] { new float[512], new float[512] };
            //            inputsPtr = Marshal.AllocCoTaskMem(sizeof(float) * 2 * 512 + sizeof(int) * 30);
            //            inputsPtrs[0] = Marshal.AllocCoTaskMem(sizeof(int));
            //            inputsPtrs[1] = Marshal.AllocCoTaskMem(sizeof(int));
            bufOutputs = new float[2 * 512];
            outputsPtr = Marshal.AllocCoTaskMem(sizeof(float) * 3 * 512);
            //            bufOutputs = new float[2][] { new float[512], new float[512] };
            //            outputsPtr = Marshal.AllocCoTaskMem(sizeof(float) * 2 * 512 + sizeof(int) * 30);
            //            outputsPtrs[0] = Marshal.AllocCoTaskMem(sizeof(int));
            //            outputsPtrs[1] = Marshal.AllocCoTaskMem(sizeof(int));

            return(true);
        }
Esempio n. 2
0
 public VSTForm(AEffect effect, VST vst)
 {
     InitializeComponent();
     this.effect = effect;
     this.vst    = vst;
 }