GetMp3Tag2Data method |
|
Remarks
Retrieves the full binary contents of the ID3V2 tag for a MP3 sound. The overall tag size can be obtained through a call to the GetMp3Tag2Size method.
Details about the use of Tags and a sample of use of this method can be found on the How to read TAG information in sound files and How to retrieve basic TAG information from the sound loaded into a player tutorials.
Syntax
Return value
Sample
Below you can find a couple of samples that demonstrate how to load into a memory buffer the ID3V2 tag contents in Visual Basic.NET and Visual C# .
Visual Basic.NET
' declare the memory buffer (cannot be a local variable) Dim m_byteBuffer() As Byte
Private Sub ButtonReadTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' load sound and obtain info AudioDjStudio1.LoadSound(0, "c:\mp3_sounds\bb.mp3") AudioDjStudio1.ReadSoundInfo2(0)
' check if the ID3V2 tag is available If AudioDjStudio1.IsTagAvailable(0, AudioDjStudio.enumTagTypes.TAGTYPE_ID3V2) > 0 Then ' get the tag size in bytes Dim nTagLength As Int32 nTagLength = AudioDjStudio1.GetMp3Tag2Size(0)
' allocate the receiving buffer ReDim m_byteBuffer(nTagLength)
' read tag data AudioDjStudio1.GetMp3Tag2Data(0, m_byteBuffer, nTagLength)
' now you could parse tag data ' . ' . ' . End If End Sub
Visual C#.NET
// declare the memory buffer (cannot be a local variable) byte[] m_byteBuffer = null;
private void buttonReadTag_Click(object sender, System.EventArgs e) { // load sound and obtain info audioDjStudio1.LoadSound (0, "c:\\mysound.mp3"); audioDjStudio1.ReadSoundInfo2 (0);
// check if the ID3V2 tag is available if (audioDjStudio1.IsTagAvailable (0, enumTagTypes.TAGTYPE_ID3V2) > 0) { // get the tag size in bytes Int32 nTagLength = audioDjStudio1.GetMp3Tag2Size (0);
// allocate the receiving buffer m_byteBuffer = new byte[nTagLength];
// read tag data audioDjStudio1.GetMp3Tag2Data (0, m_byteBuffer, (Int32) nTagLength);
// now you could parse tag data // . // . // . } }
|