MidiPacket and MidiPacketList Size if differnece between carbon and cocoa.
Original Reporter info from Mantis: josh
-
Reporter name: josh
Original Reporter info from Mantis: josh
- Reporter name: josh
Description:
WHen 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
{$push}
{$packrecords 4}
{$pop}
Appears to solve the problem; but need to check for any knock on effects.
In MidiServices around line 565
{$push}
{$packrecords 4}
MIDIPacket = record
timeStamp: MIDITimeStamp;
length: UInt16;
data: packed array [0..255] of Byte;
end;
{$pop}
and around midipacketlist
{$push}
{$packrecords 4}
MIDIPacketList = record
numPackets: UInt32;
packet: array [0..0] of MIDIPacket;
end;
{$pop}
Discussion here.
https://forum.lazarus.freepascal.org/index.php/topic,45782.0.html
Mantis conversion info:
- Mantis ID: 35750
- Version: 2.0.3 (SVN)
- Monitored by: » @bero1985 (Benjamin Rosseaux)