A game framework written with osu! in mind.
at master 30 lines 860 B view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4namespace osu.Framework.Audio.Sample 5{ 6 /// <summary> 7 /// A <see cref="SampleChannel"/> which explicitly plays no audio. 8 /// Aimed for scenarios in which a non-null <see cref="SampleChannel"/> is needed, but one that doesn't necessarily play any sound. 9 /// </summary> 10 internal class SampleChannelVirtual : SampleChannel 11 { 12 private volatile bool playing = true; 13 14 public override bool Playing => playing; 15 16 protected override void UpdateState() 17 { 18 base.UpdateState(); 19 20 if (!Looping) 21 Stop(); 22 } 23 24 public override void Stop() 25 { 26 base.Stop(); 27 playing = false; 28 } 29 } 30}