0
0

I’m having a problem with FMOD 3.63 with Ogg Vorbis files. I can start one playing on a free channel, but starting another playing crashes in FMOD.DLL on the FSOUND_Stream_OpenFile() call.

I searched the forum and found another post with the same issue, but it was supposedly fixed in an earlier version of FMOD.

Any ideas?

  • You must to post comments
0
0

I used OggDrop to convert the WAV files to OGG. I tried a few different OGG files and it crashed on the second OGG I started whichever order I tried them. I can zip up one or two of them for you to try if you’ve got somewhere for me to send them.

Here is the crash error:
The instruction at “0x77c42fd4” referenced memory at “0x000000ff”. The memory could not be “writen”.

Stepping over it in the debugger, it crashes in FSOUND_Stream_OpenFile().

Here is some code which crashes, changing the files to WAV works without the crash:

[code:1z657h4j]

include <windows.h>

include <crtdbg.h>

include <stdio.h>

include <stdlib.h>

include <math.h>

include <string.h>

define TRUE 1

define FALSE 0

include "/fmod/api/inc/fmod.h"

FSOUND_STREAM *play(char *fname,int bLoop,int volume,int *channel)
{
FSOUND_STREAM *stream;
DWORD dwFlags;

dwFlags = FSOUND_NORMAL | (bLoop ? FSOUND_LOOP_NORMAL : 0) | FSOUND_2D;
stream = FSOUND_Stream_OpenFile(fname, dwFlags, 0);
if (stream) {
channel = FSOUND_Stream_PlayEx(FSOUND_FREE, stream, NULL, TRUE);
FSOUND_SetVolume(
channel,volume);
FSOUND_SetPaused(*channel,FALSE);
return stream;
}
return NULL;
}

void main(int argc,char *argv[])
{
FSOUND_STREAM *stream[3];
int channel[3];
int volume[3] = {255,0,0};
float abstime = 0.0f;
float amb_out,amb_outside;
int invol1,invol2,outvol;

// init FMOD (error checks removed for clarity)
FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
FSOUND_SetMemorySystem(malloc(110241024), 110241024, NULL, NULL, NULL);
FSOUND_SetDriver(0);
FSOUND_SetMixer(FSOUND_MIXER_AUTODETECT);
FSOUND_Init(44100, 32, 0);
FSOUND_3D_SetDistanceFactor(100.0f); // not used in this sample but included for completeness

// start to streams playing to crossfade (no error checks...)
stream[0] = play("ambiance_outside_1.ogg",TRUE,255,&channel[0]);
stream[1] = play("ambiance_outside_2.ogg",TRUE,0,&channel[1]);
stream[2] = play("ambiance_inside_1.ogg",TRUE,0,&channel[2]);

// play for 30 seconds with crossfading between three streams
while (abstime < 30.0f) {
Sleep(100);
abstime += 0.1f;

// update volume smoothly over time
amb_out = (float)cos(abstime * 0.1f);
amb_outside = (float)(cos(abstime * 0.141f) * cos((abstime + 1.32f) * 0.221f));
invol1 = (int)(amb_outside * amb_out * 255.0f);
invol2 = (int)((1.0f - amb_outside) * amb_out * 255.0f);
outvol = 255 - (invol1 + invol2);
if (volume[0] != invol1) FSOUND_SetVolume(channel[0],volume[0]=invol1);
if (volume[1] != invol2) FSOUND_SetVolume(channel[1],volume[1]=invol2);
if (volume[2] != outvol) FSOUND_SetVolume(channel[2],volume[2]=outvol);

}

// stop the sounds
FSOUND_Stream_Stop(stream[0]);
FSOUND_Stream_Stop(stream[1]);
FSOUND_Stream_Stop(stream[2]);
FSOUND_Stream_Close(stream[0]);
FSOUND_Stream_Close(stream[1]);
FSOUND_Stream_Close(stream[2]);

FSOUND_Close();
}
[/code:1z657h4j]

  • You must to post comments
0
0

Have you tried removing the call to FSOUND_SetMemorySystem? I see that you are only giving FMOD 1MB of memory to play with. Ogg playback uses fairly large buffers.

  • You must to post comments
0
0

That seems to have been it; I removed the call and no more crashes.

I believe I copied that line from one of the samples and didn’t think to change the amount of memory allocated. I would have preferred an error returned instead of a crash on running out of memory, though 😮 .. would have made finding this easier.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.