Jump to content
  • Advertisement
Sign in to follow this  
wasd

DirectMusic: Why wont it stop? :(

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to do a very simple thing in DirectMusic. I have a segment playing, and I want it to stop after a certain time, so I do this:
// Get the current time
REFERENCE_TIME RefTime;
m_pPerformance->GetTime(&RefTime, NULL);
m_pPerformance->StopEx(m_pSegmentState, RefTime + TransitionTime, DMUS_SEGF_GRID | DMUS_SEGF_REFTIME);

TransitionTime is 44000000, which should be about 4.4 seconds. Unfortunately, it just doesn't stop. I can either get it to stop instantly or not at all, by playing around with the values I pass in for time.

Share this post


Link to post
Share on other sites
Advertisement
At the moment I'm testing it with a short segment (4 bars) which is set to loop constantly. Does it invalidate the stop command when the segment loops? Surely if I'm stopping the segment state then it shouldn't matter about loops etc.

Share this post


Link to post
Share on other sites
No, the segments are authored in DirectMusic Producer, so the loop points are set that way. What I want is for the segment to loop continuously until the stop function is called, which makes the segment stop after a certain amount of time.

Share this post


Link to post
Share on other sites
Oh, sorry. I misunderstood =)

Hmm, have you set the correct parameters in ::PlaySegemntEx().
For instance, is the SegmentState supplied in the function call and have you used the correct flags for timing and boundaries.

Share this post


Link to post
Share on other sites
My PlaySegmentEx function just looks like this:


m_pPerformance->PlaySegmentEx(m_pSegment, NULL, NULL, DMUS_SEGF_BEAT, 0, &SegmentState, NULL, NULL);



It just plays the segment on the next beat boundary.

Share this post


Link to post
Share on other sites
Although my most recent experiance with DirectMusic was using the DX.7 SDK, this sounds like you may have another function call that you have called to start the damn thing playing again AFTER you have this code put a stop to it. Make sure it isn't an error on your side, before looking at DirectMusic.

Having a look at the DX 9 SDK, I have notice that your "StopEX" method call uses a flag to indicate Reference Time, but the flags for your "PlaySegmentEx" call does not. This is new to me, but I suggest you look into it.

Also, in the "PlaySegmentEx" call, you use "&SegmentState" but you use "m_pSegmentState" for the "StopEx" call. Makes me wonder if you are stopping the wrong segment...

I hope this helps.

Share this post


Link to post
Share on other sites
The reference time flags just indicate that the time you've specified to play / stop is in reference time. There isn't another call starting the segment again, I've stripped the whole thing down so basically I press a button to start a segment, then another one to call the stop function. Also, I call PlaySegmentEx with &SegmentState then use that to get the DX8 interface with ::QueryInterface, which goes into m_pSegmentState.

Share this post


Link to post
Share on other sites
Hmm. Okay, lets go back to the discussion on "setting loop points"...

Did you specifically put those in yourself using the DMP(DirectMusic Producer) or did the DMP automatically put them in itself?

If you put them in - take them out and see what happens. If the DMP did it - then the loop points shouldn't be the problem.

Also, when you stop the segment playing, you could immedietly after reset the counter back to 0. Though, I expect you have already tried this...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!