I have added in a CloseWaveOut() function. This works in exclusive mode via IIS on 2 of 3 computers I have tried it on. It does not however work with my M2Tech EVO usb to spdif convertor. In fact the only way to keep the EVO playing is to not call CloseWaveOut at all using shared mode. Any call to CloseWaveOut and the EVO will not play again until I IIS reset. This looks to be a driver issue with the EVO. Very sad as I wrote this program specifically for my main stereo using the EVO.
private static void WaveplayerPlaybackStopped(object sender, StoppedEventArgs e)
{
if (!Data.ContinuePlayingTracks) return;
CloseWaveOut();
SetPlayIndex(+1);
PlayFile(Data.LstServerMedia[Data.PlayIndex].FullPath + @"\" + Data.LstServerMedia[Data.PlayIndex].FileName, Data.PlayIndex);
}
public static void CloseWaveOut()
{
if (Waveplayer != null)
{
Waveplayer.Stop();
Thread.Sleep(200); // Let the _waveplayer threads finish and exit
}
if (FileWaveStream != null)
{
// this one really closes the file and ACM conversion
FileWaveStream.Dispose();
}
if (Waveplayer == null) return;
Waveplayer.Dispose();
Waveplayer = null;
}