Time In DirectMusic (DX7)
Hello all.
I am doing some experimentation with DirectMusic, and writing a midi player. I am attempting to keep track of the time passed playing a segment... this is the code I have.
When the segment is started (called only once):
REFERENCE_TIME m_rmusicstart;
MUSIC_TIME m_mmusicstart;
...
m_segmentstate->GetStartTime(&m_mmusicstart);
m_perf->MusicToReferenceTime( m_mmusicstart, &m_rmusicstart);
then I have on a loop to compute the time:
REFERENCE_TIME m_prtNow;
MUSIC_TIME m_pmtNow;
m_perf->GetTime(&m_prtNow, &m_pmtNow);
m_prtNow =- m_rmusicstart;
m_pmtNow =- m_mmusicstart;
Then I would do my conversion into HH:MM:SS (Hours minutes and seconds). All that is suposed to work nicely (and in the MIDI Player sample from the DX7 SDK, it does,) but in my sample, as the values from GetTime() get larger, m_rmusicstart and m_rmusicstart get equally smaller, making the time elapsed always appear to be 0.
Im not sure why any of this happens, because my code never modifies m_rmusicstart or m_mmusicstart after GetStartTime() is called for the segment.
Any ideas, or other methods to keep track of time?
Fungame
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement