Answered
0
0

Hi..
I am working on an app in which i am playing an mp3 audio file. i am giving path from sd card of that file in createSound(“.mp3”, FMOD_DEFAULT, 0, &sound). everything is working fine. but problem is that, it takes 2 or 3 seconds to play sound.. what should I do? Please help me out…

result = system->setDSPBufferSize(1024, 4);
ERRCHECK(result);

result = system->init(1000, FMOD_INIT_NORMAL, extradriverdata);
ERRCHECK(result);

result = system->getMasterChannelGroup(&mastergroup);
ERRCHECK(result);





result = system->createSound(Common_EffFilePath(), FMOD_DEFAULT, 0, &sound);
ERRCHECK(result);

result = system->playSound(sound, 0, false, &channel);
ERRCHECK(result);
  • You must to post comments
Best Answer
1
1

Is the file really big? Its possible you’re trying to create the sound and decompress it into memory as part of your playing of the sound. The time to play a sound should be measured around the ‘playSound’, not the createSound which loads the sound.

If you want the createSound to be faster, try playing it compressed (ie FMOD_CREATECOMRPESSEDSAPMLE) or streaming (createStream).

  • Jitendra Singh
    thanx for answering sir, its working… but i have one more issue, how can i convert mp3 audio data to stream(pcm) without playing it… I want to save stream in pcm file and byte array.. please help me out sir.. thanx
  • Brett Paterson
    If you use FMOD_OPENONLY you can read data from an mp3 into your own buffer with Sound::readData
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.