01-24-2012 10:41 AM
I was trying to set the volume for a sound using the mmr_* API functions, this is what I was trying:
char vol[MAX_PATH]; sprintf(vol, "%d", volume); strm_dict_t *dict = strm_dict_new(); dict = strm_dict_set(dict, "volume", vol); if (dict) mmr_output_parameters(ctxt, audio_oid, dict);
it does not work, anyone knows what is wrong or how should it be done ?
01-25-2012 01:41 PM - edited 01-25-2012 01:43 PM
The PlayAudio sample shows how you can set the audio volume:
The method this sample uses to change the volume is:
01-25-2012 04: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.
01-26-2012 09:09 AM
01-26-2012 09:49 AM
I would, but I have a game almost ready to release, and I like to stick to 1.0 for a while to maximize potential user base.
btw, there is no way to loop audio using mmr API, is it ?, I'm surprised on that, such functionallity is a must.
01-26-2012 02:34 PM
You can listen for the current audio to stop then restart it:
I will post back if I discover another way to do this.
01-26-2012 02:43 PM
I just discovered mmr_input_parameters(), you can pass parameters to tell it to repeat the same track:
01-26-2012 03:23 PM
already tried that (listen if audio stopped), but again, it seems is not available on NDK 1.0
the work around I might try is: just keep calling mmr_play, I noticed that once the audio starts to play, subsecuent calls to mmr_play do nothing unless the audio has finished playing, making it to start again.