Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 26
Registered: ‎06-27-2012
My Device: Playbook
My Carrier: n/a

How do I set audio gain in the MediaPlayer?

As I stream various URLs one after the next, I need to adjust the audio gain per stream. Is this possible? Is there a way to do this, perhaps through OpenAL?

Posts: 127
Registered: ‎02-27-2012
My Device: Bold
My Carrier: Rogers

Re: How do I set audio gain in the MediaPlayer?


I am assuming you were you able to figure this out? Yes, currently the Cascades MediaPlayer API doesn't allow controlling low level settings such as "gain". Both C mmrenderer API and Cascades MediaPlayer API (which is a wrapper over the C mmrenderer API); they weren't designed for making audio editing/mixing applications where low level functionalities might be required; they were mainly designed for playback and streaming (say watching movies).

You can however set the gain via OpenAl. Note that that the OpenAl headers come bundled with the SDK and I'm sure you already know of the "pullmybeard" Cascades sample app which shows the basic usage. That source code project app comes bundled with the IDE and is also available here: https://github.com/blackberry/Cascades-Samples/tree/master/pullmybeard


You can take a look at the following function for OpenAL (taken from "pullmybeard"):

            alSourcef(source, AL_GAIN, gain);




Posts: 1,636
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: How do I set audio gain in the MediaPlayer?



I notice that while playing a sound and then I start the audio recorder the sounds is muted.


Is there a reason? It works fine if I play the sound using the media control but not using the AL apis.