private void MigratePluginInfo(VstPluginInfoSurrogate oldPluginInfo,
                                       NewModels.VstPluginInfoSurrogate newPluginInfo)
        {
            if (oldPluginInfo == null)
            {
                return;
            }

            var propertiesToMigrate = new HashSet <string>
            {
                nameof(VstPluginInfoSurrogate.Flags),
                nameof(VstPluginInfoSurrogate.InitialDelay),
                nameof(VstPluginInfoSurrogate.ProgramCount),
                nameof(VstPluginInfoSurrogate.PluginVersion),
                nameof(VstPluginInfoSurrogate.ParameterCount),
                nameof(VstPluginInfoSurrogate.PluginID),
                nameof(VstPluginInfoSurrogate.AudioInputCount),
                nameof(VstPluginInfoSurrogate.AudioOutputCount),
            };

            foreach (var propertyName in propertiesToMigrate)
            {
                var oldValue = PropertyHelper.GetPropertyValue(oldPluginInfo, propertyName);
                PropertyHelper.SetPropertyValue(newPluginInfo, propertyName, oldValue);
            }
        }
Example #2
0
        public VstPluginInfoSurrogate GetPluginInfo(Guid pluginGuid)
        {
            var info = new VstPluginInfoSurrogate
            {
                ProgramCount = 1, Flags = VstPluginFlags.ProgramChunks, PluginID = _pluginId
            };

            return(info);
        }
Example #3
0
        public VstPluginInfoSurrogate GetPluginInfo(Guid pluginGuid)
        {
            App.Ping();
            var plugin = GetPluginByGuid(pluginGuid);

            if (!plugin.IsLoaded)
            {
                throw GetFaultException <PluginNotLoadedFault>();
            }

            var vstInfo = new VstPluginInfoSurrogate(plugin.PluginContext.PluginInfo);


            return(vstInfo);
        }
Example #4
0
        private void TestPluginInfo(VstPluginInfoSurrogate originalInfo, VstPluginInfoSurrogate savedInfo)
        {
            var testedProperties = new HashSet <string>();

            foreach (var x in PluginInfoPropertiesWhichShouldBePersisted)
            {
                var loadedValue   = PropertyHelper.GetPropertyValue(savedInfo, x.Key);
                var originalValue = PropertyHelper.GetPropertyValue(originalInfo, x.Key);

                loadedValue.Should().BeEquivalentTo(originalValue,
                                                    $"Loading the property {x.Key} should be the same as the saved one");
                testedProperties.Add(x.Key);
            }

            testedProperties.AddRange(PluginInfoPropertiesWhichShouldBeIgnored);

            var allProperties =
                (from prop in typeof(VstPluginInfoSurrogate).GetProperties() select prop.Name).ToList();

            allProperties.Except(testedProperties).Should().BeEmpty("We want to test ALL TEH PROPERTIEZ");
        }