mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
Extra helpers
This commit is contained in:
parent
ee93b9d59f
commit
05ff8464fd
@ -90,7 +90,9 @@ void decode_ulaw(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing,
|
||||
void decode_ulaw_int(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_alaw(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_pcmfloat(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int big_endian);
|
||||
size_t pcm_bytes_to_samples(size_t bytes, int channels, int bits_per_sample);
|
||||
int32_t pcm_bytes_to_samples(size_t bytes, int channels, int bits_per_sample);
|
||||
int32_t pcm16_bytes_to_samples(size_t bytes, int channels);
|
||||
int32_t pcm8_bytes_to_samples(size_t bytes, int channels);
|
||||
|
||||
|
||||
/* psx_decoder */
|
||||
|
@ -216,7 +216,15 @@ void decode_pcmfloat(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelsp
|
||||
}
|
||||
}
|
||||
|
||||
size_t pcm_bytes_to_samples(size_t bytes, int channels, int bits_per_sample) {
|
||||
int32_t pcm_bytes_to_samples(size_t bytes, int channels, int bits_per_sample) {
|
||||
if (channels <= 0 || bits_per_sample <= 0) return 0;
|
||||
return ((int64_t)bytes * 8) / channels / bits_per_sample;
|
||||
}
|
||||
|
||||
int32_t pcm16_bytes_to_samples(size_t bytes, int channels) {
|
||||
return pcm_bytes_to_samples(bytes, channels, 16);
|
||||
}
|
||||
|
||||
int32_t pcm8_bytes_to_samples(size_t bytes, int channels) {
|
||||
return pcm_bytes_to_samples(bytes, channels, 8);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user