[gnome-boxes/introduce-audio-for-vnc-connections: 9/9] vnc-display: Implement audio playback




commit 87452e8acf6fd15e1efdd295b131ae585aa5db8d
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Mar 15 16:55:26 2021 +0100

    vnc-display: Implement audio playback

 src/vnc-display.vala | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/src/vnc-display.vala b/src/vnc-display.vala
index bf639a86..dde1d05f 100644
--- a/src/vnc-display.vala
+++ b/src/vnc-display.vala
@@ -23,6 +23,8 @@
         display.set_force_size (false);
         display.set_scaling (true);
 
+        set_enable_audio (true);
+
         // the VNC widget doesn't like not to have a realized window,
         // so we put it into a window temporarily
         window = new Gtk.Window ();
@@ -113,6 +115,19 @@ public VncDisplay (BoxConfig config, string host, int port) {
     }
 
     public override void set_enable_audio (bool enable) {
+        var connection = display.get_connection ();
+        if (!enable) {
+            connection.audio_disable ();
+
+            return;
+        }
+
+        connection.set_audio_format (new Vnc.AudioFormat () {
+            frequency = 44100,
+            nchannels = 2
+        });
+        connection.set_audio (new Vnc.AudioPulse ());
+        connection.audio_enable ();
     }
 
     public override Gdk.Pixbuf? get_pixbuf (int n) throws Boxes.Error {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]