Directional Sounds - Using the cone angles...

I was wanting to use directional sounds using JOAL. Reading the OpenAL docs, it appears the commands to specify my cone angles are:

AL_CONE_INNER_ANGLE
AL_CONE_OUTER_ANGLE

Which don’t seem to be implemented in JOAL. I then plan to use the setConeOuterGain function to specify gain falloff when outside the cone. Why would setConeOuterGain be implemented and not the cone angle settings (Considering that the default angle is 360 degrees).?

I don’t see that the cone angle specification is in JOAL. Is it implemented in another way? Am I missing something?

Any help would be appreciated!

Tubby

By ‘not implemented’, do you mean that they throw some exception when you try to use them? Or they just don’t seem to have any effect?

It’s probably me overlooking something, but I can’t see where that setting is implemented. I see a constant for these two…but how would I implement them for a particular source?

The OpenAL programmers guide has:
AL_CONE_OUTER_GAIN f, fv the gain when outside the oriented cone
AL_CONE_INNER_ANGLE f, fv, i, iv the gain when inside the oriented cone
AL_CONE_OUTER_ANGLE f, fv, i, iv outer angle of the sound cone, in degrees default is 360

So you’d use alSource(f/fv/i/iv) for those, eg:

al.alSourcef(sourceid, AL_CONE_INNER_ANGLE, 1f);
al.alSourcef(sourceid, AL_CONE_OUTER_ANGLE, 30f);
al.alSourcef(sourceid, AL_CONE_OUTER_GAIN, 1f);

(the float values I’m passing are just examples, I don’t even know if they’re valid)

Appreciate the information…I’ll try it!

Tubby

In my application, I created the source objects by instanciating the Source object. Everything is working fine, but how do I get a integer source id (sid)?

I must be missing something…

Tubby

So you’re using the sound3d package in JOAL?
Hmm you’re right, I don’t see a getSourceID() in there, or anything to give you the source ID of the Source. That’s quite annoying actually.

Maybe you could make your own Source object, one that’ll give you access to the source ID. Or, modify the source code of the existing JOAL sound3d package: source ID is a private final field in there, and it’d be a really quick change to add additional cone functions like you wanted, or to retrieve the source ID for other functions.

I will look into that. Thanks for the response. Maybe a nice feature for future upgrade?