]> source.dussan.org Git - poi.git/commitdiff
Support for getting embedded sounds from slide show
authorYegor Kozlov <yegor@apache.org>
Sat, 19 Apr 2008 11:09:59 +0000 (11:09 +0000)
committerYegor Kozlov <yegor@apache.org>
Sat, 19 Apr 2008 11:09:59 +0000 (11:09 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@649796 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java
src/scratchpad/src/org/apache/poi/hslf/record/Sound.java [new file with mode: 0755]
src/scratchpad/src/org/apache/poi/hslf/record/SoundCollection.java [new file with mode: 0755]
src/scratchpad/src/org/apache/poi/hslf/record/SoundData.java [new file with mode: 0755]
src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/SoundData.java [new file with mode: 0755]
src/scratchpad/testcases/org/apache/poi/hslf/data/ringin.wav [new file with mode: 0755]
src/scratchpad/testcases/org/apache/poi/hslf/data/sound.ppt [new file with mode: 0755]
src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java [new file with mode: 0755]
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java [new file with mode: 0755]

index a1bc499453b096748d9a7a7156c7f1c4c293e51d..45038f7a287f1a0c557af79ca420ad47fc0f6803 100644 (file)
@@ -70,9 +70,10 @@ public class RecordTypes {
     public static final Type List = new Type(2000,null);
     public static final Type FontCollection = new Type(2005,FontCollection.class);
     public static final Type BookmarkCollection = new Type(2019,null);
+    public static final Type SoundCollection = new Type(2020,SoundCollection.class);
     public static final Type SoundCollAtom = new Type(2021,null);
-    public static final Type Sound = new Type(2022,null);
-    public static final Type SoundData = new Type(2023,null);
+    public static final Type Sound = new Type(2022,Sound.class);
+    public static final Type SoundData = new Type(2023,SoundData.class);
     public static final Type BookmarkSeedAtom = new Type(2025,null);
     public static final Type ColorSchemeAtom = new Type(2032,ColorSchemeAtom.class);
     public static final Type ExObjRefAtom = new Type(3009,null);
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java b/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java
new file mode 100755 (executable)
index 0000000..211a9b0
--- /dev/null
@@ -0,0 +1,136 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+package org.apache.poi.hslf.record;\r
+\r
+import org.apache.poi.util.POILogger;\r
+\r
+import java.io.OutputStream;\r
+import java.io.IOException;\r
+\r
+/**\r
+ * A container holding information about a sound. It contains:\r
+ * <p>\r
+ * <li>1. CString (4026), Instance 0: Name of sound (e.g. "crash")\r
+ * <li>2. CString (4026), Instance 1: Type of sound (e.g. ".wav")\r
+ * <li>3. CString (4026), Instance 2: Reference id of sound in sound collection\r
+ * <li>4. CString (4026), Instance 3, optional: Built-in id of sound, for sounds we ship. This is the id that?s in the reg file.\r
+ * <li>5. SoundData (2023), optional\r
+ * </p>\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class Sound extends RecordContainer {\r
+    /**\r
+     * Record header data.\r
+     */\r
+    private byte[] _header;\r
+\r
+    // Links to our more interesting children\r
+    private CString _name;\r
+    private CString _type;\r
+    private SoundData _data;\r
+\r
+\r
+    /**\r
+     * Set things up, and find our more interesting children\r
+     *\r
+     * @param source the source data as a byte array.\r
+     * @param start the start offset into the byte array.\r
+     * @param len the length of the slice in the byte array.\r
+     */\r
+    protected Sound(byte[] source, int start, int len) {\r
+        // Grab the header\r
+        _header = new byte[8];\r
+        System.arraycopy(source,start,_header,0,8);\r
+\r
+        // Find our children\r
+        _children = Record.findChildRecords(source,start+8,len-8);\r
+        findInterestingChildren();\r
+    }\r
+\r
+    private void findInterestingChildren() {\r
+        // First child should be the ExHyperlinkAtom\r
+        if(_children[0] instanceof CString) {\r
+            _name = (CString)_children[0];\r
+        } else {\r
+            logger.log(POILogger.ERROR, "First child record wasn't a CString, was of type " + _children[0].getRecordType());\r
+        }\r
+\r
+        // Second child should be the ExOleObjAtom\r
+        if (_children[1] instanceof CString) {\r
+            _type = (CString)_children[1];\r
+        } else {\r
+            logger.log(POILogger.ERROR, "Second child record wasn't a CString, was of type " + _children[1].getRecordType());\r
+        }\r
+\r
+        for (int i = 2; i < _children.length; i++) {\r
+            if(_children[i] instanceof SoundData){\r
+                _data = (SoundData)_children[i];\r
+                break;\r
+            }\r
+        }\r
+\r
+    }\r
+\r
+    /**\r
+     * Returns the type (held as a little endian in bytes 3 and 4)\r
+     * that this class handles.\r
+     *\r
+     * @return the record type.\r
+     */\r
+    public long getRecordType() {\r
+        return RecordTypes.Sound.typeID;\r
+    }\r
+\r
+    /**\r
+     * Have the contents printer out into an OutputStream, used when\r
+     * writing a file back out to disk.\r
+     *\r
+     * @param out the output stream.\r
+     * @throws java.io.IOException if there was an error writing to the stream.\r
+     */\r
+    public void writeOut(OutputStream out) throws IOException {\r
+        writeOut(_header[0],_header[1],getRecordType(),_children,out);\r
+    }\r
+\r
+    /**\r
+     * Name of the sound (e.g. "crash")\r
+     *\r
+     * @return name of the sound\r
+     */\r
+    public String getSoundName(){\r
+        return _name.getText();\r
+    }\r
+\r
+    /**\r
+     * Type of the sound (e.g. ".wav")\r
+     *\r
+     * @return type of the sound\r
+     */\r
+    public String getSoundType(){\r
+        return _type.getText();\r
+    }\r
+\r
+    /**\r
+     * The sound data\r
+     *\r
+     * @return the sound data.\r
+     */\r
+    public byte[] getSoundData(){\r
+        return _data == null ? null : _data.getData();\r
+    }\r
+}\r
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/SoundCollection.java b/src/scratchpad/src/org/apache/poi/hslf/record/SoundCollection.java
new file mode 100755 (executable)
index 0000000..c244859
--- /dev/null
@@ -0,0 +1,73 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+package org.apache.poi.hslf.record;\r
+\r
+import org.apache.poi.util.POILogger;\r
+\r
+import java.io.OutputStream;\r
+import java.io.IOException;\r
+\r
+/**\r
+ * Is a container for all sound related atoms and containers. It contains:\r
+ *<li>1. SoundCollAtom (2021)\r
+ *<li>2. Sound (2022), for each sound, if any\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class SoundCollection extends RecordContainer {\r
+    /**\r
+     * Record header data.\r
+     */\r
+    private byte[] _header;\r
+\r
+    /**\r
+     * Set things up, and find our more interesting children\r
+     *\r
+     * @param source the source data as a byte array.\r
+     * @param start the start offset into the byte array.\r
+     * @param len the length of the slice in the byte array.\r
+     */\r
+    protected SoundCollection(byte[] source, int start, int len) {\r
+        // Grab the header\r
+        _header = new byte[8];\r
+        System.arraycopy(source,start,_header,0,8);\r
+\r
+        // Find our children\r
+        _children = Record.findChildRecords(source,start+8,len-8);\r
+    }\r
+\r
+    /**\r
+     * Returns the type (held as a little endian in bytes 3 and 4)\r
+     * that this class handles.\r
+     *\r
+     * @return the record type.\r
+     */\r
+    public long getRecordType() {\r
+        return RecordTypes.SoundCollection.typeID;\r
+    }\r
+\r
+    /**\r
+     * Have the contents printer out into an OutputStream, used when\r
+     * writing a file back out to disk.\r
+     *\r
+     * @param out the output stream.\r
+     * @throws java.io.IOException if there was an error writing to the stream.\r
+     */\r
+    public void writeOut(OutputStream out) throws IOException {\r
+        writeOut(_header[0],_header[1],getRecordType(),_children,out);\r
+    }\r
+}\r
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/SoundData.java b/src/scratchpad/src/org/apache/poi/hslf/record/SoundData.java
new file mode 100755 (executable)
index 0000000..42be48f
--- /dev/null
@@ -0,0 +1,103 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.hslf.record;\r
+\r
+import java.io.ByteArrayInputStream;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.OutputStream;\r
+import java.util.zip.InflaterInputStream;\r
+\r
+import org.apache.poi.util.LittleEndian;\r
+\r
+/**\r
+ * Storage for embedded sounds.\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class SoundData extends RecordAtom {\r
+\r
+    /**\r
+     * Record header.\r
+     */\r
+    private byte[] _header;\r
+\r
+    /**\r
+     * Record data.\r
+     */\r
+    private byte[] _data;\r
+\r
+    /**\r
+     * Constructs a new empty sound container.\r
+     */\r
+    protected SoundData() {\r
+        _header = new byte[8];\r
+        _data = new byte[0];\r
+\r
+        LittleEndian.putShort(_header, 2, (short)getRecordType());\r
+        LittleEndian.putInt(_header, 4, _data.length);\r
+    }\r
+\r
+    /**\r
+     * Constructs the link related atom record from its\r
+     *  source data.\r
+     *\r
+     * @param source the source data as a byte array.\r
+     * @param start the start offset into the byte array.\r
+     * @param len the length of the slice in the byte array.\r
+     */\r
+    protected SoundData(byte[] source, int start, int len) {\r
+        // Get the header.\r
+        _header = new byte[8];\r
+        System.arraycopy(source,start,_header,0,8);\r
+\r
+        // Get the record data.\r
+        _data = new byte[len-8];\r
+        System.arraycopy(source,start+8,_data,0,len-8);\r
+    }\r
+\r
+    /**\r
+     * Returns the sound data.\r
+     *\r
+     * @return the sound data \r
+     */\r
+    public byte[] getData() {\r
+        return _data;\r
+    }\r
+\r
+    /**\r
+     * Gets the record type.\r
+     *\r
+     * @return the record type.\r
+     */\r
+    public long getRecordType() {\r
+        return RecordTypes.SoundData.typeID;\r
+    }\r
+\r
+    /**\r
+     * Write the contents of the record back, so it can be written\r
+     * to disk.\r
+     *\r
+     * @param out the output stream to write to.\r
+     * @throws java.io.IOException if an error occurs.\r
+     */\r
+    public void writeOut(OutputStream out) throws IOException {\r
+        out.write(_header);\r
+        out.write(_data);\r
+    }\r
+}\r
index 418dc3d2f031139e018daa973c12503ef3b3b3f8..828255087bf6606764b96cdf20b4d65502348221 100644 (file)
@@ -494,6 +494,14 @@ public class SlideShow
     public ObjectData[] getEmbeddedObjects() {
         return _hslfSlideShow.getEmbeddedObjects();
     }
+
+    /**
+     * Returns the data of all the embedded sounds in the SlideShow
+     */
+    public SoundData[] getSoundData() {
+        return SoundData.find(_documentRecord);
+    }
+
        /**
         * Return the current page size
         */
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SoundData.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SoundData.java
new file mode 100755 (executable)
index 0000000..ad7922e
--- /dev/null
@@ -0,0 +1,93 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+package org.apache.poi.hslf.usermodel;\r
+\r
+import org.apache.poi.hslf.record.*;\r
+\r
+import java.util.ArrayList;\r
+\r
+/**\r
+ * A class that represents sound data embedded in a slide show.\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class SoundData {\r
+    /**\r
+     * The record that contains the object data.\r
+     */\r
+    private Sound _container;\r
+\r
+    /**\r
+     * Creates the object data wrapping the record that contains the sound data.\r
+     *\r
+     * @param container the record that contains the sound data.\r
+     */\r
+    public SoundData(Sound container) {\r
+        this._container = container;\r
+    }\r
+\r
+    /**\r
+     * Name of the sound (e.g. "crash")\r
+     *\r
+     * @return name of the sound\r
+     */\r
+    public String getSoundName(){\r
+        return _container.getSoundName();\r
+    }\r
+\r
+    /**\r
+     * Type of the sound (e.g. ".wav")\r
+     *\r
+     * @return type of the sound\r
+     */\r
+    public String getSoundType(){\r
+        return _container.getSoundType();\r
+    }\r
+\r
+    /**\r
+     * Gets an input stream which returns the binary of the sound data.\r
+     *\r
+     * @return the input stream which will contain the binary of the sound data.\r
+     */\r
+    public byte[] getData() {\r
+        return _container.getSoundData();\r
+    }\r
+\r
+    /**\r
+     * Find all sound records in the supplied Document records\r
+     *\r
+     * @param document the document to find in\r
+     * @return the array with the sound data\r
+     */\r
+    public static SoundData[] find(Document document){\r
+        ArrayList lst = new ArrayList();\r
+        Record[] ch = document.getChildRecords();\r
+        for (int i = 0; i < ch.length; i++) {\r
+            if(ch[i].getRecordType() == RecordTypes.SoundCollection.typeID){\r
+                RecordContainer col = (RecordContainer)ch[i];\r
+                Record[] sr = col.getChildRecords();\r
+                for (int j = 0; j < sr.length; j++) {\r
+                    if(sr[j] instanceof Sound){\r
+                        lst.add(new SoundData((Sound)sr[j]));\r
+                    }\r
+                }\r
+            }\r
+\r
+        }\r
+        return (SoundData[])lst.toArray(new SoundData[lst.size()]);\r
+    }\r
+}\r
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/data/ringin.wav b/src/scratchpad/testcases/org/apache/poi/hslf/data/ringin.wav
new file mode 100755 (executable)
index 0000000..f8d4292
Binary files /dev/null and b/src/scratchpad/testcases/org/apache/poi/hslf/data/ringin.wav differ
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/data/sound.ppt b/src/scratchpad/testcases/org/apache/poi/hslf/data/sound.ppt
new file mode 100755 (executable)
index 0000000..2d1316a
Binary files /dev/null and b/src/scratchpad/testcases/org/apache/poi/hslf/data/sound.ppt differ
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java
new file mode 100755 (executable)
index 0000000..97a4b7c
--- /dev/null
@@ -0,0 +1,86 @@
+\r
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+        \r
+\r
+\r
+package org.apache.poi.hslf.record;\r
+\r
+\r
+import junit.framework.TestCase;\r
+import java.io.ByteArrayOutputStream;\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.text.SimpleDateFormat;\r
+import java.util.ArrayList;\r
+import java.util.Date;\r
+import java.util.Arrays;\r
+\r
+import org.apache.poi.hslf.HSLFSlideShow;\r
+import org.apache.poi.hslf.usermodel.SlideShow;\r
+\r
+/**\r
+ * Tests Sound-related records: SoundCollection(2020), Sound(2022) and SoundData(2023)).\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class TestSound extends TestCase {\r
+       public void testRealFile() throws Exception {\r
+               String cwd = System.getProperty("HSLF.testdata.path");\r
+               FileInputStream is = new FileInputStream(new File(cwd, "sound.ppt"));\r
+               SlideShow ppt = new SlideShow(is);\r
+               is.close();\r
+\r
+               // Get the document\r
+               Document doc = ppt.getDocumentRecord();\r
+        SoundCollection soundCollection = null;\r
+        Record[] doc_ch = doc.getChildRecords();\r
+        for (int i = 0; i < doc_ch.length; i++) {\r
+            if(doc_ch[i] instanceof SoundCollection){\r
+                soundCollection = (SoundCollection)doc_ch[i];\r
+                break;\r
+            }\r
+        }\r
+        assertNotNull(soundCollection);\r
+\r
+        Sound sound = null;\r
+        Record[] sound_ch = soundCollection.getChildRecords();\r
+        int k = 0;\r
+        for (int i = 0; i < sound_ch.length; i++) {\r
+            if(sound_ch[i] instanceof Sound){\r
+                sound = (Sound)sound_ch[i];\r
+                k++;\r
+            }\r
+        }\r
+        assertNotNull(sound);\r
+        assertEquals(1, k);\r
+\r
+        assertEquals("ringin.wav", sound.getSoundName());\r
+        assertEquals(".WAV", sound.getSoundType());\r
+        assertNotNull(sound.getSoundData());\r
+\r
+        File f = new File(cwd, "ringin.wav");\r
+        int length = (int)f.length();\r
+        byte[] ref_data = new byte[length];\r
+        is = new FileInputStream(f);\r
+        is.read(ref_data);\r
+        is.close();\r
+\r
+        assertTrue(Arrays.equals(ref_data, sound.getSoundData()));\r
+\r
+       }\r
+}\r
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java
new file mode 100755 (executable)
index 0000000..95de38f
--- /dev/null
@@ -0,0 +1,63 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.hslf.usermodel;\r
+\r
+import org.apache.poi.hslf.*;\r
+import org.apache.poi.hslf.exceptions.HSLFException;\r
+import org.apache.poi.hslf.blip.*;\r
+import org.apache.poi.hslf.model.*;\r
+import junit.framework.TestCase;\r
+\r
+import java.io.*;\r
+import java.util.Arrays;\r
+\r
+/**\r
+ * Test reading sound data from a ppt\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class TestSoundData extends TestCase{\r
+\r
+    protected File cwd;\r
+\r
+    public void setUp() throws Exception {\r
+        cwd = new File(System.getProperty("HSLF.testdata.path"));\r
+    }\r
+\r
+    /**\r
+     * Read a reference sound file from disk and compare it from the data extracted from the slide show\r
+     */ \r
+    public void testSounds() throws Exception {\r
+        //read the reference sound file\r
+        File f = new File(cwd, "ringin.wav");\r
+        int length = (int)f.length();\r
+        byte[] ref_data = new byte[length];\r
+        FileInputStream is = new FileInputStream(f);\r
+        is.read(ref_data);\r
+        is.close();\r
+\r
+        is = new FileInputStream(new File(cwd, "sound.ppt"));\r
+        SlideShow ppt = new SlideShow(is);\r
+        is.close();\r
+\r
+        SoundData[] sound = ppt.getSoundData();\r
+        assertEquals("Expected 1 sound", 1, sound.length);\r
+\r
+        assertTrue(Arrays.equals(ref_data, sound[0].getData()));\r
+    }\r
+}\r