CFData equivalent and SInt32 (Xojo Array/List structures)

I have an external Mac library (CoreMIDI) which can return an array of SInt32 values as a CFData object.
Is there a way to organise this result into a Xojo array-like format so I can access the SInt32 values easily?

The property that can be an array is KMIDIPropertyConnectionUniqueID
The function which fetches it is MIDIObjectGetDataProperty (I think the MIDIObjectGetIntegerProperty could work as well).

Below is a C implementation (from here ), which uses pointer arithmetic to iterate through the values (pointed to by the ‘pid’ variable).

You could use MBS classes for MidiObject, e.g. MidiobjectMBS.

We also have a CFBinaryDataMBS class, which can do take the CFData reference and give you the data. That would just be an integer, I presume.

1 Like

Thank you, I think the MBS plugins will make things simpler.
Suppose I have a MIDIEndpointRef in UInt32 format on Xojo (in line with the specifications), is there a tool to convert the UInt32 into MIDIObjectMBS?

I can only find a conversion method for its parent class, for which it requires an Integer handle that I think my UInt32 would work for.

If you use the plugin, you should not need to deal with those conversion things.
We have functions to create/get endpoints.

CFData and it’s NSData equivalent are simply wrappers to a blob of memory. With a declare or two you can get a Xojo memory block and then simply loop through reading each Int32.

1 Like