GTNewHorizons / lwjgl3ify

A mod to run Minecraft 1.7.10 using LWJGL3 and Java 17+
GNU Lesser General Public License v3.0
171 stars 37 forks source link

Incompatability with SoundPhysics #60

Closed mist475 closed 10 months ago

mist475 commented 1 year ago

When lwgl3ify and sound physics are both installed the game uses the default audio instead of Sound Physics's. The issue probably lies in it's coremod but my knowledge of java byte code is not great enough to confirm this.

eigenraven commented 1 year ago

Looks like SP mixins into paulscode audio, which I redirect into my own package in the current version. Since I already fixed openal bindings in lwjglx, it should be safe to remove that lwjgl3ify module completely now, I'll do it for the next update

mist475 commented 1 year ago

Not fixed unfortunately, now it spams this in the logs (with debugging enabled)

[09:44:12] [Client thread/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:131]: Error in class 'ChannelLWJGL OpenAL'
[09:44:12] [Client thread/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:132]:     Invalid enumerated parameter value.
[09:44:12] [Thread-9/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:131]: Error in class 'SourceLWJGL OpenAL'
[09:44:12] [Thread-9/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:132]:     Invalid enumerated parameter value.

Every now and then the following is also printed:

[09:44:18] [Client thread/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:131]: Error in class 'ChannelLWJGL OpenAL'
[09:44:18] [Client thread/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:132]:     Invalid enumerated parameter value.
[09:44:18] [Thread-9/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:131]: Error in class 'LibraryLWJGLOpenAL'
[09:44:18] [Thread-9/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:132]:     alGenBuffers error when loading minecraft:sounds/step/stone5.ogg
[09:44:18] [Thread-9/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:131]: Error in class 'LibraryLWJGLOpenAL'
[09:44:18] [Thread-9/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:132]:     Source 'a7cdfa11-f80a-4353-aca3-3b040edefb28' was not created because an error occurred while loading minecraft:sounds/step/stone5.ogg
[09:44:18] [Thread-9/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:131]: Error in class 'LibraryLWJGLOpenAL'
[09:44:18] [Thread-9/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:132]:     Source 'a7cdfa11-f80a-4353-aca3-3b040edefb28' not found in method 'play'
[09:44:18] [Client thread/INFO] [STDOUT/]: [paulscode.sound.SoundSystemLogger:errorMessage:131]: Error in class 'ChannelLWJGL OpenAL'
mist475 commented 1 year ago

I've moved most of the asm to mixins, https://github.com/mist475/Sound-Physics/tree/1.7.10-backport Finding the issue should be a lot easier now

mist475 commented 1 year ago

In dev when trying to run runClient17 I get

Exception in thread "Sound Library Loader" [09:51:53] [Sound Library Loader/INFO]: [java.lang.Throwable$WrappedPrintStream:println:763]: java.lang.NoSuchMethodError: 'org.lwjglx.openal.ALCdevice org.lwjglx.openal.ALC10.alcGetContextsDevice(org.lwjglx.openal.ALCcontext)'
[09:51:53] [Sound Library Loader/INFO]: [java.lang.Throwable$WrappedPrintStream:println:763]:   at com.sonicether.soundphysics.SoundPhysics.setupEFX(SoundPhysics.java:263)
[09:51:53] [Sound Library Loader/INFO]: [java.lang.Throwable$WrappedPrintStream:println:763]:   at com.sonicether.soundphysics.SoundPhysics.init(SoundPhysics.java:106)
[09:51:53] [Sound Library Loader/INFO]: [java.lang.Throwable$WrappedPrintStream:println:763]:   at net.minecraft.client.audio.SoundManager$SoundSystemStarterThread.handler$zzf000$soundphysics$initSoundPhysics(SoundManager.java:621)
[09:51:53] [Sound Library Loader/INFO]: [java.lang.Throwable$WrappedPrintStream:println:763]:   at net.minecraft.client.audio.SoundManager$SoundSystemStarterThread.<init>(SoundManager.java:533)
[09:51:53] [Sound Library Loader/INFO]: [java.lang.Throwable$WrappedPrintStream:println:763]:   at net.minecraft.client.audio.SoundManager$SoundSystemStarterThread.<init>(SoundManager.java:555)
[09:51:53] [Sound Library Loader/INFO]: [java.lang.Throwable$WrappedPrintStream:println:763]:   at net.minecraft.client.audio.SoundManager$1.run(SoundManager.java:117)
[09:51:53] [Sound Library Loader/INFO]: [java.lang.Throwable$WrappedPrintStream:println:763]:   at java.base/java.lang.Thread.run(Thread.java:833)

For reference, that method is called here which is the issue here I think, weird it gave a different error when running out of dev though.

mist475 commented 1 year ago

75 fixes the binding issues when combined with https://github.com/mist475/Sound-Physics/pull/1

However, the

[14:38:47] [Thread-10/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:errorMessage:131]: Error in class 'ChannelLWJGL OpenAL'
[14:38:47] [Thread-10/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:errorMessage:132]:     Invalid enumerated parameter value.

problem still persists. This error is printed but the sounds do play correctly now

mist475 commented 11 months ago

Having done some more debugging I found the following:

Another observation which might help solve the problem is that the assigned slots vary between in gl2 seem to be global whereas the ones in gl3 are assigned per type: Gl 2 assigned info: auxFXSlot0 = 33 auxFXSlot1 = 34 auxFXSlot2 = 35 auxFXSlot3 = 36 reverb0 = 37 reverb1 = 38 reverb2 = 39 reverb3 = 40 directFilter0 = 41 sendFilter0 = 42; sendFilter1 = 42; sendFilter2 = 42; sendFilter3 = 42;

Gl3: auxFXSlot0 = 1 auxFXSlot1 = 2 auxFXSlot2 = 3 auxFXSlot3 = 4 reverb0 = 1 reverb1 = 2 reverb2 = 3 reverb3 = 4 directFilter0 = 1 sendFilter0 = 2; sendFilter1 = 3; sendFilter2 = 4; sendFilter3 = 5;

kappa-maintainer commented 10 months ago

It was caused by lwjglx not creating AL context with the correct properties. Just add attribs.put(EXTEfx.ALC_MAX_AUXILIARY_SENDS); attribs.put(4); to AL.create() and it should get rid of these errors