From 17be3d4b7382d58a30331f598ced9df4ce3f9b06 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Sat, 13 Jul 2024 22:39:36 +0300 Subject: [PATCH] template.c: simplify `file_length` calculation --- src/template.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/template.c b/src/template.c index 86c4f10..19b6d3d 100644 --- a/src/template.c +++ b/src/template.c @@ -227,18 +227,12 @@ main(void) // 2. prepare variables const uint32_t header_size = - 4 * 4 /* 4 strings of 4 characters */ + - 5 * 4 /* 5 uint32_t values */ + + 3 * 4 /* 3 strings of 4 characters: "WAVE", "fmt ", "data" */ + + 4 * 4 /* 4 uint32_t values */ + 4 * 2 /* 4 uint16_t values */; uint32_t buffer_size = PRODUCT * (REPEAT_TIMES + 1), - file_length = - header_size + - buffer_size /* sample data */ - - /* subtract Subchunk2 headers: */ - - 4 /* a string of 4 characters */ - - 4 /* a uint32_t value */, + file_length = header_size + buffer_size, fmt_data_length = 16 /* <-- * length of format data before this value * in the file format structure