*edit: I’m using Vista, not sure if that matters. :]

I’ve had some problems with user created sounds, below are the key pieces of code I’ve been trying to get working, essentially I get an error which states that a parameter passed to ‘FMOD_System_CreateSound’ is invalid (FMOD_ERR_INVALID_PARAM). I suspect it may be ‘cacreatesoundexinfo’, but I’m not sure and I’m a little tired of fighting this!

Soo, lol, can anyone spot any errors with the snippet below or have an idea of why this is failing?

Would much appreciate any help!

FMOD_RESULT F_CALLBACK pcmreadcallback(FMOD_SOUND *sound, void *data, unsigned int datalen)
unsigned int count;
static float t1 = 0, t2 = 0; // time
static float v1 = 0, v2 = 0; // velocity
signed short *stereo16bitbuffer = (signed short *)data;

for (count=0; count < datalen>>2; ++count)        // >>2 = 16bit stereo (4 bytes per sample)
    *stereo16bitbuffer++ = (signed short)(sin(t1) * 32767.0f);    // left channel
    *stereo16bitbuffer++ = (signed short)(sin(t2) * 32767.0f);    // right channel

    t1 += 0.06f + v1;
    t2 += 0.06f + v2;
    v1 += (float)(sin(t1) * 0.002f);
    v2 += (float)(sin(t2) * 0.002f);

return FMOD_OK;


FMOD_SYSTEM *casystem;
int cachannels = 2;
FMOD_CHANNEL *cachannel;
FMOD_SOUND *casound;
FMOD_CREATESOUNDEXINFO  cacreatesoundexinfo;
FMOD_RESULT caresult;

caresult = FMOD_System_Create(&casystem);
ERRCHECK(caresult, "FMOD_System_Create:"); caresult = FMOD_OK;

caresult = FMOD_System_Init(casystem, 1, FMOD_INIT_NORMAL, NULL);
ERRCHECK(caresult, "FMOD_System_Init:"); caresult = FMOD_OK;

memset(&cacreatesoundexinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
cacreatesoundexinfo.cbsize            = sizeof(FMOD_CREATESOUNDEXINFO);
cacreatesoundexinfo.decodebuffersize  = 44100;
cacreatesoundexinfo.length            = 44100 * cachannels * sizeof(signed short) * 5;
cacreatesoundexinfo.numchannels       = cachannels;
cacreatesoundexinfo.defaultfrequency  = 44100;
cacreatesoundexinfo.format            = FMOD_SOUND_FORMAT_PCM16;
cacreatesoundexinfo.pcmreadcallback   = pcmreadcallback;
cacreatesoundexinfo.pcmsetposcallback = pcmsetposcallback;

caresult = FMOD_System_CreateSound(casystem, 0, camode, &cacreatesoundexinfo, &casound);
ERRCHECK(caresult, "FMOD_System_CreateSound:"); caresult = FMOD_OK;

caresult = FMOD_System_PlaySound(casystem, FMOD_CHANNEL_FREE, casound, 0, &cachannel);
ERRCHECK(caresult, "FMOD_System_PlaySound:"); caresult = FMOD_OK;


  • You must to post comments

Excellent I am glad you have your issue resolved.

  • You must to post comments

Here are the last few lines of my fmod.log, does the fact that the logging ends at the following line infer that there is a problem with that or the following property?
"FMOD: [938443671 ms delta = 32] SystemI::createSoundInternal : exinfo->initialseekpostype = 2"

I’m not sure how to interpret this, FMOD_RESULT shows an error but I see no errors logged.


[quote:nzwepe60]FMOD: [938443172 ms delta = 26] MemPool::alloc : 24 bytes (01B7FA48)
FMOD: [938443196 ms delta = 24] Thread::initThread : Initializing FMOD stream thread. priority 2
FMOD: [938443222 ms delta = 26] Thread::initThread : – Stacksize 49152. Stack pointer 00000000 : usesemaphore = 0 : sleeptime = 10
FMOD: [938443247 ms delta = 25] Thread::callback : * FMOD stream thread started
FMOD: [938443248 ms delta = 26] Thread::initThread : done.
FMOD: [938443296 ms delta = 48] MemPool::alloc : 24 bytes (01B7FC98)
FMOD: [938443322 ms delta = 26] MemPool::alloc : 168 bytes (01B7FCC8)
FMOD: [938443346 ms delta = 24] MemPool::alloc : 168 bytes (01B7FD88)
FMOD: [938443372 ms delta = 26] SystemI::init : done

FMOD: [938443405 ms delta = 33] SystemI::createSoundInternal : filename = : mode 000004ca
FMOD: [938443430 ms delta = 25] SystemI::createSoundInternal : exinfo->cbsize = 92
FMOD: [938443454 ms delta = 24] SystemI::createSoundInternal : exinfo->length = 882000
FMOD: [938443480 ms delta = 26] SystemI::createSoundInternal : exinfo->numchannels = 2
FMOD: [938443504 ms delta = 24] SystemI::createSoundInternal : exinfo->defaultfrequency = 44100
FMOD: [938443530 ms delta = 26] SystemI::createSoundInternal : exinfo->format = 2
FMOD: [938443563 ms delta = 33] SystemI::createSoundInternal : exinfo->decodebuffersize = 44100
FMOD: [938443589 ms delta = 26] SystemI::createSoundInternal : exinfo->pcmreadcallback = 00401800
FMOD: [938443613 ms delta = 24] SystemI::createSoundInternal : exinfo->pcmsetposcallback = 00401936
FMOD: [938443639 ms delta = 26] SystemI::createSoundInternal : exinfo->speakermap = 2293616
FMOD: [938443671 ms delta = 32] SystemI::createSoundInternal : exinfo->initialseekpostype = 2[/quote:nzwepe60]

  • You must to post comments

It worked on my PC at home! … but not my PC at work.

Would that imply a hardware or driver issue? 😮

  • You must to post comments

It is possible that the problem is hardware related. The simplest test is to use FMOD_SOFTWARE instead of FMOD_HARDWARE and test again.

Have you tried running the usercreatedsound example and verified that it works on the problem machine?

  • You must to post comments

The code I’m using is essentially a briefer version of the example that comes with the SDK, the fmod usercreatedaudio sample didn’t work either, same error – which is why I have been line-by-line rebuilding the example with logging…

I have tried SOFTWARE and HARDWARE, the results are the same. So I suppose that implies it may not be a hardware issue.

Can you think of anything else I can do to determine what the cause of the failure is? I suppose if this at least works on my PC at home it’s not such a big deal… though I feel determined to finding a solution on principle now, lol.

*Edit: just noticed this is in the log, any ideas?

[quote:18kfe1r5]FMOD: [948083911 ms delta = 31] OutputWASAPI::initEx : Forcing output channels to match Windows mix format: 2 channel(s)
FMOD: [948083939 ms delta = 28] OutputWASAPI::initEx : Device doesn’t support requested format, trying again with Windows mix frequency
FMOD: [948083973 ms delta = 34] MemPool::alloc : 16384 bytes (016B7E20)
FMOD: [948084005 ms delta = 32] OutputWASAPI::initEx : Done.[/quote:18kfe1r5]

  • You must to post comments

There shouldn’t be anything overly wrong with those warnings from OutputWASAPI but seeing those does indicate to me you are use an old version of FMOD. Can you try out the latest version of FMOD to ensure any problem you are having has not already been corrected.

  • You must to post comments

Updating the assemblies/libs/includes/etc did not resolve the issue.

Let it be known I have run in to a ridiculously subtle and obscure error, and knowing me I will be the only person alive to experience it.

On the problem PC I am able to do other things with FMOD, like play audio files and what not, everything except use usercreatedaudio.

I suppose it wouldn’t be very convenient for you to tell me exactly how useracreatedaudio differs from everything else in the back-end huh?

Lol, well, I think I can just deal with this situation, and maybe I’ll give OpenAL a try and see if I have the same problem. I’ll keep tabs on this post occasionally in case anyone ever runs in to the same problem or you think of any tests I can perform to analyze the issue more closely.

At the moment I’m stumped, I’ll just work more with it later on I guess – ultimately as long as my personal PC doesn’t have the issue it’s tolerable.

  • You must to post comments

Could you provide a full log output using the code you specified above with the latest version of FMOD. Looking at your existing output it seems like you are having a header / lib conflict. You will get an FMOD_ERR_INVALID_PARAM if the size of your FMOD_CREATESOUNDEXINFO structure (specified as cbsize) doesn’t match what the lib thinks the size should be.

Also I noticed in the output it is printing things like speakermap and initialseekpostype, neither of which you have specified in the code provided indicating something is corrupting that structure.

  • You must to post comments

I can’t believe it, it’s working now. The only thing I did was close dev-cpp and shut down the PC before I left work Friday. Today I log in and open the project back up after reading your reply.

My best guess is there is some kind of cache for windows assemblies, so replacing them didn’t really update what dev-cpp was referencing? That or dev-cpp caches libraries… must have been something similar since the update appeared to not take place immediately.

Well, I guess ultimately updating FMOD corrected what ever issues existed, and the FMod.log now reflects the FMOD_CREATESOUNDEXINFO structure I specified in my source. (no more speakermap/initialseekpos/etc)

Thanks for your patience. :]

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.