From dd847f3041e232072c3282a7762eacd82c0d0a63 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 7 Apr 2019 01:47:52 +0200 Subject: [PATCH] Tweak some logs --- src/layout/flat.c | 5 +++-- src/layout/layered.c | 12 ++++++++---- src/layout/segmented.c | 18 +++++++++++++----- src/meta/awc.c | 3 ++- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/layout/flat.c b/src/layout/flat.c index 829b2bcc..ae5b91e9 100644 --- a/src/layout/flat.c +++ b/src/layout/flat.c @@ -23,9 +23,10 @@ void render_vgmstream_flat(sample_t * buffer, int32_t sample_count, VGMSTREAM * samples_to_do = vgmstream_samples_to_do(samples_this_block, samples_per_frame, vgmstream); if (samples_to_do > sample_count - samples_written) samples_to_do = sample_count - samples_written; - + if (samples_to_do == 0) { - VGM_LOG("layout_flat: wrong samples_to_do found\n"); + VGM_LOG("layout_flat: wrong samples_to_do 0 found\n"); /* could happen when calling render at EOF? */ + //VGM_LOG("layout_flat: tb=%i sib=%i, spf=%i\n", samples_this_block, vgmstream->samples_into_block, samples_per_frame); memset(buffer + samples_written*vgmstream->channels, 0, (sample_count - samples_written) * vgmstream->channels * sizeof(sample_t)); break; } diff --git a/src/layout/layered.c b/src/layout/layered.c index 0c27f7e8..af4ebd1e 100644 --- a/src/layout/layered.c +++ b/src/layout/layered.c @@ -87,11 +87,15 @@ int setup_layout_layered(layered_layout_data* data) { for (i = 0; i < data->layer_count; i++) { int layer_input_channels, layer_output_channels; - if (!data->layers[i]) + if (data->layers[i] == NULL) { + VGM_LOG("layered: no vgmstream in %i\n", i); goto fail; + } - if (data->layers[i]->num_samples <= 0) + if (data->layers[i]->num_samples <= 0) { + VGM_LOG("layered: no samples in %i\n", i); goto fail; + } /* different layers may have different input/output channels */ mixing_info(data->layers[i], &layer_input_channels, &layer_output_channels); @@ -103,12 +107,12 @@ int setup_layout_layered(layered_layout_data* data) { if (i > 0) { /* a bit weird, but no matter */ if (data->layers[i]->sample_rate != data->layers[i-1]->sample_rate) { - VGM_LOG("layered layout: layer %i has different sample rate\n", i); + VGM_LOG("layered: layer %i has different sample rate\n", i); } /* also weird */ if (data->layers[i]->coding_type != data->layers[i-1]->coding_type) { - VGM_LOG("layered layout: layer %i has different coding type\n", i); + VGM_LOG("layered: layer %i has different coding type\n", i); } } diff --git a/src/layout/segmented.c b/src/layout/segmented.c index 86bf4fef..2c2e18c8 100644 --- a/src/layout/segmented.c +++ b/src/layout/segmented.c @@ -135,15 +135,21 @@ int setup_layout_segmented(segmented_layout_data* data) { for (i = 0; i < data->segment_count; i++) { int segment_input_channels, segment_output_channels; - if (!data->segments[i]) + if (data->segments[i] == NULL) { + VGM_LOG("segmented: no vgmstream in segment %i\n", i); goto fail; + } - if (data->segments[i]->num_samples <= 0) + + if (data->segments[i]->num_samples <= 0) { + VGM_LOG("segmented: no samples in segment %i\n", i); goto fail; + } + /* disable so that looping is controlled by render_vgmstream_segmented */ if (data->segments[i]->loop_flag != 0) { - VGM_LOG("segmented layout: segment %i is looped\n", i); + VGM_LOG("segmented: segment %i is looped\n", i); data->segments[i]->loop_flag = 0; } @@ -159,12 +165,14 @@ int setup_layout_segmented(segmented_layout_data* data) { int prev_output_channels; mixing_info(data->segments[i-1], NULL, &prev_output_channels); - if (segment_output_channels != prev_output_channels) + if (segment_output_channels != prev_output_channels) { + VGM_LOG("segmented: segment %i has wrong channels %i vs prev channels %i\n", i, segment_output_channels, prev_output_channels); goto fail; + } /* a bit weird, but no matter */ if (data->segments[i]->sample_rate != data->segments[i-1]->sample_rate) { - VGM_LOG("segmented layout: segment %i has different sample rate\n", i); + VGM_LOG("segmented: segment %i has different sample rate\n", i); } /* perfectly acceptable */ diff --git a/src/meta/awc.c b/src/meta/awc.c index 1ff2d1eb..bde1a21d 100644 --- a/src/meta/awc.c +++ b/src/meta/awc.c @@ -299,7 +299,8 @@ static int parse_awc_header(STREAMFILE* streamFile, awc_header* awc) { if ((awc->num_samples && !(awc->num_samples >= num_samples - 10 && awc->num_samples <= num_samples + 10)) || (awc->sample_rate && awc->sample_rate != sample_rate) || (awc->codec && awc->codec != codec)) { - VGM_LOG("AWC: found header diffs between channels\n"); + VGM_LOG("AWC: found header diffs in channel %i, ns=%i vs %i, sr=%i vs %i, c=%i vs %i\n", + ch, awc->num_samples, num_samples, awc->sample_rate, sample_rate, awc->codec, codec); goto fail; }