mme_setrandom()

Sets the random playback mode for a control context

Synopsis:

#include <mme/mme.h>

int mme_setrandom( mme_hdl_t *hdl,
                   int mode );

Arguments:

hdl
An MME connection handle.
mode
The random mode. For a list of random modes, see mmme_mode_random_t.

Library:

mme

Description:

The function mme_setrandom() sets the random playback mode for a control context. Tracks are played in pseudo-random order (using the QDB random() function), and won't be repeated until all the tracks in the track session have already been played.

Clearing a track session

You can clear a track session by:


Note: A random or repeat mode setting only works if the external device supports the setting. If the external device doesn't support the requested setting, the MME logs a warning and continues playback.


Caution: A call to mme_settrksession() or mme_set_msid_resume_trksession() regenerates the pseudo-random list the MME uses for random mode playback.

Switching modes

The following describes how the MME plays through a track session when it switches between random and sequential modes, assuming that repeat mode is off.

When the MME switches the track session from sequential to random mode it:

When the MME switches the track session from random to sequential mode it:

If the client application calls mme_setrandom() when the track session is already in random mode, the MME clears all random history and:

For information about how the MME counts tracks played, see mme_trksession_get_info().


Caution: The client application should always call the function mme_trksession_get_info() immediately after switching between random and sequential modes. Changing the random mode resets the value of current_trk, and if the client application doesn't update this information with mme_trksession_get_info() the client application can't know where it is in the track session.

Events

MME_EVENT_RANDOMCHANGE when the function has completed work.

Blocking and validation

This function blocks on control contexts. If mme_setrandom() is called and another function is called before mme_setrandom() returns, the second function blocks on io-media until mme_setrandom() returns. If there are no other pending calls, mme_setrandom() returns without blocking on io-media.

Returns:

0
Success.
-1
An error occurred (errno is set).

Classification:

QNX Neutrino

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

mme_getrandom(), mme_getrepeat(), mme_getscanmode() mme_setrepeat(), mmme_mode_random_t, mmme_mode_repeat_t