0
0

This is the code (in vb) I use to get the ID3-tags:

[code:185mrr25]Public Sub GetID3(File As String)
Dim TypeVal As Long, DataVal As Long, NameVal As String, LenVal As Long, num As Long
Call FSOUND_Stream_GetNumTagFields(streamHandle, num)
For num = 0 To num – 1
Call FSOUND_Stream_GetTagField(streamHandle, num, TypeVal, NameVal, DataVal, LenVal)
MsgBox num & vbCrLf & TypeVal & vbCrLf & NameVal & vbCrLf & GetStringFromPointer(DataVal)
Next
End Sub[/code:185mrr25]

It crashes on most files, and that seems to be the case with ID3v2 tags. The first tags will be read, but it crashes when an iD3v2 tag comes around. When only ID3v1 is present, all is ok.

So the obvious quiestion is what to do about the error (The error itself is “The memory could not be read” on win2k)

Then something else…
It would be very nice if modifieing the tags is possible…
Can images from a ID3v2 tag be read?

I’ve searched quite a lot of sites and forums for a decent tag-reader but still haven’t got it working perfect… Wouldn’t have a problem with it if fmod could do it…[code:185mrr25][/code:185mrr25]

  • You must to post comments
0
0

I see your problem, what you did was retrieve the number of tag fields as num and then you used it again in your for statement, that is not right, try this:
[code:3rhcd8yp]
Public Sub GetID3(File As String)
Dim TypeVal As Long, DataVal As Long, NameVal As String, LenVal As Long, num As Long, x as long
Call FSOUND_Stream_GetNumTagFields(streamHandle, num)
For x = 0 To num – 1
Call FSOUND_Stream_GetTagField(streamHandle, x, TypeVal, NameVal, DataVal, LenVal)
MsgBox num & vbCrLf & TypeVal & vbCrLf & NameVal & vbCrLf & GetStringFromPointer(DataVal)
Next
End Sub[/code:3rhcd8yp]

  • You must to post comments
0
0

We won’t be supporting tag writing and yes, you can access images in an ID3v2 tag. FMOD places no limits on what tag fields you can or can’t read – if it’s in the tag, you’ll be able to access it with FMOD.

  • You must to post comments
0
0

I was quite sure my previous code was OK, and this gives exactly the same problem. I tested on a mp3 with only a ID3v1 tag, and it didn’t crash. Other mp3’s still crash I’m afraid. Are there any others that have succeeded in using the tag-function of fmod?
[code:2t80ui3p]Public Sub GetID3(File As String)
Dim TypeVal As Long, DataVal As Long, NameVal As String, LenVal As Long, num As Long, X As Integer
X = FSOUND_Stream_GetNumTagFields(streamHandle, num)
If X Then
For X = 0 To num – 1
Call FSOUND_Stream_GetTagField(streamHandle, X, TypeVal, NameVal, DataVal, LenVal)
MsgBox X & " – " & TypeVal & vbCrLf & GetStringFromPointer(DataVal) & vbCrLf & Trim(NameVal)
Next
End If
End Sub[/code:2t80ui3p]

  • You must to post comments
0
0

http://www.id3.org/

FMOD will give you the tag fields as they appear in the file. It won’t parse them so it’s up to you, the application writer, to work out how to display or use them. Check out the spec – some tag fields are text but they also have a “text encoding” byte in front of the actual string. It’s up to you to handle that. Read the spec.

[quote:h9ltqhoe] Are there any others that have succeeded in using the tag-function of fmod? [/quote:h9ltqhoe]

Yes, me.

  • You must to post comments
0
0

I don’t mean to be a pain in the ass…
But it still doesn’t work. I get the error when vb calls fmod.dll. So the error happends before I can do anything with the data. The error comletely crashes VB. Either I call the dll wrong, or there is an error in fmod.

  • You must to post comments
0
0

I haven’t actually tried using these functions in vb yet, but I think there is something wrong with the way the functions are called.

The declaration currently is (in fmod.bas) :
Public Declare Function FSOUND_Stream_GetTagField Lib “fmod.dll” Alias “_FSOUND_Stream_GetTagField@24” (ByVal stream As Long, ByVal Num As Long, ByRef tagtype As Long, ByRef name As String, ByRef Value As Long, ByRef length As Long) As Byte

stream, num and tagtype are correct I think.
I think name should be ‘ByRef namePtr as Long’ because the specs say char **name, which means the address that should be passed is a pointer and not a string.
You can then use GetStringFromPointer on namePtr to retreive the string.
value is the same, so that is correct, and length is correct as well.

With these changes, the call to GetTagField should work withouth crashing I think.
After that, retreiving the name can be done with GetStringFromPointer, but I don’t know if you can get the value with GetStringFromPointer, since it might not be a string.

You might have to add a function
[code:23rwvrn4]
Public Function GetStringFromPointer2(ByVal ptr as Long, ByVal length as Long) As String
Dim tmpBArr() As Byte
Dim i as Long
Redim tmpBArr(length)
CopyMemory tmpBArr(0), ByVal ptr, length
For i = 0 to length – 1
GetStringFromPointer2 = GetStringFromPointer2 & Chr$(tmpBArr(i))
Next
End Function
[/code:23rwvrn4]
It might not be necessary, and I haven’t tested this function, but I think this is what you’ll need.

  • You must to post comments
0
0

Thanx, that ‘ll keep me busy for a while

You were right…
So andrew, Please edit your fmod.bas as well…

And now to figure out how to get the picture displayed…

And btw, I changed the function, it didn’t return any data from ID3v2 tags:
[code:j8qnoyik]Public Function GetStringFromPointer2(ByVal ptr As Long, ByVal length As Long) As String
Dim tmpBArr() As Byte
Dim i As Long
ReDim tmpBArr(length)
CopyMemory tmpBArr(0), ByVal ptr, length
If tmpBArr(0) = 0 Then i = 1
For i = i To length – 1
GetStringFromPointer2 = GetStringFromPointer2 & Chr$(tmpBArr(i))
Next
End Function[/code:j8qnoyik]

  • You must to post comments
0
0

ByRef does mean it will pass a pointer to a String, but it is a pointer directly to the String data, and not to a pointer pointing to the data.

  • You must to post comments
0
0

Using Delphi for this isn’t any better.

fmod.pas also contains a bug in FSOUND_Stream_GetTagField.
[code:17lf1x7k]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:17lf1x7k]
Should be:[code:17lf1x7k]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:17lf1x7k]
So both TagType and Length have to be pointers they can be accessed in Delphi like this:[code:17lf1x7k]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:17lf1x7k]
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.

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.