fix: make sure to dispose channel

This commit is contained in:
Anna 2020-12-29 11:11:32 -05:00
parent 71ecb7b3af
commit 7c796a339a

View File

@ -208,10 +208,12 @@ 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}) {
using var output = new WaveOutEvent {DeviceNumber = soundDevice};
output.Init(channel);
output.Play();
@ -219,7 +221,6 @@ namespace PeepingTom {
Thread.Sleep(500);
}
}
}
}).Start();
}