BASS.NET API for the Un4seen BASS Audio Library

BassCdBASS_CD_GetID Method

BASS.NET API for the Un4seen BASS Audio Library
Retrieves identification info from the CD in a drive.

Namespace:  Un4seen.Bass.AddOn.Cd
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

public static string BASS_CD_GetID(
	int drive,
	BASSCDId id
)

Parameters

drive
Type: SystemInt32
The drive... 0 = the first drive.
id
Type: Un4seen.Bass.AddOn.CdBASSCDId
The identification to retrieve, one of the following (see BASSCDId):
BASS_CDID_UPCReturns the catalog number of the CD. The number uses UPC/EAN-code (BAR coding). This might not be available for all CDs.
BASS_CDID_CDDBProduces a CDDB identifier. This can be used to get details on the CD's contents from a CDDB server.
BASS_CDID_CDDB_QUERYSends a "query" command to the configured CDDB server (see BASS_CONFIG_CD_CDDB_SERVER) to get a list of matching entries for the CD's CDDB identifier. The contents of each entry can be retrieved via the BASS_CDID_CDDB_READ option.
BASS_CDID_CDDB_READ + entrySends a "read" command to the configured CDDB server (see BASS_CONFIG_CD_CDDB_SERVER) to get a database entry for the CD's CDDB identifier... 0 = first entry.
BASS_CDID_CDDB_READ_CACHEReturns the cached CDDB "read" command response, if there is one.
BASS_CDID_CDDB2Produces a CDDB2 identifier. This can be used to get details on the CD's contents from a CDDB2 server.
BASS_CDID_CDPLAYERProduces an identifier that can be used to lookup CD details in the CDPLAYER.INI file, located in the Windows directory.
BASS_CDID_MUSICBRAINZProduces an identifier that can be used to get details on the CD's contents from MusicBrainz.
BASS_CDID_ISRC + trackReturns the International Standard Recording Code of the track... 0 = first track. This might not be available for all CDs. Use BASS_CD_GetISRC(Int32, Int32) for a more convenient way to read the ISRC.

Return Value

Type: String
If an error occurs, is returned, use BASS_ErrorGetCode to get the error code. If successful, the identication info is returned.
Remarks

BASS_CDID_TEXT is not supported with this overload (see BASS_CD_GetIDText(Int32)).

The returned identification string will remain in memory until the next call to this function, when it will be overwritten by the next result. If you need to keep the contents of an identification string, you should copy it before calling this function again. Exceptions to that are BASS_CDID_CDDB_QUERY and BASS_CDID_CDDB_READ responses, which are cached separately per-drive. A BASS_CDID_CDDB_QUERY response remains cached while the same CD is in the drive, and a BASS_CDID_CDDB_READ response is cached until a different database entry is requested. The CDDB caches are also cleared whenever the CDDB server is changed via the BASS_CONFIG_CD_CDDB_SERVER config option.

When requesting CDDB identification, the string returned is what should be used in a CDDB query. The command sent to the CDDB server would be "cddb query <the returned string>". If successful, that results in a list of matching CDs, which the contents of can be requested using the "cddb read" command. That is what the BASS_CDID_CDDB_QUERY and BASS_CDID_CDDB_READ options do. See www.cddb.com and www.freedb.org for more information on using a CDDB server.

When requesting MUSICBRAINZ see www.musicbrainz.org for details.

ERROR CODEDescription
BASS_ERROR_DEVICEdrive is invalid.
BASS_ERROR_NOCDThere's no CD in the drive.
BASS_ERROR_ILLPARAMid is invalid.
BASS_ERROR_NOTAVAILThe CD does not have a UPC, ISRC or CD-TEXT info, or the BASS_CDID_CDDB_READ entry number is not valid.
BASS_ERROR_UNKNOWNSome other mystery problem!

Examples

Get a CDDB2 string from your first drive:
string cddb2 = BASS_CD_GetID(0, BASSCDId.BASS_CDID_CDDB2);
See Also

Reference