0
0

Hi, FMod community.

I set a compound sound (sound with several sub sounds) and played it with a variable frequency (positive and negative values) and it works as expected. When it has positive frequency, it plays forwards and when the frequency is negative it plays backwards. Also it keeps the order of the sounds sentence within the parent sound. But if I play around for a while with several values (provided by a slider from -60.000 Hz to 60.000 Hz), while the channel is running, the application suddenly crashes and prompts the following logs:

At:
FMod_Resampler_Linear_disassembly_0x00195e11.nasm:
0x00195e11 <+5969> movswl (%edi,%edx,4),%eax

At:
Thread 8: Program received signal:
"EXC_BAD_ACCESS"

Here is the function that creates the sound:

[code:1cqb9c6e]
-(void) playSoundPhrase
{
FMOD_CREATESOUNDEXINFO exinfo = {0};

memset(&amp;exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize           = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.defaultfrequency = 44100;
exinfo.numsubsounds     = 20;
exinfo.numchannels      = 1;
exinfo.format           = FMOD_SOUND_FORMAT_PCM16;

// Create the parent sound with the exinfo object.
FMOD::Sound *parentSound;
ERRCHECK(system-&gt;createSound(NULL, FMOD_OPENUSER | FMOD_LOOP_NORMAL | FMOD_SOFTWARE, &amp;exinfo, &amp;parentSound));

// Set the subsounds and create the list for the sentence of sounds.
int soundsList[20];

// sounds[] is an array of 20 sounds that have been successfully created like this:
// ERRCHECK(system-&gt;createSound(buffer, FMOD_LOOP_NORMAL | FMOD_SOFTWARE, 0, &amp;sounds[i]));

for (int i = 0; i &lt; 20; ++i)
{
    ERRCHECK(parentSound-&gt;setSubSound(i, sounds[i]));    
    soundsList[i] = i;
}

// Set the sentence.
ERRCHECK(parentSound-&gt;setSubSoundSentence(soundsList, 20));

// Play the sound.
ERRCHECK(system-&gt;playSound(FMOD_CHANNEL_FREE, parentSound, false, &amp;parentSoundChannel));

}
[/code:1cqb9c6e]

And here is the function that changes the channel’s frequency:

[code:1cqb9c6e]
-(void) updatePhraseFrequency:(id)sender
{
// This produces values from -60.000 to 60.000
float frequency = (int)((([slider percent]) – 0.5f) * 100000.0f * 1.2f);

if(parentSoundChannel)
    ERRCHECK(parentSoundChannel-&gt;setFrequency(frequency));

}
[/code:1cqb9c6e]

I think the code is working properly because it works for a while as expected. This may be a bug or I don’t know if I am missing something.
I tested the same functionality over a simple sound and it doesn’t crashes, so the problem may be related with the use of sub sounds I guess…

Any advice would be appreciated.

Thanks!

Juan P. Reyes

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.