<html><head></head><body><div>On Thu, 2020-12-17 at 10:46 +0000, Michael Johnson wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="auto">Another point here, connecting to the audio-stream signal and printing the current-audio yields -1 until I physically close the window when it gets the correct audio stream here</div></blockquote><div><br></div><div>That seems wrong, please provide a testcase for that.</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="auto"><div dir="auto">Also, I imagine when I want to bind changing stream to a key press I need to emit this signal to be caught. But I can't access any data structures from the callback, so it'll always chose a constant stream. Am I missing something? here </div></div></blockquote><div><br></div><div>You can pass any heap allocated data without references to stack memory into the signal handler closure.</div><div><br></div><div>A common pattern would be to store your state in a std::sync::Arc to give it reference counting, and use a std::sync::Mutex for getting interior mutability of whatever state you need to change.</div><div><br></div><div><span><pre>-- <br></pre><div data-evo-paragraph="" class="" style="width: 71ch;" data-evo-signature-plain-text-mode="">Sebastian Dröge, Centricular Ltd · <a href="http://www.centricular.com">https://www.centricular.com</a></div><div data-evo-paragraph="" class="" style="width: 71ch;"><br></div></span></div></body></html>