Playing around with my new MacBook, I found a strange issue with BASS_ChannelGetPosition on OS X using Free Pascal. Take a look at the following minimal example:
BASS_Init(1, 44100, 0, 0, nil);
chan := BASS_StreamCreateFile(false, PChar('test.mp3'), 0, 0, BASS_SAMPLE_FLOAT);
p := BASS_ChannelGetPosition(chan, BASS_POS_BYTE);
This code works fine. However, when I omit the first "readln" and query the current position directly after the call to BASS_ChannelPlay, there's an invalid floating point exception inside BASS_ChannelGetPosition, obviously caused by a nested call to BASS_ChannelIsSliding:
Program received signal EXC_ARITHMETIC, Arithmetic exception.
0x00087770 in BASS_ChannelIsSliding ()
#0 0x00087770 in BASS_ChannelIsSliding ()
#1 0x00000000 in ?? ()
Remember, this only happens when you query the position right after the beginning of the playback. At any later point, it's ok.
The code is compiled with fpc in Delphi mode (-Mdelphi) using the bass.pas file from the BASS for Linux distribution (because of the calling conventions). BASS_ChannelGetPosition is declared as cdecl, I guess this is correct for OS X. The libbass.dylib is the one from the current release, downloaded from un4seen just yesterday.
Interestingly, when I rewrite the example code in C and compile it with gcc on the same machine, it works just fine.
Does anybody have a clue what's going on here?