3

I'm using cocos2dx's SimpleAudioEngine. ( I need to use that, not the new AudioEngine).

I tried to implement pitch function to SimpleAudioEngine for Win32 but I'm stuck.

cocos2dx uses MCI for audio playback when SimpleAudioEngine is used. (MCI ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd742874(v=vs.85).aspx ).

I can't figure out how to implement the pitch function. There is also setVolume, but it's implementation is also empty (cocos2dx guys didn't implement it I guess). I'm using cocos2d-x v.3.3 c++. I found out that there is a dwSpeed variable which can be used to change playback rate but I can't figure out how to work with that.

Here's what I did:

void MciPlayer::SetSpeed(DWORD dwSpeed)
{
    tagMCI_VD_PLAY_PARMS mciSetParms;
   DWORD dwFlags;
   if (!_dev)
      return ;
   mciSetParms.dwSpeed = dwSpeed;

   mciSendCommand(_dev, MCI_PLAY, MCI_FROM|MCI_NOTIFY,
                                  reinterpret_cast<DWORD_PTR> (&mciSetParms));  
}

And here is the cpp file for MciPlayer: http://pastebin.com/BNyC7FEK

Is there any chance to implement pitch in this specific case? Or does MCI not support this? If any MCI geek is out there, please help!

It's quite a challenging task I guess.

Thanks for your time!

Chris

CXJ
  • 4,301
  • 3
  • 32
  • 62

0 Answers0