[fpc-pascal] Mac OSX API call

EarMaster - Bent Olsen bent at earmaster.com
Fri Aug 29 12:20:10 CEST 2008

Hi all,

I've been playing with audio unit framework on Mac OSX 10.4, and trying to
make a sample from Xcode (PlayAudioFileLite) running on Lazarus 0.9.25/rev
15279 with FPC 2.2.0.

I'm nearly done, and I'm only getting an error -50 (error in user parameter
list) on the last API call from the callback process.

I don't have the sufficient experience with C/C++ vs. Pascal calling
conventions, but I've been lucky with other API calls, except for the last
one. I'm hoping one of you can help translate this call, which btw the way
works fine in Xcode - the sample is playing an audio file.

The API call is in the AudioFile.h:

Extern OSStatus
AudioFileReadPackets (  AudioFileID                   inAudioFile,
                        Boolean                       inUseCache,
                        UInt32                        *outNumBytes,
                        SInt64                        inStartingPacket,
                        UInt32                        *ioNumPacket,
                        void                          *outBuffer)

I've translated this to:

function AudioFileReadPacket(inAudioFile: AudioFileID;
                             inUseCache: Boolean;
                             var outNumBytes: UInt32;
                             var outPacketDescriptions:
AudioStreamPacketDescription; //also tried Pointer
                             inStartingPacket: SInt64;
                             var ioNumPacket: UInt32;
                             var outBuffer: Pointer): OSStatus; external
name '_AudioFileReadPackets'; mwpascal;

I've tried to change the types of parameters in various combination, but yet
it didn't give me a clue on which of the parameters is in a wrong type.

I'm sorry if this off topic, but I'll be happy if one of you can tell me
what I'm translating wrong.

Best regards,

More information about the fpc-pascal mailing list