Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: how to get the accurate play time ? (Read 2328 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

how to get the accurate play time ?

Hi,
  Now I am working on a new music player. I use the foo_out_dsound_ex plugin to handle audio output. But in this player, I must get accurate play time( millisecond ) from 
foo_out_dsound_ex. At first , I find there are some codes in  ds_stream_i::update() that calculate current play time, but I find the time is not accurate especially when the machine performance is very low.  Later, I find that the ds_stream_i::flush_internal () function in ds_stream_i::update() reset the current play time to zero when there is no data in buffer. And flush_internal function is called under two condition:
1. music ends;
2. the decoder thread does not fill data into buffer because some reason( in this case, the reason is the machine performance is very low ).
  I comment out the codes that reset play time in flush_internal function. That make things better but the play time is not accurate.
  Can someone give me some hints? Thanks in advance!
  BTW, forgive my poor English