TGC Codebase Backup



MP3 ID3v1 Tag Informations by Peace

11th Nov 2004 17:41
Summary

Get full information about a mp3 file



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Remstart
   ------------------------------------------------------------------
   Author:        Volker Stepprath of Testaware
   Project:       MP3 ID3v1 Tag Information
   Version:       0.00.001 ;D
   Language:      DarkBASIC Professional v1.057
   Description:   Get full information about a mp3 musicformat
   Date:          11. November 2004 / 23:12:07
   ------------------------------------------------------------------
   Hint 1:        Only use with ID3v1 Tag format
   Hint 2:        Use function as include in your own sources
   ------------------------------------------------------------------
Remend

dim xIDTagInfo$(6,1)       : Rem * Buffer for mp3 tag's

xFileName$="Prophecy.mp3"  : Rem * Name of musicfile (enter own file)

_MP3TagInfo(xFileName$)    : Rem * Generate informations to xIDTagInfo$()

for a=0 to 6
   print xIDTagInfo$(a,0),xIDTagInfo$(a,1)
next a

wait key

FUNCTION _MP3TagInfo(xFileName$)

   make memblock 1,128

   open to read 1,xFileName$
   skip bytes 1,file size(xFileName$)-128
   for a=0 to 127
      read byte 1,b
      write memblock byte 1,a,b
   next a
   close file 1

   xIDPos=3

   restore _ID3TagHdr

   for a=0 to 4

      read xIDTag$
      read xIDLen

      xIDNfo$=""

      for b=0 to xIDLen
         c=memblock byte(1,xIDPos)
         if c>0 then xIDNfo$=xIDNfo$+chr$(c)
         inc xIDPos
      next b

      xIDTagInfo$(a,0)=xIDTag$
      xIDTagInfo$(a,1)=xIDNfo$

   next a

   xIDTagInfo$(5,0)="Track: " : xIDTagInfo$(5,1)=str$(memblock byte(1,XIDPos))
   xIDTagInfo$(6,0)="Genre: " : xIDTagInfo$(6,1)=str$(memblock byte(1,XIDPos+1))

   delete memblock 1

   _ID3TagHdr:
   data "Title: "  ,29
   data "Artist: " ,29
   data "Album: "  ,29
   data "Year: "   , 3
   data "Comment: ",28

ENDFUNCTION