Joao

Joao

  • NA
  • 1
  • 0

Getting MP3 duration

Dec 6 2006 4:45 PM
Hi,

I'm just starting out with C# and I've successfully managed to write a program that plays a MP3 file using MCI.

Now I want to get the duration of a MP3 file.
I've tried using the "status mMP3 length" MCI comand and a number is returned but it's not the duration of the song nor is it the size of file. So what is it?

My code:


       public int Duration()
       {
           int ReturnSeconds?;
           mciSendString("status mMP3 length", sBuffer, 128, IntPtr?.Zero);

           ReturnSeconds? = int.Parse(sBuffer.ToString());
           return ReturnSeconds?;
       }


Thanks,

Joao