How to get the accurate song time?
Carlos Henrique <[email protected]> Wed, 6 May 2009 16:14:45 -0300
| Newsgroups | gmane.comp.audio.mad.devel |
|---|---|
| Message-ID | <[email protected]> |
--0016364d230386209b0469433606
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
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
--0016364d230386209b0469433606
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi to all,<br><br>I neet to get the time of the song when it is playing. I =
am using the code below:<br><br><span style=3D"font-family: courier new,mon=
ospace;">static</span><br style=3D"font-family: courier new,monospace;"><sp=
an style=3D"font-family: courier new,monospace;">enum mad_flow header(void =
*data, struct mad_header const *header)</span><br style=3D"font-family: cou=
rier new,monospace;">
<span style=3D"font-family: courier new,monospace;">{</span><br style=3D"fo=
nt-family: courier new,monospace;"><span style=3D"font-family: courier new,=
monospace;">=A0=A0=A0 mad_timer_add(&musicTimer, header->duration);<=
/span><br style=3D"font-family: courier new,monospace;">
<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 return MAD_FL=
OW_CONTINUE;</span><br style=3D"font-family: courier new,monospace;"><span =
style=3D"font-family: courier new,monospace;">}</span><br><br><span style=
=3D"font-family: courier new,monospace;">long mp3_song_time(void)</span><br=
style=3D"font-family: courier new,monospace;">
<span style=3D"font-family: courier new,monospace;">{</span><br style=3D"fo=
nt-family: courier new,monospace;"><span style=3D"font-family: courier new,=
monospace;">=A0=A0=A0 return mad_timer_count(musicTimer, MAD_UNITS_MILLISEC=
ONDS);</span><br style=3D"font-family: courier new,monospace;">
<span style=3D"font-family: courier new,monospace;">}</span><br><br>The cod=
e works, but it is not fast enough. I am getting the time with "<span =
style=3D"font-family: courier new,monospace;">mp3_song_time</span>" fa=
ster than the header is called. (obs: I am using two processors, one to dec=
ode the song and the other to run the code that uses the song time).<br>
<br>Is there another way to get the right (more accurate) time?<br><br>Than=
ks in advance,<br clear=3D"all"><br>-- <br>Carlos Henrique Gomes Correia<br=
>Game Programmer<br>Interama Games<br><br>Skype: carloshgcorreia<br>Tel: +5=
5 27 3345 8525<br>
Web: <a href=3D"http://www.interama.net">www.interama.net</a><br>
--0016364d230386209b0469433606--