fix: catch exceptions when playing sound
This commit is contained in:
parent
d82d0bf0cb
commit
96880ae757
|
@ -188,11 +188,15 @@ namespace PeepingTom {
|
||||||
using var output = new WaveOutEvent {
|
using var output = new WaveOutEvent {
|
||||||
DeviceNumber = soundDevice,
|
DeviceNumber = soundDevice,
|
||||||
};
|
};
|
||||||
output.Init(channel);
|
try {
|
||||||
output.Play();
|
output.Init(channel);
|
||||||
|
output.Play();
|
||||||
|
|
||||||
while (output.PlaybackState == PlaybackState.Playing) {
|
while (output.PlaybackState == PlaybackState.Playing) {
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
PluginLog.LogError(ex, "Exception playing sound");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).Start();
|
}).Start();
|
||||||
|
|
Loading…
Reference in New Issue