From 14d236367021e41b71d3157c5450d2afb2e8dfe8 Mon Sep 17 00:00:00 2001 From: bnnm Date: Fri, 13 Jan 2017 23:56:48 +0100 Subject: [PATCH] Moved dsp_read_coefs_be to ngc_dsp_decoder.c --- src/coding/coding.h | 1 + src/coding/ngc_dsp_decoder.c | 16 ++++++++++++++++ src/header.c | 15 --------------- src/header.h | 2 -- src/meta/fsb.c | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/coding/coding.h b/src/coding/coding.h index 7480b5f2..2fb1fed8 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -30,6 +30,7 @@ void decode_ms_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * out void decode_ngc_dsp(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_ngc_dsp_mem(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, uint8_t * mem); int32_t dsp_nibbles_to_samples(int32_t nibbles); +void dsp_read_coefs_be(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t offset, off_t spacing); /* ngc_dtk_decoder */ void decode_ngc_dtk(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); diff --git a/src/coding/ngc_dsp_decoder.c b/src/coding/ngc_dsp_decoder.c index 66dd845d..5b87c45b 100644 --- a/src/coding/ngc_dsp_decoder.c +++ b/src/coding/ngc_dsp_decoder.c @@ -94,3 +94,19 @@ int32_t dsp_nibbles_to_samples(int32_t nibbles) { if (remainder>0) return whole_frames*14+remainder-2; else return whole_frames*14; } + + +/** + * reads DSP coefs built in the streamfile + */ +void dsp_read_coefs_be(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t offset, off_t spacing) { + int ch, i; + /* get ADPCM coefs */ + for (ch=0; ch < vgmstream->channels; ch++) { + for (i=0; i < 16; i++) { + vgmstream->ch[ch].adpcm_coef[i] = + read_16bitBE(offset + ch*spacing + i*2, streamFile); + } + } +} + diff --git a/src/header.c b/src/header.c index f9a0561c..b479a8a1 100644 --- a/src/header.c +++ b/src/header.c @@ -94,21 +94,6 @@ int header_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t star } -/** - * reads DSP coefs built in the streamfile - */ -void header_dsp_read_coefs_be(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t offset, off_t spacing) { - int ch, i; - /* get ADPCM coefs */ - for (ch=0; ch < vgmstream->channels; ch++) { - for (i=0; i < 16; i++) { - vgmstream->ch[ch].adpcm_coef[i] = - read_16bitBE(offset + ch*spacing + i*2, streamFile); - } - } -} - - #if 0 /** * Converts a data offset (without headers) to sample, so full datasize would be num_samples diff --git a/src/header.h b/src/header.h index d2742398..d5cd44ce 100644 --- a/src/header.h +++ b/src/header.h @@ -14,6 +14,4 @@ int header_check_extensions(STREAMFILE *streamFile, const char * cmpexts); int header_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t start_offset); -void header_dsp_read_coefs_be(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t offset, off_t spacing); - #endif /* _HEADER_H_ */ diff --git a/src/meta/fsb.c b/src/meta/fsb.c index fe1c4348..f7ddaa74 100644 --- a/src/meta/fsb.c +++ b/src/meta/fsb.c @@ -351,7 +351,7 @@ VGMSTREAM * init_vgmstream_fsb_offset(STREAMFILE *streamFile, off_t offset) { vgmstream->coding_type = coding_NGC_DSP; vgmstream->layout_type = layout_interleave_byte; vgmstream->interleave_block_size = 0x2; - header_dsp_read_coefs_be(vgmstream, streamFile, custom_data_offset, 0x2e); + dsp_read_coefs_be(vgmstream, streamFile, custom_data_offset, 0x2e); } else if (fsbh.mode & FSOUND_OGG) { /* FSB4: ? (possibly FMOD's custom ogg) */