Java Code Examples for javax.sound.sampled.AudioInputStream#available()
The following examples show how to use
javax.sound.sampled.AudioInputStream#available() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecognizeHugeAiffFiles.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Tests the {@code AudioInputStream} fetched from the fake header. * <p> * Note that the frameLength is stored as long which means that {@code * AudioInputStream} must store all possible data from aiff file. */ private static void testAIS(final byte bits, final int rate, final int channel, final long frameLength) throws Exception { final byte[] header = createHeader(bits, rate, channel, frameLength); final ByteArrayInputStream fake = new ByteArrayInputStream(header); final AudioInputStream ais = AudioSystem.getAudioInputStream(fake); final AudioFormat format = ais.getFormat(); if (frameLength != ais.getFrameLength()) { System.err.println("Expected: " + frameLength); System.err.println("Actual: " + ais.getFrameLength()); throw new RuntimeException(); } if (ais.available() < 0) { System.err.println("available should be >=0: " + ais.available()); throw new RuntimeException(); } validateFormat(bits, rate, channel, format); }
Example 2
Source File: RecognizeHugeWaveExtFiles.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Tests the {@code AudioInputStream} fetched from the fake header. * <p> * Note that the frameLength is stored as long which means that {@code * AudioInputStream} must store all possible data from wave file. */ private static void testAIS(final int[] type, final int rate, final int channel, final long size) throws Exception { final byte[] header = createHeader(type, rate, channel, size); final ByteArrayInputStream fake = new ByteArrayInputStream(header); final AudioInputStream ais = AudioSystem.getAudioInputStream(fake); final AudioFormat format = ais.getFormat(); final long frameLength = size / format.getFrameSize(); if (frameLength != ais.getFrameLength()) { System.err.println("Expected: " + frameLength); System.err.println("Actual: " + ais.getFrameLength()); throw new RuntimeException(); } if (ais.available() < 0) { System.err.println("available should be >=0: " + ais.available()); throw new RuntimeException(); } validateFormat(type[1], rate, channel, format); }
Example 3
Source File: RecognizeHugeWaveFiles.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Tests the {@code AudioInputStream} fetched from the fake header. * <p> * Note that the frameLength is stored as long which means that {@code * AudioInputStream} must store all possible data from wave file. */ private static void testAIS(final byte[] type, final int rate, final int channel, final long size) throws Exception { final byte[] header = createHeader(type, rate, channel, size); final ByteArrayInputStream fake = new ByteArrayInputStream(header); final AudioInputStream ais = AudioSystem.getAudioInputStream(fake); final AudioFormat format = ais.getFormat(); final long frameLength = size / format.getFrameSize(); if (frameLength != ais.getFrameLength()) { System.err.println("Expected: " + frameLength); System.err.println("Actual: " + ais.getFrameLength()); throw new RuntimeException(); } if (ais.available() < 0) { System.err.println("available should be >=0: " + ais.available()); throw new RuntimeException(); } validateFormat(type[1], rate, channel, format); }
Example 4
Source File: SoundData.java From DareEngine with BSD 2-Clause "Simplified" License | 5 votes |
private static byte[] readStream(AudioInputStream stream) throws IOException { byte[] data = new byte[stream.available()]; int bytesRead = 0; int totalBytesRead = 0; while ((bytesRead = stream.read(data, totalBytesRead, data.length - totalBytesRead)) != -1 && totalBytesRead < data.length) { totalBytesRead += bytesRead; } return data; }
Example 5
Source File: RecognizeHugeAuFiles.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Tests the {@code AudioInputStream} fetched from the fake header. * <p> * Note that the frameLength is stored as long which means * that {@code AudioInputStream} must store all possible data from au file. */ private static void testAIS(final byte[] type, final int rate, final int channel, final long size) throws Exception { final byte[] header = createHeader(type, rate, channel, size); final ByteArrayInputStream fake = new ByteArrayInputStream(header); final AudioInputStream ais = AudioSystem.getAudioInputStream(fake); final AudioFormat format = ais.getFormat(); final long frameLength = size / format.getFrameSize(); if (size != MAX_UNSIGNED_INT) { if (frameLength != ais.getFrameLength()) { System.err.println("Expected: " + frameLength); System.err.println("Actual: " + ais.getFrameLength()); throw new RuntimeException(); } } else { if (ais.getFrameLength() != AudioSystem.NOT_SPECIFIED) { System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED); System.err.println("Actual: " + ais.getFrameLength()); throw new RuntimeException(); } } if (ais.available() < 0) { System.err.println("available should be >=0: " + ais.available()); throw new RuntimeException(); } validateFormat(type[1], rate, channel, format); }
Example 6
Source File: SoftSynthesizer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 7
Source File: SoftSynthesizer.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 8
Source File: SoftSynthesizer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 9
Source File: SoftSynthesizer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 10
Source File: SoftSynthesizer.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 11
Source File: SoftSynthesizer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 12
Source File: SoftSynthesizer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 13
Source File: SoftSynthesizer.java From hottub with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 14
Source File: SoftSynthesizer.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 15
Source File: SoftSynthesizer.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 16
Source File: SoftSynthesizer.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 17
Source File: SoftSynthesizer.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 18
Source File: SoftSynthesizer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 19
Source File: SoftSynthesizer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }
Example 20
Source File: SoftSynthesizer.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public int available() throws IOException { AudioInputStream local_stream = stream; if(local_stream != null) return local_stream.available(); return 0; }