08-10-2012 06:46 PM
The code you provided for mmr worked for me, I just plugged it into the PlayAudio sample at line 150 of main.c:
strm_dict_t *dict = strm_dict_new(); dict = strm_dict_set(dict, "volume", "50"); if (dict) mmr_output_parameters(ctxt, audio_oid, dict);
This successfully resulted in the output audio volume being halved. I used the NDK 2.0 Beta 3.
I have tried this approach with the playbook 2.0.1 ndk ( i too need to set the mmr volume independantly of other audio) and while the volume is changing - it doesn't appear to be linear from 0->100. It ramps down quickly from "100", and a volume of "50" seems to be almost silent.
I couldn't really find any documentation on this - is this scale supposed to be linear? (ie 0 silent, 100 full) Is there something else I might be missing? Thanks!
08-10-2012 07:38 PM
OK, to answer my own question: based on trying a few things out, it does seem like the volume response is non-linear.
if you have a simple scalar volume from 0->1 then I beleive the value you send to the mmr should be:
float db_vol = 100.f + (20.0f * log10f(vol));
ie. 100 is full volume and attenuation is in dB.
If this is not the intended behavior(perhaps a bug in the version - 2.0.1 - of the sdk i am using?) then someone let me know!! If it is intended, then it would be nice for it to be documented somewhere