0
0

Hi,
I’ve a crash when setting setSubSoundSentence. This does appear after fmod update. I switch from 4.02.04 to 4.30.01. Everything works well before that.
I use C++ and crash appears both with linux and windows.

Here is the code (all error codes are FMOD_OK):

[code:105nxj9v]SoundBoxFMOD::SoundBoxFMOD()
{

FMOD_RESULT result;

system = NULL;
music_channel = NULL;
samples_channel_group = NULL;
current_music_channel_volume = 1;
current_samples_channel_group_volume = 1;
last_music_buffer_id = 1;
hasSwappedBetweenZikBuffers = false;
zik_buffers_parent_sound = NULL;


result = FMOD::System_Create(&system);      // cree l'object systeme fmod principal
ErrorCheck(result);


result = system->init(MAX_FMODE_CHANNELS, FMOD_INIT_NORMAL, 0);  // Initialise FMOD.
ErrorCheck(result);

result = system->createChannelGroup("Samples",&samples_channel_group); //cree un groupe pour les channels de sample, utile pour changer le volume pour tous les samples en une passe
ErrorCheck(result);



//cree le son qui contient les deux buffers de zik et swap en boucle entre les deux
memset(&exinfo,0,sizeof(FMOD_CREATESOUNDEXINFO));

exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.defaultfrequency = 44100;
exinfo.numsubsounds = 2;
exinfo.numchannels = 2;
exinfo.format = FMOD_SOUND_FORMAT_PCM16;

result = system->createStream(0,FMOD_LOOP_NORMAL|FMOD_OPENUSER,&exinfo,&zik_buffers_parent_sound);
ErrorCheck(result);

int subsoundlist[2] = {0,1};
result = zik_buffers_parent_sound->setSubSoundSentence(subsoundlist,2);<-CRASH HERE
ErrorCheck(result);

}
[/code:105nxj9v]

  • You must to post comments
0
0

Any idea about what could have change here?
I don’t see any API changes regards to setSubSound stuff, but maybe something else change in initialization…

  • You must to post comments
0
0

The crash is occuring because the parent was initialized to have 2 subsounds but they haven’t been set to anything, you should use Sound::setSubsound to initialize each subsound.

Here is a modified version of your code:
[code:1xc45i1p]
result = system->createStream(0,FMOD_LOOP_NORMAL|FMOD_OPENUSER,&exinfo,&zik_buffers_parent_sound);
ErrorCheck(result);

FMOD::Sound *sub0 = NULL;
result = system->createStream("../media/subsound0.wav",FMOD_DEFAULT,NULL,&sub0);
ErrorCheck(result);

FMOD::Sound *sub1 = NULL;
result = system->createStream("../media/subsound1.wav",FMOD_DEFAULT,NULL,&sub1);
ErrorCheck(result);

result = zik_buffers_parent_sound->setSubSound(0, sub0);
ErrorCheck(result);

result = zik_buffers_parent_sound->setSubSound(1, sub1);
ErrorCheck(result);

int subsoundlist[2] = {0,1};
result = zik_buffers_parent_sound->setSubSoundSentence(subsoundlist,2);
ErrorCheck(result); [/code:1xc45i1p]

I will look into making this return an FMOD_ERR instead of crashing.

  • You must to post comments
0
0

Is there anyway to not give true sounds here?
Because it’s an initialization code and sounds are given next.
Or I could just set the playlist later when a sound is given for the very first time?

Context: I have a little engine doing "back buffering": when a sound is stopped, it is filled with a new one (while the other is playing). Purpose is to have sample precision for smooth listening experience.

  • You must to post comments
0
0

I’ve thought about how to get over it but I have no easy way without your correction.
That would be the same for a real time scenario, for instance a web radio which have to deal with empty buffer at some point (network failure for instance)…

In which version will your correctif be available?

  • You must to post comments
0
0

Hi punknad,

We have fixed the crash. That will be available in the next release.

[quote:1ho2zvyd]Is there anyway to not give true sounds here?[/quote:1ho2zvyd]
No, when you call setSubsoundSentence it will flush the stream and initialize the sentence right there and then. If there are unitialized subsounds in the sentence they will be skipped.

If this restriction is a problem for your application you can do sample accurate sequencing in other ways.

Check out this great example from our wiki:
http://52.88.2.202/wiki/index.php5?tit … h_setDelay

-Pete

  • You must to post comments
0
0

Thanks Peter. I’ve seen new releases are available now. I’ll test it and let you know.

About your alternative, does it work with stream?

  • You must to post comments
0
0

Yes, it works with all types of sounds.

  • You must to post comments
0
0

Your bug fix works both on linux and windows (I use release fmod 4.30.02).

Thanks very much for the quick action!!

  • You must to post comments
0
0

Glad to hear it’s working for you. :)

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.