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
Developer
AppStoreLover
Posts: 297
Registered: ‎10-30-2010
My Device: PlayBook

Helper libraries to play WAV/MP3 files?

[ Edited ]

I looked at the PlayWav and PlayAudio samples, it looks like there are a thousand lines just to play a single audio file. :manindifferent:

 As a programmer, I shouldn't have to worry about the underlying implementation of the code to achieve the need functionality. :mansurprised:

 

Is there a helper library that simplifies loading and playing of audio files?

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Helper libraries to play WAV/MP3 files?

The PlayWav sample uses less than 200 lines of code including opening and parsing the WAV headers, and is a pretty low-level implementation.  This is the sort of thing someone would use for playing sound effects in a game.  You would write this function once, and call it with different WAV buffers.  If you know your sample rates, etc. ahead of time, then you can skip half of the code.  The example is generic enough to be more flexible than that.

 

If all you want to do is play an audio file (eg. the user selects an mp3 and you play it for them), you can use the mm-renderer interface which the PlayAudio sample code uses.  The code is only about 10 lines to open mm-renderer and pass it a URL to the file you want to play.

 

So different use-cases require different levels of implementation complexity.  It just depends on what you are trying to accomplish.

 

Cheers,

Sean

Please use plain text.
Developer
AppStoreLover
Posts: 297
Registered: ‎10-30-2010
My Device: PlayBook

Re: Helper libraries to play WAV/MP3 files?

[ Edited ]

I'm trying to play an mp3, without knowing any of it's technical details. 

 

How can I include the mmrenderer / any extra library to a new project in QNX Momentics IDE? It fails to compile because it can't find the symbols. 'undefined reference to mmr_...'

Please use plain text.
New Contributor
haxpor
Posts: 4
Registered: ‎03-04-2012
My Device: Developer with no real device

Re: Helper libraries to play WAV/MP3 files?

I have tested with "Play Wav" test project bundle with the IDE and can't hear any sound playing by the simulator.

I successfully compiled and load into a simulator.

 

Do you have any suggestion ?

Please use plain text.
BlackBerry Development Advisor (Retired)
hlatif
Posts: 1
Registered: ‎10-24-2011
My Device: 9810

Re: Helper libraries to play WAV/MP3 files?

What version of the NDK and simualtor did you try this on? 2.0.0.7971? You may have to adjust the volume settings in the "Sounds and Notifications" options menu.

Please use plain text.