Exemplo n.º 1
0
 static public IEnumerable <VstCCPgm> EnumPrograms(VstPlugin ctx)
 {
     for (int i = 0; i < ctx.PluginInfo.ProgramCount; i++)
     {
         yield return(new VstCCPgm(ctx, i));
     }
 }
Exemplo n.º 2
0
        public VstPlugin OpenPlugin(string pluginPath, bool ignoreAdd)
        {
            bool      haserror = false;
            VstPlugin ctx      = null;

            try {
                ctx = new VstPlugin(pluginPath, Parent);
            } catch (Exception xx) {
                haserror = true;
//			  System.Diagnostics.Debug.Print("{0}",xx);
//				System.Windows.Forms.MessageBox.Show(
//					xx.ToString(), "VstPluginManager", System.Windows.Forms.MessageBoxButtons.OK,
//					System.Windows.Forms.MessageBoxIcon.Error
//				);
                Console.Out.WriteLine("Had an error loading");
            }
            if (!ignoreAdd && !haserror)
            {
                PluginsList.Add(pluginPath);
            }
            if (ctx != null)
            {
                ctx.PluginCommandStub.Open();
            }
            return(ctx);
        }
Exemplo n.º 3
0
        public VstCCPgm(VstPlugin plugin, int id)
        {
            this.plugin = plugin;
//			begin();
            ID   = id;
            Name = Stub.GetProgramName();
//			end();
        }
Exemplo n.º 4
0
 public void RemovePlugin(VstPlugin ctx)
 {
     if (ctx != null)
     {
         string path = ctx.PluginPath; // checkme
         ctx.PrsData = null;           // checkme
         ctx.Dispose();
         pluginsList.Remove(path);     // checkme
         _plugins.Remove(ctx);
         OnPropertyChanged("RemovePlugin");
     }
 }
Exemplo n.º 5
0
        static public VstPluginBank Read(VstPlugin plugin, string fileName)
        {
            VstPatchChunkInfo x;
            VstPluginBank     bank = VstPluginBank.Prepare(plugin);

            using (FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                using (BinaryReader reader = new BinaryReader(stream, System.Text.Encoding.Unicode))
                {
                    bank.ChunkMagic    = reader.ReadInt32();
                    bank.ChunkSize     = reader.ReadInt32();
                    bank.PluginMagic   = reader.ReadInt32();
                    bank.Version       = reader.ReadInt32();
                    bank.PluginId      = reader.ReadInt32();
                    bank.PluginVersion = reader.ReadInt32();
                    bank.NumPrograms   = reader.ReadInt32();
                }
            return(bank);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Unload each plugin, then reload all plugins.
        /// </summary>
        public void ResetPluginList()
        {
            ReleaseAllPlugins();
            pluginsList.Reverse();
            Stack <string> newlist = new Stack <string>(pluginsList);

            pluginsList.Reverse();
            while (newlist.Count > 0)
            {
                string    name = newlist.Pop();
                VstPlugin ctx  = OpenPlugin(name, true);
                if (ctx != null)
                {
                    _plugins.Add(ctx);
                }
            }
            newlist = null;
            // trigger update event
            OnPluginListRefreshed();
        }