Beispiel #1
0
 public static void createInstance()
 {
     if (myInstance == null)
     {
         myInstance = new VoicingManage();
     }
 }
        public void initialize()
        {
            Write("Load chord infomation\n");
            ChordBasic.initialize();

            Write("Load pad infomation\n");
            loadPadInfo();

            Write("Load chord progression database\n");
            cpd.initialize();

            Write("Load chord progression suggest\n");
            cps.initialize();
            cps.read(cpd.enabledFileList);

            Write("Initialize midi devices\n");
            mm.initialize();

            Write("Initialize voicing manage\n");
            VoicingManage.createInstance();

            createScaleLabel();
            createTonePad();
            createChannelSelector();
            createProgramSelector();
            createKeySelector();
            mm.setCanvas(KeyboardCanvas);

            initializeUI();
        }
Beispiel #3
0
        public void playChord(Chord chord, int velocity, int channel, int transpose = 0)
        {
            if (chord == null)
            {
                return;
            }
            var notes = VoicingManage.getInstance().chordToNotes(chord, transpose);

            paintPlayedNote(notes);
            foreach (int note in notes)
            {
                midiAdapter.sendNote(note, velocity, channel);
                playedNotes.Add(note);
            }
            lastPlayedNotes = notes;
        }
        private void initializeUI()
        {
            // データバインド
            ChordPadPanel.MouseLeftButtonDown += new MouseButtonEventHandler(Callback_MouseDown);
            this.MouseLeftButtonUp            += new MouseButtonEventHandler(Callback_MouseUp);
            this.LostMouseCapture             += new MouseEventHandler(Callback_MouseLost);
            this.AllowDrop = true;
            this.Drop     += new DragEventHandler(Callback_FileDrop);
            CheckBox_HoldMode.DataContext         = this;
            fileDatabaseList.ItemsSource          = cpd.fileStates;
            ComboBox_outputDevice.ItemsSource     = mm.outDeviceList;
            ComboBox_inputDevice.ItemsSource      = mm.inDeviceList;
            ComboBox_Channel.DataContext          = this;
            TextBlock_Program.DataContext         = this;
            CheckBox_ignoreSlashChord.DataContext = cps;
            ComboBox_MajorMinor.DataContext       = this;
            TextBox_Velocity.DataContext          = this;
            TextBlock_Octave.DataContext          = this;
            ComboBox_BaseNote.DataContext         = VoicingManage.getInstance();
            ComboBox_KeepNote.DataContext         = VoicingManage.getInstance();
            TextBox_MinimumInterval.DataContext   = VoicingManage.getInstance();
            ComboBox_NearTo.DataContext           = VoicingManage.getInstance();
            ComboBox_BaseNearTo.DataContext       = VoicingManage.getInstance();
            ComboBox_ExpandTo.DataContext         = VoicingManage.getInstance();

            if (mm.outDeviceList.Count > 0)
            {
                ComboBox_outputDevice.SelectedIndex = 0;
            }
            if (mm.inDeviceList.Count > 0)
            {
                ComboBox_inputDevice.SelectedIndex = 0;
            }
            noteVelocity = 100;
            octaveShift  = 0;
            VoicingManage.getInstance().keepNotePolicyIndex   = 0;
            VoicingManage.getInstance().nearToPolicyIndex     = 0;
            VoicingManage.getInstance().minimumInterval       = 0;
            VoicingManage.getInstance().baseNotePolicyIndex   = 1;
            VoicingManage.getInstance().baseNearToPolicyIndex = 0;
            VoicingManage.getInstance().expandToPolicyIndex   = 0;
        }
 private void Callback_NoteOffButtonClicked(object sender, MouseButtonEventArgs e)
 {
     currentChord = null;
     VoicingManage.getInstance().resetNearTo();
     noteOff();
 }