02-02-2013 03:21 AM
Hello guys!
So my problem is that I'm working on alarm application and need to override system sound. So when user set his phone in silent mode my app still will play a sound.
Any help would be much appreciated!
Solved! Go to Solution.
02-03-2013 06:40 AM
Hiya,
This is definitley possible - you can use mmr_play() to play the audio once the context is set up, and you can set the system volume using:
rc = audiomixer_get_output_level(AUDIOMIXER_OUTPUT_SPEA
if (rc == BPS_SUCCESS) {
audiomixer_set_output_level(AUDIOMIXER_OUTPUT_SPEA
} else {
//Failed to query the output level
}
I recommend that after the alarm stops you set the sound back to the original so the user doesn't unexpectedly have everything on loud after the alarm (oldVolume is current volume level before any changes are made to the volume level in the above code).
I think this has to be done in C++ as system volume controls don't seem to be exposed yet in QML...
The Native PlayAudio example (which I think was actually for the PlayBook) is what you need to look at:
https://github.com/blackberry/NDK-Samples/tree/mas
Cheers!
02-11-2013 03:24 AM
Thanks a lot. That works!