[directmusic] GetTime(...) occasionally returns decreasing MUSIC_TIME

  • From: Abhijit Patait <abhijit_patait@xxxxxxxxx>
  • To: directmusic@xxxxxxxxxxxxx
  • Date: Sat, 24 Jul 2004 22:11:47 -0700 (PDT)

What is the recommended method to compute the current play position when a 
segment is being played on a performance?

In my application, I have implemented a method in which I am calling 
IDirectMusicPerformance8::GetTime(...) from WM_TIMER handler, which runs every 
100 ms. As soon as the segment starts playing, a timer is set up for 100 ms, 
and in the WM_TIMER handler, I am calling 
IDirectMusicPerformance8::GetTime(...). The values returned by GetTime(...) are 
used to display the current play position. It works fine most of the times. 
However, after some time (after playing/stopping the segment a few times), the 
behavior of IDirectMusicPerformance8::GetTime(...) is unexpected. Specifically, 
the consecutive calls of GetTime(...) sometimes return music times in 
decreasing time order. Following is a log of the values returned by calls to 
IDirectMusicPerformance8::GetTime(NULL, &mtNow) - look at line marked 
"Incorrect" and the line before it. This is throwing off the play position 
display. Why would the consecutive calls to GetTime(...) (which are 
approximately spaced at 100 ms) return music tim
 e values
 in decreasing order?

mtNow = 874280
mtNow = 881356
mtNow = 883152
mtNow = 877888
mtNow = 875750  // Incorrect
mtNow = 880046
mtNow = 883698
mtNow = 882012  // Incorrect
mtNow = 878590
mtNow = 879852
mtNow = 883515
mtNow = 884023
mtNow = 881538  // Incorrect
mtNow = 880753
mtNow = 882993
mtNow = 884906
mtNow = 883875  // Incorrect
mtNow = 882377
mtNow = 883275
mtNow = 885230

Thank you for helping..

Abhijit



                
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!


Other related posts:

  • » [directmusic] GetTime(...) occasionally returns decreasing MUSIC_TIME