public void LoadPresets() { presets = new PunkOrganPreset[25]; for (int i = 0; i < 25; i++) { presets[i] = new PunkOrganPreset(); } if (File.Exists(presetfilename)) { XmlSerializer serializer = new XmlSerializer(typeof(PunkOrganPreset[])); FileStream fs = new FileStream(presetfilename, FileMode.Open); presets = (PunkOrganPreset[])serializer.Deserialize(fs); } SetPreset(presets[0]); }
private void SetPreset(PunkOrganPreset preset) { CurrentPolyphony = preset.Polphony; Transpose = preset.Transpose; for (int i = 0; i < 9; i++) { Drawbars[i + 1].Volume = preset.Drawbars[i]; } OverDrive = preset.Overdrive; Amplify = preset.Amplify; Leslie_Freq = preset.LeslieFreq; Leslie_Rate = preset.LeslieRate; Echo.Freq = preset.EchoFreq; Echo.Rate = preset.EchoRate; NotifyPropertyChanged(); }
private PunkOrganPreset GetPreset() { PunkOrganPreset preset = new PunkOrganPreset(); preset.Polphony = CurrentPolyphony; preset.Transpose = Transpose; for (int i = 0; i < 9; i++) { preset.Drawbars[i] = Drawbars[i + 1].Volume; } preset.Overdrive = OverDrive; preset.Amplify = Amplify; preset.LeslieFreq = Leslie_Freq; preset.LeslieRate = Leslie_Rate; preset.EchoFreq = Echo.Freq; preset.EchoRate = Echo.Rate; return(preset); }