예제 #1
0
        private Boolean SetupDevice()
        {
            audioDevices = new AudioDevice();

            midiDevice = new NanoKontrol2(audioDevices);

            if (!midiDevice.Found)
            {
                midiDevice = new XtouchMini(audioDevices);
            }

            if (!midiDevice.Found)
            {
                midiDevice = new OP1(audioDevices);
            }

            if (!midiDevice.Found)
            {
                midiDevice = new EasyControl(audioDevices);
            }


            audioDevices.midiDevice = midiDevice;

            logarithmic = System.Convert.ToBoolean(ConfigSaver.GetAppSettings("logarithmic"));
            SaveLogarithmic();

            return(midiDevice.Found);
        }
예제 #2
0
 public Fader(MidiDevice midiDevice, int faderNum, FaderDef _faderDef)
 {
     parent      = midiDevice;
     midiOut     = midiDevice.midiOut;
     faderNumber = faderNum;
     faderDef    = _faderDef;
 }
예제 #3
0
 public Fader(MidiDevice midiDevice, int faderNum)
 {
     parent      = midiDevice;
     midiOut     = midiDevice.midiOut;
     faderNumber = faderNum;
     faderDef    = parent.DefaultFaderDef;
 }
예제 #4
0
        public SysTrayApp()
        {
            System.AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
            Console.WriteLine($@"NK2 Tray {DateTime.Now}");
            trayIcon = new NotifyIcon
            {
                Text = "NK2 Tray",
                Icon = new Icon(Properties.Resources.nk2tray, 40, 40),

                ContextMenu = new ContextMenu()
            };
            trayIcon.ContextMenu.Popup += OnPopup;

            trayIcon.Visible = true;

            audioDevice = new AudioDevice();

            midiDevice = new NanoKontrol2(audioDevice);
            if (!midiDevice.Found)
            {
                midiDevice = new XtouchMini(audioDevice);
            }

            audioDevice.midiDevice = midiDevice;
        }
예제 #5
0
파일: Program.cs 프로젝트: jacktm22/NK2Tray
        private Boolean SetupDevice()
        {
            audioDevices = new AudioDevice();

            midiDevice = new NanoKontrol2(audioDevices);
            if (!midiDevice.Found)
            {
                midiDevice = new XtouchMini(audioDevices);
            }

            audioDevices.midiDevice = midiDevice;

            return(midiDevice.Found);
        }
예제 #6
0
파일: Button.cs 프로젝트: pilo1337/NK2Tray
        public bool HandleEvent(MidiInMessageEventArgs e, MidiDevice device)
        {
            if (!IsHandling())
            {
                SetHandling(true);

                if (e.MidiEvent.CommandCode != commandCode)
                {
                    return(false);
                }

                int c;

                if (commandCode == MidiCommandCode.ControlChange)
                {
                    var me = (ControlChangeEvent)e.MidiEvent;

                    if (me.Channel != channel || me.ControllerValue != 127) // Only on correct channel and button-down (127)
                    {
                        return(false);
                    }

                    c = (int)me.Controller;
                }
                else if (commandCode == MidiCommandCode.NoteOn)
                {
                    var me = (NoteEvent)e.MidiEvent;

                    if (me.Channel != channel || me.Velocity != 127) // Only on correct channel and button-down (127)
                    {
                        return(false);
                    }

                    c = me.NoteNumber;
                }
                else
                {
                    return(false);
                }

                if (c == controller)
                {
                    switch (buttonType)
                    {
                    case ButtonType.MediaNext:
                        MediaTools.Next();
                        break;

                    case ButtonType.MediaPrevious:
                        MediaTools.Previous();
                        break;

                    case ButtonType.MediaStop:
                        MediaTools.Stop();
                        break;

                    case ButtonType.MediaPlay:
                        MediaTools.Play();
                        break;

                    case ButtonType.MediaRecord:
                        device.LightShow();
                        break;

                    default:
                        break;
                    }
                    return(true);
                }
            }

            return(false);
        }