0
0

How can I add some informations in a mp3 file?
The informations are title, artist, album, year, ..
It’s possible with the fmod library ?
If it is no possible, how can I just return the current information ?

  • You must to post comments
0
0

you can’t add information to a mp3 with fmod you can only read it
if you only want to read the info you can use the function FSOUND_Stream_GetTagField (see the docs)

you can find more info on this site (about ID3v1 and ID3v2)
[url:2hib87m0]http://www.id3.com[/url:2hib87m0]

  • You must to post comments
0
0

signed char F_API FSOUND_Stream_GetTagField(
FSOUND_STREAM *stream,
int num,
int *type,
char **name,
void **value,
int *length
);

“void **value” <– I don’t understand how I can return a chain of character with a pointer of a void… in samples\fmod this a pointer to a char. If I use a pointer to a char in the function, I have got a error.. How can I return the value ?
thanks for your help.

  • You must to post comments
0
0

Yes, but how can I read the information if it is a void ?
I use borland builder c++.

  • You must to post comments
0
0

Cast the void * to whatever you need. If it’s a text tag – i.e. an ID3V2 TIT2 tag – than cast it to a char *, add 1 to skip the encoding byte and there you have a pointer to the song title. We do it this way because not all tag fields are plain text – they may be images, any sort of data, so you have to cast your pointer depending on its type.

Check out [url:2x1d42an]http://www.id3.org[/url:2x1d42an] and [url:2x1d42an]http://www.xiph.org[/url:2x1d42an] to see detailed specs on all standard ID3 and Vorbis Comment tag fields.

  • You must to post comments
0
0

I have got that:

int type,length;
char *name;
void *value;
if (FSOUND_Stream_GetTagField(song,0,&type, &name, &value, &length))
{
Label1->Caption=name;
//here I want post le title of my song
}

How I must make ?

  • You must to post comments
0
0

This is my function to get the title of MP3’s, WMA’s and Ogg files.

String TfrmMain::getTitle(String file)
{
// Open a temporary stream to that file
FSOUND_STREAM *tempHan = FSOUND_Stream_Open(file.c_str(), NULL, 0, 0);
String songName = “”, hold;

    if (tempHan != NULL)
    {
            char *name, *value;
            int  type, length, numTags;

// Make sure there are tags
FSOUND_Stream_GetNumTagFields(tempHan, &numTags);
if (numTags != 0)
{
// Find the file’s tag type
FSOUND_Stream_GetTagField(tempHan , 0, &type, &name, (void **)&value, &length);
// Find the artists tag
if ((type == FSOUND_TAGFIELD_ID3V1) || (type == FSOUND_TAGFIELD_ID3V2))
{
// Try to load the ID3V2 tag information first
if (FSOUND_Stream_FindTagField(tempHan , FSOUND_TAGFIELD_ID3V2, “TPE1”, (void **)&value, &length))
{
strncpy(value, value + 1, length – 1);
hold = (String)value;
hold = hold.SubString(0, hold.Length() – 1);
if (isascii(hold[1]))
songName = hold.SubString(0, length) + ” – “;
else
songName = “”;
}
else if (FSOUND_Stream_FindTagField(tempHan , FSOUND_TAGFIELD_ID3V1, “ARTIST”, (void **)&value, &length))
{
hold = (String)value;
hold = removeSpaces(hold);
songName = hold.SubString(0, length) + ” – “;
}
}
else if (FSOUND_Stream_FindTagField(tempHan , type, “ARTIST”, (void **)&value, &length))
{
hold = (String)value;
songName = hold.SubString(0, length) + ” – “;
}
// Check whether it is a WMA file
else if (FSOUND_Stream_FindTagField(tempHan , type, “AUTHOR”, (void **)&value, &length))
{
hold = (String)value;
songName = hold.SubString(0, length) + ” – “;
}
else
songName = ” – “;
// Find the song’s title tag
if ((type == FSOUND_TAGFIELD_ID3V1) || (type == FSOUND_TAGFIELD_ID3V2))
{
if (FSOUND_Stream_FindTagField(tempHan , FSOUND_TAGFIELD_ID3V2, “TIT2”, (void **)&value, &length))
{
strncpy(value, value + 1, length – 1);
hold = (String)value;
hold = hold.SubString(0, hold.Length() – 1);
if (isascii(hold[1]))
songName += hold.SubString(0, length);
}
else if (FSOUND_Stream_FindTagField(tempHan , FSOUND_TAGFIELD_ID3V1, “TITLE”, (void **)&value, &length))
{
hold = (String)value;
hold = removeSpaces(hold);
songName += hold.SubString(0, length);
}
}
else if (FSOUND_Stream_FindTagField(tempHan , type, “TITLE”, (void **)&value, &length))
{
hold = (String)value;
songName += hold.SubString(0, length);
}
}
}
// Check whether the file had tags, or if the songs tags were empty
if ((songName == NULL) || (songName == “”) || (songName == ” – “))
songName = frmPlaylist->FileNameConvert(file, -1);

    return songName;

}
//—————————————————————————

Hope it helps.

  • You must to post comments
0
0

ok, it’s perfect, thanks chris_gorrie
++

  • You must to post comments
0
0

in first call of this function it’s ok, but in next calls function add liters to end of name

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.