rename variable w
to time
This commit is contained in:
parent
19409e0860
commit
759fa6df4a
@ -1,7 +1,7 @@
|
|||||||
# C_bytebeat_render
|
# C\_bytebeat\_render
|
||||||
|
|
||||||
## Bytebeat code
|
## Bytebeat code
|
||||||
|
|
||||||
**Variables:**
|
**Variables:**
|
||||||
- `w`: a `size_t` variable casted as `long double`
|
- `time`: a `size_t` variable casted as `long double`
|
||||||
- `t`: `w` casted as `uintmax_t`
|
- `t`: `time` casted as `uintmax_t`
|
||||||
|
@ -73,7 +73,7 @@ long double
|
|||||||
#else
|
#else
|
||||||
SAMPLE_TYPE
|
SAMPLE_TYPE
|
||||||
#endif
|
#endif
|
||||||
bytebeat(long double w);
|
bytebeat(long double time);
|
||||||
|
|
||||||
// function implementations
|
// function implementations
|
||||||
#if FP_RETURN_TYPE
|
#if FP_RETURN_TYPE
|
||||||
@ -81,18 +81,18 @@ long double
|
|||||||
#else
|
#else
|
||||||
SAMPLE_TYPE
|
SAMPLE_TYPE
|
||||||
#endif
|
#endif
|
||||||
bytebeat(long double w)
|
bytebeat(long double time)
|
||||||
{
|
{
|
||||||
#if PRECALCULATED_RATIO
|
#if PRECALCULATED_RATIO
|
||||||
`final_sample_rate_code`
|
`final_sample_rate_code`
|
||||||
#elif ORIGINAL_SAMPLE_RATE != SAMPLE_RATE
|
#elif ORIGINAL_SAMPLE_RATE != SAMPLE_RATE
|
||||||
# if SAMPLE_RATE > ORIGINAL_SAMPLE_RATE
|
# if SAMPLE_RATE > ORIGINAL_SAMPLE_RATE
|
||||||
w /= ((long double) SAMPLE_RATE) / ((long double) ORIGINAL_SAMPLE_RATE);
|
time /= ((long double) SAMPLE_RATE) / ((long double) ORIGINAL_SAMPLE_RATE);
|
||||||
# else
|
# else
|
||||||
w *= ((long double) ORIGINAL_SAMPLE_RATE / ((long double) SAMPLE_RATE));
|
time *= ((long double) ORIGINAL_SAMPLE_RATE / ((long double) SAMPLE_RATE));
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
uintmax_t t = (uintmax_t) w;
|
uintmax_t t = (uintmax_t) time;
|
||||||
`bytebeat_contents`;
|
`bytebeat_contents`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,10 +220,10 @@ main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SEQUENTIAL_MODE
|
#if SEQUENTIAL_MODE
|
||||||
size_t w = 0;
|
size_t time = 0;
|
||||||
for (size_t seq = 0; seq < MAX; seq++) {
|
for (size_t seq = 0; seq < MAX; seq++) {
|
||||||
if ((w + BLOCK_SIZE) >= PRODUCT)
|
if ((time + BLOCK_SIZE) >= PRODUCT)
|
||||||
calc_block_size = PRODUCT - w;
|
calc_block_size = PRODUCT - time;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * bytebeat generating loop
|
// * bytebeat generating loop
|
||||||
@ -240,18 +240,21 @@ main(void)
|
|||||||
|
|
||||||
#if SEQUENTIAL_MODE
|
#if SEQUENTIAL_MODE
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
for (; idx < BLOCK_SIZE && w < PRODUCT; idx++, w++) {
|
for (; idx < BLOCK_SIZE && time < PRODUCT; idx++,
|
||||||
|
time++) {
|
||||||
#else
|
#else
|
||||||
for (size_t w = 0; w < PRODUCT; w++) {
|
for (size_t time = 0; time < PRODUCT; time++) {
|
||||||
#endif
|
#endif
|
||||||
// 1. generate audio data
|
// 1. generate audio data
|
||||||
#if FP_RETURN_TYPE
|
#if FP_RETURN_TYPE
|
||||||
long double bytebeat_res = floor(bytebeat(floor((long double) w)));
|
long double bytebeat_res =
|
||||||
|
floor(bytebeat(floor((long double) time)));
|
||||||
#elif IS_SIGNED
|
#elif IS_SIGNED
|
||||||
intmax_t bytebeat_res = (intmax_t) bytebeat(floor((long double) w));
|
intmax_t bytebeat_res =
|
||||||
|
(intmax_t) bytebeat(floor((long double) time));
|
||||||
#else
|
#else
|
||||||
uintmax_t bytebeat_res =
|
uintmax_t bytebeat_res =
|
||||||
(uintmax_t) bytebeat(floor((long double) w));
|
(uintmax_t) bytebeat(floor((long double) time));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 2. if signed, then wrap up to unsigned
|
// 2. if signed, then wrap up to unsigned
|
||||||
@ -277,13 +280,13 @@ main(void)
|
|||||||
#if SEQUENTIAL_MODE
|
#if SEQUENTIAL_MODE
|
||||||
buffer[idx] = sample_res;
|
buffer[idx] = sample_res;
|
||||||
#else
|
#else
|
||||||
buffer[w] = sample_res;
|
buffer[time] = sample_res;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 6. log
|
// 6. log
|
||||||
#if VERBOSE_MODE
|
#if VERBOSE_MODE
|
||||||
if (w % FREQUENCY_OF_STATUS_REPORTING == 0 ||
|
if (time % FREQUENCY_OF_STATUS_REPORTING == 0 ||
|
||||||
w >= product_minus_1 /* or if writing last sample */) {
|
time >= product_minus_1 /* or if writing last sample */) {
|
||||||
printf(
|
printf(
|
||||||
"%sremaining samples = %18" PRIuMAX " (%3.2Lf%% done)"
|
"%sremaining samples = %18" PRIuMAX " (%3.2Lf%% done)"
|
||||||
#if SEQUENTIAL_MODE
|
#if SEQUENTIAL_MODE
|
||||||
@ -291,8 +294,8 @@ main(void)
|
|||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
ANSI_CLEAR,
|
ANSI_CLEAR,
|
||||||
product_minus_1 - w,
|
product_minus_1 - time,
|
||||||
((long double) w * 100) / (long double) PRODUCT
|
((long double) time * 100) / (long double) PRODUCT
|
||||||
#if SEQUENTIAL_MODE
|
#if SEQUENTIAL_MODE
|
||||||
, (uintmax_t) seq + 1, (uintmax_t) MAX
|
, (uintmax_t) seq + 1, (uintmax_t) MAX
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user