• Popular Now

• 9
• 13
• 9
• 18
• 19

Archived

This topic is now archived and is closed to further replies.

directmusic problems regarding StopEx

This topic is 5290 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi! I have a really big problem with directMusic. I want to stop a segment after a certain period of time, i.e. 10000 ms or so... but the following doesn''t work, it stops immediately. i also tried out several combinations of the flags, but they either let the segment stop at once or not at all, but never after a delay. here is my code: void stop_after_a_while(int time) { __int64 prtNow = 0; dMusicPerformance->GetTime(&prtNow, NULL); dMusicPerformance->StopEx(pSegment, prtNow+(__int64)time*10000, DMUS_SEGF_REFTIME); } please, help me out. P.S. both methods return ok, since in my original code there is error handling and no errors are detected.

Share on other sites
I''m not 100% sure, as i havn''t done this in awhile, but I think you want to do this.
// assuming time is secondsvoid stop_after_a_while(int time) {dMusicPerformance->StopEx(pSegment, time*1000, DMUS_SEGF_REFTIME);}

This will stop the segment X seconds from the time it is called.

Let me know if I''m right. I havn''t done this in awhile and I''m going by memory.

Share on other sites
Thx!! You''re right!

That just solved all my problems.

But afaik if you use the flag DMUS_SEGF_REFTIME, you should multiply the time by 100000, not by 10000, since reference time ticks 100 million times a second (given time is in ms). Haben''t tested that yet, though!

stalker