Closed dverriere closed 3 years ago
Hi,
Thanks for using the library. Unfortunately my unit tests don't show any issues with InputDevice
. Please show your code, how you get an instance of InputDevice
and get events from it.
I had yje idea to use the demo code you give . And ... i have the same problem. As you can see i m using a MPK249 from Akai.
using System; using Melanchall.DryWetMidi.Devices;
namespace TestInput { class Program { private static IInputDevice _inputDevice;
static void Main(string[] args)
{
_inputDevice = InputDevice.GetByName("MPK249");
_inputDevice.EventReceived += OnEventReceived;
_inputDevice.StartEventsListening();
Console.WriteLine("Input device is listening for events. Press any key to exit...");
Console.ReadKey();
(_inputDevice as IDisposable)?.Dispose();
}
private static void OnEventReceived(object sender, MidiEventReceivedEventArgs e)
{
var midiDevice = (MidiDevice)sender;
Console.WriteLine($"Event received from '{midiDevice.Name}' at {DateTime.Now}: {e.Event}");
}
}
}
Ok my investigations showed me, that i have to wait for some delay (it seems me one second), to begin to hit a piano key. That delay disapear when the program is in memory and i rerun it. So my last question is : is there any solution to know that the api is ready ?
I'm pretty sure it's related with your device (Akai MPK249). DryWetMIDI API (StartEventsListening
) does all required actions. After method execution finished you can work with a device and receive events from it. But I suppose there are some special things about Akai keyboard or maybe how Windows works with this device. Maybe you need to install a driver for the keyboard?
Also I found similar issue on the web: https://forum.image-line.com/viewtopic.php?t=147266. It looks like users have missing first note with different Akai hardware.
@dverriere Can the issue be closed or you have something to add?
Ok you cant do anything for that poblem. Thank you for the good job !
Im trying to use InputDevice, and i observed taht the first event NoteOn is not received. I only get the NoteOff event. After that, all events are correctly received. Any idea ?
C# Vs 2019, Windows 10
Ps : thank you for all the job yoou do for us !