Пример #1
0
        public string getParameterName(int paramIndex)
        {
            if (pluginFailedToLoad)
            {
                return("");
            }

            IntPtr p_paramName = HostDllCpp.getParamName(thisVSTIndex, paramIndex);

            return(Marshal.PtrToStringAnsi(p_paramName));
        }
Пример #2
0
        public static void init()
        {
            HostDllCpp.initHost();

            ////////////////////// setup io //////////////////////
            int _numBuff;

            AudioSettings.GetDSPBufferSize(out blockSize, out _numBuff);
            sampleRate = AudioSettings.outputSampleRate;
            HostDllCpp.setHostBlockSize(blockSize);
            HostDllCpp.setSampleRate(sampleRate);
        }
Пример #3
0
        public int loadEffect(string path)
        {
            if (pluginFailedToLoad)
            {
                return(0);
            }

            IntPtr intPtr_aux  = Marshal.StringToHGlobalAnsi(path);
            int    effectIndex = HostDllCpp.loadEffect(intPtr_aux);

            Marshal.FreeHGlobal(intPtr_aux);
            return(effectIndex);
        }
Пример #4
0
        void setupIO()
        {
            ////////////////////// alloc space for audio io //////////////////////
            numPluginInputs   = HostDllCpp.getNumPluginInputs(thisVSTIndex);
            numPluginOutputs  = HostDllCpp.getNumPluginOutputs(thisVSTIndex);
            audioThroughArray = new float[numPluginInputs][];
            for (int i = 0; i < numPluginInputs; i++)
            {
                audioThroughArray[i] = new float[pluggoHost.blockSize];
            }

            //alloc unmanaged memory
            audioPtrSize        = Marshal.SizeOf(audioThroughArray[0][0]) * audioThroughArray[0].Length * audioThroughArray.Length;
            inputArrayAsVoidPtr = Marshal.AllocHGlobal(audioPtrSize);
        }
        void Update()
        {
            if (pluginFailedToLoad)
            {
                return;
            }

            for (int i = 0; i < numParams; i++)
            {
                if (previousParams[i] != parameters[i])
                {
                    HostDllCpp.setParam(thisVSTIndex, i, parameters[i]);
                    previousParams[i] = parameters[i];
                }
            }
        }
Пример #6
0
        void Update()
        {
            if (pluginFailedToLoad)
            {
                return;
            }
            if (!ready)
            {
                return;
            }

            for (int i = 0; i < numParams; i++)
            {
                if (previousParams[i] != paramList[i].value)
                {
                    HostDllCpp.setParam(thisVSTIndex, i, paramList[i].value);
                    previousParams[i] = paramList[i].value;
                }
            }
        }
Пример #7
0
        void setupParams()
        {
            if (pluginFailedToLoad)
            {
                return;
            }

            numParams      = HostDllCpp.getNumParams(thisVSTIndex);
            previousParams = new float[numParams];
            paramList      = new FloatContain[numParams];
            for (int i = 0; i < numParams; i++)
            {
                paramList[i].value = HostDllCpp.getParam(thisVSTIndex, i);
                previousParams[i]  = paramList[i].value;
                paramList[i].name  = getParameterName(i);
            }
            //alloc unmanaged memory
            messagePtrSize   = 8 * 256;
            messageAsVoidPtr = Marshal.AllocHGlobal(messagePtrSize);
        }
Пример #8
0
        void OnAudioFilterRead(float[] data, int channels)
        {
            if (!ready)
            {
                return;
            }
            if (pluginFailedToLoad)
            {
                return;
            }

            HostDllCpp.processBuffer(thisVSTIndex, data, pluggoHost.blockSize, channels);

            if (MonoOutput && channels == 2)
            {
                for (int i = 0; i < data.Length; i += 2)
                {
                    data[i + 1] = data[i];
                }
            }
        }
        void OnAudioFilterRead(float[] data, int channels)
        {
            if (!ready)
            {
                return;
            }
            if (pluginFailedToLoad)
            {
                return;
            }

            Marshal.Copy(data, 0, inputArrayAsVoidPtr, pluggoHost.blockSize * channels);
            IntPtr outputVoidPtr = HostDllCpp.processFxAudio(thisVSTIndex, inputArrayAsVoidPtr, pluggoHost.blockSize, channels);

            Marshal.Copy(outputVoidPtr, data, 0, pluggoHost.blockSize * channels);
            if (MonoOutput && channels == 2)
            {
                for (int i = 0; i < data.Length; i += 2)
                {
                    data[i + 1] = data[i];
                }
            }
        }
 private void OnApplicationQuit()
 {
     HostDllCpp.clearVSTs();
 }