XRam Error: can not play anything
It appears there is a problem with the XRam code in:
The program will crash when ever you load a sound. The line it crashes on is:
if(mSetXRamMode(numBuffers, buffers, bufferMode) == AL_FALSE) return AL_FALSE;
from the aforementioned eaxSetBufferMode(...) function
I tried debugging it myself and found that the 'BufferRef *buffers' parsed into eaxSetBufferMode() gets corrupted on passing. Also im not sure about the 'Size numBuffers' parsed variable but in one example the passed int was 4096 but by the time it got into the function and cast to Size 'numBuffers' became 2. So assuming Visual Studio is not being stupid then i think there are some issues here.
Anyway heres my log
*-*-* Creating OpenAL
23:59:54: OpenAL Version: 1.1
23:59:54: Available Devices
23:59:55: * Auzen X-Fi Audio [EC00]
23:59:55: * Generic Software
23:59:55: Choosing: Auzen X-Fi Audio [EC00]
23:59:55: Supported Formats
23:59:55: EAX 5.0 Detected
23:59:55: EFX Extension Found
23:59:55: X-RAM Detected
23:59:55: X-RAM: 285344770 (285344769 free)
23:59:55: Creating OgreAL Thread
23:59:55: Creating resource group Sound
23:59:55: Added resource location 'Data/Sounds/Music' of type 'FileSystem' to resource group 'Sound'
23:59:55: Initialising resource group Sound
23:59:55: Parsing scripts for resource group Sound
23:59:55: Finished parsing scripts for resource group Sound
23:59:55: === Setting X-RAM Buffer Mode
23:59:55: === Allocating 0 bytes of X-RAM
and its at this point that it crashes. This is only a problem for cards with XRam detected as it works perfectly for my onboard. also if i just comment out the call to 'eaxSetBufferMode' from 'Sound::generateBuffers()' then everything works fine again.
Has anyone else with an XRam capable soundcard had this problem. Has anyone else actually tested it! And if it cant be easily fixed then perhaps someone could add a user configurable option so that it doesn't automatically try and load into XRam just because its there and instead lets there user decide if it should do that. I could write that up myself reasonably quick but i figured CaseyB would probably want control over what happens (and also hes the one controlling the svn).
Anyway if anyone else has a XRam card let me know as im curious to see if its just the Auzen variants or all X-Fi cards that do this.
OK one should probably not post problems in the early hours of the morning. Anyway a fresh set of eyes this morning and it appears that OgreAL is not detecting any supported formats for the soundcard. So there are clearly some issues with the sound card and OgreAL. Interestingly though if you dont set the buffers to XRam mode then the sound card works perfectly (even without any detected supported formats).
So just a blanket question:
Has anyone else tried OgreAL on a card with XRam and if so what card?
If others can get it to work on there creative X-Fi cards then clearly its an issue with Auzen cards which gives me a starting point to look at a possible fix.
OK i finally got around to looking into this and spent about an hour this afternoon debugging stuff. And ive come to the conclusion that XRam has never worked on OgreAL and any program that uses OgreAL on a computer with XRam will crash.
I managed to fix the problem with it crashing but it still doesnt correctly allocate buffers. But i figured i would post this hear as it is something that really needs to be updated in the svn code.
const ALenum SoundManager::xRamAuto = alGetEnumValue("AL_STORAGE_AUTOMATIC");
This is currently set to "AL_STORAGE_AUTO" which is not the correct value
But the big problem is in SoundManager::checkFeatureSupport()
EAXSetBufferMode setXRamMode = (EAXSetBufferMode)alGetProcAddress("EAXSetBufferMode");
EAXGetBufferMode getXRamMode = (EAXGetBufferMode)alGetProcAddress("EAXGetBufferMode");
should be replace with:
mSetXRamMode = (EAXSetBufferMode)alGetProcAddress("EAXSetBufferMode");
mGetXRamMode = (EAXGetBufferMode)alGetProcAddress("EAXGetBufferMode");
This will prevent OgreAL from crashing on cards with XRam and the program will still function however OgreAL still doesnt properly use the XRam. But still this is better than nothing.
Good detective work so far!
I can't offer help on the problem as yet and I'm not sure how long it will be before the SVN code will be updated, as far as I know CaseyB has disappeared off the planet, so for now there is no active development on this project.
I'm working on my own sound library though and, as yet, not looked at XRAM support but if there's a call for it I may add this in sometime, but for now you'd be best trying to sort out the problem yourself or find another audio library with that support.
Unfortunately im not going to have the time to fix this completely until the end of the year (christmas holidays). I thought i would put this fix up as at least it gets something working but it is still a ways from being a complete solution. If by the end of the year no one else has done anything with this then i will have another look and perhaps consider continuing to work on it.
Its just one of those things were you never have enough time!
I've added XRAM support to my library but I don't have access to a XRAM supported card so would appreciate it if you could try the code out for me?
You shouldn't have much trouble integrating it if you have OgreAL setup already and maybe we'll get any issues sorted out!
Im assuming this library is your Ogreoggsound library? Im seriously limited for time at the moment but i can try and help out if i can. One problem is that my app that uses OgreAL uses my modified version which isnt easily replaceable. But if you have a nice little test program for you library that i can just download and play with that may make it much easier to test.
No problem Siberian,
I've uploaded a test project to the SVN download so if you want/can try it that would be great!