AL_INVALID_NAME when generating Sources

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

AL_INVALID_NAME when generating Sources

Bertrahm
This post was updated on .
Im currently working on building a AudioEngine for my game engine and have finished everything for it. Now when I want to generate a source (AL.alGenSources) AL errors with "AL_INVALID_NAME". How can this error be caused? And how would I go about fixing it? Here are the files:

AudioEngine.java
Listener.java
Source.java
Sound.java

The error is caught in AudioEngine.java on line 67.

Wir sind Schaufensterpuppen|Twitter
Reply | Threaded
Open this post in threaded view
|

Re: AL_INVALID_NAME when generating Sources

gouessej
Administrator
Hello

src.source is null, it can't work.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: AL_INVALID_NAME when generating Sources

Xerxes Rånby
This post was updated on .
In reply to this post by Bertrahm
Your alGenBuffers line is incorrect, it passes AE_SOUNDS.keySet().size()  that is 0 when you load the first sound; to the function argument that specify the number of buffers to generate, that should always be 1 as you are only loading 1 sound, thus creating 1 new buffer at a time,
in AudioEngine loadSound replace
AE_AL.alGenBuffers(AE_SOUNDS.keySet().size(), s.buffer, 0);
with
AE_AL.alGenBuffers(1, s.buffer, 0);


this is discovered by looking for the AL lib: (WW) warnings when running the code:

AL lib: (WW) Error generated on context 0x7ffbd0303420, code 0xa001, "Invalid buffer ID 0"
An error occured whilst creating sound source: NAME "boing" ; AL_INVALID_NAME (alGenSources)
AL lib: (WW) Error generated on context 0x7ffbd0303420, code 0xa001, "Invalid source ID 4294967295"


it is OK to pass an array containing null to alGenSources as it is filled with the generated source id


I have uploaded a working example with a Run class with a main to playback two sounds at the same time here:
https://github.com/xranby/jogamp-forum-examples/tree/master/src/main/java
Reply | Threaded
Open this post in threaded view
|

Re: AL_INVALID_NAME when generating Sources

gouessej
Administrator
You're right, I misread his source code: "this.source = new int[1];" Yes his array isn't null.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: AL_INVALID_NAME when generating Sources

Bertrahm
In reply to this post by Xerxes Rånby
Thank you very much for your help with this topic. It works perfectly.
Wir sind Schaufensterpuppen|Twitter