As a result when my USB audio device replugged I cannot call speaker.Init() again, it's always stuck.
So right now I change the done channel into a buffered chan, it looks good so far, but I'm not sure whether it will cause other problem.
Is it necessary to make the done channel an unbuffered chan? How to handle the replug situation properly?
I have an USB audio device which has poor contact, when replugged I have to call speaker.Init() again to make the speaker work again.
But it's stuck at here: https://github.com/faiface/beep/blob/98afada94bffc8665c7fce42814174a3e8650108/speaker/speaker.go#L129 Since it's in a for loop, the whole loop is blocked: https://github.com/faiface/beep/blob/98afada94bffc8665c7fce42814174a3e8650108/speaker/speaker.go#L48-L57 the done channel cannot be consumed, when I call speaker.Init again, it calls speaker.Close first, then it's stuck at here: https://github.com/faiface/beep/blob/98afada94bffc8665c7fce42814174a3e8650108/speaker/speaker.go#L69
As a result when my USB audio device replugged I cannot call speaker.Init() again, it's always stuck. So right now I change the done channel into a buffered chan, it looks good so far, but I'm not sure whether it will cause other problem.
Is it necessary to make the done channel an unbuffered chan? How to handle the replug situation properly?