Moved dsp_read_coefs_be to ngc_dsp_decoder.c

This commit is contained in:
bnnm 2017-01-13 23:56:48 +01:00
parent f5750ba2cc
commit 14d2363670
5 changed files with 18 additions and 18 deletions

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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

View File

@ -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_ */

View File

@ -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) */