From c5b9ff16774766892169d157cea3d369d32d358b Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 2 Aug 2022 11:11:45 -0700 Subject: [PATCH] add volume control to video --- src/Video/Video.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Video/Video.cs b/src/Video/Video.cs index bdcc66e..01dba5b 100644 --- a/src/Video/Video.cs +++ b/src/Video/Video.cs @@ -19,7 +19,17 @@ namespace MoonWorks.Video internal IntPtr Handle; public bool Loop { get; private set; } - public float Volume { get; private set; } + public float Volume { + get => volume; + set + { + volume = value; + if (audioStream != null) + { + audioStream.Volume = value; + } + } + } public float PlaybackSpeed { get; set; } public double FramesPerSecond => fps; private VideoState State = VideoState.Stopped; @@ -43,6 +53,7 @@ namespace MoonWorks.Video private AudioDevice AudioDevice = null; private StreamingSoundTheora audioStream = null; + private float volume = 1.0f; private Stopwatch timer; private double lastTimestamp;