0
0

Hi all.
I’m beginner in FMOD.
Currently i’m trying with stitching. If i create sentence from 2 mp3 files, all works fine.
Next, i try to sentense 1 mp3 file and 1 generated stream. I just fill this stream with all zeros. If i play this generated stream alone – ok i hear silence.
But when i use sentence with mp3 and silence – instead of silence i hear fragments from mp3. Look on code please, where is my trouble?

[code:2rsko05p]
// generating silence
FMOD_RESULT F_CALLBACK ReadCallback (FMOD_SOUND *sound, void *data, unsigned int datalen)
{
memset (data, 0, datalen);
return FMOD_OK;
}

void Test ()
{
using namespace FMOD;

Sound * ms; // master
Sound * s1; // sub
Sound * s2; // sub

FMOD_CREATESOUNDEXINFO info;

memset (&info, 0, sizeof info);
info.cbsize = sizeof info;
info.defaultfrequency = 22050;
info.numsubsounds = 2;
info.numchannels = 1;
info.format = FMOD_SOUND_FORMAT_PCM16;

sys->createStream (0, FMOD_LOOP_NORMAL | FMOD_OPENUSER, &info, &ms);

sys->createStream ("media/sound1.mp3", FMOD_SOFTWARE, 0, &s1);

memset (&info, 0, sizeof info);
info.cbsize = sizeof info;
info.decodebuffersize = 22050;
info.defaultfrequency = 22050;
info.length = 22050 * 2 * 2;
info.numchannels = 1;
info.format = FMOD_SOUND_FORMAT_PCM16;
info.pcmreadcallback = ReadCallback; // silence
sys->createStream (0, FMOD_OPENUSER | FMOD_SOFTWARE , &info, &s2);

ms->setSubSound (0, s1);
ms->setSubSound (1, s2);

int subs[] = {0, 1};
ms->setSubSoundSentence (subs, 2);

Channel * ch;
sys->playSound (FMOD_CHANNEL_FREE, ms, false, &ch);

}
[/code:2rsko05p]

  • You must to post comments
0
0

the issue may be that your channel count or frequency of the user created sound vs the mp3 may be different.

You should be checking return codes of all fmod functions and seeing if they return any error.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.