|
Hans de Goede |
56753f |
From a9f796f670f3c34c3b5874026b61bbe4d782be2e Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
56753f |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@gmail.com>
|
|
Hans de Goede |
56753f |
Date: Tue, 17 Apr 2012 14:32:40 +0200
|
|
Hans de Goede |
56753f |
Subject: [PATCH 506/509] audio/spice: add support for volume control
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Use Spice server volume control API when available.
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
|
|
Hans de Goede |
56753f |
Signed-off-by: malc <av1474@comtv.ru>
|
|
Hans de Goede |
56753f |
---
|
|
Hans de Goede |
56753f |
audio/spiceaudio.c | 41 +++++++++++++++++++++++++++++++++++++++++
|
|
Hans de Goede |
56753f |
1 file changed, 41 insertions(+)
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c
|
|
Hans de Goede |
56753f |
index f972110..6f15591 100644
|
|
Hans de Goede |
56753f |
--- a/audio/spiceaudio.c
|
|
Hans de Goede |
56753f |
+++ b/audio/spiceaudio.c
|
|
Hans de Goede |
56753f |
@@ -202,7 +202,26 @@ static int line_out_ctl (HWVoiceOut *hw, int cmd, ...)
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
spice_server_playback_stop (&out->sin);
|
|
Hans de Goede |
56753f |
break;
|
|
Hans de Goede |
56753f |
+ case VOICE_VOLUME:
|
|
Hans de Goede |
56753f |
+ {
|
|
Hans de Goede |
56753f |
+#if ((SPICE_INTERFACE_PLAYBACK_MAJOR >= 1) && (SPICE_INTERFACE_PLAYBACK_MINOR >= 2))
|
|
Hans de Goede |
56753f |
+ SWVoiceOut *sw;
|
|
Hans de Goede |
56753f |
+ va_list ap;
|
|
Hans de Goede |
56753f |
+ uint16_t vol[2];
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ va_start (ap, cmd);
|
|
Hans de Goede |
56753f |
+ sw = va_arg (ap, SWVoiceOut *);
|
|
Hans de Goede |
56753f |
+ va_end (ap);
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ vol[0] = sw->vol.l / ((1ULL << 16) + 1);
|
|
Hans de Goede |
56753f |
+ vol[1] = sw->vol.r / ((1ULL << 16) + 1);
|
|
Hans de Goede |
56753f |
+ spice_server_playback_set_volume (&out->sin, 2, vol);
|
|
Hans de Goede |
56753f |
+ spice_server_playback_set_mute (&out->sin, sw->vol.mute);
|
|
Hans de Goede |
56753f |
+#endif
|
|
Hans de Goede |
56753f |
+ break;
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
return 0;
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
@@ -304,7 +323,26 @@ static int line_in_ctl (HWVoiceIn *hw, int cmd, ...)
|
|
Hans de Goede |
56753f |
in->active = 0;
|
|
Hans de Goede |
56753f |
spice_server_record_stop (&in->sin);
|
|
Hans de Goede |
56753f |
break;
|
|
Hans de Goede |
56753f |
+ case VOICE_VOLUME:
|
|
Hans de Goede |
56753f |
+ {
|
|
Hans de Goede |
56753f |
+#if ((SPICE_INTERFACE_RECORD_MAJOR >= 2) && (SPICE_INTERFACE_RECORD_MINOR >= 2))
|
|
Hans de Goede |
56753f |
+ SWVoiceIn *sw;
|
|
Hans de Goede |
56753f |
+ va_list ap;
|
|
Hans de Goede |
56753f |
+ uint16_t vol[2];
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ va_start (ap, cmd);
|
|
Hans de Goede |
56753f |
+ sw = va_arg (ap, SWVoiceIn *);
|
|
Hans de Goede |
56753f |
+ va_end (ap);
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ vol[0] = sw->vol.l / ((1ULL << 16) + 1);
|
|
Hans de Goede |
56753f |
+ vol[1] = sw->vol.r / ((1ULL << 16) + 1);
|
|
Hans de Goede |
56753f |
+ spice_server_record_set_volume (&in->sin, 2, vol);
|
|
Hans de Goede |
56753f |
+ spice_server_record_set_mute (&in->sin, sw->vol.mute);
|
|
Hans de Goede |
56753f |
+#endif
|
|
Hans de Goede |
56753f |
+ break;
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
return 0;
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
@@ -337,6 +375,9 @@ struct audio_driver spice_audio_driver = {
|
|
Hans de Goede |
56753f |
.max_voices_in = 1,
|
|
Hans de Goede |
56753f |
.voice_size_out = sizeof (SpiceVoiceOut),
|
|
Hans de Goede |
56753f |
.voice_size_in = sizeof (SpiceVoiceIn),
|
|
Hans de Goede |
56753f |
+#if ((SPICE_INTERFACE_PLAYBACK_MAJOR >= 1) && (SPICE_INTERFACE_PLAYBACK_MINOR >= 2))
|
|
Hans de Goede |
56753f |
+ .ctl_caps = VOICE_VOLUME_CAP
|
|
Hans de Goede |
56753f |
+#endif
|
|
Hans de Goede |
56753f |
};
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
void qemu_spice_audio_init (void)
|
|
Hans de Goede |
56753f |
--
|
|
Hans de Goede |
56753f |
1.7.10
|
|
Hans de Goede |
56753f |
|