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
My Carrier: other

Multimedia renderer: REPEAT/LOOP Audio?

I am assuming I should set it via: mmr_output_parameters.

 

But there is no useful information in the headers about 

strm_dict_t 

 

int mmr_output_parameters( mmr_context_t *ctxt, unsigned output_id, strm_dict_t *parms );

//currently
strm_dict_t *aoparams = NULL; // output parameters

 

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

Re: Multimedia renderer: REPEAT/LOOP Audio?

[ Edited ]

Related question:

 

How to find out the state of audio playback? (playing, stopped, idle)

 

 

Monitoring the context state

The header file mmrenderer.h in the BPS library provides functions that allow your application to monitor the multimedia renderer's state changes. For example, it provides functions that allow the application to:

determine the context state (playing, stopped, idle)
For details about these functions, refer to the bps/mmrenderer.h header file.

 I checked the  mmrenderer header file, I could not find a single occurence of the word 'state'. :manmad:

The documentation is useless.

 

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

Re: Multimedia renderer: REPEAT/LOOP Audio?

These questions have been addressed in previous threads on this forum.  Please use the search feature.

 

here is one thread:

http://supportforums.blackberry.com/t5/Native-SDK-for-BlackBerry-Tablet/how-to-set-volume-to-mmrende...

 

Cheers,

Sean

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

Re: Multimedia renderer: REPEAT/LOOP Audio?

[ Edited ]

Would it be possible to reuse the sound context object to replay the audio once it has played?

I tried doing:

 

mmr_play(soundctx); 

 

But it doesn't seem to work. Some times I get "I/O invalid operation"

 

I always have to do mmr_disconnect. Which causes about half a second of freezing.

Then create a new mmr_connect, input_attach and play and disconnect. The only way I can get the sound effect to play again is by disconnecting from the mmrenderer and starting from the beginning.

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

Re: Multimedia renderer: REPEAT/LOOP Audio?

Have you tried mmr_stop() / mmr_start() ?

Cheers,
Sean
Please use plain text.
Developer
AppStoreLover
Posts: 297
Registered: ‎10-30-2010
My Device: PlayBook
My Carrier: other

Re: Multimedia renderer: REPEAT/LOOP Audio?

[ Edited ]
I have tried that as well as mmr_seek "0:0".
It doesn't play the sound again Did you mean mmr_stop and mmr_play? What's the mmr_start method?
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: Multimedia renderer: REPEAT/LOOP Audio?

Yes, mmr_play() was what I meant.

If you care to boil your code down to a simple case that is failing, maybe we can look closer at it.

Also, if you are not already using the 2.0 NDK, you may want to consider trying it out, as I believe you can specify that a track should be repeated:

https://bdsc.webapps.blackberry.com/native/beta/reference/com.qnx.doc.mme.mmrenderer/topic/mmr_api/m...

 

Cheers,

Sean

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

Re: Multimedia renderer: REPEAT/LOOP Audio?

I've asked the mm-renderer guys to provide an updated PlayAudio example code with "repeat" set.  Will post the diff when I have it.

 

Cheers,

Sean

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

Re: Multimedia renderer: REPEAT/LOOP Audio?

Okay!

Here is an explanation of how to loop an mp3 file using mm-renderer.

I am using the PlayAudio example from NDK-Samples here:

https://github.com/blackberry/NDK-Samples/tree/master/PlayAudio

 

Changes are applied to main.c.

 

The first change is to set inputtype="autolist" instead of "track":

    const char *inputtype = "autolist";

This is needed because the "repeat" input parameter can only be applied to playlists or autolists -- not to individual tracks.  This inputtype argument gets passed in to mmr_input_attach() later.

 

Next, you need to define an input parameters list:

    strm_dict_t *aiparams = strm_dict_new();
    aiparams = strm_dict_set(aiparams, "repeat", "all");

This creates an empty strm_dict_t list and then adds a "repeat=all" entry to it.

 

Finally, you need to push this input parameter list to mm-renderer using mmr_input_parameters().. see the lines marked "//NEW" below.  Make sure to set the parameters after your call to mmr_input_attach():

    } else if ( mmr_input_attach( ctxt, inputurl, inputtype ) < 0 ) {
        mmrerror( ctxt, inputurl );
    } else if ( aiparams && mmr_input_parameters( ctxt, aiparams ) ) {  // NEW
    	mmrerror( ctxt, "input parameters (audio)" );  // NEW
    } else if ( mmr_play( ctxt ) < 0 ) {
        mmrerror( ctxt, "mmr_play" );

 

And that's it.  Your MP3 file (or whatever format you are using) will now play on a loop until you stop it.

 

Cheers,

Sean

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

Re: Multimedia renderer: REPEAT/LOOP Audio?

[ Edited ]

Awesome! Can't wait for the official stable release of 2.0 NDK (still using 1.0).

 

Where is the documentation for the other parameters for strmdict? like this

"repeat"

 

 

Please use plain text.