0
0

I’ve been trying to access the Table Of Contents of a CD. After many failed attempts I noticed that the length returned by FSOUND_Stream_FindTagField was greater than the length of the FSOUND_TOC_TAG struct. So then I reallized that the struct was written incorrectly. Here is the code in the current module:
[code:79jnb8ti]
Type FSOUND_TOC_TAG
tagname(4) As Byte
numtracks As Long
min(100) As Long
sec(100) As Long
frame(100) As Long
End Type
[/code:79jnb8ti]
But, because VB arrays start at 0 the code should be:
[code:79jnb8ti]
Type FSOUND_TOC_TAG
tagname(3) As Byte
numtracks As Long
min(99) As Long
sec(99) As Long
frame(99) As Long
End Type
[/code:79jnb8ti]
After changing the struct the length in bytes matched up with the length returned by FSOUND_Stream_FindTagField. But, now I have another problem that isnt making sense to me. Here is my code:
[code:79jnb8ti]
dim TOC as FSOUND_TOC_TAG
FSOUND_Stream_FindTagField(strm, 0, "CD_TOC", pValue, pLength)
Call CopyMemory(TOC, ByVal pValue, pLength)
[/code:79jnb8ti]
Now, this code fills up the TOC struct correctly, except numtracks is double what it should be. For example, a cd with 13 tracks returns 26 in the table of contents. And I’ve tested several CD’s and the same result for each CD, always double the ammount of tracks. I hope someone can help me with this because I’m stumped.

  • You must to post comments
0
0

I don’t really see anything wrong either. I’ve looked both declarations up in fmod.h and fmod.bas and everything seems to be correct.
The min,sec and frame arrays give correct values up to the correct number of tracks?

Exactly double might mean the data is bit-shifted to the left with 1 bit, but I don’t see why that would happen, since ‘Long’ should match to ‘int’

  • You must to post comments
0
0

Yes, that’s correct, in visual basic you specify the upper bound of the array rather than the number of elements.

  • You must to post comments
0
0

[quote="Adion":1bbk09bz]
The min,sec and frame arrays give correct values up to the correct number of tracks?
[/quote:1bbk09bz]
Yes, but in the min, sec, and frame arrays it has the values double as well. For example, a CD with 12 tracks on it will fill each array with 24 values. The first 12 values are correct, and the last 12 values are correct. After the 12th item in each array it starts over with the 1st item and fills it correctly until the 24th array index. So, there is double the ammount of information.

[quote="Adion":1bbk09bz]
Exactly double might mean the data is bit-shifted to the left with 1 bit, but I don’t see why that would happen, since ‘Long’ should match to ‘int’
[/quote:1bbk09bz]
So, would I need to bitshift it to the right by 1 bit?

[quote="Brett":1bbk09bz]
ok i’ve updated the zip and re-uploaded it then with that change.
[/quote:1bbk09bz]
Thanks Brett!

  • You must to post comments
0
0

Bit-shifting to the right would just mean dividing by 2, and I guess you figured out yourself that you could do that :)

But since the array is actually filled up to numtracks I don’t think it’s a mistake in reading it in anymore.
So maybe it is a problem with fmod?

  • You must to post comments
0
0

[quote="Adion":1tkzi13h]Bit-shifting to the right would just mean dividing by 2, and I guess you figured out yourself that you could do that :)

But since the array is actually filled up to numtracks I don’t think it’s a mistake in reading it in anymore.
So maybe it is a problem with fmod?[/quote:1tkzi13h]
That’s what I’m starting to think. But, a question that I have is why it would work perfectly in C/C++ but have this problem in VB???

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.