예제 #1
0
 private int NanoFind() //polling is mandatory, naudio does not implement a watcher
 {
     for (int device = 0; device < MidiIn.NumberOfDevices; device++)
     {
         if ((MidiIn.DeviceInfo(device).ProductId == 65535))//checks that nano slider is present
         {
             if (nanoID != device)
             {
                 nanoID = device;
                 try
                 {
                     midiIn = new MidiIn(nanoID);
                 }
                 catch (Exception e)
                 {
                     Debug.WriteLine(e.Message);
                     nanoSliderTray.midiAlredyInUse();
                 }
                 midiIn.MessageReceived        += MidiIn_MessageReceived;
                 SystemEvents.PowerModeChanged += OnPowerChange;
                 midiIn.Start();
                 nanoSliderTray.Ready();
                 if (settings.notifyStatus)
                 {
                     nanoSliderTray.ReadyBaloon();
                 }
             }
             showed = false;
             return(nanoID);
         }
     }
     nanoID = -1;
     showed = nanoSliderTray.NanoNotPresentMB(showed);
     return(nanoID);
 }
예제 #2
0
 private int NanoFind()
 {
     for (int device = 0; device < MidiIn.NumberOfDevices; device++)
     {
         if ((MidiIn.DeviceInfo(device).ProductId == 65535))//checks that nano slider is present
         {
             if (nanoID != device)
             {
                 nanoID = device;
                 midiIn = new MidiIn(nanoID);
                 midiIn.MessageReceived        += MidiIn_MessageReceived;
                 SystemEvents.PowerModeChanged += OnPowerChange;
                 midiIn.Start();
                 nanoSliderTray.Ready();
             }
             showed = false;
             return(nanoID);
         }
     }
     nanoID = -1;
     showed = nanoSliderTray.NanoNotPresentMB(showed);
     return(nanoID);
 }