mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-27 16:10:48 +01:00
describe_vgmstream is a handy debugging tool
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@19 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
00c1a3abdb
commit
c62bb473fb
@ -245,3 +245,80 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
|
||||
/*}*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
void describe_vgmstream(VGMSTREAM * vgmstream) {
|
||||
if (!vgmstream) {
|
||||
printf("NULL VGMSTREAM\n");
|
||||
return;
|
||||
}
|
||||
printf("sample rate %d Hz\n",vgmstream->sample_rate);
|
||||
printf("channels: %d\n",vgmstream->channels);
|
||||
if (vgmstream->loop_flag) {
|
||||
printf("loop start: %d samples (%.2lf seconds)\n",vgmstream->loop_start_sample,(double)vgmstream->loop_start_sample/vgmstream->sample_rate);
|
||||
printf("loop end: %d samples (%.2lf seconds)\n",vgmstream->loop_end_sample,(double)vgmstream->loop_end_sample/vgmstream->sample_rate);
|
||||
}
|
||||
printf("stream total samples: %d (%.2lf seconds)\n",vgmstream->num_samples,(double)vgmstream->num_samples/vgmstream->sample_rate);
|
||||
|
||||
printf("metadata from: ");
|
||||
switch (vgmstream->meta_type) {
|
||||
case meta_RSTM:
|
||||
printf("RSTM header");
|
||||
break;
|
||||
case meta_ADX_03:
|
||||
printf("ADX header type 03");
|
||||
break;
|
||||
case meta_ADX_04:
|
||||
printf("ADX header type 04");
|
||||
break;
|
||||
default:
|
||||
printf("THEY SHOULD HAVE SENT A POET");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("encoding: ");
|
||||
switch (vgmstream->coding_type) {
|
||||
case coding_PCM16BE:
|
||||
printf("Big Endian 16-bit PCM");
|
||||
break;
|
||||
case coding_PCM16LE:
|
||||
printf("Little Endian 16-bit PCM");
|
||||
break;
|
||||
case coding_PCM8:
|
||||
printf("8-bit PCM");
|
||||
break;
|
||||
case coding_NGC_DSP:
|
||||
printf("Gamecube \"DSP\" 4-bit ADPCM");
|
||||
break;
|
||||
case coding_CRI_ADX:
|
||||
printf("CRI ADX 4-bit ADPCM");
|
||||
break;
|
||||
default:
|
||||
printf("CANNOT DECODE");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("layout: ");
|
||||
switch (vgmstream->layout_type) {
|
||||
case layout_none:
|
||||
printf("flat (no layout)");
|
||||
break;
|
||||
case layout_interleave:
|
||||
printf("interleave");
|
||||
break;
|
||||
case layout_interleave_shortblock:
|
||||
printf("interleave with short last block");
|
||||
break;
|
||||
default:
|
||||
printf("INCONCEIVABLE");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (vgmstream->layout_type == layout_interleave || vgmstream->layout_type == layout_interleave_shortblock) {
|
||||
printf("interleave: %#x bytes\n",vgmstream->interleave_block_size);
|
||||
if (vgmstream->layout_type == layout_interleave_shortblock) {
|
||||
printf("last block interleave: %#x bytes\n",vgmstream->interleave_smallblock_size);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -161,4 +161,6 @@ int vgmstream_samples_to_do(int samples_this_block, int samples_per_frame, VGMST
|
||||
* Returns 1 if loop was done. */
|
||||
int vgmstream_do_loop(VGMSTREAM * vgmstream);
|
||||
|
||||
void describe_vgmstream(VGMSTREAM * vgmstream);
|
||||
|
||||
#endif
|
||||
|
@ -72,6 +72,7 @@ int main(int argc, char ** argv) {
|
||||
}
|
||||
|
||||
printf("decoding %s\n",argv[optind]);
|
||||
/*
|
||||
printf("sample rate %d Hz\n",s->sample_rate);
|
||||
printf("channels: %d\n",s->channels);
|
||||
if (s->loop_flag) {
|
||||
@ -79,6 +80,8 @@ int main(int argc, char ** argv) {
|
||||
printf("loop end: %d samples (%.2lf seconds)\n",s->loop_end_sample,(double)s->loop_end_sample/s->sample_rate);
|
||||
}
|
||||
printf("file total samples: %d (%.2lf seconds)\n",s->num_samples,(double)s->num_samples/s->sample_rate);
|
||||
*/
|
||||
describe_vgmstream(s);
|
||||
|
||||
len = get_vgmstream_play_samples(loop_count,fade_time,s);
|
||||
printf("samples to play: %d (%.2lf seconds)\n",len,(double)len/s->sample_rate);
|
||||
|
Loading…
Reference in New Issue
Block a user