mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-30 20:41:00 +00:00
Update DUMB to revision 30b178af5674b8604306885a693c2a8aa422472f
- Fixed ADPCM sample support SVN r4105 (trunk)
This commit is contained in:
parent
5c65f7188e
commit
a0bc90bbc8
1 changed files with 19 additions and 7 deletions
|
@ -393,10 +393,12 @@ static DUMBFILE *dumbfile_buffer_mod(DUMBFILE *f, uint32 *fft)
|
||||||
return dumbfile_open_ex(bm, &buffer_mod_dfs);
|
return dumbfile_open_ex(bm, &buffer_mod_dfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DUMBFILE *dumbfile_buffer_mod_2(DUMBFILE *f, int32 *remain)
|
static DUMBFILE *dumbfile_buffer_mod_2(DUMBFILE *f, int n_samples, IT_SAMPLE *sample, int32 *total_sample_size, int32 *remain)
|
||||||
{
|
{
|
||||||
int32 read;
|
int32 read;
|
||||||
|
int sample_number;
|
||||||
BUFFERED_MOD *bm = malloc(sizeof(*bm));
|
BUFFERED_MOD *bm = malloc(sizeof(*bm));
|
||||||
|
unsigned char *ptr;
|
||||||
if (!bm) return NULL;
|
if (!bm) return NULL;
|
||||||
|
|
||||||
bm->buffered = malloc(32768);
|
bm->buffered = malloc(32768);
|
||||||
|
@ -430,6 +432,21 @@ static DUMBFILE *dumbfile_buffer_mod_2(DUMBFILE *f, int32 *remain)
|
||||||
|
|
||||||
if (*remain) {
|
if (*remain) {
|
||||||
bm->ptr = 0;
|
bm->ptr = 0;
|
||||||
|
ptr = bm->buffered + *remain;
|
||||||
|
sample_number = n_samples - 1;
|
||||||
|
*total_sample_size = 0;
|
||||||
|
while (ptr > bm->buffered && sample_number >= 0) {
|
||||||
|
if (sample[sample_number].flags & IT_SAMPLE_EXISTS) {
|
||||||
|
ptr -= (sample[sample_number].length + 1) / 2 + 5 + 16;
|
||||||
|
if (ptr >= bm->buffered && !memcmp(ptr, "ADPCM", 5)) { /* BAH */
|
||||||
|
*total_sample_size += (sample[sample_number].length + 1) / 2 + 5 + 16;
|
||||||
|
} else {
|
||||||
|
*total_sample_size += sample[sample_number].length;
|
||||||
|
ptr -= sample[sample_number].length - ((sample[sample_number].length + 1) / 2 + 5 + 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sample_number--;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
free(bm->buffered);
|
free(bm->buffered);
|
||||||
bm->buffered = NULL;
|
bm->buffered = NULL;
|
||||||
|
@ -635,17 +652,12 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
|
||||||
long total_sample_size;
|
long total_sample_size;
|
||||||
long remain;
|
long remain;
|
||||||
rem = f;
|
rem = f;
|
||||||
f = dumbfile_buffer_mod_2(rem, &remain);
|
f = dumbfile_buffer_mod_2(rem, sigdata->n_samples, sigdata->sample, &total_sample_size, &remain);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
_dumb_it_unload_sigdata(sigdata);
|
_dumb_it_unload_sigdata(sigdata);
|
||||||
dumbfile_close(rem);
|
dumbfile_close(rem);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (total_sample_size = 0, i = 0; i < sigdata->n_samples; i++) {
|
|
||||||
if (sigdata->sample[i].flags & IT_SAMPLE_EXISTS) {
|
|
||||||
total_sample_size += sigdata->sample[i].length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (remain > total_sample_size) {
|
if (remain > total_sample_size) {
|
||||||
sigdata->n_patterns = ( remain - total_sample_size + 4 ) / ( 256 * sigdata->n_pchannels );
|
sigdata->n_patterns = ( remain - total_sample_size + 4 ) / ( 256 * sigdata->n_pchannels );
|
||||||
if (fft == DUMB_ID('M',0,0,0) || fft == DUMB_ID('8',0,0,0)) {
|
if (fft == DUMB_ID('M',0,0,0) || fft == DUMB_ID('8',0,0,0)) {
|
||||||
|
|
Loading…
Reference in a new issue