About the previous problem, I’ve solved using another function, thank you for the support!
But, I’ve an analogous problem, and maybe they’re related. I can’t load an audio file from a package. This is the file in the package:
$ multify -tvf MyModule.mf
1 subfiles:
129186 alarm.ogg
I’ve this code:
import direct.directbase.DirectStart
from panda3d.core import getModelPath
loader.loadSfx( '../MyModule/alarm.ogg' ).play()
loader.loadSfx( base.appRunner.multifileRoot + '../MyModule/alarm.ogg' ).play()
loader.loadSfx( '$MAIN_DIR/../MyModule/alarm.ogg' ).play()
loader.loadSfx( '$MYMODULE_ROOT/alarm.ogg' ).play()
loader.loadSfx( getModelPath().findFile( 'alarm.ogg' ) ).play()
run()
The first four loadSfxs give me:
:audio(error): createSound(/home/flavio/.panda3d/hosts/www.ya2.it_87f5f01a6deb8355/MyModule/alarm.ogg): Unsupported file or audio format.
:audio(error): createSound(/home/flavio/.panda3d/start../MyModule/alarm.ogg): File not found.
:audio(error): createSound($MAIN_DIR/../MyModule/alarm.ogg): File not found.
:audio(error): createSound($MYMODULE_ROOT/alarm.ogg): File not found.
The last loadSfx gives me:
Traceback (most recent call last):
File "/home/buildbot/slave/dev_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showbase/Messenger.py", line 415, in __taskChainDispatch
File "/home/buildbot/slave/dev_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showbase/Messenger.py", line 473, in __dispatch
File "/home/buildbot/slave/dev_rtdist_linux_amd64/build/panda3d/built_cmu/direct/p3d/AppRunner.py", line 745, in __startIfReady
File "VFSImporter", line 153, in load_module
File "/home/flavio/Scrivania/provasnd/main/main.py", line 7, in <module>
loader.loadSfx( getModelPath().findFile( 'alarm.ogg' ) ).play()
File "/home/buildbot/slave/dev_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showbase/Loader.py", line 638, in loadSfx
File "/home/buildbot/slave/dev_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showbase/Loader.py", line 683, in loadSound
TypeError: Arguments must match one of:
getSound(non-const AudioManager this, non-const MovieAudio source)
getSound(non-const AudioManager this, string file_name)
getSound(non-const AudioManager this, non-const MovieAudio source, bool positional)
getSound(non-const AudioManager this, string file_name, bool positional)
getSound(non-const AudioManager this, non-const MovieAudio source, bool positional, int mode)
getSound(non-const AudioManager this, string file_name, bool positional, int mode)
How can I load that file from the package? Thanks again!