// Path: ffsampledsp-complete/src/test/java/com/tagtraum/ffsampledsp/TestFFURLInputStream.java
// static void extractFile(final String filename, final File file) throws IOException {
//     try (final InputStream in = TestFFURLInputStream.class.getResourceAsStream(filename);
//          OutputStream out = new FileOutputStream(file)) {
//         final byte[] buf = new byte[1024*64];
//         int justRead;
//         while ((justRead = in.read(buf)) != -1) {
//             out.write(buf, 0, justRead);
//         }
//     }
// }


import static org.junit.Assert.assertTrue;
import org.junit.Test;
import javax.sound.sampled.*;
import java.io.File;
import java.io.IOException;
import static com.tagtraum.ffsampledsp.TestFFURLInputStream.extractFile;
import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED;
import static org.junit.Assert.assertEquals;
/*
 * =================================================
 * Copyright 2013 tagtraum industries incorporated
 * This file is part of FFSampledSP.
 *
 * FFSampledSP is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFSampledSP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFSampledSP; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 * =================================================
 */
package com.tagtraum.ffsampledsp;





/**
 * TestAudioSystemIntegration.
 *
 * @author <a href="mailto:hs@tagtraum.com">Hendrik Schreiber</a>
 */
public class TestAudioSystemIntegration {


    @Test
    public void testAudioFileFormat() throws IOException, UnsupportedAudioFileException {
        final String filename = "test.flac";
        final File file = File.createTempFile("testAudioFileFormat", filename);
        extractFile(filename, file);
        try {
            AudioSystem.getAudioFileFormat(file);
        } finally {
            file.delete();
        }
    }

    @Test
    public void testAudioFileReader() throws IOException, UnsupportedAudioFileException {
        final String filename = "test.flac";
        final File file = File.createTempFile("testAudioFileReader", filename);
// Path: ffsampledsp-complete/src/test/java/com/tagtraum/ffsampledsp/TestFFURLInputStream.java
// static void extractFile(final String filename, final File file) throws IOException {
//     try (final InputStream in = TestFFURLInputStream.class.getResourceAsStream(filename);
//          OutputStream out = new FileOutputStream(file)) {
//         final byte[] buf = new byte[1024*64];
//         int justRead;
//         while ((justRead = in.read(buf)) != -1) {
//             out.write(buf, 0, justRead);
//         }
//     }
// }


// Path: ffsampledsp-complete/src/test/java/com/tagtraum/ffsampledsp/TestAudioSystemIntegration.java
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import javax.sound.sampled.*;
import java.io.File;
import java.io.IOException;
import static com.tagtraum.ffsampledsp.TestFFURLInputStream.extractFile;
import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED;
import static org.junit.Assert.assertEquals;

/*
 * =================================================
 * Copyright 2013 tagtraum industries incorporated
 * This file is part of FFSampledSP.
 *
 * FFSampledSP is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFSampledSP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFSampledSP; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 * =================================================
 */
package com.tagtraum.ffsampledsp;





/**
 * TestAudioSystemIntegration.
 *
 * @author <a href="mailto:hs@tagtraum.com">Hendrik Schreiber</a>
 */
public class TestAudioSystemIntegration {


    @Test
    public void testAudioFileFormat() throws IOException, UnsupportedAudioFileException {
        final String filename = "test.flac";
        final File file = File.createTempFile("testAudioFileFormat", filename);
        extractFile(filename, file);
        try {
            AudioSystem.getAudioFileFormat(file);
        } finally {
            file.delete();
        }
    }

    @Test
    public void testAudioFileReader() throws IOException, UnsupportedAudioFileException {
        final String filename = "test.flac";
        final File file = File.createTempFile("testAudioFileReader", filename);
        extractFile(filename, file);