Solved

How to Generate CDDB DISC ID in VB5

Posted on 1997-08-14
9
431 Views
Last Modified: 2012-06-27
To generate a CDDB Disc ID, I need to sum up the starting offset of each track. How do I get the Offset from the start of the CD for each track? For example, Track 3 may start from 20:45 from the start of the CD.

Also I need to add up the length of each tracks as described in the CDDB doc. Can I just use this?

lRes = mmSend("status cd_1 length track " & _  Format$(iTrackNumber))

If u know how to generate the disc ID in VB, please give me the code
0
Comment
Question by:fury
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 2

Expert Comment

by:msiman
ID: 1430808
check this up:
How to Get or Create a Unique Audio CD Volume Label

Article ID: Q112768

---------------------------------------------------------------------
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for
  Windows, version 3.0
---------------------------------------------------------------------

SUMMARY
=======

Part of the Multimedia standard calls for all Audio CDs to have a unique
volume identifier following a specific (suggested) format of:

   XXXX-#####

XXXX is the alpha vendor code, and ##### is a five-digit unique number

for the CD. This information is stored on the inner track of the CD and
is also usually etched on the inner edge of the inside ring of the CD.
Not all manufacturers have a unique volume identifier, nor do all follow
this standard volume label format. Although this is a standard, at this
time the MultiMedia Application Programming Interface (API) does not have
a built-in function that will retrieve this information. This article
shows you how to retrieve or create this information programmatically.


MORE INFORMATION
================

In order to retrieve the unique volume identifier from the CD, you need to
call MSCDEX directly. The information on how to do this is contained within
the MSCDEX 2.20 specification.

Because some manufacturers aren't including this unique identifier on their
CDs, Microsoft recommends that you create a unique volume identifying
number based on the track information already included on the CD. The
following example shows you how.


Step-by-Step Example
--------------------

This example shows a method for creating a unique number to identify an
audio CD based on track information. The purpose of this number is to make
it possible for Visual Basic programs to recognize a loaded CD and retrieve
information from it.

1. Start a new project in Visual Basic. Form1 is created by default.

2. Add a text box (Text1) and an MCI control (MMControl1) to Form1.

3. Place the following code in the Form_Load event of Form1:


   Sub Form_Load ()
      Dim DiskID As Long
      Dim Track As Integer
      ' Initialize CD:
      mmcontrol1.DeviceType = "CDAudio"
      mmcontrol1.Command = "open"
      ' Make unique number based on tracks and tracklength:
      DiskID = mmcontrol1.Tracks
      For Track = 1 To mmcontrol1.Tracks
         mmcontrol1.Track = Track
         DiskID = DiskID + mmcontrol1.TrackLength  ' Add 4-byte TrackLength
         DiskID = DiskID + mmcontrol1.Length       ' Add 4-byte CD Length

      Next Track
      ' Set text to unique value:
      Text1.Text = DiskID
   End Sub

4. Load a CD.

5. Start the program, or press the F5 key.

6. The Text1 box should have a unique identifying number for the CD.

NOTE: Before starting the program, a CD must be inserted and ready to play.
Therefore, you should add code to detect when a CD has been inserted and
then run the above code.

REFERENCES
==========

For more information, see the MultiMedia Programmer's Reference, CDAudio


Additional reference words: 3.00
KBCategory: kbprg kbcode
KBSubcategory: PrgOther

Copyright (c) Microsoft Corporation. All rights reserved.
0
 

Author Comment

by:fury
ID: 1430809
This is not what I asked. I am not asking how to get a Disc ID, but a CDDB ID.

0
 
LVL 2

Expert Comment

by:msiman
ID: 1430810
check this out:
How to Get or Create a Unique Audio CD Volume Label

Article ID: Q112768

---------------------------------------------------------------------
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for
  Windows, version 3.0
---------------------------------------------------------------------

SUMMARY
=======

Part of the Multimedia standard calls for all Audio CDs to have a unique
volume identifier following a specific (suggested) format of:

   XXXX-#####

XXXX is the alpha vendor code, and ##### is a five-digit unique number

for the CD. This information is stored on the inner track of the CD and
is also usually etched on the inner edge of the inside ring of the CD.
Not all manufacturers have a unique volume identifier, nor do all follow
this standard volume label format. Although this is a standard, at this
time the MultiMedia Application Programming Interface (API) does not have
a built-in function that will retrieve this information. This article
shows you how to retrieve or create this information programmatically.


MORE INFORMATION
================

In order to retrieve the unique volume identifier from the CD, you need to
call MSCDEX directly. The information on how to do this is contained within
the MSCDEX 2.20 specification.

Because some manufacturers aren't including this unique identifier on their
CDs, Microsoft recommends that you create a unique volume identifying
number based on the track information already included on the CD. The
following example shows you how.


Step-by-Step Example
--------------------

This example shows a method for creating a unique number to identify an
audio CD based on track information. The purpose of this number is to make
it possible for Visual Basic programs to recognize a loaded CD and retrieve
information from it.

1. Start a new project in Visual Basic. Form1 is created by default.

2. Add a text box (Text1) and an MCI control (MMControl1) to Form1.

3. Place the following code in the Form_Load event of Form1:


   Sub Form_Load ()
      Dim DiskID As Long
      Dim Track As Integer
      ' Initialize CD:
      mmcontrol1.DeviceType = "CDAudio"
      mmcontrol1.Command = "open"
      ' Make unique number based on tracks and tracklength:
      DiskID = mmcontrol1.Tracks
      For Track = 1 To mmcontrol1.Tracks
         mmcontrol1.Track = Track
         DiskID = DiskID + mmcontrol1.TrackLength  ' Add 4-byte TrackLength
         DiskID = DiskID + mmcontrol1.Length       ' Add 4-byte CD Length

      Next Track
      ' Set text to unique value:
      Text1.Text = DiskID
   End Sub

4. Load a CD.

5. Start the program, or press the F5 key.

6. The Text1 box should have a unique identifying number for the CD.

NOTE: Before starting the program, a CD must be inserted and ready to play.
Therefore, you should add code to detect when a CD has been inserted and
then run the above code.

REFERENCES
==========

For more information, see the MultiMedia Programmer's Reference, CDAudio


Additional reference words: 3.00
KBCategory: kbprg kbcode
KBSubcategory: PrgOther

Copyright (c) Microsoft Corporation. All rights reserved.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:fury
ID: 1430811
Again, I am not asking how to creat a disc ID.
Its CDDB ok? CDDB from Ti Kan. CDDB Disc ID. CDDB CDDB man, not a general disc ID.

0
 
LVL 2

Expert Comment

by:msiman
ID: 1430812
sorry i posted it twice... my mistake...
sorry
0
 
LVL 2

Accepted Solution

by:
msiman earned 200 total points
ID: 1430813
0
 

Author Comment

by:fury
ID: 1430814
I read already...however...VB does not support UNSIGNED 32 bit long which is what the id requires.

I tried the use Variant, but it won't work
I tried to do:

n = (n Mod &HFF) * (2 ^ 24) 'shift 24 bit according to CDDB doc
tlength = tlength * 2 ^ 8 'shift 8 bit
id = n Or tlength Or nt

(at that time, n=3623828656, tlength=981392m nt=16
broke on the last line , cannot generate id. All variables are variants.



0
 

Author Comment

by:fury
ID: 1430815
I thought about writing a dll to do he mathematics part, however, i don't know how to write a dll using vc++4
0
 
LVL 2

Expert Comment

by:msiman
ID: 1430816
i'll check this out
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 19 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question