コード例 #1
0
 public void FromNonSurrogate(VstPluginInfo vstPluginInfo)
 {
     Flags            = vstPluginInfo.Flags;
     PluginID         = vstPluginInfo.PluginID;
     InitialDelay     = vstPluginInfo.InitialDelay;
     ProgramCount     = vstPluginInfo.ProgramCount;
     ParameterCount   = vstPluginInfo.ParameterCount;
     PluginVersion    = vstPluginInfo.PluginVersion;
     AudioInputCount  = vstPluginInfo.AudioInputCount;
     AudioOutputCount = vstPluginInfo.AudioOutputCount;
 }
コード例 #2
0
        /// <inheritdoc />
        public void Close()
        {
            // Calling back into the Form at this point can cause a dead-lock.
            //Log("Close");

            // perform cleanup of the host stub
            if (_hostStub != null)
            {
                _hostStub.Dispose();
                _hostStub = null;

                _pluginInfo = null;
            }
        }
コード例 #3
0
        //private WpfControlWrapper<EditorControl> _editorCtrl = new WpfControlWrapper<EditorControl>(300, 300);

        #region IVstPluginCommandStub Members

        /// <inheritdoc />
        public VstPluginInfo GetPluginInfo(IVstHostCommandStub hostCmdStub)
        {
            _hostStub   = hostCmdStub;
            _pluginInfo = new VstPluginInfo();

            _pluginInfo.AudioInputCount  = 1;
            _pluginInfo.AudioOutputCount = 2;
            _pluginInfo.ProgramCount     = 1;
            _pluginInfo.Flags            = VstPluginFlags.HasEditor | VstPluginFlags.CanReplacing;
            _pluginInfo.PluginID         = 1234;
            _pluginInfo.PluginVersion    = 1000;

            return(_pluginInfo);
        }
コード例 #4
0
        public VstPluginInfo ToNonSurrogate()
        {
            var vstPluginInfo = new VstPluginInfo
            {
                Flags            = Flags,
                ProgramCount     = ProgramCount,
                ParameterCount   = ParameterCount,
                AudioInputCount  = AudioInputCount,
                AudioOutputCount = AudioOutputCount,
                InitialDelay     = InitialDelay,
                PluginID         = PluginID,
                PluginVersion    = PluginVersion
            };

            return(vstPluginInfo);
        }
コード例 #5
0
ファイル: VstPluginContext.cs プロジェクト: tiwadara/vst.net
        /// <summary>
        /// Disposes all members, cascades the Dispose call.
        /// </summary>
        public void Dispose()
        {
            PluginInfo = null;

            if (Plugin != null)
            {
                Plugin.Dispose();
                Plugin = null;
            }

            if (Host != null)
            {
                Host.Dispose();
                Host = null;
            }
        }
コード例 #6
0
        /// <summary>
        /// Creates summary info based on the <paramref name="plugin"/>.
        /// </summary>
        /// <param name="plugin">Must not be null.</param>
        /// <returns>Never returns null.</returns>
        /// <remarks>Override to add or change behavior.</remarks>
        protected virtual VstPluginInfo CreatePluginInfo(IVstPlugin plugin)
        {
            VstPluginInfo pluginInfo = new VstPluginInfo();

            var audioProcessor = plugin.GetInstance <IVstPluginAudioProcessor>();

            // determine flags
            if (plugin.Supports <IVstPluginEditor>())
            {
                pluginInfo.Flags |= VstPluginFlags.HasEditor;
            }
            if (audioProcessor != null)
            {
                pluginInfo.Flags |= VstPluginFlags.CanReplacing;
            }
            if (plugin.Supports <IVstPluginAudioPrecisionProcessor>())
            {
                pluginInfo.Flags |= VstPluginFlags.CanDoubleReplacing;
            }
            if (plugin.Supports <IVstPluginPersistence>())
            {
                pluginInfo.Flags |= VstPluginFlags.ProgramChunks;
            }
            if (audioProcessor != null && plugin.Supports <IVstMidiProcessor>())
            {
                pluginInfo.Flags |= VstPluginFlags.IsSynth;
            }
            if ((plugin.Capabilities & VstPluginCapabilities.NoSoundInStop) > 0)
            {
                pluginInfo.Flags |= VstPluginFlags.NoSoundInStop;
            }

            // basic plugin info
            pluginInfo.InitialDelay  = plugin.InitialDelay;
            pluginInfo.PluginID      = plugin.PluginID;
            pluginInfo.PluginVersion = plugin.ProductInfo.Version;

            // audio processing info
            if (audioProcessor != null)
            {
                pluginInfo.AudioInputCount  = audioProcessor.InputCount;
                pluginInfo.AudioOutputCount = audioProcessor.OutputCount;
            }

            // parameter info
            IVstPluginParameters?pluginParameters = plugin.GetInstance <IVstPluginParameters>();

            if (pluginParameters != null)
            {
                pluginInfo.ParameterCount = pluginParameters.Parameters.Count;
            }

            // program info
            IVstPluginPrograms?pluginPrograms = plugin.GetInstance <IVstPluginPrograms>();

            if (pluginPrograms != null)
            {
                pluginInfo.ProgramCount = pluginPrograms.Programs.Count;
            }

            return(pluginInfo);
        }
コード例 #7
0
 public VstPluginInfoSurrogate(VstPluginInfo vstPluginInfo)
 {
     FromNonSurrogate(vstPluginInfo);
 }
コード例 #8
0
ファイル: VstPluginContext.cs プロジェクト: whinkloss/vst.net
 internal VstPluginContext(IVstPlugin plugin, VstHost host, VstPluginInfo info)
 {
     Plugin     = plugin ?? throw new ArgumentNullException(nameof(plugin));
     _host      = host ?? throw new ArgumentNullException(nameof(host));
     PluginInfo = info ?? throw new ArgumentNullException(nameof(plugin));
 }
コード例 #9
0
        public static (LoadFxpResult result, string message, FXP fxp) LoadFxp(string filePath, VstPluginInfo pluginInfo)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                return(LoadFxpResult.Error, "Unable to load the FXP because the path is null or empty", null);
            }

            if (!File.Exists(filePath))
            {
                return(LoadFxpResult.Error, "Unable to load the FXP because the file does not exist",
                       null);
            }


            if (!pluginInfo.Flags.HasFlag(VstPluginFlags.ProgramChunks))
            {
                return(LoadFxpResult.Error,
                       "Aborting loading because the plugin does not support ProgramChunks", null);
            }

            var fxp = new FXP();

            fxp.ReadFile(filePath);

            if (fxp.ChunkMagic != "CcnK")
            {
                return(LoadFxpResult.Error,
                       "Aborting loading because it is not an fxp or fxb file. Maybe a corrupted file? (invalid chunk)",
                       null);
            }

            var pluginUniqueId  = PluginIdStringToIdNumber(fxp.FxID);
            var currentPluginId = pluginInfo.PluginID;

            if (pluginUniqueId != currentPluginId)
            {
                return(LoadFxpResult.Error,
                       "Aborting loading because it was created for a different plugin. " +
                       $"FXP/FXB plugin ID: {pluginUniqueId}, Plugin ID: {currentPluginId}",
                       null);
            }

            // Preset (Program) (.fxp) with chunk (magic = 'FPCh')
            // Bank (.fxb) with chunk (magic = 'FBCh')

            switch (fxp.FxMagic)
            {
            case "FPCh":
                return(LoadFxpResult.Program, null, fxp);

            case "FBCh":
                return(LoadFxpResult.Bank, null, fxp);

            default:
                return(LoadFxpResult.Error,
                       "Cannot load the file because it is neither a bank nor a program. " +
                       $"The magic value {fxp.FxMagic} is unknown.",
                       null);
            }
        }
コード例 #10
0
        public VstPluginInfo GetPluginInfo(IVstHostCommandStub hostCmdStub)
        {
            _hostStub = hostCmdStub;
            _pluginInfo = new VstPluginInfo();
            _pluginInfo.ParameterCount = theSynth.parameters.Length;
            _pluginInfo.AudioInputCount = 0;
            _pluginInfo.AudioOutputCount = 2;
            _pluginInfo.ProgramCount = progs.Length;
            _pluginInfo.Flags = Jacobi.Vst.Core.VstPluginFlags.IsSynth | VstPluginFlags.HasEditor;
            //_pluginInfo.PluginID = ?;
            //_pluginInfo.PluginVersion = ?;

            return _pluginInfo;
        }