template.c: simplify file_length
calculation
This commit is contained in:
parent
eaf7b06b1e
commit
56dd8dace3
@ -241,18 +241,12 @@ main(void)
|
|||||||
|
|
||||||
// 2. prepare variables
|
// 2. prepare variables
|
||||||
const uint32_t header_size =
|
const uint32_t header_size =
|
||||||
4 * 4 /* 4 strings of 4 characters */ +
|
3 * 4 /* 3 strings of 4 characters: "WAVE", "fmt ", "data" */ +
|
||||||
5 * 4 /* 5 uint32_t values */ +
|
4 * 4 /* 4 uint32_t values */ +
|
||||||
4 * 2 /* 4 uint16_t values */;
|
4 * 2 /* 4 uint16_t values */;
|
||||||
|
|
||||||
uint32_t buffer_size = PRODUCT * (REPEAT_TIMES + 1),
|
uint32_t buffer_size = PRODUCT * (REPEAT_TIMES + 1),
|
||||||
file_length =
|
file_length = header_size + buffer_size,
|
||||||
header_size +
|
|
||||||
buffer_size /* sample data */
|
|
||||||
|
|
||||||
/* subtract Subchunk2 headers: */
|
|
||||||
- 4 /* a string of 4 characters */
|
|
||||||
- 4 /* a uint32_t value */,
|
|
||||||
fmt_data_length = 16 /* <--
|
fmt_data_length = 16 /* <--
|
||||||
* length of format data before this value
|
* length of format data before this value
|
||||||
* in the file format structure
|
* in the file format structure
|
||||||
|
Loading…
Reference in New Issue
Block a user