Пример #1
0
        public static List <Synth1Preset> GetPresetsFromFolderAndSubfolders(string folderPath)
        {
            var presets = new List <Synth1Preset>();

            //check if the path is a folder

            if (Path.HasExtension(folderPath))
            {
                return(presets);
            }

            DirectoryInfo d = new DirectoryInfo(folderPath);

            foreach (var file in d.GetFiles("*.sy1", SearchOption.AllDirectories))
            {
                var fileLines = File.ReadAllLines(file.FullName);

                if (fileLines.Length < 15)
                {
                    continue;
                }

                var synth1Preset = new Synth1Preset(fileLines);

                Console.WriteLine(synth1Preset.Name + synth1Preset.Version1);

                presets.Add(synth1Preset);
            }
            return(presets);
        }
Пример #2
0
        public static Dictionary <int, float> VstParametersFromPreset(Synth1Preset preset)
        {
            //TODO: logic for different preset versions

            var vstParameters = new Dictionary <int, float>();

            if (preset != null)
            {
                foreach (var parameter in preset.Parameters)
                {
                    vstParameters.Add(parameter.Key, ConvertParaToVstPara(parameter.Key, parameter.Value, preset.Version1));
                }
            }

            return(vstParameters);
        }