October 28, 2021, 13:30:41

Author Topic: CreateSoundBuffer failed (87)  (Read 370 times)

Offline therevills

  • Hero Member
  • *****
  • Posts: 661
CreateSoundBuffer failed (87)
« on: May 07, 2021, 11:38:51 »
Hey Guys,

Anyone seen this error before?
Code: [Select]
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:
Code: [Select]
DSASS _driver._dsound.CreateSoundBuffer( desc,buf,Null ),"CreateSoundBuffer"
Code: [Select]
Function DSASS( n,t$="DirectSound" )
If n>=0 Return
Throw t+" failed ("+(n & 65535)+")"
End Function

Any ideas?

Cheers,
Steve

Offline Derron

  • Hero Member
  • *****
  • Posts: 3675
Re: CreateSoundBuffer failed (87)
« Reply #1 on: May 07, 2021, 12:03:49 »
The error message itself is rather "specific" - it happens in the buffer creation:

Code: BlitzMax
  1.         Function Create:TDirectSoundSound( sample:TAudioSample,flags:Int )
  2.                 _driver.FlushLonely
  3.                
  4.                 Select sample.format
  5.                 Case SF_MONO16BE
  6.                         sample=sample.Convert( SF_MONO16LE )
  7.                 Case SF_STEREO16BE
  8.                         sample=sample.Convert( SF_STEREO16LE )
  9.                 End Select
  10.  
  11.                 GCSuspend
  12.  
  13.                 Local length:Int=sample.length
  14.                 Local hertz:Int=sample.hertz
  15.                 Local format:Int=sample.format
  16.                 Local chans:Int=ChannelsPerSample[format]
  17.                 Local bps:Int=BytesPerSample[format]/chans
  18.                 Local size:Int=length*chans*bps
  19.  
  20.                 Local buf:Byte Ptr
  21.                 DSASS bmx_directsound_IDirectSound_createsoundbuffer(_driver._dsound, Varptr buf, length, hertz, format, chans, bps, size, flags, _driver._mode), "CreateSoundBuffer"
  22.  

which is defined (as extern) in pub.mod/directx.mod/dsound.bmx
Code: BlitzMax
  1.         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)
  2.  

leading to pub.mod/directx.mod/dsound.cpp
Code: [Select]
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

Offline Derron

  • Hero Member
  • *****
  • Posts: 3675
Re: CreateSoundBuffer failed (87)
« Reply #2 on: May 07, 2021, 12:08:04 »
Maybe use another backend ... dunno what dsound on windows uses - wasm, ....

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


bye
Ron

Offline therevills

  • Hero Member
  • *****
  • Posts: 661
Re: CreateSoundBuffer failed (87)
« Reply #3 on: May 08, 2021, 01:41:41 »
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?

Offline therevills

  • Hero Member
  • *****
  • Posts: 661
Re: CreateSoundBuffer failed (87)
« Reply #4 on: May 08, 2021, 02:05:27 »
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
« Last Edit: May 08, 2021, 02:12:54 by therevills »

Offline Derron

  • Hero Member
  • *****
  • Posts: 3675
Re: CreateSoundBuffer failed (87)
« Reply #5 on: May 08, 2021, 07:38:06 »
Hope you kept the corrupted sound file somewhere ... in case you need "test cases" .


bye
Ron

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal