add volume control to video

pull/20/head
cosmonaut 2022-08-02 11:11:45 -07:00
parent dc7e68fecc
commit c5b9ff1677
1 changed files with 12 additions and 1 deletions

View File

@ -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;