CreateSoundBuffer failed (87)

Started by therevills, May 07, 2021, 11:38:51

Previous topic - Next topic

therevills

Hey Guys,

Anyone seen this error before? CreateSoundBuffer failed (87)

Big Fish Games QA team has reported it for our latest game running on Windows 7.

I've search BlitzMax source code and I believe it happens in \mod\brl.mod\directsoundaudio.mod\directsoundaudio.bmx:
DSASS _driver._dsound.CreateSoundBuffer( desc,buf,Null ),"CreateSoundBuffer"

Function DSASS( n,t$="DirectSound" )
If n>=0 Return
Throw t+" failed ("+(n & 65535)+")"
End Function


Any ideas?

Cheers,
Steve

Derron

The error message itself is rather "specific" - it happens in the buffer creation:

Code (Blitzmax) Select

Function Create:TDirectSoundSound( sample:TAudioSample,flags:Int )
_driver.FlushLonely

Select sample.format
Case SF_MONO16BE
sample=sample.Convert( SF_MONO16LE )
Case SF_STEREO16BE
sample=sample.Convert( SF_STEREO16LE )
End Select

GCSuspend

Local length:Int=sample.length
Local hertz:Int=sample.hertz
Local format:Int=sample.format
Local chans:Int=ChannelsPerSample[format]
Local bps:Int=BytesPerSample[format]/chans
Local size:Int=length*chans*bps

Local buf:Byte Ptr
DSASS bmx_directsound_IDirectSound_createsoundbuffer(_driver._dsound, Varptr buf, length, hertz, format, chans, bps, size, flags, _driver._mode), "CreateSoundBuffer"


which is defined (as extern) in pub.mod/directx.mod/dsound.bmx
Code (Blitzmax) Select

Function bmx_directsound_IDirectSound_createsoundbuffer:Int(handle:Byte Ptr, buf:Byte Ptr Ptr, length:Int, hertz:Int, format:Int, chans:Int, bps:Int, size:Int, flags:Int, _mode:Int)


leading to pub.mod/directx.mod/dsound.cpp

int bmx_directsound_IDirectSound_createsoundbuffer(IDirectSound * dsound, IDirectSoundBuffer ** buf, int length, int hertz, int format, int chans, int bps, int size, int flags, int mode) {



Which calls "dsound->createsoundbuffer"

here are a list of error codes:
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ee418039(v=vs.85)
(maybe needs to lookup for another version)


bye
Ron

Derron

Maybe use another backend ... dunno what dsound on windows uses - wasm, ....

With  NG you could also try audio.mod/soloud.mod .


bye
Ron

therevills

Thanks Ron.

By default we use OpenAL ("OpenAL Generic Software") for the sound driver.

Back in 2016 I added a piece of code which forced the sound driver to be "DirectSound" when the OS is 64Bit and Windows7, due to a reported issue from a player back then.

Unfortunately we no longer have a Win7 machine (we have 2 x Win 10, 1 x Win8, 1 x XP), so I can't really test it properly, but if I force Windows 10 to use DirectSound it fails with the same reported error of "CreateSoundBuffer failed (87)"

Do you know what error code 87 matches with those return values?

therevills

#4
Hmm looks like one of my sound files got corrupted somehow which caused the issue  ::)

And OpenAL didnt care about it... but DirectSound did  :P

Derron

Hope you kept the corrupted sound file somewhere ... in case you need "test cases" .


bye
Ron