Non-blocking speaker clicks even when the queue is full

This commit is contained in:
Ivan Izaguirre 2020-01-11 20:29:12 +01:00
parent 08edc95834
commit 4c227f3399
1 changed files with 6 additions and 1 deletions

View File

@ -48,7 +48,12 @@ func newSDLSpeaker() *sdlSpeaker {
// Click receives a speaker click. The argument is the CPU cycle when it is generated
func (s *sdlSpeaker) Click(cycle uint64) {
s.clickChannel <- cycle
select {
case s.clickChannel <- cycle:
// Sent
default:
// The channel is full, the click is lost.
}
}
func stateToLevel(state bool) C.Uint8 {