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.
Syntax
|
[Visual Basic]
Public Function GetMp3Tag2Data (
nPlayerIndex as Int16,
pBuffer() as Byte,
nBufferLength as Int32
|
|
[C#]
Int16 nPlayerIndex,
byte [] pBuffer,
Int32 nBufferLength
);
|
|
[C++]
Int16 nPlayerIndex,
unsigned char __gc[] pBuffer,
Int32 nBufferLength
);
|
|
Parameter
|
Description
|
|
|
|
|
nPlayerIndex
|
Number representing the zero-based index of the involved player
|
|
pBuffer
|
Destination buffer
|
|
nBufferLen
|
Length in bytes of the buffer
|
Return value
|
Value
|
Meaning
|
|
|
|
|
Negative value
|
An error occurred (see the LastError property for further error details)
|
|
enumErrorCodes.NOERROR (0)
|
The method call was successful.
|
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.ReadSoundInfo(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.ReadSoundInfo (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
// .
// .
// .
}
}