Пример #1
0
        /// <summary>
        ///
        /// </summary>
        public FormFmEditor(InstrumentBase inst, TimbreBase timbre, bool singleSelect)
        {
            InitializeComponent();

            this.singleSelect = singleSelect;

            for (int nn = 0; nn < 128; nn++)
            {
                toolStripComboBoxNote.Items.Add(MidiManager.GetNoteName((SevenBitNumber)nn) + "(" + nn + ")");
                toolStripComboBoxVelo.Items.Add(nn);
            }

            toolStripComboBoxNote.SelectedIndex = 60;
            toolStripComboBoxVelo.SelectedIndex = 127;
            toolStripComboBoxGate.SelectedIndex = 0;
            toolStripComboBoxCh.SelectedIndex   = 0;
            toolStripComboBoxCC.SelectedIndex   = 0;

            Settings.Default.SettingsLoaded    += Default_SettingsLoaded;
            toolStripButtonPlay.Checked         = Settings.Default.FmPlayOnEdit;
            toolStripButtonHook.Checked         = Settings.Default.FmHook;
            toolStripComboBoxVelo.SelectedIndex = Settings.Default.FmVelocity;
            toolStripComboBoxGate.SelectedIndex = Settings.Default.FmGateTime;
            toolStripComboBoxNote.SelectedIndex = Settings.Default.FmNote;

            if (singleSelect)
            {
                pianoControl1.TargetTimbres = new TimbreBase[] { timbre }
            }
            ;
            this.Timbre     = timbre;
            this.Instrument = inst;

            ignoreMetroComboBoxTimbres_SelectedIndexChanged = true;
            for (int i = 0; i < Instrument.BaseTimbres.Length; i++)
            {
                metroComboBoxTimbres.Items.Add(new TimbreItem(inst.BaseTimbres[i], i));
                if (inst.BaseTimbres[i] == timbre)
                {
                    TimbreNo = i;
                }
            }
            metroComboBoxTimbres.SelectedIndex = TimbreNo;
            ignoreMetroComboBoxTimbres_SelectedIndexChanged = false;

            if (singleSelect)
            {
                metroComboBoxTimbres.Enabled    = false;
                metroButtonImportAll.Enabled    = false;
                metroButtonImportAllGit.Enabled = false;
            }

            setTitle();

            InstrumentManager.InstrumentChanged += InstrumentManager_InstrumentChanged;
            InstrumentManager.InstrumentRemoved += InstrumentManager_InstrumentRemoved;

            pianoControl1.NoteOn           += PianoControl1_NoteOn;
            pianoControl1.NoteOff          += PianoControl1_NoteOff;
            pianoControl1.EntryDataChanged += PianoControl1_EntryDataChanged;

            Midi.MidiManager.MidiEventHooked += MidiManager_MidiEventHooked;
        }