View Issue Details

IDProjectCategoryView StatusLast Update
0035750PackagesPackagespublic2019-06-22 10:35
Reporterjosh Assigned To 
Status newResolutionopen 
Product Version2.0.3 (SVN) 
Summary0035750: MidiPacket and MidiPacketList Size if differnece between carbon and cocoa.
DescriptionWHen using CoreMidi services cia MidiService; all works fine under Carbon; as the STructure of The Midi Packet matches the data stream.
When the same code is used when using 64bot cocoa; then the data being received into the packet is corrupted and invalid.

After checking the Size of the Packet Record is larger when running under cocoa.
The record is 268 bytes under carbon; but 272bytes when compiled for cocoa.

Sorroundinng the Definition with
{$packrecords 4}
Appears to solve the problem; but need to check for any knock on effects.

In MidiServices around line 565
{$packrecords 4}
MIDIPacket = record
        timeStamp: MIDITimeStamp;
        length: UInt16;
        data: packed array [0..255] of Byte;

and around midipacketlist
{$packrecords 4}
MIDIPacketList = record
        numPackets: UInt32;
        packet: array [0..0] of MIDIPacket;

Discussion here.,45782.0.html
TagsNo tags attached.
Fixed in Revision
Attached Files


Thaddy de Koning

2019-06-22 10:22

reporter   ~0116831

Last edited: 2019-06-22 10:35

View 5 revisions

Packrecords 4 is wrong as I already explained on the forum. Should be packrecords 1.
The issue at hand is simply a natural alignment issue if the pack size is wrong.
If the pack size is one, the records are equal on all platforms.
Midi is a streaming protocol and does not allow slack space.
Anything else is misinformation.

On the forum I provided a link to the official midi specification, just in case.

This is not a bug, but programmer error.

Issue History

Date Modified Username Field Change
2019-06-22 08:49 josh New Issue
2019-06-22 10:22 Thaddy de Koning Note Added: 0116831
2019-06-22 10:23 Thaddy de Koning Note Edited: 0116831 View Revisions
2019-06-22 10:24 Thaddy de Koning Note Edited: 0116831 View Revisions
2019-06-22 10:34 Thaddy de Koning Note Edited: 0116831 View Revisions
2019-06-22 10:35 Thaddy de Koning Note Edited: 0116831 View Revisions