Skip to content

Commit

Permalink
chore: code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed May 3, 2024
1 parent 4c823e1 commit 693e5ff
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
7 changes: 4 additions & 3 deletions src/Dls.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static uint8_t const* DmDls_decodeAdpcmBlock(uint8_t const* adpcm, float* pcm, u
int predictor = (coeff_1 * sample_a + coeff_2 * sample_b) / 256;
predictor += nibble * delta;
predictor = clamp_16bit(predictor);
*pcm++ = (float) predictor / (float)INT16_MAX;
*pcm++ = (float) predictor / (float) INT16_MAX;
sample_b = sample_a;
sample_a = (int16_t) (predictor);
delta = max_s32((ADPCM_ADAPT_TABLE[(b & 0xF0) >> 4] * delta) / 256, 16);
Expand All @@ -199,7 +199,7 @@ static uint8_t const* DmDls_decodeAdpcmBlock(uint8_t const* adpcm, float* pcm, u
predictor = (coeff_1 * sample_a + coeff_2 * sample_b) / 256;
predictor += nibble * delta;
predictor = clamp_16bit(predictor);
*pcm++ = (float) predictor / (float)INT16_MAX;
*pcm++ = (float) predictor / (float) INT16_MAX;
sample_b = sample_a;
sample_a = (int16_t) (predictor);
delta = max_s32((ADPCM_ADAPT_TABLE[b & 0x0F] * delta) / 256, 16);
Expand All @@ -217,7 +217,8 @@ static size_t DmDls_decodeAdpcm(DmDlsWave const* slf, float* out, size_t len) {
}

uint32_t block_count = slf->pcm_size / slf->block_align;
uint32_t frames_per_block = (uint32_t) (slf->block_align - 6 * slf->channels) * 2 /* two frames per channel from the header */;
uint32_t frames_per_block =
(uint32_t) (slf->block_align - 6 * slf->channels) * 2 /* two frames per channel from the header */;
uint32_t size = frames_per_block * block_count;

if (out == NULL || len == 0) {
Expand Down
5 changes: 2 additions & 3 deletions src/Message.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static void DmMessageQueue_heapRemove(DmMessageQueue* slf) {
sort_2 = DmMessage_sort(&slf->queue[slf_i]->data, &slf->queue[child_2]->data);
}

if ((sort_1 == -2 && sort_2 == -2) || (sort_1 <= 0 && sort_2 <= 0)) {
if ((sort_1 == -2 && sort_2 == -2) || (sort_1 <= 0 && sort_2 <= 0)) {
break;
}

Expand Down Expand Up @@ -194,7 +194,7 @@ void DmMessageQueue_free(DmMessageQueue* slf) {

static DmMessageQueueItem* DmMessageQueue_getAt(DmMessageQueue* slf, size_t time, DmMessageType type) {
for (size_t i = 0; i < slf->queue_length; ++i) {
int64_t delta = (int64_t) slf->queue[i]->data.time - (int64_t)time;
int64_t delta = (int64_t) slf->queue[i]->data.time - (int64_t) time;
int64_t d = delta < 0 ? (delta * -1) : delta;
if (d < 10 && slf->queue[i]->data.type == type) {
return slf->queue[i];
Expand Down Expand Up @@ -286,4 +286,3 @@ void DmMessageQueue_clear(DmMessageQueue* slf) {

slf->queue_length = 0;
}

6 changes: 3 additions & 3 deletions src/Performance.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,9 +746,9 @@ static void DmPerformance_handleMessage(DmPerformance* slf, DmMessage* msg) {
case DmMessage_SEGMENT:
if (msg->segment.segment) {
Dm_report(DmLogLevel_TRACE,
"DmPerformance(Message): time=%d type=segment-change name=\"%s\"",
slf->time,
msg->segment.segment->info.unam);
"DmPerformance(Message): time=%d type=segment-change name=\"%s\"",
slf->time,
msg->segment.segment->info.unam);
}

DmPerformance_handleSegmentMessage(slf, &msg->segment);
Expand Down
4 changes: 2 additions & 2 deletions src/io/Dls.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static DmResult DmDls_parseRegion(DmDlsRegion* slf, DmRiff* rif) {

// If we're overriding lart, we need to free all the exising articulators
if (slf->articulators != NULL) {
for (size_t i = 0; i < slf->articulator_count; ++i) {
for (size_t i = 0; i < slf->articulator_count; ++i) {
DmDlsArticulator_free(&slf->articulators[i]);
}

Expand Down Expand Up @@ -193,7 +193,7 @@ static DmResult DmDls_parseInstrument(DmDlsInstrument* slf, DmRiff* rif) {

// If we're overriding lart, we need to free all the exising articulators
if (slf->articulators != NULL) {
for (size_t i = 0; i < slf->articulator_count; ++i) {
for (size_t i = 0; i < slf->articulator_count; ++i) {
DmDlsArticulator_free(&slf->articulators[i]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/thread/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ DMINT int c11threads_win32_thrd_register(unsigned long win32_thread_id);
/* ---- thread management ---- */

DMINT int _c11threads_win32_thrd_sleep32(const struct _c11threads_win32_timespec32_t* ts_in,
struct _c11threads_win32_timespec32_t* rem_out);
struct _c11threads_win32_timespec32_t* rem_out);
DMINT int _c11threads_win32_thrd_sleep64(const struct _c11threads_win32_timespec64_t* ts_in,
struct _c11threads_win32_timespec64_t* rem_out);
struct _c11threads_win32_timespec64_t* rem_out);

/* ---- mutexes ---- */

Expand Down
3 changes: 2 additions & 1 deletion src/util/Tsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ static size_t DmSynth_insertGeneratorArticulators(struct tsf_hydra_igen* gens, D
return count;
}

static DmResult Dm_createHydraSamplesForDls(DmDls* dls, float** pcm, int32_t* pcm_len, struct tsf_hydra_shdr** cfg, int32_t* cfg_len) {
static DmResult
Dm_createHydraSamplesForDls(DmDls* dls, float** pcm, int32_t* pcm_len, struct tsf_hydra_shdr** cfg, int32_t* cfg_len) {
// 1. Count the number of PCM samples actually required after decoding.
size_t sample_count = 0;
for (uint32_t i = 0; i < dls->wave_table_size; ++i) {
Expand Down

0 comments on commit 693e5ff

Please sign in to comment.