Assertion failure when music manager is used

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:
(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\", line 1961, in __audioLoop
AssertionError: !_in->fail() at line 103 of c:\buildslave\sdk-windows-i386\build\dtool\src\prc\streamReader.cxx
Traceback (most recent call last):
  File "", line 29, in <module>
  File "E:\projects\python\game\lib\site-packages\direct\showbase\", line 3109, in run
  File "E:\projects\python\game\lib\site-packages\direct\task\", line 531, in run
  File "E:\projects\python\game\lib\site-packages\direct\task\", line 485, in step
  File "E:\projects\python\game\lib\site-packages\direct\showbase\", line 1961, in __audioLoop
AssertionError: !_in->fail() at line 103 of c:\buildslave\sdk-windows-i386\build\dtool\src\prc\streamReader.cxx

i load the music like the following:

def load_menumusic(self, fn):
		self.menumusic = base.loader.loadMusic(Filename.fromOsSpecific(fn))
		self.menumusic_loaded = True

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.

Is the music file encrypted or compressed in the multifile?

Is the multifile with the sound something you can share with us or do you not have the permission to distribute it?

  1. 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!.
  2. it is a bit large to upload.
    but if it is required, i can place the sound into a multifile and upload it.

Here is how i load the multifile object from the Showbase:

		# load the resource file = Multifile()"sounds.dat")
		#set the encryption stuff"FicnzieoBjvnxmz")
		# mount the resource manager
		if not VirtualFileSystem.getGlobalPtr().mount(, ".", VirtualFileSystem.MFReadOnly):
			error("the resource file could not be loaded")

and, here is how i pack the resource file by using multify:

multify -9 -ep "FicnzieoBjvnxmz" -v audio -c -f sounds.dat

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.

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.

it was inn ogg, which i converted that in wav in order to support compression and encryption to make it a bit secure.

I’ll see what I can do to support looping in this case in Panda.

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.

Perhaps I may revisit this in the future.

it is possible to load and decrypt it into memory and then instead of reopening it, it will be possible to use it. this is true for other files.

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.