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




commit 78786651a7b6b12f1d6490e7bf789b2d3a9f0a55
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]