Closed drewc5131 closed 4 years ago
Without having looked at the report yet, I can take a guess at the issue: you've probably stored the .ogg file compressed in the multifile, but that makes them unseekable, and audio implementations usually require audio streams to be seekable. When multifying, you need to store them uncompressed (.ogg already has its own compression, so double-compression makes not much sense anyway).
There's a threshold for audio size below which Panda buffers the entire sound into memory rather than streaming them from disk, which explains why you have no trouble with shorter sounds. You can tweak this threshold with a Config.prc variable, I think.
According to this piece of code:
for i in range(mf.getNumSubfiles()):
print(f'Subfile {mf.getSubfileName(i)} is: {"compressed" if mf.isSubfileCompressed(i) else "not compressed"}')
The files in the zip attached to this issue are:
Subfile music/nether1.ogg is: not compressed
Subfile music/test.ogg is: not compressed
This is the best I can do, as I don't have FMOD installed myself...
Nope, I used no compression args with the multifile command. Just -c. It only happens if the audio is loaded with readWrite, just read works perfectly
Can you build and try https://github.com/darktohka/panda3d/tree/misc/multifile-rework ? See if loading your music files works.
No promises, still a WIP, but please try it when you can.
Can you run
from panda3d.core import Notify, NSSpam
Notify.ptr().getCategory('fmodAudio').setSeverity(NSSpam)
before you try to load the audio? What does Panda print?
openReadWrite prints
E:\Testing\ResourcePackBug>c:\Panda3D-1.11.0-py37-x64\python\python.exe -m main
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:audio:fmodAudio(debug): Streaming /e/Testing/ResourcePackBug/music/nether1.ogg from disk (music.mf, 93, 2731933)
:audio(error): createSound(/e/Testing/ResourcePackBug/music/nether1.ogg): Error loading file.
openRead prints
E:\Testing\ResourcePackBug>c:\Panda3D-1.11.0-py37-x64\python\python.exe -m main
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:audio:fmodAudio(debug): Streaming /e/Testing/ResourcePackBug/music/nether1.ogg from disk (music.mf, 93, 2731933)
So im not getting any new information
Can you build and try https://github.com/darktohka/panda3d/tree/misc/multifile-rework ? See if loading your music files works.
No promises, still a WIP, but please try it when you can.
Build times for my pc are quite long, I dont have a ton of free time right now, and I was forced to reset windows so I am missing some SDKs so I won't be able to get back to you on this for a bit, so if anyone else can test this that would be very much appreciated, if not, I can get back to you in a day or 2
We pass sounds that are stored in multifiles to FMOD by giving it the name of the file and the offset within the file. Then FMOD can open it again.
However, my suspicion is that Windows locks the .mf file when opening it for writing, so that when we pass the file info to FMOD, it is then unable to open it on its own.
We also have a separate bit of load code that uses a callback interface for FMOD to read the file via Panda's VFS mechanisms, used when having FMOD directly read from the multifile is not an option. I think we should just fall back to that case if FMOD reports being unable to open the file.
You can work around the problem by increasing the value of fmod-audio-preload-threshold
high enough to preload the entire sound into memory rather than use the streaming interface. You can set it to -1 to mean "infinite".
I have no idea whether the locking theory is correct (I have my doubts), but I did verify that the fix I suggested (falling back to the callback case) does actually work. Going to check it in for 1.10.7.
Description
When trying to play music that is loaded from a multifile using openReadWrite, many audio files refuse to load and throw a vague "Error loading file" error. This only happens when using FMOD but doesn't happen with ALL files.
I included 2 .ogg files in the included .mf file. nether1.ogg, from minecraft doesnt work. test.ogg, which is Alchemists Tower by Kevin Macleod, works fine.
Simply changing openReadWrite to openRead fixes this (or changing to OpenAL, but that does not allow for the advanced sound effects provided by FMOD), however, for custom user made resource packs to be loaded into a game, its optimal to use openReadWrite so we can remove file extensions that aren't allowed to be modified, like .bam.
A popular Toontown server currently encounters this bug preventing users from changing the music. That game uses FMOD as it has special audio effects in some places, so simply reverting to OpenAL would not be ideal. It also needs to prevent .bam modifications so people cant modify level geometry to exploit the game.
Something I have noticed is that files under approximately 1 megabyte work fine, but over approximately 1 megabyte encounter this error. This theory is backed up by the 2 files i included. nether1.ogg is 2,731,933 bytes, while test.ogg is 999,434 bytes
Steps to Reproduce
I have included a .py file and a .mf file to test.
ResourcePackBug.zip
Environment