0
0

Hi Brett and Andrew,

I have been having a problem. I play two streams and it’s fine. As soon as I Add a System DSP then [b:jy5x8rny]only[/b:jy5x8rny] the second stream plays.

The following code demonstrates the problem. If you compile and run it you hear two streams playing. If you then uncomment the three sections marked you only hear the second stream playing.

Please help because I have spent quite some time on this one which is seemingly a potential bug.

FMODex is ace by the way ๐Ÿ˜€

[code:jy5x8rny]
// Includes

include "fmod.h"

include "fmod_errors.h"

include <windows.h>

include <stdio.h>

include <conio.h>

// DSP callback
FMOD_RESULT F_CALLBACK myDSPcallback(
FMOD_DSP* dsp, float* inbuffer, float* outbuffer,
unsigned int length, int inchannels, int outchannels)
{
// Do nothing
return FMOD_OK;
}

// Main entry point
int main(int argc, char argv[])
{
// Variables
FMOD_SYSTEM
system;
FMOD_SOUND* sound1, sound2;
FMOD_CHANNEL
channel = 0;
int key;

// DSP Variables

/* —— U N C O M M E N T F R O M H E R E ——
FMOD_DSP_DESCRIPTION myDSPdesc;
FMOD_DSP* myDSP;
—— T O H E R E —— */

// Create and Initialise FMOD
FMOD_System_Create(&amp;system);
FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, NULL);

// Create, Add and Activate our DSP

/* —— U N C O M M E N T F R O M H E R E ——
memset(&myDSPdesc, 0, sizeof(myDSPdesc));
if(*myDSPdesc.name == ‘\0’)
strcpy(myDSPdesc.name, "myDSP");
if(!myDSPdesc.version) // version 0xAAAABBBB (A = major, B = minor)
myDSPdesc.version = 0x00010000;
if(!myDSPdesc.read)
myDSPdesc.read = &myDSPcallback;
FMOD_System_CreateDSP(system, &myDSPdesc, &myDSP);
FMOD_System_AddDSP(system, myDSP);
FMOD_DSP_SetActive(myDSP, 1);
—— T O H E R E —— */

// Create two streams
FMOD_System_CreateStream(system, &quot;Song1.mp3&quot;, FMOD_SOFTWARE, 0, &amp;sound1);
FMOD_System_CreateStream(system, &quot;Song2.mp3&quot;, FMOD_SOFTWARE, 0, &amp;sound2);

// Play both streams
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, 0, &amp;channel);
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, 0, &amp;channel);

// Do main program loop
printf(&quot;Press 'Esc' to quit\n&quot;);
do
{
    if (kbhit())
        key = getch();
    FMOD_System_Update(system);
} while (key != 27);

// Release the two streams
FMOD_Sound_Release(sound1);
FMOD_Sound_Release(sound2);

// Deactivate, Remove and Release our DSP

/* —— U N C O M M E N T F R O M H E R E ——
FMOD_DSP_SetActive(myDSP, 0);
FMOD_DSP_Remove(myDSP);
FMOD_DSP_Release(myDSP);
—— T O H E R E —— */

// Close and Release FMOD
FMOD_System_Close(system);
FMOD_System_Release(system);

// Finished
return 0;

}
[/code:jy5x8rny]

  • You must to post comments
0
0

Just fyi,

I do actually ‘ERRCHECK’ all the return values etc in the actual code but I just posted the leanest possible code here for demonstration purposes.

Also I am using the latest API download too.

I look forward to your response :)

  • You must to post comments
0
0

Anyone???

  • You must to post comments
0
0

Hey ๐Ÿ˜€

That got it!

The old fmod 3 automatically did this already i think.

Brett good luck in Japan, bet it’s absolutely awesome!

For anyone who’s interested in the fix code it’s below:

[code:341t0ur1]
// DSP callback
FMOD_RESULT F_CALLBACK myDSPcallback(
FMOD_DSP* dsp, float* inbuffer, float* outbuffer,
unsigned int length, int inchannels, int outchannels)
{
// Note: This code assumes outchannels and inchannels are the same value here
memcpy(outbuffer, inbuffer, length * sizeof(float) * inchannels);
return FMOD_OK;
}
[/code:341t0ur1]

Keep up the good work FMOD team.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.