Logo Search packages:      
Sourcecode: pulseaudio version File versions  Download package

pa_operation* pa_context_play_sample ( pa_context c,
const char *  name,
const char *  dev,
pa_volume_t  volume,
pa_context_success_cb_t  cb,
void *  userdata 
)

Play a sample from the sample cache to the specified device. If the latter is NULL use the default sink. Returns an operation object

Parameters:
c  Context
name  Name of the sample to play
dev  Sink to play this sample on
volume  Volume to play this sample with
cb  Call this function after successfully starting playback, or NULL
userdata  Userdata to pass to the callback

Definition at line 88 of file scache.c.

References PA_CONTEXT_READY, PA_ERR_BADSTATE, PA_ERR_INVALID, and PA_INVALID_INDEX.

                                                                                                                                                       {
    pa_operation *o;
    pa_tagstruct *t;
    uint32_t tag;

    pa_assert(c);
    pa_assert(PA_REFCNT_VALUE(c) >= 1);

    PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
    PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
    PA_CHECK_VALIDITY_RETURN_NULL(c, !dev || *dev, PA_ERR_INVALID);

    o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);

    if (!dev)
        dev = c->conf->default_sink;

    t = pa_tagstruct_command(c, PA_COMMAND_PLAY_SAMPLE, &tag);
    pa_tagstruct_putu32(t, PA_INVALID_INDEX);
    pa_tagstruct_puts(t, dev);
    pa_tagstruct_putu32(t, volume);
    pa_tagstruct_puts(t, name);
    pa_pstream_send_tagstruct(c->pstream, t);
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);

    return o;
}


Generated by  Doxygen 1.6.0   Back to index