hi,
I want to load a music for my menu, and play it as looped
it loads for the first time, plays successfully, while the music is near it’s end, or finishes, it gives me this assertion falure error:
Known pipe types:
wglGraphicsPipe
(2 aux display modules not yet loaded.)
Assertion failed: !_in->fail() at line 103 of c:\buildslave\sdk-windows-i386\build\dtool\src\prc\streamReader.cxx
:task(error): Exception occurred in PythonTask audioLoop
Traceback (most recent call last):
File "E:\projects\python\game\lib\site-packages\direct\showbase\ShowBase.py", line 1961, in __audioLoop
self.musicManager.update()
AssertionError: !_in->fail() at line 103 of c:\buildslave\sdk-windows-i386\build\dtool\src\prc\streamReader.cxx
Traceback (most recent call last):
File "game.py", line 29, in <module>
game.run()
File "E:\projects\python\game\lib\site-packages\direct\showbase\ShowBase.py", line 3109, in run
self.taskMgr.run()
File "E:\projects\python\game\lib\site-packages\direct\task\Task.py", line 531, in run
self.step()
File "E:\projects\python\game\lib\site-packages\direct\task\Task.py", line 485, in step
self.mgr.poll()
File "E:\projects\python\game\lib\site-packages\direct\showbase\ShowBase.py", line 1961, in __audioLoop
self.musicManager.update()
AssertionError: !_in->fail() at line 103 of c:\buildslave\sdk-windows-i386\build\dtool\src\prc\streamReader.cxx
panda3d: 1.10.2, python 3.7.3 32 bit, windows 10 64 bit
also, i have placed my sound into a multifile and the multifile loads successfully without any problem.
thanks for your help.
yes encrypted and compressed
also, i’ve set the encryption mechanism in my code to load it, and it works well!.
because, when i move through the menu, it plays the movement and selection sounds, and it even plays the music for the first time!.
it is a bit large to upload.
but if it is required, i can place the sound into a multifile and upload it.
thanks.
Here is how i load the multifile object from the Showbase:
# load the resource file
self.sm = Multifile()
self.sm.openRead("sounds.dat")
#set the encryption stuff
self.sm.setEncryptionFlag(True)
self.sm.setEncryptionPassword("FicnzieoBjvnxmz")
# mount the resource manager
if not VirtualFileSystem.getGlobalPtr().mount(self.sm, ".", VirtualFileSystem.MFReadOnly):
error("the resource file could not be loaded")
and, here is how i pack the resource file by using multify:
hi again,
i have loaded the sound file from the given directory without pack file being mounted, and it worked!. but with pack files, it doesn’t work and i get the assertion failure exception.
thanks.
What format is the sound file in, exactly? Is it .wav, .flac, …?
You should note that it is generally not possible to seek in encrypted or compressed multifiles, and therefore, looping may also not be permitted. However, I wonder if we can support looping in some cases by simply reopening the compression/decryption stream.
I’ve investigated this. I’ve checked in a series of changes that, among other things, make looping compressed .wav files possible. These fixes will be in the upcoming 1.10.3 release.
As for encrypted .wav files, it is more difficult, but it will still be able to do this by reopening the .wav file entirely; this may only cause a small performance chug when the sound is restarted.
Actually, I think I figured out how to easily support looping in encrypted streams. I will be checking this in tomorrow and it will be part of the 1.11.0 release.