Allegro.pas version 4.2.2 released

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Allegro.pas version 4.2.2 released

Guillermo Martínez Jiménez
A new version of Allegro.pas was released yesterday. Allegro.pas is a
wrapper to allow Pascal compilers (such as Free Pascal) to use the
Allegro library in games or multimedia programs.

This version introduces new functions that allows to create, write and
read files using the LZSS compression algorithm.

Also I've created a public mailing list, but it needs some hours to be
active so be patient if you find an error page.

That's all today. Don't forget to download and test it.

http://allegro-pas.sourceforge.net/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Mac OSX API call

Bent Normann Olsen
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,
                        AudioStreamPacketDescription
*outPacketDescriptions,
                        SInt64                        inStartingPacket,
                        UInt32                        *ioNumPacket,
                        void                          *outBuffer)
AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER;


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,
Normann

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Mac OSX API call

Vincent Snijders
EarMaster - Bent Olsen schreef:

> Extern OSStatus
> AudioFileReadPackets (  AudioFileID                   inAudioFile,
>                         Boolean                       inUseCache,
>                         UInt32                        *outNumBytes,
>                         AudioStreamPacketDescription
> *outPacketDescriptions,
>                         SInt64                        inStartingPacket,
>                         UInt32                        *ioNumPacket,
>                         void                          *outBuffer)
> AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER;
>
>
> 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 think it should be (no var for the pointer):
function AudioFileReadPacket(inAudioFile: AudioFileID;
                              inUseCache: Boolean;
                              var outNumBytes: UInt32;
                              var outPacketDescriptions:
AudioStreamPacketDescription; //also tried Pointer
                              inStartingPacket: SInt64;
                              var ioNumPacket: UInt32;
                              outBuffer: Pointer): OSStatus; external
name '_AudioFileReadPackets'; mwpascal;

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Mac OSX API call

Marco van de Voort
In our previous episode, Vincent Snijders said:
>
> I think it should be (no var for the pointer):

... and if ObjC's concept of a boolean is the same as FPC's. Maybe longbool
?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: Mac OSX API call

Bent Normann Olsen
In reply to this post by Vincent Snijders
> -----Original Message-----
> From: [hidden email] [mailto:fpc-pascal-
> [hidden email]] On Behalf Of Vincent Snijders
> Sent: 29. august 2008 12:27
> To: FPC-Pascal users discussions
> Subject: Re: [fpc-pascal] Mac OSX API call
>
> I think it should be (no var for the pointer):

I tried, and same result.

Could a Mac OSX API call return -50 even though the types are correct, but
the contents of them are not what it expected?

I would assume -50 is only after a check for types in the parameter list,
and check is done before even calling the API.

Thanks,
Normann


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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: Mac OSX API call

Bent Normann Olsen
In reply to this post by Marco van de Voort
> -----Original Message-----
> From: [hidden email] [mailto:fpc-pascal-
> [hidden email]] On Behalf Of Marco van de Voort
> Sent: 29. august 2008 12:39
> To: FPC-Pascal users discussions
> Subject: Re: [fpc-pascal] Mac OSX API call
>
> In our previous episode, Vincent Snijders said:
> >
> > I think it should be (no var for the pointer):
>
> ... and if ObjC's concept of a boolean is the same as FPC's. Maybe
> longbool
> ?

I did thought the boolean type could have a different size, and I did make a
sizeof in Xcode and in FPC, and the both returned a size of 1. This don't
mean, there's an alignment issue?

Thanks,
Normann

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Mac OSX API call

Jonas Maebe-2
In reply to this post by Bent Normann Olsen

On 29 Aug 2008, at 11:58, EarMaster - Bent Olsen wrote:

>> From: [hidden email] [mailto:fpc-pascal-
>> [hidden email]] On Behalf Of Vincent Snijders
>> Sent: 29. august 2008 12:27
>> To: FPC-Pascal users discussions
>> Subject: Re: [fpc-pascal] Mac OSX API call
>>
>> I think it should be (no var for the pointer):
>
> I tried, and same result.
>
> Could a Mac OSX API call return -50 even though the types are  
> correct, but
> the contents of them are not what it expected?
>
> I would assume -50 is only after a check for types in the parameter  
> list,
> and check is done before even calling the API.

External functions have no idea what the declaration of the function  
in your source code is. A couple of the parameters your are passing  
(inAudioFile a outPacketDescriptions) however are pointers to opaque  
structures, and the called function is probably performing some sanity  
checks on those structures to ensure that they are valid.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Mac OSX API call

Jonas Maebe-2

On 29 Aug 2008, at 20:34, Jonas Maebe wrote:

>
> On 29 Aug 2008, at 11:58, EarMaster - Bent Olsen wrote:
>
>>> From: [hidden email] [mailto:fpc-pascal-
>>> [hidden email]] On Behalf Of Vincent Snijders
>>> Sent: 29. august 2008 12:27
>>> To: FPC-Pascal users discussions
>>> Subject: Re: [fpc-pascal] Mac OSX API call
>>>
>>> I think it should be (no var for the pointer):
>>
>> I tried, and same result.
>>
>> Could a Mac OSX API call return -50 even though the types are  
>> correct, but
>> the contents of them are not what it expected?
>>
>> I would assume -50 is only after a check for types in the parameter  
>> list,
>> and check is done before even calling the API.
>
> External functions have no idea what the declaration of the function  
> in your source code is. A couple of the parameters your are passing  
> (inAudioFile a outPacketDescriptions) however are pointers to opaque  
> structures, and the called function is probably performing some  
> sanity checks on those structures to ensure that they are valid.

Or alternatively, one of the other parameters could be invalid as well  
(either on their own or in combination with the other parame
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal