1
0

template.c: reformat

This commit is contained in:
Intel A80486DX2-66 2024-01-09 15:42:43 +03:00
parent 918361489c
commit b50915aed6
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -131,13 +131,13 @@ main(void)
bytebeat_res = signed_to_unsigned(bytebeat_res); bytebeat_res = signed_to_unsigned(bytebeat_res);
// 3. convert audio data to sample // 3. convert audio data to sample
SAMPLE_TYPE sample_res = (SAMPLE_TYPE)bytebeat_res & SAMPLE_TYPE sample_res = (SAMPLE_TYPE) bytebeat_res &
BIT_DEPTH_LIMITER; BIT_DEPTH_LIMITER;
// 4. if bit depth is less than 8, stretch it // 4. if bit depth is less than 8, stretch it
#if BIT_DEPTH < 8 #if BIT_DEPTH < 8
sample_res = (SAMPLE_TYPE) sample_res = (SAMPLE_TYPE)
((long double)buffer[w] * ((long double)BIT_DEPTH / 8.L)); ((long double) buffer[w] * ((long double) BIT_DEPTH / 8.L));
#endif #endif
// 5. save sample into buffer // 5. save sample into buffer
@ -151,7 +151,7 @@ main(void)
"%sremaining samples = %18" PRIuMAX " (%.2Lf%% done)", "%sremaining samples = %18" PRIuMAX " (%.2Lf%% done)",
ANSI_CLEAR, ANSI_CLEAR,
PRODUCT - w - 1, PRODUCT - w - 1,
(long double)w * 100 / (long double)PRODUCT); (long double) w * 100 / (long double) PRODUCT);
fflush(stdout); fflush(stdout);
} }
#endif #endif
@ -181,8 +181,10 @@ main(void)
5 * 4 /* 4 uint32_t values */ + 5 * 4 /* 4 uint32_t values */ +
4 * 2 /* 5 uint16_t values */ + 4 * 2 /* 5 uint16_t values */ +
PRODUCT /* sample data */, PRODUCT /* sample data */,
fmt_data_length = 16 /* length of format data before this value fmt_data_length = 16 /*
in the file format structure */, * length of format data before this value
* in the file format structure
*/,
sample_rate = SAMPLE_RATE, sample_rate = SAMPLE_RATE,
byte_rate = (SAMPLE_RATE * BIT_DEPTH * CHANNELS) / 8; byte_rate = (SAMPLE_RATE * BIT_DEPTH * CHANNELS) / 8;
uint16_t fmt_type = 1, // format type is PCM uint16_t fmt_type = 1, // format type is PCM