## Playback Channel Playback Channel — audio stream for playback |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #include <channel-playback.h>

    struct              SpicePlaybackChannel;
    struct              SpicePlaybackChannelClass;
    void                spice_playback_channel_set_delay    (SpicePlaybackChannel *channel,
                                                             guint32 delay_ms);

## Object Hierarchy

      GObject
       +----SpiceChannel
             +----SpicePlaybackChannel

## Properties

      "mute"                     gboolean              : Read / Write
      "nchannels"                guint                 : Read / Write
      "volume"                   gpointer              : Read / Write

## Signals

      "playback-data"                                  : Run First
      "playback-get-delay"                             : Run First
      "playback-start"                                 : Run First
      "playback-stop"                                  : Run First

## Description

SpicePlaybackChannel class handles an audio playback stream. The audio data is received via "playback-data" signal, and is controlled by the guest with "playback-stop" and "playback-start" signal events.

Note: You may be interested to let the SpiceAudio class play and record audio channels for your application.

## Details

### struct SpicePlaybackChannel

    struct SpicePlaybackChannel;

The SpicePlaybackChannel struct is opaque and should not be accessed directly.

### struct SpicePlaybackChannelClass

    struct SpicePlaybackChannelClass {
        SpiceChannelClass parent_class;

        /* signals */
        void (*playback_start)(SpicePlaybackChannel *channel,
                               gint format, gint channels, gint freq);
        void (*playback_data)(SpicePlaybackChannel *channel, gpointer *data, gint size);
        void (*playback_stop)(SpicePlaybackChannel *channel);
    };

Class structure for SpicePlaybackChannel.

SpiceChannelClass `parent_class`; | Parent class.
`playback_start` () | Signal class handler for the "playback-start" signal.
`playback_data` () | Signal class handler for the "playback-data" signal.
`playback_stop` () | Signal class handler for the "playback-stop" signal.

### spice_playback_channel_set_delay ()

    void                spice_playback_channel_set_delay    (SpicePlaybackChannel *channel,
                                                             guint32 delay_ms);

## Property Details

### The `"mute"` property

      "mute"                     gboolean              : Read / Write

Mute.

Default value: FALSE

### The `"nchannels"` property

      "nchannels"                guint                 : Read / Write

Number of Channels.

Allowed values: <= 255

Default value: 2

### The `"volume"` property

      "volume"                   gpointer              : Read / Write

Playback volume.

## Signal Details

### The `"playback-data"` signal

    void                user_function                      (SpicePlaybackChannel *channel,
                                                            gpointer              data,
                                                            gint                  data_size,
                                                            gpointer              user_data)      : Run First

Provide audio data to be played.

`channel` : | the SpicePlaybackChannel that emitted the signal
`data` : | pointer to audio data
`data_size` : | size in byte of `data`
`user_data` : | user data set when the signal handler was connected.

### The `"playback-get-delay"` signal

    void                user_function                      (SpicePlaybackChannel *channel,
                                                            gpointer              user_data)      : Run First

Notify when the current playback delay is requested

`channel` : | the SpicePlaybackChannel that emitted the signal
`user_data` : | user data set when the signal handler was connected.

### The `"playback-start"` signal

    void                user_function                      (SpicePlaybackChannel *channel,
                                                            gint                  format,
                                                            gint                  channels,
                                                            gint                  rate,
                                                            gpointer              user_data)      : Run First

Notify when the playback should start, and provide audio format characteristics.

`channel` : | the SpicePlaybackChannel that emitted the signal
`format` : | a SPICE_AUDIO_FMT
`channels` : | number of channels
`rate` : | audio rate
`user_data` : | user data set when the signal handler was connected.

### The `"playback-stop"` signal

    void                user_function                      (SpicePlaybackChannel *channel,
                                                            gpointer              user_data)      : Run First

Notify when the playback should stop.

`channel` : | the SpicePlaybackChannel that emitted the signal
`user_data` : | user data set when the signal handler was connected.

## See Also

SpiceChannel, and SpiceAudio