Visualization: Reset buffer on playback stop

Reset the visualization system when stopping playback.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2023-10-03 19:32:40 -07:00
parent 0d682fef37
commit 416e77d220
2 changed files with 15 additions and 1 deletions

View file

@ -1347,7 +1347,10 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
}
#endif
outputController = nil;
visController = nil;
if(visController) {
[visController reset];
visController = nil;
}
if(rsvis) {
rsstate_delete(rsvis);
rsvis = NULL;

View file

@ -25,6 +25,17 @@ class VisualizationController : NSObject {
class func sharedController() -> VisualizationController {
return sharedVisualizationController
}
@objc
func reset() {
serialQueue.sync {
self.latency = 0;
let amount = self.visAudioSize
for i in 0..<amount {
self.visAudio[i] = 0
}
}
}
@objc
func postLatency(_ latency: Double) {