[Openal] Get current volume for a source

The Big Uno the.big.uno at gmail.com
Mon Jun 8 09:25:27 PDT 2009


Jason Daly wrote:
> The Big Uno wrote:
>> Hello all,
>>
>> I am trying to implement a VU Meter style widget by pulling the 
>> currently playing volume of a given source.  Note that this is not 
>> the gain of the source; I want the number to be either the raw value 
>> of the sound frame at the time I call the function, or the raw value 
>> * current gain set for the source.  Does anyone have an idea on what 
>> function I could call for this?
>>
>> I would like to get this value for just a certain source, not the 
>> entire OpenAL environment.  The VU meters I am making are going to be 
>> on a per-channel level, with each source logically mapped to a 
>> certain channel.  Think of the giant mixing boards with a VU meter 
>> for each input source for an idea of what I am trying to do here.
>>   
>
> The only way to do this is to retain your own copy of each source's 
> buffer data after you pass it to OpenAL, and then get the current 
> position of each source as you update your meter.  You can either call 
> alGetIntegerv with AL_SAMPLE_OFFSET or AL_BYTE_OFFSET, or you can call 
> alGetFloatv or alGetDoublev with AL_SEC_OFFSET, whichever you prefer.
>
>
>> (On a side note, I am actually using JOAL - Java wrappers for the 
>> OpenAL functions - which I believe is currently using the OpenAL 1.0 
>> specification.  The JOAL methods map quite closely to the underlying 
>> OpenAL API, which is why I am asking here and not on the JOAL 
>> forums.  If you can get me the OpenAL function, that would be good 
>> enough for me.)
>>   
>
> Oh, then you're out of luck.  The AL_*_OFFSET queries are 1.1 
> features.  As far as I know, there isn't any reliable way to do what 
> you want in OpenAL 1.0.
>
> --"J"
>

Thanks for your help, I guess I will have to wait for Joal to get to 1.1 
(or find another wrapper library).

Cheers


More information about the Openal mailing list