Welcome!

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

Reply
Contributor
Jaime_Barrachina
Posts: 21
Registered: ‎10-25-2012
My Carrier: None
Accepted Solution

Multiple audio sounds

Hello all,

this community has been very helpful recently so I thought I'd see if someone here can give me a few hints with my current problem.

 

I'm trying to interface a custom multiplatform library, let's call it L, with the audio system in BB, where L acts like a wrapper around BB, and has the following functionalities (rough sketch).

 

class L
{
  list_of_audio_channels lac;
  Init();
  Play(sound, which_audio_chanel);
  Stop(sound, which_audio_channel);
  Volume(sound, which_audio_channel, volume);
  Exit();
}

 

 

Where a sound can be set to play in a particular channel, stopped, changed volume, etc. And a sound can be in any supported format.

 

My problem is I'm a bit lost at the moment. The two existing BB audio samples use what appear to be different libraries (one has everything prefixed with snd_pcm_xxx and the other one with  mmr_xxx), and both only play one single sample. 

 

If anyone can give me some rough guidelines on what functions / structure I should be looking to be able to make a library that plays multiple sounds simultaneously, in multiple channels, and how to initialize such library, I'd be really helpful.

 

I'm not an audio programmer, and my knowledge in the area is limited, so maybe I'm missing something obvious in the samples / docs that would help me build this system without too much fuss. 

 

Thank you for the help,

Jaime

 

PS: If I haven't explained something clearly enough please let me know. 

Please use plain text.
Developer
useful
Posts: 26
Registered: ‎09-23-2012
My Carrier: tnl

Re: Multiple audio sounds

Use this example here.
http://developer.blackberry.com/native/documentation/recipe_play_audio_1935324_11.html
If determining a new value for ctxt_name you can play multiple sounds at once.

Please use plain text.
Contributor
Jaime_Barrachina
Posts: 21
Registered: ‎10-25-2012
My Carrier: None

Re: Multiple audio sounds

Thank you for the reply, that was helpful, but I already got it working with OpenAl, which was a lot easier to understand for me.
Please use plain text.
Contributor
hamlatzis
Posts: 24
Registered: ‎08-06-2012
My Carrier: Cosmote

Re: Multiple audio sounds

I've followed your sample but now I have a question how can I determine if a particular sound is playing or not?

I've found the API mmrenderer_event_get_state but I don't see a way to distinguish between the different sounds?

Any help?
Please use plain text.
Developer
useful
Posts: 26
Registered: ‎09-23-2012
My Carrier: tnl

Re: Multiple audio sounds

I use for this
if ((ctxt = mmr_context_create (connection, ctxt_name, 0, mode))

If the flow exists, the sound plays.

Please use plain text.
Contributor
hamlatzis
Posts: 24
Registered: ‎08-06-2012
My Carrier: Cosmote

Re: Multiple audio sounds

Unfortunately in my case it want do. I call mmr_context_create for all my sounds during game's initialisation stage, so even if the sound isn't playing mmr_context_create will return null when I try to check if a sound is playing

Please use plain text.