fix: make sure to dispose channel
This commit is contained in:
parent
71ecb7b3af
commit
7c796a339a
|
@ -208,16 +208,17 @@ namespace PeepingTom {
|
|||
return;
|
||||
}
|
||||
|
||||
WaveChannel32 channel = new WaveChannel32(reader) {Volume = this.Plugin.Config.SoundVolume,};
|
||||
using WaveChannel32 channel = new WaveChannel32(reader) {
|
||||
Volume = this.Plugin.Config.SoundVolume,
|
||||
};
|
||||
|
||||
using (reader) {
|
||||
using (var output = new WaveOutEvent() {DeviceNumber = soundDevice}) {
|
||||
output.Init(channel);
|
||||
output.Play();
|
||||
using var output = new WaveOutEvent {DeviceNumber = soundDevice};
|
||||
output.Init(channel);
|
||||
output.Play();
|
||||
|
||||
while (output.PlaybackState == PlaybackState.Playing) {
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
while (output.PlaybackState == PlaybackState.Playing) {
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
}).Start();
|
||||
|
|
Loading…
Reference in New Issue