internal InstrumentGroup ToInstrumentGroup(int index) => InstrumentGroup.ForPresetInstruments( index, ValidateNotNull(Description, nameof(Description)), ValidateNotNull(VEditCategory, nameof(VEditCategory)), ValidateNotNull(Instruments, nameof(Instruments)), VeditDefaults);
} //SetupSliders void PopulateInstruments() { const int verticalMargin = 8; const int horizontalMargin = 12; var groupName = this.gridInstruments.GetType().Name; var splitPanel = new StackPanel(); splitPanel.Orientation = Orientation.Vertical; var count = InstrumentGroupSet.Groups.Length; var first = count / 2; var rest = count - first; int[] start = new int[] { 0, first }; int[] length = new int[] { first, rest }; for (int splitIndex = 0; splitIndex < start.Length; ++splitIndex) { var instrumentPanel = new StackPanel(); instrumentPanel.Orientation = Orientation.Horizontal; instrumentPanel.Margin = new Thickness(0, verticalMargin, 0, verticalMargin * splitIndex); for (int groupIndex = start[splitIndex]; groupIndex < start[splitIndex] + length[splitIndex]; ++groupIndex) { InstrumentGroup group = InstrumentGroupSet.Groups[groupIndex]; var panel = new StackPanel(); panel.Margin = new Thickness(horizontalMargin, 0, horizontalMargin, 0); panel.Orientation = Orientation.Vertical; TextBlock tb = new TextBlock(); tb.Text = group.Name; panel.Children.Add(tb); for (int index = (int)group.First; index <= (int)group.Last; ++index) { RadioButton rb = new RadioButton(); if (defaultInstrument == null) { defaultInstrument = rb; } rb.GroupName = groupName; rb.Tag = (Instrument)index; rb.Margin = new Thickness(0, 4, 0, 0); string id = Regex.Replace( ((Instrument)index).ToString(), "([A-Z][a-z])", " $1", System.Text.RegularExpressions.RegexOptions.Compiled).Trim(); id = Regex.Replace(id, "([0-9])", " $1", System.Text.RegularExpressions.RegexOptions.Compiled).Trim(); rb.Content = id; panel.Children.Add(rb); rb.Checked += (sender, eventArgs) => { RadioButton instance = (RadioButton)rb; Instrument instrument = (Instrument)instance.Tag; api.SetInstrument(instrument, channel); }; rb.IsChecked = index == 0; } //loop instruments instrumentPanel.Children.Add(panel); } //loop splitPanel.Children.Add(instrumentPanel); } //loop this.gridInstruments.Children.Add(splitPanel); } //PopulateInstruments
public int CompareTo(IInstrument other) { if (other == null) { return(1); } Guitar otherFlute = (Guitar)other; return(InstrumentName.CompareTo(otherFlute.InstrumentName) + InstrumentGroup.CompareTo(otherFlute.InstrumentGroup) + InstrumentValue.CompareTo(otherFlute.InstrumentValue) + IsAntiquity.CompareTo(otherFlute.IsAntiquity) + GuitarBrand.CompareTo(otherFlute.GuitarBrand) + GuitarType.CompareTo(otherFlute.GuitarType)); }
public int CompareTo(IInstrument other) { if (other == null) { return(1); } Piano otherFlute = (Piano)other; return(InstrumentName.CompareTo(otherFlute.InstrumentName) + InstrumentGroup.CompareTo(otherFlute.InstrumentGroup) + InstrumentValue.CompareTo(otherFlute.InstrumentValue) + IsAntiquity.CompareTo(otherFlute.IsAntiquity) + PianoBrand.CompareTo(otherFlute.PianoBrand) + PianoType.CompareTo(otherFlute.PianoType)); }
public int CompareTo(IInstrument other) { if (other == null) { return(1); } Flute otherFlute = (Flute)other; return(InstrumentName.CompareTo(otherFlute.InstrumentName) + InstrumentGroup.CompareTo(otherFlute.InstrumentGroup) + InstrumentValue.CompareTo(otherFlute.InstrumentValue) + IsAntiquity.CompareTo(otherFlute.IsAntiquity) + FluteBrand.CompareTo(otherFlute.FluteBrand) + Material.CompareTo(otherFlute.Material) + FluteType.CompareTo(otherFlute.FluteType)); }
private void SoundAttributesForm_Load(object sender, EventArgs e) { this.Text = "Sound Attributes"; foreach (InstrumentGroup ig in InstrumentGroupSet.Groups) { int i = cbHarpSoundInstrument.Items.Add(ig); } /* * foreach (eHarpInstruments ehi in HarpInstrumentFactory.GetInstruments()) * { * cbHarpInstrument.Items.Add(ehi); * cbReferenzHarpInstruments.Items.Add(ehi); * } */ foreach (Harp harpIntument in FormInstances.Instance().hc.Harps) { cbHarpInstrument.Items.Add(harpIntument); cbReferenzHarpInstruments.Items.Add(harpIntument); } SetUIVolume(); SetUIVelocity(); FormInstances.Instance().HarpNotifies.Register4Info(infoNotify); cbHarpInstrument.SelectedIndex = cbHarpInstrument.Items.Count > 0 ? 0 : -1; cbReferenzHarpInstruments.SelectedIndex = cbHarpInstrument.SelectedIndex; cbHarpSoundInstrument.SelectedIndex = cbHarpSoundInstrument.Items.Count > 0 ? 0 : -1; InstrumentGroup ig2 = (InstrumentGroup)cbHarpSoundInstrument.SelectedItem; //FormInstances.Instance().hc.SetTranspose(FormInstances.Instance().Transpose); FormInstances.Instance().hc.SetInstrument(ig2.First); int x = FormInstances.Instance().hc.CreateHarp(FormInstances.Instance().harpSlotsForm.pnlSlots, FormInstances.Instance().songSequenceForm.rtbSong, FormInstances.Instance().sa, (Harp)cbHarpInstrument.SelectedItem, (Harp)cbReferenzHarpInstruments.SelectedItem); FormInstances.Instance().harpSlotsForm.Width = x; FirstRun = false; }
internal InstrumentGroupOrUserSample(InstrumentGroup group) =>
public InstrumentGroupAudioViewModel(InstrumentGroup group, IReadOnlyList <InstrumentAudio> audio) => (Group, Audio) = (group, audio);
/// <summary> /// Finds the slider by instrument. /// </summary> /// <param name="instrument">Instrument to find slider of</param> /// <returns></returns> public RMSSlider GetSlider(InstrumentGroup instrument) { return(m_Sliders.Find(x => x.Instrument == instrument)); }
private void cbHarpSoundInstrument_SelectedIndexChanged(object sender, EventArgs e) { InstrumentGroup ig2 = (InstrumentGroup)cbHarpSoundInstrument.SelectedItem; FormInstances.Instance().sa.SetInstrument(ig2.First); }