LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.67k stars 631 forks source link

Problem while using AL_EFFECT_EQUALIZER #787

Closed noryon closed 1 year ago

noryon commented 1 year ago

Version

3.3.1

Platform

Windows x64

JDK

openjdk-16.0.1

Module

OpenAL

Bug description

I'm trying to develop sound effects, but theres is this untraceable error while trying to use equalizer. I have tested every other effect (if i just replace _AL_EFFECTEQUALIZER, to _AL_EFFECTECHO or any other effect, the code works perfecly). Minimal test:


public static void main(String[] args) {
        device = ALC10.alcOpenDevice((ByteBuffer)null);
        if(device == NULL){
            throw new IllegalStateException("Failed to open OpenAL device");
        }
        ALCCapabilities deviceCaps = ALC.createCapabilities(device);

        if(!ALC10.alcIsExtensionPresent(device, "ALC_EXT_EFX")){
            throw new IllegalStateException("Device has no EFX extension.");
        }

        long context = ALC10.alcCreateContext(device, (int[])null);
        ALC10.alcMakeContextCurrent(context);
        if(context == NULL){
            throw new IllegalStateException("Failed to open the OpenAL context.");
        }
        AL.createCapabilities(deviceCaps);

        //Request the available auxiliary sends
        int[] arr = new int[1];
        ALC10.alcGetIntegerv(device, EXTEfx.ALC_MAX_AUXILIARY_SENDS, arr);
        int maxAuxiliarySends = arr[0];

        System.out.println("Max Auxiliary Sends per source: "+maxAuxiliarySends);

        int source = AL10.alGenSources();
        int buffer = requestBuffer("tra"); //load buffer with stb_vorbis
        int auxEffSlot = EXTEfx.alGenAuxiliaryEffectSlots();
        int effect = EXTEfx.alGenEffects();
        //Set effect type
        EXTEfx.alEffecti(effect, EXTEfx.AL_EFFECT_TYPE, EXTEfx.AL_EFFECT_EQUALIZER); //<- change effect type
        //Attach the effect to the slot
        EXTEfx.alAuxiliaryEffectSloti(auxEffSlot, EXTEfx.AL_EFFECTSLOT_EFFECT, effect);
        //Attach the source to the the slot
        AL11.alSource3i(source, EXTEfx.AL_AUXILIARY_SEND_FILTER, auxEffSlot, 0, EXTEfx.AL_FILTER_NULL);
        //Attach the buffer to the source
        AL10.alSourcei(source, AL_BUFFER, buffer);

        AL10.alSourcePlay(source);
        int err = ALC10.alcGetError(device);
        if(err != ALC10.ALC_NO_ERROR){
            throw new Error("ALC ERROR: "+err);
        }
        while(alGetSourcei(source, AL_SOURCE_STATE) == AL_PLAYING){

        }
    }

Running with ALSOFT_LOGLEVEl=3 through the CMD I have the attached stacktrace data, it just cease to run and does nothing, no poping sound or error messages. Running through the IDE (netbeans) i have a exception I have no ideia and could'n find nothing substantial about it. The error code is always the same. alGetError() or alcGetError() never catch any problems.


    org.apache.commons.exec.ExecuteException: Process exited with an error: -1073741819 (Exit value: -1073741819)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:982)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:929)
    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:457)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

Stacktrace or crash log output

[ALSOFT] (II) Initializing library v1.21.1-2290817 master
[ALSOFT] (II) Supported backends: wasapi, dsound, winmm, null, wave
[ALSOFT] (II) Loading config ...\alsoft.ini...
[ALSOFT] (II) Got binary: ...\jdk-16.0.1\bin, java.exe
[ALSOFT] (II) Loading config ...\jdk-16.0.1\bin\alsoft.ini...
[ALSOFT] (II) Key disable-cpu-exts not found
[ALSOFT] (II) Vendor ID: "AuthenticAMD"
[ALSOFT] (II) Name: "AMD Phenom(tm) II X6 1100T Processor"
[ALSOFT] (II) Extensions: +SSE +SSE2 +SSE3 -SSE4.1
[ALSOFT] (II) Key rt-prio not found
[ALSOFT] (II) Key resampler not found
[ALSOFT] (II) Key trap-al-error not found
[ALSOFT] (II) Key trap-alc-error not found
[ALSOFT] (II) Key reverb/boost not found
[ALSOFT] (II) Key drivers not found
[ALSOFT] (II) Starting message thread
[ALSOFT] (II) Message thread initialization complete
[ALSOFT] (II) Starting message loop
[ALSOFT] (II) Initialized backend "wasapi"
[ALSOFT] (II) Added "wasapi" for playback
[ALSOFT] (II) Added "wasapi" for capture
[ALSOFT] (II) Key excludefx not found
[ALSOFT] (II) Key default-reverb not found
[ALSOFT] (II) Got message "Open Device" (0x0000, this=000002217893D728)
[ALSOFT] (II) Key channels not found
[ALSOFT] (II) Key sample-type not found
[ALSOFT] (II) Key frequency not found
[ALSOFT] (II) Key period_size not found
[ALSOFT] (II) Key periods not found
[ALSOFT] (II) Key sources not found
[ALSOFT] (II) Key slots not found
[ALSOFT] (II) Key sends not found
[ALSOFT] (II) Key ambi-format not found
[ALSOFT] (II) Created device 00000221797D7B20, "OpenAL Soft on Headphones (High Definition Audio Device)"
[ALSOFT] (II) Key hrtf not found
[ALSOFT] (II) Pre-reset: Stereo, Float32, 44100hz, 882 / 2646 buffer
[ALSOFT] (II) Got message "Reset Device" (0x0001, this=000002217893D728)
[ALSOFT] (II) Requesting playback format:
    FormatTag      = 0xfffe
    Channels       = 2
    SamplesPerSec  = 48000
    AvgBytesPerSec = 384000
    BlockAlign     = 8
    BitsPerSample  = 32
    Size           = 22
    Samples        = 32
    ChannelMask    = 0x3
    SubFormat      = {00000003-0000-0010-8000-00aa00389b71}
[ALSOFT] (II) Post-reset: Stereo, Float32, 48000hz, 960 / 2880 buffer
[ALSOFT] (II) Key stereo-mode not found
[ALSOFT] (II) Key hrtf-paths not found
[ALSOFT] (II) Searching ...\target\*.mhr
[ALSOFT] (II) Searching ...\Roaming\openal\hrtf\*.mhr
[ALSOFT] (II) Searching ...\openal\hrtf\*.mhr
[ALSOFT] (II) Adding built-in entry "!1_Built-In HRTF"
[ALSOFT] (II) Key default-hrtf not found
[ALSOFT] (II) Loading !1_Built-In HRTF...
[ALSOFT] (II) Detected data set format v3
[ALSOFT] (II) Resampling HRTF Built-In HRTF (44100hz -> 48000hz)
[ALSOFT] (II) Loaded HRTF Built-In HRTF for sample rate 48000hz, 35-sample filter
[ALSOFT] (II) Key hrtf-size not found
[ALSOFT] (II) Key hrtf-mode not found
[ALSOFT] (II) 1st order + Full HRTF rendering enabled, using "Built-In HRTF"
[ALSOFT] (II) Channel config, Main: 4, Real: 2
[ALSOFT] (II) Allocating 6 channels, 24576 bytes
[ALSOFT] (II) Skipped delay: 8.00, new max delay: 24.75, FIR length: 60
[ALSOFT] (II) Key decoder/nfc not found
[ALSOFT] (II) Max sources: 256 (255 + 1), effect slots: 64, sends: 2
[ALSOFT] (II) Key dither not found
[ALSOFT] (II) Key dither-depth not found
[ALSOFT] (II) Dithering disabled
[ALSOFT] (II) Key output-limiter not found
[ALSOFT] (II) Output limiter disabled
[ALSOFT] (II) Fixed device latency: 5333333ns
[ALSOFT] (II) Got message "Start Device" (0x0002, this=000002217893D728)
[ALSOFT] (II) Increasing allocated voices to 256
[ALSOFT] (II) Key volume-adjust not found
[ALSOFT] (II) Created context 00000221797F75E0
Max Auxiliary Sends per source: 2
21216431 1 44100
Spasi commented 1 year ago

Hey @noryon,

It's a bug in OpenAL Soft, fixed 2 days ago: https://github.com/kcat/openal-soft/issues/738. The next 3.3.2 snapshot will include the fix.

noryon commented 1 year ago

Thank you! @Spasi I did search on the openal issues but did'nt found anything related. My ineptitude :D. All good.