aboutsummaryrefslogtreecommitdiff
path: root/audio/spiceaudio.c
diff options
context:
space:
mode:
authorKővágó, Zoltán <dirty.ice.hu@gmail.com>2019-10-13 21:58:01 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-10-18 08:14:05 +0200
commitcecc1e79bf9ad9a0e2d3ce513d4f71792a0985f6 (patch)
treee9f8f7dff995a409a5ec35258b1e013a805c09fb /audio/spiceaudio.c
parent337e8de6fbaa61b7dd14e6c29836673132891642 (diff)
audio: support more than two channels in volume setting
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Message-id: 5d3dd2ee3baaa62805e79c3901abb7415ae32461.1570996490.git.DirtY.iCE.hu@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/spiceaudio.c')
-rw-r--r--audio/spiceaudio.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c
index 9860f9c5e1..6ed7f7a79e 100644
--- a/audio/spiceaudio.c
+++ b/audio/spiceaudio.c
@@ -179,13 +179,14 @@ static void line_out_enable(HWVoiceOut *hw, bool enable)
}
#if ((SPICE_INTERFACE_PLAYBACK_MAJOR >= 1) && (SPICE_INTERFACE_PLAYBACK_MINOR >= 2))
-static void line_out_volume(HWVoiceOut *hw, struct mixeng_volume *vol)
+static void line_out_volume(HWVoiceOut *hw, Volume *vol)
{
SpiceVoiceOut *out = container_of(hw, SpiceVoiceOut, hw);
uint16_t svol[2];
- svol[0] = vol->l / ((1ULL << 16) + 1);
- svol[1] = vol->r / ((1ULL << 16) + 1);
+ assert(vol->channels == 2);
+ svol[0] = vol->vol[0] * 257;
+ svol[1] = vol->vol[1] * 257;
spice_server_playback_set_volume(&out->sin, 2, svol);
spice_server_playback_set_mute(&out->sin, vol->mute);
}
@@ -262,13 +263,14 @@ static void line_in_enable(HWVoiceIn *hw, bool enable)
}
#if ((SPICE_INTERFACE_RECORD_MAJOR >= 2) && (SPICE_INTERFACE_RECORD_MINOR >= 2))
-static void line_in_volume(HWVoiceIn *hw, struct mixeng_volume *vol)
+static void line_in_volume(HWVoiceIn *hw, Volume *vol)
{
SpiceVoiceIn *in = container_of(hw, SpiceVoiceIn, hw);
uint16_t svol[2];
- svol[0] = vol->l / ((1ULL << 16) + 1);
- svol[1] = vol->r / ((1ULL << 16) + 1);
+ assert(vol->channels == 2);
+ svol[0] = vol->vol[0] * 257;
+ svol[1] = vol->vol[1] * 257;
spice_server_record_set_volume(&in->sin, 2, svol);
spice_server_record_set_mute(&in->sin, vol->mute);
}