private void readFromFilePath_ReadChunks_Data(DataInputStreamLittleEndian reader) throws IOException { byte[] data = new byte[4]; reader.read(data); int subchunk2Size = reader.readInt(); byte[] samplesForChannelsMixedAsBytes = new byte[subchunk2Size]; reader.read(samplesForChannelsMixedAsBytes); Sample[][] samplesForChannels = Sample.buildManyFromBytes(samplingInfo, samplesForChannelsMixedAsBytes); this.samplesForChannels = samplesForChannels; }
private void readFromFilePath_ReadChunks(DataInputStreamLittleEndian reader) throws IOException { byte[] riff = new byte[4]; reader.read(riff); int numberOfBytesInFile = reader.readInt(); byte[] wave = new byte[4]; reader.read(wave); this.readFromFilePath_ReadChunks_Format(reader); this.readFromFilePath_ReadChunks_Data(reader); }
private void readFromFilePath_ReadChunks_Format(DataInputStreamLittleEndian reader) throws IOException { byte[] fmt = new byte[4]; reader.read(fmt); int chunkSizeInBytes = reader.readInt(); Short formatCode = reader.readShort(); Short numberOfChannels = reader.readShort(); int samplesPerSecond = reader.readInt(); int bytesPerSecond = reader.readInt(); Short bytesPerSampleMaybe = reader.readShort(); Short bitsPerSample = reader.readShort(); SamplingInfo samplingInfo = new SamplingInfo( "[from file]", chunkSizeInBytes, formatCode, numberOfChannels, samplesPerSecond, bitsPerSample); this.samplingInfo = samplingInfo; }