clarkezone / audiovisualizer

A UWP audio visualization component that provides a stream analyzer and XAML visualization controls for displaying VU and spectrum meters powered by Win2D
MIT License
121 stars 26 forks source link

CustomVisualizer doesn't behave similar as CanvasAnimatedControl #43

Closed xiaosu-zhu closed 6 years ago

xiaosu-zhu commented 6 years ago

Looks like CustomVisualizer is a Win2D UIElement CanvasAnimatedControl, but in CanvasAnimatedControl, it has many properties and methods and events that CustomVisualizer doesn't.

Such as CanvasAnimatedControl.Paused that can pause the drawing loop and many others in CanvasAnimatedControl Class

Also, memory leaks in CanvasAnimatedControl may also occur in CustomVisualizer, please see Avoiding memory leaks

tonuv commented 6 years ago

CustomVisualizer is based on SwapPanel but not CanvasAnimatedControl, there indeed is no way to pause the draw loop, however you can set the property of IsSuspended property on VisualizationSource to suspend processing. You can also figure out if the source is rendering audio from the VisualizationSource PlaybackState property. This will not stop draw loop however you can look at these properties and do nothing in the draw event handler

xiaosu-zhu commented 6 years ago

Got it. I didn't look deep in the code, I will use these tricks to pause drawing.