• Advertisement


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

Pausing a MIDI

This topic is 5979 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''ve been having a few problems getting a MIDI to pause lately. Here''s my play and pause code respectively. I can get it to sort of pause and unpause. However unpausing make it start at different positions to where it was stopped. Sometimes before where I stopped it or after where it gets stopped, depending on how I play around with the variables. Any help would be greatly appreciated. void CDirectMidi::play() { if(!m_bInitialized) //Exit if not ready. return; if(m_pMIDIsegment && m_pPerformance) //No bad pointers. { m_pMIDIsegment->SetRepeats(0xFFFFFFFF); //Repeat multiple times. m_pPerformance->PlaySegment(m_pMIDIsegment, 0, 0, &m_pSegmentState); //Play. m_pMIDIsegment->GetStartPoint(&mtStart); } } void CDirectMidi::pause() { MUSIC_TIME mtNow; if (!m_bInitialized) //Exit if not ready. return; if (m_pPerformance) { m_pPerformance->Stop(NULL, NULL, 0, 0); //Stop playing. m_pPerformance->GetTime(NULL, &mtNow); mtOffset = mtOffset + (mtNow - mtStart); m_pMIDIsegment->SetStartPoint(mtOffset); //m_pSegmentState->Release(); } }

Share this post

Link to post
Share on other sites

  • Advertisement