AL_EXT_source_distance_model revisit

View: New views
4 Messages — Rating Filter:   Alert me  

AL_EXT_source_distance_model revisit

by Chris Robinson-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Poking about this one, first.

http://kcat.strangesoft.net/openal-extensions/EXT_source_distance_model.txt

Seems to be the simplest to handle, as it just makes a given source's distance
calculation use a source property value instead of the context property value.
Any issues with it that I may have missed? If not, I can go ahead and finalize
it.
_______________________________________________
Openal-devel mailing list
Openal-devel@...
http://opensource.creative.com/mailman/listinfo/openal-devel

Re: AL_EXT_source_distance_model revisit

by Bob Aron :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

• What happens when some of the sources are set to something other than the default and then the application calls alDistanceModel()?

Do all the sources then switch to the new default? including those that had been explicitly set to some 'non-default' distance model already. If not, then the source object will have to maintain state not only for which distance model it should be using, but also whether it was explicitly set.

• What is the purpose of having different distance models for each source?

-bob


On Oct 15, 2009, at 10:21 AM, Chris Robinson wrote:

Poking about this one, first.

http://kcat.strangesoft.net/openal-extensions/EXT_source_distance_model.txt

Seems to be the simplest to handle, as it just makes a given source's distance
calculation use a source property value instead of the context property value.
Any issues with it that I may have missed? If not, I can go ahead and finalize
it.
_______________________________________________
Openal-devel mailing list
Openal-devel@...
http://opensource.creative.com/mailman/listinfo/openal-devel

____________________________________________
CoreAudio Team  Apple Inc.  


_______________________________________________
Openal-devel mailing list
Openal-devel@...
http://opensource.creative.com/mailman/listinfo/openal-devel

Re: AL_EXT_source_distance_model revisit

by Chris Robinson-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 15 October 2009 11:11:24 am Bob Aron wrote:
> • What happens when some of the sources are set to something other
> than the default and then the application calls alDistanceModel()?

All existing and newly-generated sources are set to the model given to
alDistanceModel, regardless if anything specific was set on the source.
Normally an app shouldn't use alDistanceModel if it's also using
AL_EXT_source_distance_model (except perhaps to set a global default on
initialization), so I don't think it really matters. Having alDistanceModel
simply reset all sources seems to be the simplest method while maintaining
backwards compatibility with code not aware of the extension. Especially since
there would be no way to "unset" a specific model to make alDistanceModel
affect it again.

> • What is the purpose of having different distance models for each
> source?

Different sounds may want different rolloff properties. For instance, some
sounds may want to follow a more natural inverse distance rolloff, while
others may want to use linear or a manual method to ensure reaching 0/min gain
at max distance (without losing EFX air absorption).

_______________________________________________
Openal-devel mailing list
Openal-devel@...
http://opensource.creative.com/mailman/listinfo/openal-devel

Parent Message unknown Re: AL_EXT_source_distance_model revisit

by Chris Robinson-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 19 October 2009 3:20:30 pm you wrote:
> You never know how a developer will decide to use a published API :-)
> So while 'normally' you probably wouldn't use these 2 mechanisms
> together, almost certainly someone will, so it's important to document
> the expected behavior.

Right. And in that case, alDistanceModel will reset every source's distance
model, whether one was explicitly set on it or not. It needs to reset the
model for generated sources to maintain backwards compatibility, and I don't
personally see a reason to special-case sources that had a distance model
explicitly set.

Though if people recommends otherwise, I won't complain too much. It's just an
extra flag per source that's set in alSourcei[v] with AL_DISTANCE_MODEL, and
checked in alDistanceModel.


Or perhaps another option I just thought of.. have an alEnable/alDisable
context state for per-source distance models. When disabled (default) the
context's model is used, otherwise the source's model is. Then alDistanceModel
has no explicit effect on source state, but the enable says which should be
used. Eg:

alSourcei(sID, AL_DISTANCE_MODEL, AL_LINEAR_DISTANCE_CLAMPED);
alDistanceModel(AL_NONE);
... AL_NONE is used for all sources ...

alEnable(AL_SOURCE_DISTANCE_MODEL);
... now linear distance clamped is used for sID, inverse distance clamped for
other sources ...

alDisable(AL_SOURCE_DISTANCE_MODEL);
... now AL_NONE is used for all sources ...

alGetSourceiv(sID, AL_DISTANCE_MODEL, &val);
... gives val == AL_LINEAR_DISTANCE_CLAMPED ...
_______________________________________________
Openal-devel mailing list
Openal-devel@...
http://opensource.creative.com/mailman/listinfo/openal-devel