Author Topic: MIDIPacket on Cocoa is returning invalid data.  (Read 1684 times)


  • Hero Member
  • *****
  • Posts: 806
MIDIPacket on Cocoa is returning invalid data.
« on: January 10, 2019, 12:33:53 am »

I am having an issue retrieving midi packets on cocoa, when the packet is triggered the actual packet contains invalid/null data.

The same routines on carbon are working fine.

I suspect I am doing something wrong for cocoa to work, but I have spent many hrs now trying to track it down, as the adding breakpoint in the callback routine is being Fired and processed, but the data coming in is wrong.

Attached sample small project, you need a midi device,  click the button list and connect first device, then press a button on midi device/controller to send a midi cc/pc message. On carbon all is ok, on cocoa invalid data.

Hope someone has cocoa and a midi controller that can test this, also the send midi data is not working on cocoa.

« Last Edit: January 10, 2019, 12:36:15 am by josh »
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.


  • Sr. Member
  • ****
  • Posts: 261
Re: MIDIPacket on Cocoa is returning invalid data.
« Reply #1 on: November 13, 2020, 11:51:34 pm »
Hi Josh, it's now late 2020, but in an attempt to gather as much possible info on accessing MIDI data in Lazarus under macOS, I've downloaded your project and am happy to lend my Delphi/Lazarus experience to solving this problem.

I'm especially interested because now that Lazarus 2.0.10 is here with Cocoa support built in without having to do custom builds, it makes it much easier to deal with.

I'm assuming, of course that the problem you mentioned is still a problem. I'd welcome an update on any progress you've made that I haven't yet seen.

Just to make sure that I've set the project up okay, when I run it I get a list of my MIDI controllers in the top listbox. I then select the entry for my Impulse MIDI keyboard. Am I right in thinking that I should then press a note key on the keyboard and something should happen in the app?

Looking forward to hearing from you!

macOS 10.14.6
Lazarus 2.0.10
FPC 3.2


TinyPortal © 2005-2018