OpenAL and buttons' rolloverSound

Hello, I’ve a problem with my code. I report a minimal example to show this. I’m using Panda 1.7.0.

If I run the following code, it crashes.

import direct.directbase.DirectStart
from direct.gui.DirectButton import DirectButton
DirectButton( rolloverSound = loader.loadSfx( 'foo.ogg' ) )
run()

Instead, if I run with fmod, it works:

from panda3d.core import loadPrcFileData
loadPrcFileData('', 'audio-library-name p3fmod_audio')
import direct.directbase.DirectStart
from direct.gui.DirectButton import DirectButton
DirectButton( rolloverSound = loader.loadSfx( 'foo.ogg' ) )
run()

The problem is that I prefer to use OpenAL, but it crashes. How can I solve this? Thanks!

Works for me…
Can you try on another PC?

You’re right! I tried on a Snow Leopard machine and there it works. What could be? I’m on a Windows Seven (64 bit) machine. The problem is that the application crashes without any message, so I have no hints to infer the reason.

Try setting your debugging output a bit more verbose:
panda3d.org/manual/index.php/Log_Messages

Thanks! With FMod it works and I obtain (I copy only the audio part):

[...]
:audio(debug): create_AudioManager()
  audio_library_name="p3fmod_audio"
:audio(debug):   dl_name="libp3fmod_audio.so"
:audio(debug): symbol of get_audio_manager_func_fmod_audio = 070E8970
:audio(debug): Create_FmodAudioManager()
:express(debug): Converted 'C:\Windows\system32\drivers\GM.DLS' from registry to 'C:\Windows\system32\drivers\GM.DLS'
:audio(debug): create_AudioManager()
  audio_library_name="p3fmod_audio"
:audio(debug): Create_FmodAudioManager()
:express(debug): Converted 'C:\Windows\system32\drivers\GM.DLS' from registry to 'C:\Windows\system32\drivers\GM.DLS'
:express:clock(spam): time 1.23282 tod 1.2344 corrected time 1.23282
:express:clock(spam): time 1.23292 tod 1.2344 corrected time 1.23292
:util(debug): Adjusting global clock's real time by 0.422381 seconds.
:express:clock(spam): time 1.23303 tod 1.2344 corrected time 1.23303
:express:clock(spam): time 1.23309 tod 1.2344 corrected time 1.23309
:pgraph(spam): find_matches pass: 0 NodePaths, 1, 7000
    (dataRoot):(match_many),0
:pgraph(spam): find_matches pass: 0 NodePaths, 1, 6999
    (dataRoot/____HID_VID_046D_PID_C050.7_21b3b3d2_0_0000):(match_many),0
    (dataRoot/____Root_RDP_MOU.0000):(match_many),0
    (dataRoot/keyboard_mouse):(match_many),0
    (dataRoot/____HID_VID_046D_PID_C050.7_21b3b3d2_0_0000): solution!
    (dataRoot/____Root_RDP_MOU.0000): solution!
    (dataRoot/keyboard_mouse): solution!
:task(debug): Adding PythonTask resetPrevTransform
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask resetPrevTransform with sort -51 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask dataLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask dataLoop with sort -50 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask ivalLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask ivalLoop with sort 20 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask collisionLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask collisionLoop with sort 30 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask igLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask igLoop with sort 50 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask audioLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask audioLoop with sort 60 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask eventManager
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask eventManager with sort 0 to chain default with current_sort -2147483647
:audio(debug): FmodAudioSound::FmodAudioSound() Creating new sound, filename: /c/Users/flavio/Desktop/button/foo.ogg
:audio(debug): FmodAudioSound::FmodAudioSound() Creating new sound, filename: /c/Panda3D-1.7.0/models/audio/sfx/GUI_rollover.wav
:audio(debug): FmodAudioSound::FmodAudioSound() Creating new sound, filename: /c/Panda3D-1.7.0/models/audio/sfx/GUI_click.wav
[...]

With OpenAL I obtain:

:audio(debug): create_AudioManager()
  audio_library_name="p3openal_audio"
:audio(debug):   dl_name="libp3openal_audio.so"
:audio(debug): symbol of get_audio_manager_func_openal_audio = 074505C0
:audio(debug): Create_OpenALAudioManager()
:audio(debug): create_AudioManager()
  audio_library_name="p3openal_audio"
:audio(debug): Create_OpenALAudioManager()
:express:clock(spam): time 3.37404 tod 3.36961 corrected time 3.3736
:express:clock(spam): time 3.3796 tod 3.36961 corrected time 3.37916
:express:clock(spam): time 3.38683 tod 3.38721 corrected time 3.38638
:util(debug): Adjusting global clock's real time by 0.496961 seconds.
:express:clock(spam): time 3.39986 tod 3.40021 corrected time 3.39943
:express:clock(spam): time 3.40948 tod 3.41021 corrected time 3.40907
:ShowBase: __dev__ == 0
:pgraph(spam): find_matches pass: 0 NodePaths, 1, 7000
    (dataRoot):(match_many),0
:pgraph(spam): find_matches pass: 0 NodePaths, 1, 6999
    (dataRoot/____HID_VID_046D_PID_C050.7_21b3b3d2_0_0000):(match_many),0
    (dataRoot/____Root_RDP_MOU.0000):(match_many),0
    (dataRoot/keyboard_mouse):(match_many),0
    (dataRoot/____HID_VID_046D_PID_C050.7_21b3b3d2_0_0000): solution!
    (dataRoot/____Root_RDP_MOU.0000): solution!
    (dataRoot/keyboard_mouse): solution!
:task(debug): Adding PythonTask resetPrevTransform
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask resetPrevTransform with sort -51 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask dataLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask dataLoop with sort -50 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask ivalLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask ivalLoop with sort 20 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask collisionLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask collisionLoop with sort 30 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask igLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask igLoop with sort 50 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask audioLoop
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask audioLoop with sort 60 to chain default with current_sort -2147483647
:task(debug): Adding PythonTask eventManager
:event(debug): Throwing event TaskManager-addTask(PythonTask)
:task(spam): Adding PythonTask eventManager with sort 0 to chain default with current_sort -2147483647

… and it crashes. I don’t understand the problem… :frowning:

I can’t test at the moment, but can you try loading the sound before it is used? Like this:

import direct.directbase.DirectStart
from direct.gui.DirectButton import DirectButton
mysound = loader.loadSfx('foo.ogg')
DirectButton(rolloverSound=mysound)
run()

Thanks, I tried your code but it has exactly the same behaviour. :frowning: