Example #1
0
        /// <summary>
        /// Reads a Program header from the stream.
        /// </summary>
        /// <param name="programs">Must not be null.</param>
        /// <returns>Returns the number of Programs expected after the header.</returns>
        protected virtual int ReadProgramHeader(VstProgramCollection programs)
        {
            string typeName = Reader.ReadString();
            int    count    = Reader.ReadInt32();

            return(count);
        }
Example #2
0
        /// <summary>
        /// Initializes the plugin program collection.
        /// </summary>
        /// <returns>A filled program collection.</returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            var programs = new VstProgramCollection();

            var prog = new VstProgram(_plugin.ParameterFactory.Categories)
            {
                Name = "Fx Program 1"
            };

            _plugin.ParameterFactory.CreateParameters(prog.Parameters);

            programs.Add(prog);

            prog = new VstProgram(_plugin.ParameterFactory.Categories)
            {
                Name = "Fx Program 2"
            };
            _plugin.ParameterFactory.CreateParameters(prog.Parameters);

            programs.Add(prog);

            prog = new VstProgram(_plugin.ParameterFactory.Categories)
            {
                Name = "Fx Program 3"
            };
            _plugin.ParameterFactory.CreateParameters(prog.Parameters);

            programs.Add(prog);

            return(programs);
        }
        public void ReadPrograms(Stream stream, VstProgramCollection programs)
        {
            BinaryReader reader = new BinaryReader(stream, _encoding);

            _plugin.Transpose.Semitones = reader.ReadInt32();
            _plugin.Transpose.FromValue = reader.ReadInt32();
        }
Example #4
0
        /// <summary>
        /// Loads the state of the plugin and initializes the the programs. In most hosts, this will
        /// be called when the plugin first loads.
        /// </summary>
        /// <param name="stream">
        /// Stream containing an object graph which contains the state of the program. The root of
        /// this object graph should have the same type specified by SerializableRootType
        /// </param>
        /// <param name="programs">This collection must be populated with new VstPrograms unless it
        /// is null.</param>
        public void ReadPrograms(Stream stream, VstProgramCollection programs)
        {
            Control mainThreadHandel = getMainThreadHandel();

            if (mainThreadHandel != null && mainThreadHandel.InvokeRequired)
            {
                mainThreadHandel.Invoke(new Action <Stream, VstProgramCollection>(ReadPrograms), stream, programs);
                return;
            }

            if (BeforePluginDeserialized != null)
            {
                BeforePluginDeserialized();
            }

            SerializableRootType deserializedRoot;

            deserializedRoot = ContractSerializer.Deserialize <SerializableRootType>(stream);

            if (programs != null)
            {
                programs.AddRange(this.pluginPrograms.CreatePrograms());
            }

            if (PluginDeserialized != null)
            {
                PluginDeserialized(deserializedRoot);
            }

            Logger.Info(21, string.Format("Finished loading new program: {0}", deserializedRoot.ToString()));
        }
Example #5
0
        /// <summary>
        /// Writes a header for the <paramref name="programs"/> to the output stream.
        /// </summary>
        /// <param name="programs">Must not be null.</param>
        protected virtual void WriteProgramHeader(VstProgramCollection programs)
        {
            var type = typeof(VstProgram);

            Writer.Write(type.FullName ?? type.Name);
            Writer.Write(programs.Count);
        }
        public void WritePrograms(Stream stream, VstProgramCollection programs)
        {
            BinaryWriter writer = new BinaryWriter(stream, _encoding);

            writer.Write(_plugin.Transpose.Semitones);
            writer.Write(_plugin.Transpose.FromValue);
        }
Example #7
0
        /// <summary>
        /// Initialisation des presets du plugin
        /// </summary>
        protected override VstProgramCollection CreateProgramCollection()
        {
            // On instancie une nouvelle collection de presets
            VstProgramCollection programs = new VstProgramCollection();

            // On créé et ajoute les presets un à un à la collection
            VstProgram prog = new VstProgram(_plugin.ParameterFactory.Categories);

            prog.Name = "Mon Premier Preset";
            _plugin.ParameterFactory.CreateParameters(prog.Parameters);

            programs.Add(prog);

            prog      = new VstProgram(_plugin.ParameterFactory.Categories);
            prog.Name = "Mon Deuxieme Preset";
            _plugin.ParameterFactory.CreateParameters(prog.Parameters);

            programs.Add(prog);

            prog      = new VstProgram(_plugin.ParameterFactory.Categories);
            prog.Name = "Mon Troisieme Preset";
            _plugin.ParameterFactory.CreateParameters(prog.Parameters);

            programs.Add(prog);

            return(programs);
        }
        public void WritePrograms(Stream stream, VstProgramCollection programs)
        {
            BinaryWriter writer = new BinaryWriter(stream, _encoding);

            writer.Write(_version_);
            writer.Write(_plugin.Data.Height);
            writer.Write(_plugin.Data.MainBeatIndex);
            writer.Write(_plugin.Data.OtherBeatIndex);
            foreach (Cue cue in _plugin.Data.Cues.Values)
            {
                if (cue.Index < 0 || (String.IsNullOrEmpty(cue.Note) && String.IsNullOrEmpty(cue.Text)))
                {
                    continue;
                }
                int present =
                    (String.IsNullOrWhiteSpace(cue.Note) ? 0 : 1) +
                    (String.IsNullOrWhiteSpace(cue.Text) ? 0 : 2);
                writer.Write(cue.Index);
                writer.Write(present);
                if ((present & 1) == 1)
                {
                    writer.Write(cue.Note);
                }
                if ((present & 2) == 2)
                {
                    writer.Write(cue.Text);
                }
            }
        }
        /// <summary>
        /// Writes the Programs in the <paramref name="programs"/> collection to the output stream.
        /// </summary>
        /// <param name="programs">Must not be null.</param>
        public void Write(VstProgramCollection programs)
        {
            WriteProgramHeader(programs);

            foreach (VstProgram program in programs)
                Write(program);
        }
Example #10
0
        /// <summary>
        /// Writes the Programs in the <paramref name="programs"/> collection to the output stream.
        /// </summary>
        /// <param name="programs">Must not be null.</param>
        public void Write(VstProgramCollection programs)
        {
            WriteProgramHeader(programs);

            foreach (VstProgram program in programs)
            {
                Write(program);
            }
        }
Example #11
0
        /// <summary>
        /// Called to initialize the collection of programs for the plugin.
        /// </summary>
        /// <returns>Never returns null or an empty collection.</returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            VstProgramCollection programs = new VstProgramCollection();
            //!  You can add multiple programs here.
            VstProgram program = CreateProgram(ParameterInfos);

            program.Name = "Default";
            programs.Add(program);
            return(programs);
        }
Example #12
0
        protected override VstProgramCollection CreateProgramCollection()
        {
            var programs       = new VstProgramCollection();
            var defaultProgram = new VstProgram();

            defaultProgram.Parameters.Add(new VstParameter(thresholdParameterInfo));
            defaultProgram.Name = "Default";
            programs.Add(defaultProgram);
            return(programs);
        }
        /// <summary>
        /// Reads the stream and fills the <paramref name="programs"/> colllection with programs.
        /// </summary>
        /// <param name="programs">The collection does not have to be empty. Must not be null.</param>
        public void ReadPrograms(VstProgramCollection programs)
        {
            int count = ReadProgramHeader(programs);

            for (int i = 0; i < count; i++)
            {
                VstProgram program = ReadProgram();
                programs.Add(program);
            }
        }
Example #14
0
        /// <summary>
        /// Reads the stream and fills the <paramref name="programs"/> colllection with programs.
        /// </summary>
        /// <param name="programs">The collection does not have to be empty. Must not be null.</param>
        public void ReadPrograms(VstProgramCollection programs)
        {
            int count = ReadProgramHeader(programs);

            for (int i = 0; i < count; i++)
            {
                VstProgram program = ReadProgram();

                programs.Add(program);
            }
        }
Example #15
0
        /// <summary>
        /// Called to initialize the collection of programs for the plugin.
        /// </summary>
        /// <returns>Never returns null or an empty collection.</returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            var programs = new VstProgramCollection();

            // TODO: add a number of programs for your plugin.

            var program = CreateProgram("Default");
            programs.Add(program);

            return programs;
        }
Example #16
0
        /// <summary>
        /// Создает коллекцию программ.
        /// </summary>
        /// <returns></returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            VstProgramCollection programs = new VstProgramCollection();

            VstProgram defaultProgram = new VstProgram(ParameterCategories);

            defaultProgram.Parameters.AddRange(ParameterInfos.Select(x => new VstParameter(x)));
            defaultProgram.Name = "Default";
            programs.Add(defaultProgram);

            return(programs);
        }
Example #17
0
        /// <summary>
        /// Called to initialize the collection of programs for the plugin.
        /// </summary>
        /// <returns>Never returns null or an empty collection.</returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            VstProgramCollection programs = new VstProgramCollection();

            // TODO: add a number of programs for your plugin.

            VstProgram program = CreateProgram(ParameterInfos);
            program.Name = "Default";
            programs.Add(program);

            return programs;
        }
Example #18
0
        /// <summary>
        /// Initializes the plugin program collection.
        /// </summary>
        /// <returns>A filled program collection.</returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            VstProgramCollection programs = new VstProgramCollection();

            VstProgram prog = new VstProgram(_plugin.Model.Categories);

            prog.Name = "SLoOultraHD";
            _plugin.Model.CreateParameters(prog.Parameters);

            programs.Add(prog);

            return(programs);
        }
Example #19
0
        public void WritePrograms(Stream stream, VstProgramCollection programs)
        {
            var writer = new BinaryWriter(stream, _encoding);

            writer.Write(_noteMap.Count);

            foreach (MapNoteItem item in _noteMap)
            {
                writer.Write(item.KeyName);
                writer.Write(item.TriggerNoteNumber);
                writer.Write(item.OutputNoteNumber);
            }
        }
Example #20
0
        /// <summary>
        /// Called to initialize the collection of programs for the plugin.
        /// </summary>
        /// <returns>Never returns null or an empty collection.</returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            var programs = new VstProgramCollection();

            var prog = CreateProgram("Program 1");

            programs.Add(prog);
            prog = CreateProgram("Program 2");
            programs.Add(prog);
            prog = CreateProgram("Program 3");
            programs.Add(prog);

            return(programs);
        }
        public VstProgramCollection CreatePrograms()
        {
            VstProgramCollection newPrograms = new VstProgramCollection();

            //Add active program to the top of the list
            newPrograms.Add(CreateProgramFromSettingsFileInfo(this.mssProgramMgr.GetActiveSettingsFile()));

            foreach (SettingsFileInfo progInfo in this.mssProgramMgr.FlatSettingsFileList)
            {
                VstProgram program = CreateProgramFromSettingsFileInfo(progInfo);
                newPrograms.Add(program);
            }
            return(newPrograms);
        }
        public void ReadPrograms(Stream stream, VstProgramCollection programs)
        {
            int stage = 0;

            try
            {
                BinaryReader reader = new BinaryReader(stream, _encoding);
                {
                    Decimal version = reader.ReadDecimal();
                    if (version != _version_)
                    {
                        System.Windows.Forms.MessageBox.Show(String.Format("{0} != {1}", version, _version_));
                    }
                    _plugin.Data.Height         = reader.ReadInt32();
                    _plugin.Data.MainBeatIndex  = reader.ReadInt32();
                    _plugin.Data.OtherBeatIndex = reader.ReadInt32();
                    while (reader.PeekChar() > -1)
                    {
                        stage++;
                        string note = "", text = "";
                        int    index = reader.ReadInt32();
                        if (reader.PeekChar() > -1)
                        {
                            int present = reader.ReadInt32();
                            // this is a bit flag....
                            if ((present & 1) == 1)
                            {
                                note = reader.ReadString();
                            }
                            if ((present & 2) == 2)
                            {
                                text = reader.ReadString();
                            }

                            if (!_plugin.Data.Cues.ContainsKey(index))
                            {
                                _plugin.Data.Cues.Add(index, new Cue(index, note, text));
                            }
                        }
                        // we are rejecting multiple definintions - this shouldn't occur.
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, string.Format("Data read error at stage {0}", stage));
            }
        }
Example #23
0
        /// <summary>
        /// Initializes the plugin program collection.
        /// </summary>
        /// <returns>A filled program collection.</returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            var programs = new VstProgramCollection();

            var prog = new VstProgram(_plugin.ParameterFactory.Categories)
            {
                Name     = "Default",
                IsActive = true,
            };

            _plugin.ParameterFactory.CreateParameters(prog.Parameters);

            programs.Add(prog);

            return(programs);
        }
Example #24
0
        public void ReadPrograms(Stream stream, VstProgramCollection programs)
        {
            BinaryReader reader = new BinaryReader(stream, _encoding);

            _plugin.NoteMap.Clear();
            int count = reader.ReadInt32();

            for (int n = 0; n < count; n++)
            {
                MapNoteItem item = new MapNoteItem();
                item.KeyName           = reader.ReadString();
                item.TriggerNoteNumber = reader.ReadByte();
                item.OutputNoteNumber  = reader.ReadByte();

                _plugin.NoteMap.Add(item);
            }
        }
Example #25
0
        public void WritePrograms(Stream stream, VstProgramCollection programs)
        {
            BinaryWriter writer = new BinaryWriter(stream, _encoding);

            writer.Write(_plugin.NoteMap.Count);

            foreach (MapNoteItem item in _plugin.NoteMap)
            {
                writer.Write(item.KeyName);
                writer.Write(item.TriggerNoteNumber);
                writer.Write(item.OutputBytesStringOn);
                writer.Write(item.OutputBytesStringOff);
            }

            writer.Write(_plugin.midiThru);

            writer.Close();  // LB - this wasn't in the original sample code, not sure if needed or not
        }
Example #26
0
        public void WritePrograms(Stream stream, VstProgramCollection programs)
        {
            BinaryWriter writer = new BinaryWriter(stream, _encoding);

            writer.Write(_plugin.NoteMap.Count);

            foreach (MapNoteItem item in _plugin.NoteMap)
            {
                writer.Write(item.KeyName);
                writer.Write(item.TriggerNoteNumber);
                writer.Write(item.OutputBytesStringOn);
                writer.Write(item.OutputBytesStringOff);
            }

            writer.Write(_plugin.midiThru);

            writer.Close();  // LB - this wasn't in the original sample code, not sure if needed or not
        }
Example #27
0
        public void ReadPrograms(Stream stream, VstProgramCollection programs)
        {
            BinaryReader reader = new BinaryReader(stream, _encoding);

            _plugin.NoteMap.Clear();
            int count = reader.ReadInt32();

            for (int n = 0; n < count; n++)
            {
                MapNoteItem item = new MapNoteItem();

                item.KeyName = reader.ReadString();
                item.TriggerNoteNumber = reader.ReadByte();
                item.OutputBytesStringOn = reader.ReadString();
                item.OutputBytesStringOff = reader.ReadString();

                _plugin.NoteMap.Add(item);
            }

            _plugin.midiThru = reader.ReadBoolean();

            _plugin.presetsLoaded = true;
        }
 /// <inheritdoc />
 public virtual void WritePrograms(Stream stream, VstProgramCollection programs)
 {
     VstProgramWriter writer = new VstProgramWriter(stream, Encoding);
     writer.Write(programs);
 }
Example #29
0
 /// <summary>
 /// Saves the state of the plugin to the stream. This will likely be called by a host when
 /// saving a file containing this plugin.
 /// </summary>
 public void WritePrograms(Stream stream, VstProgramCollection programs)
 {
     ContractSerializer.Serialize <SerializableRootType>(stream, getSerializableRootFromPlugin());
 }
        /// <summary>
        /// Reads a Program header from the stream.
        /// </summary>
        /// <param name="programs">Must not be null.</param>
        /// <returns>Returns the number of Programs expected after the header.</returns>
        protected virtual int ReadProgramHeader(VstProgramCollection programs)
        {
            string typeName = Reader.ReadString();
            int count = Reader.ReadInt32();

            return count;
        }
        public void ReadPrograms(Stream stream, VstProgramCollection programs)
        {
            if (_plugin == null) return;

            bool headerok = false;
            BinaryReader reader = new BinaryReader(stream, _encoding);

            // Header
            try
            {
                String header = reader.ReadString();
                if (header.Equals(Constants.MIDIMAPPERX))
                {
                    headerok = true;
                }
            }
            catch (Exception)
            {
                ;
            }

            if (!headerok)  // Version 1?
            {
                ReadOldPreset(reader);
                return;
            }

            // Version Number
            int version = reader.ReadInt32();

            if (version < Constants.VERSION)
            {
                // TODO: Special handling here in future.
            }

            // Number of maps
            int count = reader.ReadInt32();

            if (count != Constants.MAXNOTES)
            {
                MessageBox.Show("Invalid number of maps stored: " + count, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // Each map
            for (int n = 0; n < count; n++)
            {
                MapNoteItem map = _plugin.NoteMaps[n];
                map.KeyName = reader.ReadString();
                map.OutputBytesStringOn = reader.ReadString();
                map.OutputBytesStringOff = reader.ReadString();
            }

            // Options
            try  // In case the preset was written with an older version that didn't have all these options yet.
            {
                _plugin.Options.MidiThru = reader.ReadBoolean();
                _plugin.Options.MidiThruAll = reader.ReadBoolean();
                _plugin.Options.AlwaysSysEx = reader.ReadBoolean();
            }
            catch // all, i.e. (System.IO.EndOfStreamException e)
            {
                // Note: This catch block never seems to be reached, investigate (Low priority)
                MessageBox.Show("No Options block in preset", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            // CCs
            for (int n = 0; n < count; n++)
            {
                MapNoteItem map = _plugin.NoteMaps[n];
                map.OutputBytesStringCC = reader.ReadString();
            }

            _plugin.presetsLoaded = true;
        }
        public void WritePrograms(Stream stream, VstProgramCollection programs)
        {
            if (_plugin == null) return;

            BinaryWriter writer = new BinaryWriter(stream, _encoding);

            // Header
            writer.Write(Constants.MIDIMAPPERX);

            // Version Number
            writer.Write(_plugin.ProductInfo.Version);

            // Number of maps (always MAXNOTES in this version, was flexible in version 1)
            writer.Write(Constants.MAXNOTES);

            // Each map
            for (int note = 0; note < Constants.MAXNOTES; note++)
            {
                MapNoteItem map = _plugin.NoteMaps[note];
                writer.Write(map.KeyName);
                writer.Write(map.OutputBytesStringOn);
                writer.Write(map.OutputBytesStringOff);
            }

            // Options
            writer.Write(_plugin.Options.MidiThru);
            writer.Write(_plugin.Options.MidiThruAll);
            writer.Write(_plugin.Options.AlwaysSysEx);

            // CCs
            for (int note = 0; note < Constants.MAXNOTES; note++)
            {
                MapNoteItem map = _plugin.NoteMaps[note];
                writer.Write(map.OutputBytesStringCC);
            }

            writer.Close();
        }
Example #33
0
        /// <summary>
        /// Called to initialize the collection of programs for the plugin.
        /// </summary>
        /// <returns>Never returns null or an empty collection.</returns>
        protected override VstProgramCollection CreateProgramCollection()
        {
            VstProgramCollection programs = new VstProgramCollection();

            // TODO: add a number of programs for your plugin.

            VstProgram program = CreateProgram(ParameterInfos);
            program.Name = "Default";
            programs.Add(program);

            return programs;
        }
        /// <inheritdoc />
        public virtual void WritePrograms(Stream stream, VstProgramCollection programs)
        {
            VstProgramWriter writer = new VstProgramWriter(stream, Encoding);

            writer.Write(programs);
        }
        /// <summary>
        /// Called by the host to retrieve a buffer with Program (and Parameter) content.
        /// </summary>
        /// <param name="isPreset">True if only the current/active program should be serialized, 
        /// otherwise (false) the complete program bank should be serialized.</param>
        /// <returns>Returns null when the plugin does not implement the <see cref="IVstPluginPersistence"/> 
        /// and/or <see cref="IVstPluginPrograms"/> interfaces.</returns>
        public virtual byte[] GetChunk(bool isPreset)
        {
            IVstPluginPersistence pluginPersistence = pluginCtx.Plugin.GetInstance<IVstPluginPersistence>();
            IVstPluginPrograms pluginPrograms = pluginCtx.Plugin.GetInstance<IVstPluginPrograms>();

            if (pluginPersistence != null)
            {
                using (MemoryStream stream = new MemoryStream())
                {
                    VstProgramCollection programs = null;

                    if (pluginPrograms != null)
                    {
                        if (isPreset)
                        {
                            programs = new VstProgramCollection();

                            if (pluginPrograms.ActiveProgram != null)
                                programs.Add(pluginPrograms.ActiveProgram);
                            else if (pluginPrograms.Programs.Count > 0)
                                programs.Add(pluginPrograms.Programs[0]);
                        }
                        else
                            programs = pluginPrograms.Programs;
                    }
                    else
                    {
                        // allocate a dummy collection
                        programs = new VstProgramCollection();
                    }

                    pluginPersistence.WritePrograms(stream, programs);

                    return stream.GetBuffer();
                }
            }

            return null;
        }
        /// <inheritdoc />
        public virtual void ReadPrograms(Stream stream, VstProgramCollection programs)
        {
            VstProgramReaderBase reader = CreateProgramReader(stream);

            reader.ReadPrograms(programs);
        }
 /// <summary>
 /// Writes a header for the <paramref name="programs"/> to the output stream.
 /// </summary>
 /// <param name="programs">Must not be null.</param>
 protected virtual void WriteProgramHeader(VstProgramCollection programs)
 {
     Writer.Write(typeof(VstProgram).FullName);
     Writer.Write(programs.Count);
 }
        /// <summary>
        /// Called by the host to load in a previously serialized program buffer.
        /// </summary>
        /// <param name="data">The buffer provided by the host that contains the program data.</param>
        /// <param name="isPreset">True if only the current/active program should be deserialized, 
        /// otherwise (false) the complete program bank should be deserialized.</param>
        /// <returns>Returns the number of bytes read from the <paramref name="data"/> buffer or 
        /// zero if the plugin does not implement the <see cref="IVstPluginPersistence"/> 
        /// and/or <see cref="IVstPluginPrograms"/> interfaces.</returns>
        public virtual int SetChunk(byte[] data, bool isPreset)
        {
            IVstPluginPersistence pluginPersistence = pluginCtx.Plugin.GetInstance<IVstPluginPersistence>();
            IVstPluginPrograms pluginPrograms = pluginCtx.Plugin.GetInstance<IVstPluginPrograms>();

            if (pluginPersistence != null)
            {
                using (MemoryStream stream = new MemoryStream(data, false))
                {
                    // use a temp collection to leave the real Programs
                    // collection in tact in case of an exception.
                    VstProgramCollection programs = new VstProgramCollection();

                    pluginPersistence.ReadPrograms(stream, programs);

                    if (pluginPrograms != null)
                    {
                        if (isPreset)
                        {
                            VstProgram prog = null;

                            if (programs.Count > 0)
                                prog = programs[0];

                            if (prog != null)
                            {
                                VstProgram formerActiveProg = pluginPrograms.ActiveProgram;

                                if (formerActiveProg != null)
                                {
                                    int index = pluginPrograms.Programs.IndexOf(formerActiveProg);
                                    pluginPrograms.Programs.Insert(index, prog);

                                    pluginPrograms.ActiveProgram = prog;

                                    // remove the previously active program that has now been replaced
                                    pluginPrograms.Programs.Remove(formerActiveProg);

                                }
                                else
                                {
                                    pluginPrograms.Programs.Add(prog);
                                    pluginPrograms.ActiveProgram = prog;
                                }
                            }
                        }
                        else
                        {
                            pluginPrograms.ActiveProgram = null;

                            if (programs.Count != pluginPrograms.Programs.Count)
                            {
                                int count = Math.Min(programs.Count, pluginPrograms.Programs.Count);

                                // replace the range of programs that overlap.
                                for (int i = 0; i < count; i++)
                                    pluginPrograms.Programs[i] = programs[i];
                            }
                            else
                            {
                                pluginPrograms.Programs.Clear();
                                pluginPrograms.Programs.AddRange(programs);
                            }
                        }
                    }

                    return (int)stream.Position;
                }
            }

            return 0;
        }
        public VstProgramCollection CreatePrograms()
        {
            VstProgramCollection newPrograms = new VstProgramCollection();

            //Add active program to the top of the list
            newPrograms.Add(CreateProgramFromSettingsFileInfo(this.mssProgramMgr.GetActiveSettingsFile()));

            foreach (SettingsFileInfo progInfo in this.mssProgramMgr.FlatSettingsFileList)
            {
                VstProgram program = CreateProgramFromSettingsFileInfo(progInfo);
                newPrograms.Add(program);
            }
            return newPrograms;
        }
        /// <inheritdoc />
        public virtual void ReadPrograms(Stream stream, VstProgramCollection programs)
        {
            VstProgramReaderBase reader = CreateProgramReader(stream);

            reader.ReadPrograms(programs);
        }