Skip to content

Issue with Recording Object Not Capturing MIDI Events in DryWetMidi #287

Answered by melanchall
dblondin asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

Thanks for the info. Your code is pretty strange...

Let's look at the Start method. Do you see that your recording will always target last device of _inputDevices? The whole foreach loop can be replaced with

var inputDevice = _inputDevices.Last();
recording = new Recording(tempoMap, inputDevice);

and nothing will change.

And I suppose it's where your bug is placed. To check my assumption please change Start method to this:

void Start()
{
    tempoMap = TempoMap.Default;

    _inputDevices = InputDevice.GetAll().ToArray();

    foreach (var inputDevice in _inputDevices)
    {
        inputDevice.EventReceived += OnEventReceived;
        inputDevice.StartEventsListening();
        recor…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by melanchall
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Just question about the library
2 participants