diff --git a/NAudio/Wave/WaveOutputs/WasapiOut.cs b/NAudio/Wave/WaveOutputs/WasapiOut.cs index d84b13f4..309ab40d 100644 --- a/NAudio/Wave/WaveOutputs/WasapiOut.cs +++ b/NAudio/Wave/WaveOutputs/WasapiOut.cs @@ -270,12 +270,19 @@ private WaveFormat GetFallbackFormat() /// Position in bytes public long GetPosition() { - if (playbackState == PlaybackState.Stopped) + ulong pos; + switch (playbackState) { - return 0; + case PlaybackState.Stopped: + return 0; + case PlaybackState.Playing: + pos = audioClient.AudioClockClient.AdjustedPosition; + break; + default: // PlaybackState.Paused + audioClient.AudioClockClient.GetPosition(out pos, out _); + break; } - var clock = audioClient.AudioClockClient; - return ((long)clock.AdjustedPosition * outputFormat.AverageBytesPerSecond) / (long)clock.Frequency; + return ((long)pos * outputFormat.AverageBytesPerSecond) / (long)audioClient.AudioClockClient.Frequency; } ///