Exemple #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);
        }
Exemple #2
0
 public Fader(MidiDevice midiDevice, int faderNum, FaderDef _faderDef)
 {
     parent      = midiDevice;
     midiOut     = midiDevice.midiOut;
     faderNumber = faderNum;
     faderDef    = _faderDef;
 }
Exemple #3
0
 public Fader(MidiDevice midiDevice, int faderNum)
 {
     parent      = midiDevice;
     midiOut     = midiDevice.midiOut;
     faderNumber = faderNum;
     faderDef    = parent.DefaultFaderDef;
 }
Exemple #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;
        }
Exemple #5
0
        private Boolean SetupDevice()
        {
            audioDevices = new AudioDevice();

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

            audioDevices.midiDevice = midiDevice;

            return(midiDevice.Found);
        }
Exemple #6
0
        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);
        }