0
0

Hi,

For my project, i’m using fMOD to create an MP3 player that would work on a desktop env (win) and a PDA (ppc). I’ve figured out most of the features of FMOD with the help of this forum.

I am now trying to read ID3 tags using fmod. The way i did it on PC version is as follows (not sure if it is the best way):

[code:53k17mhb]
int num = 0;
IntPtr file = FSOUND_Stream_Open(fName, FSOUND_NORMAL, 0, 0);

if(file == IntPtr.Zero)
MessageBox.Show("couldn’t open stream");
else
{
int num = 0;
FSOUND_Stream_GetNumTagFields(file, ref num);
MessageBox.Show(num.ToString());

for(int i =0; i<num; i++)
{
    string tagName = "";
    int len = 0;
    IntPtr val = IntPtr.Zero;
    FSOUND_TAGFIELD_TYPE type = FSOUND_TAGFIELD_ID3V1;
    bool res = false;

    try
    {
        res = FSOUND_Stream_GetTagField(file, i, ref type, ref tagName, ref val, ref len);
    }
    catch(Exception ex)
    {
        MessageBox.Show(i + ": " + ex.Message);
    }

    if (res)
    {
        void *aaaaa = val.ToPointer();
        sbyte *b = (sbyte*)aaaaa;
        string c = "";
        if(type==FSOUND_TAGFIELD_ID3V1)
            c = new string(b,0, len-1);
        else if(type==FSOUND_TAGFIELD_ID3V2)
            c = new string(b,0, len-0);

        byte[] d = System.Text.Encoding.Unicode.GetBytes(c);

        string ef = System.Text.Encoding.Default.GetString(d);
                    listBox1.Items.Add(i + " - " + tagName + " || " + ef.Trim() + " || " + len.ToString() + " || " + type);
    }
}

}
[/code:53k17mhb]

The above code runs alright on PC and i can see all tags stored. The problem I have is when i run it on the pocket pc. It opens the stream and even could play it successfully. It retrieves the number of tags but when it gets to FSOUND_Stream_GetTagField it throws a NotSupportedException. The error returned by FSOUND_GetError() is ZERO i.e. FMOD_ERR_NONE

could any one who succeeded in doing this task help me here. It is really appreciated.

N.B. in ppc, i needed to use char instead of sbyte.

regards,
Moayad

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.