• Advertisement
Sign in to follow this  

Mp3 looping problem

This topic is 4176 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

Hi there, I want looping mp3 files in my game,but i have a problem. I used GetSegment()->SetRepeats(DMUS_SEG_REPEAT_INFINITE) in my engine and compile it,but i see a run time error in program and game closed immediatly with no reason. So,I decided to use another way to loop Mp3 files. In this method,I called DispatchDirectShowNotifications function in Render function in my game(every frame i call it). in this function i wrote below code :
  while (m_MediaEventEx->GetEvent(&eventcode, &param1, &param2, 0) == S_OK) 
  {
      if (eventcode == EC_COMPLETE) 
{ 
      if( bmLoop )
      {
          LONGLONG StartPos = 0;
          m_MediaSeeking->SetPositions(&StartPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
		  //this->Play();
}
else
{
                  m_IsPlaying = false;
}
      }
      m_MediaEventEx->FreeEventParams(eventcode, param1, param2);
  }
}

bmLoop variable was defined in parent class and when i want to loop the mp3 i change it to true. In this method i have a problem. When playing the file was finished and want to loop again(start from first) i feel that the delay(about 1 second) occured to play sound. Is there anybody have any idea about it ?

Share this post


Link to post
Share on other sites
Advertisement
Have you checked to see if theres extra data with no sound in it at the end of the file?

Share this post


Link to post
Share on other sites
Quote:

Have you checked to see if theres extra data with no sound in it at the end of the file?

I checked it,the Mp3 file is Ok and don't have any extra data.
When i convert this file to WAV,Ogg and repeat it worked correctly.
Also i checked the multi Mp3 file with multi duration,but the resean was not changed!!!
I checked my game frames,it is ok(about 40 FPS).

Share this post


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

  • Advertisement