Skip to content

Commit

Permalink
Revert "Throw for NLayer bug"
Browse files Browse the repository at this point in the history
This reverts commit fb5de0e.
naudio/NLayer#19 (comment)
  • Loading branch information
AlekseyMartynov committed Mar 7, 2024
1 parent 86f017f commit d38691d
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions CaptureHelpers/FileCaptureHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,10 @@ public void SkipTo(TimeSpan time) {
WaveStream CreateWaveStream() {
var ext = Path.GetExtension(FilePath).ToLower();
return ext switch {
".mp3" => new Mp3FileReaderBase(FilePath, CreateMp3FrameDecompressor),
".mp3" => new Mp3FileReaderBase(FilePath, fmt => new Mp3FrameDecompressor(fmt)),
".wav" => new WaveFileReader(FilePath),
_ => throw new NotSupportedException($"Extension '{ext}' not supported"),
};
}

static IMp3FrameDecompressor CreateMp3FrameDecompressor(WaveFormat mp3Format) {
var sr = mp3Format.SampleRate;

if(sr > 12000 && sr < 32000)
throw new Exception($"{sr} Hz mp3 decoder is broken, https://github.com/naudio/NLayer/issues/19");

return new Mp3FrameDecompressor(mp3Format);
}
}

0 comments on commit d38691d

Please sign in to comment.