private void PresetDropDownSelectedIndexChanged(object sender, EventArgs e) { if (PresetDropDown.SelectedIndex == -1) { return; } using var inFile = new StreamReader(_presetPath + PresetDropDown.Text); Voice = JsonSerializer.Deserialize <VoicePreset>(inFile.ReadToEnd()); GetVoice(); }
private void SetVoice() { var channelVoice = new BaseVoice[Configuration.TotalChannels]; var channelAllocation = new VoiceComposition.ChannelSide[Configuration.TotalChannels]; var channelTransposition = new int[Configuration.TotalChannels]; for (var i = 0; i < Configuration.TotalChannels; ++i) { channelVoice[i] = _voiceBindingSources[i].Current as BaseVoice? ?? new BaseVoice(); channelAllocation[i] = (VoiceComposition.ChannelSide)_allocationBindingSources[i].Position; channelTransposition[i] = (int)_transpositionUpDowns[i].Value; } Voice = new VoicePreset(PresetDropDown.Text, _splitBindingSource.Position, channelVoice, channelAllocation, channelTransposition); }