0
0

I’m trying to create a music player with gapless support. I’m therefore using the subsounds feature of FMOD. However, if I have two tracks of differing sample rate or bit rate, it fails with the unsupported format error. Is there no way to accomplish this?

Below is sample code I’m using:

[code:q350h5ea]FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
exinfo.cbsize = Marshal.SizeOf(exinfo);
exinfo.defaultfrequency = 96000;
exinfo.numsubsounds = 2;
exinfo.numchannels = 2;
exinfo.format = FMOD.SOUND_FORMAT.PCM24;

        result = system.createStream("", FMOD.MODE.LOOP_NORMAL | FMOD.MODE.OPENUSER, ref exinfo, ref parentSound);
        AudioEngine.FMOD_ErrCheck(result);

        result = system.createStream(filename, FMOD.MODE.DEFAULT, ref queuedSounds[0]);
        AudioEngine.FMOD_ErrCheck(result);

        result = system.createStream(filename, FMOD.MODE.DEFAULT, ref queuedSounds[1]);
        AudioEngine.FMOD_ErrCheck(result);

        result = parentSound.setSubSound(0, queuedSounds[0]);
        AudioEngine.FMOD_ErrCheck(result);

        result = parentSound.setSubSound(1, queuedSounds[1]);
        AudioEngine.FMOD_ErrCheck(result);

        result = parentSound.setSubSoundSentence(new int[] {0, 1}, 2);
        AudioEngine.FMOD_ErrCheck(result);

        result = system.playSound(FMOD.CHANNELINDEX.FREE, parentSound, true, ref channel);
        AudioEngine.FMOD_ErrCheck(result);[/code:q350h5ea]
  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.