private void updateSpinningSample(ValueChangedEvent <bool> tracking) { // note that samples will not start playing if exiting a seek operation in the middle of a spinner. // may be something we want to address at a later point, but not so easy to make happen right now // (SkinnableSound would need to expose whether the sample is already playing and this logic would need to run in Update). if (tracking.NewValue && ShouldPlaySamples) { spinningSample?.Play(); spinningSample?.VolumeTo(1, 200); } else { spinningSample?.VolumeTo(0, 200).Finally(_ => spinningSample.Stop()); } }
public void TestStoppedSoundDoesntResumeAfterPause() { DrawableSample sample = null; AddStep("start sample with looping", () => { sample = skinnableSound.ChildrenOfType <DrawableSample>().First(); skinnableSound.Looping = true; skinnableSound.Play(); }); AddUntilStep("wait for sample to start playing", () => sample.Playing); AddStep("stop sample", () => skinnableSound.Stop()); AddUntilStep("wait for sample to stop playing", () => !sample.Playing); AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true); AddStep("resume gameplay clock", () => gameplayClock.IsPaused.Value = false); AddWaitStep("wait a bit", 5); AddAssert("sample not playing", () => !sample.Playing); }
protected override void PopOut() { base.PopOut(); pauseLoop.VolumeTo(0, TRANSITION_DURATION, Easing.OutQuad).Finally(_ => pauseLoop.Stop()); }