From 1b78440f5bfd4142ce4255e34a317a3e3790a098 Mon Sep 17 00:00:00 2001
From: koenraadvds <k.vanderschaeve@gmail.com>
Date: Sat, 29 Jan 2022 09:40:04 +0100
Subject: [PATCH] allow reading multichannel wav files where compressionformat
 is WAVE_FORMAT_EXTENSIBLE

---
 .../beadsproject/beads/data/audiofile/WavFileReaderWriter.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/beads_main/java/net/beadsproject/beads/data/audiofile/WavFileReaderWriter.java b/src/beads_main/java/net/beadsproject/beads/data/audiofile/WavFileReaderWriter.java
index f81a209..fd1ffaa 100644
--- a/src/beads_main/java/net/beadsproject/beads/data/audiofile/WavFileReaderWriter.java
+++ b/src/beads_main/java/net/beadsproject/beads/data/audiofile/WavFileReaderWriter.java
@@ -41,6 +41,7 @@ public class WavFileReaderWriter implements AudioFileReader, AudioFileWriter {
 	// Compression Codes
 	private final static int WAVE_FORMAT_PCM = 0x0001;
 	private final static int WAVE_FORMAT_IEEE_FLOAT = 0x0003;
+	private final static int WAVE_FORMAT_EXTENSIBLE = 0xFFFE;
 
 	private File file;						// File that will be read from or written to
 	private int bytesPerSample;				// Number of bytes required to store a single sample
@@ -341,7 +342,7 @@ public class WavFileReaderWriter implements AudioFileReader, AudioFileWriter {
 
 				// Check this is uncompressed data
 				int compressionCode = (int) getLE(buffer, 0, 2);
-				if (compressionCode != WAVE_FORMAT_PCM && compressionCode != WAVE_FORMAT_IEEE_FLOAT ) {
+				if (compressionCode != WAVE_FORMAT_PCM && compressionCode != WAVE_FORMAT_IEEE_FLOAT && compressionCode != WAVE_FORMAT_EXTENSIBLE) {
 					throw new OperationUnsupportedException("Compression Code " + compressionCode + " not supported");
 				}
 				this.compressionCode = compressionCode;
-- 
2.24.3 (Apple Git-128)

