Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        // create a program with all parameters.
        private VstProgram CreateProgram(VstParameterInfoCollection parameterInfos)
        {
            VstProgram program = new VstProgram(ParameterCategories);

            CreateParameters(program.Parameters, parameterInfos);
            return(program);
        }
Ejemplo n.º 3
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);
        }
        protected void ActivateProgram(VstProgram program)
        {
            if (this._activeProgram != null)
            {
                this._activeProgram.IsActive = false;
                this._activeProgram          = null;
            }

            if (program != null)
            {
                this._activeProgram          = program;
                this._activeProgram.IsActive = true;

                this.Programs[0].Name    = program.Name;
                this.ProgramFullNames[0] = this.ProgramFullNames[this.Programs.IndexOf(program)];
                this.mssProgramMgr.LoadAndActivateSettingsFromName(GetFullNameOfProgram(program));

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

                if (this.vstHost != null)
                {
                    this.vstHost.GetInstance <IVstHostShell>().UpdateDisplay();
                }
            }
        }
Ejemplo n.º 5
0
            protected override VstProgram CreateProgram()
            {
                var program = new VstProgram(_plugin.ParameterFactory.Categories);

                _plugin.ParameterFactory.CreateParameters(program.Parameters);

                return(program);
            }
Ejemplo n.º 6
0
        // create a program with all parameters.
        private VstProgram CreateProgram()
        {
            var program = new VstProgram(_parameters.Categories);

            CreateParameters(program.Parameters, _parameters.ParameterInfos);

            return(program);
        }
        public VstProgram CreateProgramFromSettingsFileInfo(SettingsFileInfo settingsFileInfo)
        {
            VstProgram program = CreateProgram(ParameterInfos);

            this.ProgramFullNames.Add(settingsFileInfo.Name);
            program.Name = GetValidProgramName(settingsFileInfo.Name);

            return(program);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Returns a new Program instance initialized with the values read from the stream.
        /// </summary>
        /// <returns>Never returns null.</returns>
        /// <remarks>
        /// The Parameters are also read.
        /// </remarks>
        public virtual VstProgram ReadProgram()
        {
            VstProgram program = CreateProgram();

            program.Name = Reader.ReadString();

            ReadParameters(program.Parameters);

            return(program);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
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;
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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);
        }
        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);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        public void Test_MaxLength_VstProgram_Name()
        {
            VstProgram p = new VstProgram();

            Assert.AreEqual(null, p.Name);

            p.Name = String.Empty;
            Assert.AreEqual(String.Empty, p.Name);

            string testData = CreateString(Constants.MaxProgramNameLength);

            p.Name = testData;
            Assert.AreEqual(testData, p.Name);

            testData += "X";
            p.Name    = testData;
            Assert.Fail("should have thrown an exception.");
        }
Ejemplo n.º 18
0
        public void Test_MaxLength_VstProgram_Name()
        {
            var p = new VstProgram();

            p.Name.Should().BeEmpty();

            p.Name = String.Empty;
            p.Name.Should().BeEmpty();

            var testData = CreateString(Constants.MaxProgramNameLength);

            p.Name = testData;
            p.Name.Should().Be(testData);

            testData += "X";
            p.Name    = testData;
            Assert.Fail("should have thrown an exception.");
        }
        protected string GetFullNameOfProgram(VstProgram program)
        {
            string fullName = "";

            int programIndex = this.Programs.IndexOf(program);

            if (programIndex > -1)
            {
                fullName = this.ProgramFullNames[programIndex];
            }
            else
            {
                //program should always be an element of this.Programs
                Debug.Assert(false);
            }

            return(fullName);
        }
        /// <summary>
        /// Copies the parameter values of the current <see cref="VstProgram"/> to the program indicated by <paramref name="programIndex"/>.
        /// </summary>
        /// <param name="programIndex">A zero-based index into the program collection.</param>
        /// <returns>Returns true when the program parameter values were successfully copied.</returns>
        /// <remarks>The name of the program itself is also copied.</remarks>
        public virtual bool CopyCurrentProgramTo(int programIndex)
        {
            IVstPluginPrograms programs = Plugin.GetInstance <IVstPluginPrograms>();

            if (programs != null && programs.ActiveProgram != null)
            {
                VstProgram targetProgram = programs.Programs[programIndex];
                // targetProgram.Categories is always the same between programs
                targetProgram.Name = programs.ActiveProgram.Name;

                // copy parameter values.
                for (int i = 0; i < programs.ActiveProgram.Parameters.Count; i++)
                {
                    targetProgram.Parameters[i].Value = programs.ActiveProgram.Parameters[i].Value;
                }

                return(true);
            }

            return(false);
        }
 /// <summary>
 /// Writes the <paramref name="program"/> to the output stream.
 /// </summary>
 /// <param name="program">Must not be null.</param>
 public virtual void Write(VstProgram program)
 {
     Writer.Write(program.Name);
     Write(program.Parameters);
 }
Ejemplo n.º 22
0
        // create a program with all parameters.
        private VstProgram CreateProgram(VstParameterInfoCollection parameterInfos)
        {
            VstProgram program = new VstProgram(ParameterCategories);

            CreateParameters(program.Parameters, parameterInfos);

            return program;
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Writes the <paramref name="program"/> to the output stream.
 /// </summary>
 /// <param name="program">Must not be null.</param>
 public virtual void Write(VstProgram program)
 {
     Writer.Write(program.Name);
     Write(program.Parameters);
 }
Ejemplo n.º 24
0
        protected string GetFullNameOfProgram(VstProgram program)
        {
            string fullName = "";

            int programIndex = this.Programs.IndexOf(program);
            if (programIndex > -1)
            {
                fullName = this.ProgramFullNames[programIndex];
            }
            else
            {
                //program should always be an element of this.Programs
                Debug.Assert(false);
            }

            return fullName;
        }
Ejemplo n.º 25
0
        protected void ActivateProgram(VstProgram program)
        {
            if (this._activeProgram != null)
            {
                this._activeProgram.IsActive = false;
                this._activeProgram = null;
            }

            if (program != null)
            {

                this._activeProgram = program;
                this._activeProgram.IsActive = true;

                this.Programs[0].Name = program.Name;
                this.ProgramFullNames[0] = this.ProgramFullNames[this.Programs.IndexOf(program)];
                this.mssProgramMgr.LoadAndActivateSettingsFromName(GetFullNameOfProgram(program));

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

                if (this.vstHost != null)
                {
                    this.vstHost.GetInstance<IVstHostShell>().UpdateDisplay();
                }
            }
        }