π π A Python library for audio.
C audioaudio-processingaudio-productionaudio-researchaudio-unitaugmentationjucemachine-learningpybind11pythonvst3vst3-host
Add cross-platform tests.
Peter Sobot7b61bc45c689
diff --git a/pedalboard/juce_overrides/juce_PatchedMP3AudioFormat.cpp b/pedalboard/juce_overrides/juce_PatchedMP3AudioFormat.cppindex c2342ad..bbbe470 100644--- a/pedalboard/juce_overrides/juce_PatchedMP3AudioFormat.cpp+++ b/pedalboard/juce_overrides/juce_PatchedMP3AudioFormat.cpp@@ -2107,7 +2107,10 @@ private:uint32 header = 0;for (;;) {- if (stream.isExhausted() || stream.getPosition() > oldPos + 32768) {+ auto streamPos = stream.getPosition();+ bool isParsingFirstFrame = streamPos == 0;++ if (stream.isExhausted() || streamPos > oldPos + 32768) {offset = -1;break;}@@ -2132,7 +2135,6 @@ private:break;}- bool isParsingFirstFrame = stream.getPosition() == 0;if (isParsingFirstFrame) {// If we're parsing the first frame of a file/stream, that frame must be// at the start of the stream. This prevents accidentally parsing .mp4diff --git a/tests/test_io.py b/tests/test_io.pyindex 69e34b7..6eff7a2 100644--- a/tests/test_io.py+++ b/tests/test_io.py@@ -66,6 +66,15 @@ UNSUPPORTED_FILENAMES = [)]+UNSUPPORTED_CROSS_PLATFORM_FILENAMES = [+ filename+ for filename in sum(TEST_AUDIO_FILES.values(), [])+ if not any(+ filename.endswith(extension)+ for extension in pedalboard.io.get_supported_read_formats(cross_platform_formats_only=True)+ )+]+def get_tolerance_for_format_and_bit_depth(extension: str, input_format, file_dtype: str) -> float:if not extension.startswith("."):@@ -485,10 +494,16 @@ def test_fails_gracefully():pass[email protected]("audio_filename", UNSUPPORTED_FILENAMES)-def test_fails_on_unsupported_format(audio_filename: str):+ "cross_platform_formats_only,audio_filename",+ [(False, f) for f in UNSUPPORTED_FILENAMES]+ + [(True, f) for f in UNSUPPORTED_CROSS_PLATFORM_FILENAMES],+)+def test_fails_on_unsupported_format(cross_platform_formats_only: bool, audio_filename: str):with pytest.raises(ValueError):- af = pedalboard.io.AudioFile(audio_filename)+ af = pedalboard.io.ReadableAudioFile(+ audio_filename, cross_platform_formats_only=cross_platform_formats_only+ )assert not af