0
0

Hi,

I"ve successfully got FMOD Ex working for my Linux game, but have run into trouble porting to Windows, on the same machine. The code is the same, but I get the error:

"FMOD_ERR_INVALID_SPEAKER"

The code that produces the error is below:
[code:2j9dwz2q]
void Audio::loadModuleIntoMemory(char *filename) throw(const char *)
{
void *buff = 0;
int length;
FMOD_CREATESOUNDEXINFO exinfo;

LoadFileIntoMemory(filename, &buff, &length);
    memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    exinfo.length = length;

_result = _system->createSound((const char *)buff,   FMOD_ACCURATETIME |
    FMOD_HARDWARE | FMOD_OPENMEMORY, &exinfo, 
    &_modules[_numModules]); 
ERRCHECK(_result); // this gives the error in _result


free(buff); 

_numModules++;
}
[/code:2j9dwz2q]
The idea is to simply load a module into memory and then add it to my _modules array.

My initialisation code is simply:
[code:2j9dwz2q]
_result = FMOD::System_Create(&_system);
ERRCHECK(_result);

unsigned int version;
_result = _system->getVersion(&version);
ERRCHECK(_result);

if (version < FMOD_VERSION)
{
    printf("Error!  You are using an old version of FMOD %08x.  This program requires %08x\n", version, FMOD_VERSION);
    return;
}

_result = _system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(_result);

}
[/code:2j9dwz2q]
which seems to work.

This code listed is adapted from sample code. I have verified that LoadFileIntoMemory() works, but the ERRCHECK(_result) produces the error mentioned. I have searched for the invalid speaker error but found no reference to it on the forum, so any help would be much appreciated.

Cheers,

Andrew.

  • You must to post comments
0
0

Is it this (from the windows issues)?
[code:2yeleifu]
result = system->getDriverCaps(0, &caps, 0, 0, &speakermode);
ERRCHECK(result);

result = system->setSpeakerMode(speakermode); 
ERRCHECK(result);

[/code:2yeleifu]

  • You must to post comments
0
0

Hi,

I just found there’s no problem with FMOD and Windows, but rather my sound hardware. As the error message actually suggested, the left speaker (of my hi-fi) isn’t working. I messed with the cables and booted Linux. For some reason, sound still comes out of the left speaker with Linux and there is no error message, but there is some crackle. I’ve tried my other speakers, but still have the same problem with Windows. So I’ll have to get my Sound Blaster hardware fixed or upgraded.

Cheers,

Andrew.

  • You must to post comments
0
0

Hi,

since my last message, I found that Windows had inexplicably muted one of my speakers, so there was no problem with my audio hardware after all. I fixed things with the Control Panel.

But when I ran my Windows game again I got the same invalid left speaker error. I’d only used the basic init code from c++ samples, and then I saw the Windows common fixes in the forum, so I pasted in this code instead, but I still got the same error message. I thought maybe my sound hardware was faulty, so I’ve just upgraded from a basic Sound Blaster Vibra 128 to a Sound Blaster Live. I’ve got my Linux game working perfectly with the Live, and the Live works fine for Windows sounds and stereo music, with no problems from either speaker, but my c++ code still bombs in Windows with the invalid speaker error. Has anyone else ran into this error?

I’m using Visual C++ 6. A little old, but it worked perfectly for the original version of my game (a couple of years ago), which was written with the same compiler but an older version of fmod.

Any help appreciated. Thanks!

Cheers,

Andrew.

  • You must to post comments
0
0

What is the source file type? It is unlikely to get that error from createSound, that error is only ever returned from ‘channel’ commands. Check you havent mixed up your header and dll/lib version first so we can find out what the error code really should be.

Try switching FMOD_HARDWARE to FMOD_SOFTWARE. It may be because you are trying to do something that dsound hardware can’t do but software can (which is what is used on linux even if you do specify hardware).

  • You must to post comments
0
0

Hi Brett,

I downloaded the latest development package from your site and replaced my old headers, dll, and lib files with the new ones. Problem fixed! No more runtime error message. Thanks heaps.

Slight problem was that I got a compile time error with the WIndows configuration: The line was:

[code:2av04to5]result = fmodSystem->getDriverName(0, name, 256);[/code:2av04to5]

VC++ gave me an error that getDriverName() doesn’t exist. I checked the latest header file and there doesn’t seem to be a prototype for getDriverName. So I simply commented out the line and the following (that uses the variable "name" from above)

[code:2av04to5]if (strstr(name, "SigmaTel"))   /* Sigmatel sound devices crackle for some reason if the format is PCM 16bit.  PCM floating point output seems to solve it. */
{
    result = fmodSystem->setSoftwareFormat(48000, FMOD_SOUND_FORMAT_PCMFLOAT, 0,0, FMOD_DSP_RESAMPLER_LINEAR);
    ERRCHECK(result);
} [/code:2av04to5]

That solved the compilation error and I got no problems without that code snippet, but if you know how to get that to compile please tell me. Thanks.

I also changed the FMOD_HARDWARE flag to FMOD_SOFTWARE, as you suggested.

Thanks again for your time. fmod is aweome; keep up the good work!

Cheers,

Andrew.

  • You must to post comments
0
0

If you check the revision history for that version, it does say

[quote:21ho4xjh]Added System::getDriverInfo and System::getRecordDriverInfo functions to replace System::getDriverName and System::getRecordDriverName. They provide the same functionality but now optionally provide GUIDs to uniquely identify a driver. GUIDs are available from DSound, WASAPI and CoreAudio output modes.[/quote:21ho4xjh]

you just need to use getDriverInfo instead

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.