[Openal] Get current volume for a source

The Big Uno the.big.uno at gmail.com
Mon Jun 8 10:00:43 PDT 2009


>> (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"
>
Hmm, please disregard my previous comment - it appears that JOAL has 
AL_*_OFFSET queries defined, so it must be using 1.1.  I must have been 
looking at outdated documentation when I read that it was 1.0 only.

I am not sure about the methods alGet*v, though - from the documentation 
it appears that these are for querying global parameters, as they don't 
appear to accept a source pointer as a parameter (page 22, OpenAL 1.1 
Specification).  alGetSourcei seems to be more suited to this, and 
appears to work from my initial tests.  For anyone reading this list who 
may be using JOAL, below is my code:

        int[] position = new int[1];
        al.alGetSourcei(sources[0], AL.AL_BYTE_OFFSET, position, 0);
        System.out.println(position[0]);

This returns an ever- increasing number as it is queried every 100ms.  
 From here, it should be possible to find the current value in the buffer.

Thank you again Jason for putting me on the right track!

Cheers


More information about the Openal mailing list