Re: Channel Volume

Chris Perry <[email protected]> Wed, 1 Jun 2011 14:19:37 -0700
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
Hi SaiD91,

You can set the volume of a source with:
alSourcef( ALuint sid, AL_GAIN, ALfloat gain )

You can set the movement velocity of a source with:
alSource3f( ALuint sid, AL_VELOCITY, ALfloat vel_x, ALfloat vel_y, ALfloat vel_z );

You can set the listener's position (the virtual speaker) with:
alListener3f(AL_POSITION, ALfloat pos_x, ALfloat pos_y, ALfloat pos_z);

OpenAL defaults to the AL_INVERSE_DISTANCE_CLAMPED attenuation model, where:
distance = max(distance,AL_REFERENCE_DISTANCE); 
distance = min(distance,AL_MAX_DISTANCE); 
gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE));

The distance attenuation stuff only works with mono sounds (AL_FORMAT_MONO16)
A stereo sound (AL_FORMAT_STEREO16) will always play full volume

More info is here:
http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.pdf

I hope that helps!
-Chris


On Jun 1, 2011, at 4:18 AM, SaiD91 wrote:

> 
> Hi,
> Is there any chance to set up the Volume of a specific Channel?
> I want to take the distance between a moving Sound and a virtual Speaker(in
> Space), to calculate the volume of the Sound at that Speaker/Channel.
> I try to place my Speakers at Runtime. 
> I hope my English wasn't to bad.
> 
> Thanks,
> 
> SaiD91
> 
> 
> -- 
> View this message in context: http://old.nabble.com/Channel-Volume-tp31689663p31689663.html
> Sent from the OpenAL - User mailing list archive at Nabble.com.
> 
> _______________________________________________
> Openal mailing list
> [email protected]
> http://opensource.creative.com/mailman/listinfo/openal
>

_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal