From 85a49d512a7d7dbe5c1e3be26916c6e3cafa6252 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Mon, 23 May 2011 12:20:17 +0200 Subject: sndworker: add AudioVolume/AudioMute messages These messages allow the guest to send the audio device volume to the client. It uses an arbitrary scale of 16bits, which works good enough for now. Save VolumeState in {Playback,Record}State, so that we can send the current volume on channel connection. Note about future improvements: - add exact dB support - add client to guest volume change Updated since v2: - bumped record and playback interface minor version to allow conditional compilation Updated since v1: - sync record volume on connection too --- common/messages.h | 9 +++++++++ spice.proto | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/common/messages.h b/common/messages.h index 6fcd8be..8151dc0 100644 --- a/common/messages.h +++ b/common/messages.h @@ -369,6 +369,15 @@ typedef struct SpiceMsgcMouseRelease { int32_t buttons_state; } SpiceMsgcMouseRelease; +typedef struct SpiceMsgAudioVolume { + uint8_t nchannels; + uint16_t volume[0]; +} SpiceMsgAudioVolume; + +typedef struct SpiceMsgAudioMute { + uint8_t mute; +} SpiceMsgAudioMute; + typedef struct SpiceMsgPlaybackMode { uint32_t time; uint32_t mode; //SPICE_AUDIO_DATA_MODE_? diff --git a/spice.proto b/spice.proto index 6160de1..80c40d4 100644 --- a/spice.proto +++ b/spice.proto @@ -926,6 +926,15 @@ enum16 audio_fmt { S16, }; +message AudioVolume { + uint8 nchannels; + uint16 volume[nchannels] @end; +}; + +message AudioMute { + uint8 mute; +}; + channel PlaybackChannel : BaseChannel { server: message { @@ -947,6 +956,8 @@ channel PlaybackChannel : BaseChannel { } start; Empty stop; + AudioVolume volume; + AudioMute mute; }; channel RecordChannel : BaseChannel { @@ -958,6 +969,8 @@ channel RecordChannel : BaseChannel { } start = 101; Empty stop; + AudioVolume volume; + AudioMute mute; client: message { uint32 time; -- cgit v1.2.3