Example #1
0
        private void SwitchConnection()
        {
            this.mode_smf = !this.mode_smf;

            this.Stop();

            if (!this.mode_smf && Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                MessageBox.Show("MIDI-IN への接続は Windows のみ対応しています。", null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.mode_smf = true;
                return;
            }

            if (this.connector != null)
            {
                this.connector.Dispose();
            }

            if (this.mode_smf)
            {
                this.connector = new SmfConnector(frequencty);
                this.label_static_connect.Text = "SMF";
            }
            else
            {
                this.connector = new MidiInConnector(frequencty, 0);
                this.label_static_connect.Text = "MIDI-IN";
            }

            #region Control
            this.label_static_title.BackColor                = this.label_static_resolution.BackColor =
                this.label_static_tick.BackColor             = this.label_static_tempo.BackColor
                                                             = (this.mode_smf) ? Color.FromArgb(64, 64, 64) : Color.FromArgb(139, 229, 139);

            this.toolStrip_connect.Checked = this.menu_connect.Checked = !this.mode_smf;
            this.hScrollBar.Enabled        = this.toolStrip_open.Enabled = this.menu_open.Enabled = this.menu_playFirst.Enabled = this.toolStrip_playFirst.Enabled = this.mode_smf;

            if (this.mode_smf)
            {
                this.label_sep2.Text         = "/";
                this.toolStrip_connect.Image = this.menu_connect.Image = Properties.Resources.plug_disconnect;
            }
            else
            {
                this.label_title.Text        = this.label_tick_left.Text = this.label_tick_right.Text =
                    this.label_tempo.Text    = this.label_resolution.Text = "";
                this.label_sep2.Text         = "";
                this.toolStrip_connect.Image = this.menu_connect.Image = Properties.Resources.plug_connect;
            }
            #endregion

            this.connector.AddPreset("ux_preset.xml");
        }
Example #2
0
        private void StartMidi()
        {
            if (midiConnector != null)
            {
                return;
            }
            midiConnector = new MidiConnector();
            midiConnector.StartReceiving();

            midiConnector.MessageReadyEvent
                      += (channel, cc, value) => { MidiMappings[new Tuple <int, int>(channel, cc)].Amout = value; };
            MidiStatus = "MIDI: Listening";
            OnPropertyChanged(nameof(MidiStatus));
        }
Example #3
0
        private void SwitchConnection()
        {
            this.Stop();

            this.mode_smf = !this.mode_smf;

            if (!this.mode_smf && Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                MessageBox.Show("MIDI-IN への接続は Windows のみ対応しています。",
                                null,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                this.mode_smf = true;
                return;
            }

            if (this.connector != null)
                this.connector.Dispose();

            if (this.mode_smf)
            {
                this.connector = new SmfConnector(frequencty);
                this.label_static_connect.Text = "SMF";
            }
            else
            {
                this.connector = new MidiInConnector(frequencty, 0);
                this.label_static_connect.Text = "MIDI-IN";
                this.masterc.Sequencer = null;
            }

            this.masterc.Master = this.connector.Master;

            #region Control
            this.label_static_title.BackColor = this.label_static_resolution.BackColor =
                this.label_static_tick.BackColor = this.label_static_tempo.BackColor
                    = (this.mode_smf) ? Color.FromArgb(64, 64, 64) : Color.FromArgb(139, 229, 139);

            this.toolStrip_connect.Checked = this.menu_connect.Checked = !this.mode_smf;
            this.hScrollBar.Enabled = this.toolStrip_open.Enabled =
                                      this.menu_open.Enabled =
                                      this.menu_playFirst.Enabled =
                                      this.toolStrip_playFirst.Enabled = this.mode_smf;

            if (this.mode_smf)
            {
                this.label_sep2.Text = "/";
                this.toolStrip_connect.Image = this.menu_connect.Image = Properties.Resources.plug_disconnect;
            }
            else
            {
                this.label_title.Text = this.label_tick_left.Text = this.label_tick_right.Text =
                    this.label_tempo.Text = this.label_resolution.Text = "";
                this.label_sep2.Text = "";
                this.toolStrip_connect.Image = this.menu_connect.Image = Properties.Resources.plug_connect;
            }
            #endregion

            foreach (string item in Settings.Default.PlayerPresets)
                this.connector.AddPreset(item);
        }