Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With MidiDumpEnabled=1, only outputs MIDI dump to HDMI, every 31/32 input events #728

Open
nhemsley opened this issue Oct 1, 2024 · 7 comments · May be fixed by #758
Open

With MidiDumpEnabled=1, only outputs MIDI dump to HDMI, every 31/32 input events #728

nhemsley opened this issue Oct 1, 2024 · 7 comments · May be fixed by #758

Comments

@nhemsley
Copy link

nhemsley commented Oct 1, 2024

Strange one. I think this worked a couple of days ago on the same build.

It appears the midi keypresses are being output to hdmi stdio every 31/32 presses.

Sound works fine though, no latency.

Any ideas? Reformat?

Running on Raspberry PI 4 B

Edit: This is MiniDexed_2024-09-08-6c56960. I will reformat and try with the latest.

Edit: Reformatted, tried with MiniDexed_2024-09-29-8c18e60. Still the same problem.

@nhemsley
Copy link
Author

nhemsley commented Oct 1, 2024

Probably caused by this:

smuehlst/circle-stdlib#35

@probonopd
Copy link
Owner

@smuehlst do you know what's going on? Thanks

@smuehlst
Copy link
Contributor

smuehlst commented Nov 16, 2024

@probonopd Could you explain what MIDI dump to HDMI actually does? Is it in any way related to stdio? The problem with smuehlst/circle-stdlib#35 was that stdout was no longer line-buffered.
@nhemsley Why do you think that smuehlst/circle-stdlib#35 is related to this problem?

@smuehlst
Copy link
Contributor

Further evidence that smuehlst/circle-stdlib#35 is unrelated:

@nhemsley
Copy link
Author

nhemsley commented Nov 16, 2024

@smuehlst, It is printf debugging of the midi codes coming in.

See here:

switch (nLength)
{
case 1:
if ( pMessage[0] != MIDI_TIMING_CLOCK
&& pMessage[0] != MIDI_ACTIVE_SENSING)
{
printf ("MIDI%u: %02X\n", nCable, (unsigned) pMessage[0]);
}
break;
case 2:
printf ("MIDI%u: %02X %02X\n", nCable,
(unsigned) pMessage[0], (unsigned) pMessage[1]);
break;
case 3:
printf ("MIDI%u: %02X %02X %02X\n", nCable,
(unsigned) pMessage[0], (unsigned) pMessage[1],
(unsigned) pMessage[2]);
break;
default:
switch(pMessage[0])
{
case MIDI_SYSTEM_EXCLUSIVE_BEGIN:
printf("MIDI%u: SysEx data length: [%d]:",nCable, uint16_t(nLength));
for (uint16_t i = 0; i < nLength; i++)
{
if((i % 16) == 0)
printf("\n%04d:",i);
printf(" 0x%02x",pMessage[i]);
}
printf("\n");
break;
default:
printf("MIDI%u: Unhandled MIDI event type %0x02x\n",nCable,pMessage[0]);
}
break;
}
}

putting a manual flush in the code linked fixes this, but it's perhaps better to upgrade to the version that fixes the line buffering bug.

@probonopd probonopd linked a pull request Nov 16, 2024 that will close this issue
@probonopd
Copy link
Owner

@nhemsley could you please test the build at #758 (comment)?
Thanks.

@nhemsley
Copy link
Author

nhemsley commented Nov 17, 2024

I gave that a try, but the PI goes into a reboot cycle. I'll build locally and try that in a few hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants