Merge pull request #235 from ArtemGr/master
Switching the headset on and off
This commit is contained in:
commit
b82ca1e348
2 changed files with 46 additions and 1 deletions
|
|
@ -500,6 +500,13 @@ impl EventLoop {
|
|||
let mut frames_available = {
|
||||
let mut padding = mem::uninitialized();
|
||||
let hresult = (*stream.audio_client).GetCurrentPadding(&mut padding);
|
||||
// Happens when a bluetooth headset was turned off, for example.
|
||||
if hresult == AUDCLNT_E_DEVICE_INVALIDATED {
|
||||
// The client code should switch to a different device eventually.
|
||||
// For now let's just skip the invalidated device.
|
||||
// Would be nice to inform the client code about the invalidation,
|
||||
// but throwing a panic isn't the most ergonomic way to do so.
|
||||
continue}
|
||||
check_result(hresult).unwrap();
|
||||
stream.max_frames_in_buffer - padding
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue