[mad-dev] How to get the accurate song time?

Carlos Henrique caique at interama.net
Wed May 6 12:14:45 PDT 2009


Hi to all,

I neet to get the time of the song when it is playing. I am using the code
below:

static
enum mad_flow header(void *data, struct mad_header const *header)
{
    mad_timer_add(&musicTimer, header->duration);
    return MAD_FLOW_CONTINUE;
}

long mp3_song_time(void)
{
    return mad_timer_count(musicTimer, MAD_UNITS_MILLISECONDS);
}

The code works, but it is not fast enough. I am getting the time with "
mp3_song_time" faster than the header is called. (obs: I am using two
processors, one to decode the song and the other to run the code that uses
the song time).

Is there another way to get the right (more accurate) time?

Thanks in advance,

-- 
Carlos Henrique Gomes Correia
Game Programmer
Interama Games

Skype: carloshgcorreia
Tel: +55 27 3345 8525
Web: www.interama.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mars.org/pipermail/mad-dev/attachments/20090506/698fbe36/attachment.html>


More information about the mad-dev mailing list