0
0

I think fmod.pas contains a bug in FSOUND_Stream_GetTagField.
[code:2db6py36]function FSOUND_Stream_GetTagField(Stream: PFSoundStream; Num: Integer; var TagType: TFSoundTagFieldType; var Name: PChar; var Value: Pointer; Length: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF};[/code:2db6py36]
Should be:[code:2db6py36]function FSOUND_Stream_GetTagField(Stream: PFSoundStream; Num: Integer; var TagType: Pointer; var Name: PChar; var Value: Pointer; Length: PInteger): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF};[/code:2db6py36]
So both TagType and Length have to be pointers they can be accessed in Delphi like this:[code:2db6py36]var
PLength: PInteger;
PTagType: Pointer;
... other needed vars to use GetTagField ...

begin
... GetTagField ...

if TFSoundTagFieldType(PTagType) = FSOUND_TAGFIELD_VORBISCOMMENT then
Edit1.Text := ‘Tag type: VORBISCOMMENT’;

Edit2.Text := IntToStr(PLen^);
end;[/code:2db6py36]
I noticed something else, using the above code will give an access violation by fmod.dll.
UNLESS you assign a value to PLength before calling FSOUND_Stream_GetTagField.

So it seems like fmod.dll expects PLength pointing to a value.

I previously posted this message here:
http://52.88.2.202/forum/viewtopic.php?t=2162
I think that topic is inactive, And am sorry if I am wrong here.

  • You must to post comments
0
0

The C declaration for FSOUND_Stream_GetTagField is
[code:10qpwysc]signed char FSOUND_Stream_GetTagField(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length);[/code:10qpwysc]

The Delphi declaration is
[code:10qpwysc]function FSOUND_Stream_GetTagField(Stream: PFSoundStream; Num: Integer; var TagType: TFSoundTagFieldType; var Name: PChar; var Value: Pointer; Length: Integer): ByteBool;[/code:10qpwysc]

Looking at it closely, there is an error here. The Length parameter in the Delphi declaration needs a ‘var’ keyword before it, so it becomes
[code:10qpwysc]function FSOUND_Stream_GetTagField(Stream: PFSoundStream; Num: Integer; var TagType: TFSoundTagFieldType; var Name: PChar; var Value: Pointer; var Length: Integer): ByteBool;[/code:10qpwysc]

Now it is equivalent to the C declaration. The other parameters are correct.

  • You must to post comments
0
0

I do not understand why he claims that the tag type parameter should be [b:399x4gn8]var TagType: Pointer[/b:399x4gn8] because that is equivalent to [b:399x4gn8]void **type[/b:399x4gn8]. My declaration of [b:399x4gn8]var TagType: TFSoundTagFieldType[/b:399x4gn8] is functionally equivalent to [b:399x4gn8]int *type[/b:399x4gn8].

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.