iUltimateLP / launchpad-dot-net

:sound: A lightweight C# Launchpad extension library, for easy handling.
12 stars 6 forks source link

Interface.getConnectedLaunchpads Doesn't work ! #1

Open vukast opened 7 years ago

vukast commented 7 years ago

Here is my code (Program.cs) : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Midi;

using LaunchpadNET;

namespace LaunchPad { class Program { static void Main(string[] args) { Interface lint = new Interface();

        lint.connect(Interface.getConnectedLaunchpads()[0]); //Connects with your Launchpad
        lint.setLED(5, 5, 127); //Sets the LED at position X=5;Y=5 to orange.
        Console.Write("Test");
        Console.ReadKey();

    }
}

}

Electronics commented 6 years ago

+1

Midi.DeviceException: Error in the application.
   at Midi.InputDevice.CheckReturnCode(MMRESULT rc)
   at Midi.InputDevice.Open()
   at LaunchpadNET.Interface.connect(LaunchpadDevice device) in ...\Projects\launchpad-dot-net-master\launchpad-dot-net\Interface.cs:line 330
Exception thrown: 'Midi.DeviceException' in Midi.dll
Exception thrown: 'System.InvalidOperationException' in Midi.dll
Electronics commented 6 years ago

It seems to occur from the OutputDevice.Open method, bizarely the error getting thrown from within the Midi.OutputDevice.CheckReturnCode method. image

Stacktrace:

   at Midi.OutputDevice.CheckReturnCode(MMRESULT rc)
   at Midi.OutputDevice.Open()
   at LaunchpadNET.Interface.connect(LaunchpadDevice device) in C:\Users\Laurie\documents\visual studio 2015\Projects\launchpad-dot-net-master\launchpad-dot-net\Interface.cs:line 343
   at Padsys.Padsys.findAndConnectToLaunchpad() in C:\Users\Laurie\documents\visual studio 2015\Projects\Padsys\Padsys\Padsys.cs:line 65
   at Padsys.Padsys.initLaunchpad(Action completion) in C:\Users\Laurie\documents\visual studio 2015\Projects\Padsys\Padsys\Padsys.cs:line 43
   at Padsys.Padsys..ctor() in C:\Users\Laurie\documents\visual studio 2015\Projects\Padsys\Padsys\Padsys.cs:line 37
   at Padsys.Program.Main() in C:\Users\Laurie\documents\visual studio 2015\Projects\Padsys\Padsys\Program.cs:line 16
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

EDIT: This only happens when connecting to the launchpad on start of the application, if there's some delay i.e. due to waiting for a launchpad to be connected or w/e, it's fine.