Exemplo n.º 1
0
func Make_riff_header(r *bufio.Reader) (rh *Riff_header, bytes_read int) {
	const (
		CHUNK_ID_SIZE    = 4
		FORMAT_SIZE      = 4
		RIFF_HEADER_SIZE = 4
	)

	rh = new(Riff_header)
	rh.chunkID = utils.Read_fixed_string(r, CHUNK_ID_SIZE)
	rh.chunkSize = utils.Read_uint32(r)
	rh.format = utils.Read_fixed_string(r, FORMAT_SIZE)

	bytes_read = RIFF_HEADER_SIZE
	return rh, bytes_read
}
Exemplo n.º 2
0
func Make_data_subchunk(r *bufio.Reader) (fs *Data_subchunk, bytes_read int) {
	const (
		SUBCHUNK_ID_SIZE = 4
	)

	fs = new(Data_subchunk)
	fs.subchunkID = utils.Read_fixed_string(r, SUBCHUNK_ID_SIZE)
	fs.size = utils.Read_uint32(r)

	_ = utils.Read_bytes(r, int(fs.size))
	bytes_read = int(fs.size) + 8

	return fs, bytes_read
}
Exemplo n.º 3
0
func Make_fmt_subchunk(r *bufio.Reader) (fs *Fmt_subchunk, bytes_read int) {
	const (
		SUBCHUNK_ID_SIZE  = 4
		FMT_SUBCHUNK_SIZE = 24
	)

	fs = new(Fmt_subchunk)
	fs.subchunkID = utils.Read_fixed_string(r, SUBCHUNK_ID_SIZE)
	fs.size = utils.Read_uint32(r)
	fs.format = utils.Read_uint16(r)
	fs.numChannels = utils.Read_uint16(r)
	fs.sampleRate = utils.Read_uint32(r)
	fs.byteRate = utils.Read_uint32(r)
	fs.blockAlign = utils.Read_uint16(r)
	fs.bitsPerSample = utils.Read_uint16(r)

	return fs, FMT_SUBCHUNK_SIZE
}