mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-12-20 18:35:52 +01:00
1eba859222
changed _noninterleaved functions to _int and changed related descriptions appropriately added an _int version of SDX2 and reverted to pre-322 behavior for normal deocder made the various get_high_nibble globals all be the same vgmstream->get_high_nibble for thread safety and code consolidation (this required some changes to make decode functions take VGMSTREAM rather than VGMSTREAMCHANNEL) git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@323 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
48 lines
1.9 KiB
C
48 lines
1.9 KiB
C
#include "coding.h"
|
|
#include "../util.h"
|
|
|
|
void decode_pcm16LE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
|
int i;
|
|
int32_t sample_count;
|
|
|
|
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
|
outbuf[sample_count]=read_16bitLE(stream->offset+i*2,stream->streamfile);
|
|
}
|
|
}
|
|
|
|
void decode_pcm16BE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
|
int i;
|
|
int32_t sample_count;
|
|
|
|
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
|
outbuf[sample_count]=read_16bitBE(stream->offset+i*2,stream->streamfile);
|
|
}
|
|
}
|
|
|
|
void decode_pcm8(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
|
int i;
|
|
int32_t sample_count;
|
|
|
|
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
|
outbuf[sample_count]=read_8bit(stream->offset+i,stream->streamfile)*0x100;
|
|
}
|
|
}
|
|
|
|
void decode_pcm8_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
|
int i;
|
|
int32_t sample_count;
|
|
|
|
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
|
outbuf[sample_count]=read_8bit(stream->offset+i*channelspacing,stream->streamfile)*0x100;
|
|
}
|
|
}
|
|
|
|
void decode_pcm16LE_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
|
int i;
|
|
int32_t sample_count;
|
|
|
|
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
|
outbuf[sample_count]=read_16bitLE(stream->offset+i*2*channelspacing,stream->streamfile);
|
|
}
|
|
}
|