From 4600b801b6b7ed36423b8e33fd0ec5357506758b Mon Sep 17 00:00:00 2001 From: casey langen Date: Sat, 3 Dec 2016 15:18:16 -0800 Subject: [PATCH] Small fix to Player's stream resolution logic -- we should also return a DynamicStream when the visualizer is hidden. --- src/core/audio/Player.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/audio/Player.cpp b/src/core/audio/Player.cpp index f88c4b55f..76558c96e 100644 --- a/src/core/audio/Player.cpp +++ b/src/core/audio/Player.cpp @@ -190,7 +190,12 @@ int Player::State() { } void musik::core::audio::playerThreadLoop(Player* player) { - player->stream = vis::SelectedVisualizer() + /* if there's no visualizer active we'll use a DynamicStream, which allows + buffer sizes to vary. this type of stream is more CPU friendly because + we won't have to memcpy a bunch of audio data around. */ + auto visualizer = vis::SelectedVisualizer(); + + player->stream = (visualizer && visualizer->Visible()) ? Stream::Create() : DynamicStream::Create(); BufferPtr buffer;