bmx-ng / audio.mod

SoLoud-based BlitzMax Audio driver
1 stars 2 forks source link

PlaySound() with SOUND_STREAM crash in debug mode. #22

Open mingwya opened 3 weeks ago

mingwya commented 3 weeks ago

`If FileType( "stream/ambient_"+ambient+".ogg" )=FILETYPE_FILE

            Local sound:TSound=LoadSound( "stream/ambient_"+ambient+".ogg",SOUND_LOOP|SOUND_STREAM )

            ambChannel=PlaySound( sound,soundPlayer.channel() )

End If`

In release mode works fine.

GWRon commented 3 weeks ago

Did you use a specific soloud audio backend?

Wonder as I am using the same flags without issues here (albeit I wrapped everything in custom classes - code from a time before soloud landed in NG).

Can you check where it crashes exactly? (build with GDB information and run within "gdb -r yourapp")

mingwya commented 3 weeks ago

im use -> Import Audio.AudioMiniAudio

Maybe it's because of the platform I'm using (win32)?

There are two files in the archive - ogg and code that reproduces the crash in debug mode (everything works in release mode). bug.zip

Ok. I haven't debugged like that for a long time... I'll try to remember...

GWRon commented 3 weeks ago
0x0000000000802e3a in bbThreadGetData (index=2) at /home/ronny/Arbeit/Tools/BlitzMaxNG/mod/brl.mod/blitz.mod/blitz_thread.c:83
83      BBObject * data = bbThreadGetCurrent()->data[index]

There it fails for me.


Import Audio.AudioMiniAudio

Local sound:TSound=LoadSound( "ambient_0.ogg",SOUND_LOOP|SOUND_STREAM )
Print "sound loaded"
Local ch:TChannel=PlaySound( sound )
Print "play sound"
Local last:Int = MilliSecs()
Local s:Int = 0
Repeat
    Print "loop"
    If MilliSecs() > last + 1000
        last = MilliSecs()
        s :+ 1
        Print 1
    EndIf
    Delay(10)
Until s > 100
Print "end"

I see 2 loops printed in the debug build until it segfaults. As the crashing behaviour already cries out: this is most probably an error happening in "C-Land" (so in the generated C code, in wrapped library C-Code, ...)

Might be something directly in "soloud.mod/soloud/src/backend/miniaudio".

mingwya commented 3 weeks ago

I get a pop-up window "EXCEPTION_ACCESS_VIOLATION" but the program continues to run - "loop" is printed all the time without stopping, after pressing the ok button - the operating system offers to terminate the program abnormally.

GWRon commented 3 weeks ago

You are on windows right? Maybe on your computer Os the main thread is not stopped in such a problematic situation.

If you enable gdb debug builds and recompile brl.mod and audio.mod (so it contains gdb information too) then execute gdb (it is in the mingw bin folder) and once you see the crash you might enter "bt" for a backtrace. Dunno if it halts at all ...if your main thread is still "looping".

Selecting the soloudaudio backend instead might solve your issues for now (while the miniaudio one is still..apparent).

mingwya commented 3 weeks ago

Yes. 32 bit Windows 8.1.

As far as I remember... -> "bmk makemods -a -gdb brl" ?

mingwya commented 3 weeks ago

I can't figure out how to rebuild modules in GDB mode... playsound

GWRon commented 2 weeks ago

if you enter "bt" after the crash <gdb> bt then it will show you the backtrace "how it reached there".

mingwya commented 2 weeks ago

I failed to compile BRL and Audio modules in GDB mode. But there is some information... bt