Record Channel: Spice-GTK Reference Manual

## Record Channel Record Channel — audio stream for recording |

## Stability Level

Stable, unless otherwise indicated

## Functions

void | spice_record_send_data ()

## Properties

gboolean | mute | Read / Write
guint | nchannels | Read / Write
gpointer | volume | Read / Write

## Signals

void | record-start | Run First
void | record-stop | Run First

## Types and Values

struct | SpiceRecordChannel
struct | SpiceRecordChannelClass

## Object Hierarchy

        GObject
        ╰── SpiceChannel
            ╰── SpiceRecordChannel

## Includes

    #include <channel-record.h>

## Description

SpiceRecordChannel class handles an audio recording stream. The audio stream should start when “record-start” is emitted and should be stopped when “record-stop” is received.

The audio is sent to the guest by calling `spice_record_send_data()` with the recorded PCM data.

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

## Functions

### spice_record_send_data ()

    void
    spice_record_send_data (SpiceRecordChannel *channel,
                            gpointer data,
                            gsize bytes,
                            guint32 time);

Send recorded PCM data to the guest.

#### Parameters

data | PCM data |
bytes | size of `data` |
time | stream timestamp |

## Types and Values

### struct SpiceRecordChannel

    struct SpiceRecordChannel;

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

### struct SpiceRecordChannelClass

    struct SpiceRecordChannelClass {
        SpiceChannelClass parent_class;

        /* signals */
        void (*record_start)(SpiceRecordChannel *channel,
                             gint format, gint channels, gint freq);
        void (*record_data)(SpiceRecordChannel *channel, gpointer *data, gint size);
        void (*record_stop)(SpiceRecordChannel *channel);
    };

Class structure for SpiceRecordChannel.

#### Members

SpiceChannelClass `parent_class`; | Parent class. |
`record_start` () | Signal class handler for the “record-start” signal. |
`record_data` () | Unused (deprecated). |
`record_stop` () | Signal class handler for the “record-stop” signal. |

## Property Details

### The `“mute”` property

      “mute”                     gboolean

Mute.

Flags: Read / Write

Default value: FALSE

### The `“nchannels”` property

      “nchannels”                guint

Number of Channels.

Flags: Read / Write

Allowed values: <= 255

Default value: 2

### The `“volume”` property

      “volume”                   gpointer

Flags: Read / Write

## Signal Details

### The `“record-start”` signal

    void
    user_function (SpiceRecordChannel *channel,
                   gint                format,
                   gint                channels,
                   gint                rate,
                   gpointer            user_data)

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

#### Parameters

channel | the SpiceRecordChannel 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. |

Flags: Run First

### The `“record-stop”` signal

    void
    user_function (SpiceRecordChannel *channel,
                   gpointer            user_data)

Notify when the recording should stop.

#### Parameters

channel | the SpiceRecordChannel that emitted the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run First

## See Also

SpiceChannel, and SpiceAudio