I’m trying to get the table of contents for a CD but whenever I call the function to retrieve the TOC I get all of the information except for the number of tracks. I get “TOC” as the name, and all of the offsets etc. But I dont get the number of tracks. here is my code:
private Toc as FSOUND_TOC_TAG
Call FSOUND_Stream_FindTagField(strm, 0, "CD_TOC", TOCptr, 0)
Call CopyMemory(Toc, ByVal TOCptr, Len(Toc))
Does anyone know what the problem is?
- Paranoid_Android asked 14 years ago
I just dont understand how to get the table of contents of a cd. I know Im doing something wrong. Does anybody know whats wrong with my code?
Public Function cddb_discid(ByVal strm As Long) As Long
Dim i As Long, t As Long, n As Long, TOCptr As Long Dim TOC As FSOUND_TOC_TAG Call FSOUND_Stream_FindTagField(strm, 0, "CD_TOC", TOCptr&, 0) Call CopyMemory(TOC, ByVal TOCptr, Len(TOC)) For i = 0 To TOC.numtracks - 1 n = n + cddb_sum((TOC.min(i) * 60) + TOC.sec(i)) Next i t = ((TOC.min(TOC.numtracks) * 60) + TOC.sec(TOC.numtracks)) - ((TOC.min(0) * 60) + TOC.sec(0)) cddb_discid = LShift((n Mod 255), 24) Or LShift(t, 8) Or TOC.numtracks
It isnt filling my struct with correct information. But it does give the tag name of “TOC”.
I looked at the C CDDA example but because VB doesnt have pointer support I have to use copymemory, which is the reason why its not being copied into the FSOUND_TOC_TAG structure properly. Does anyone know how to do this properly?
Please login first to submit.