ref: 71ecdc7274a7fa33af0a0dea915eb3a294b0b04a
parent: 667b479457fd7c1e9aff4ea8301295c81762bdf5
author: Chris Moeller <kode54@gmail.com>
date: Tue Aug 2 19:31:19 EDT 2011
- Fixed IT stereo samples - Version is now 0.9.9.43 git-tfs-id: [http://localhost:8080/tfs/DefaultCollection/]$/foobar2000/files/plugins.root;C713
--- a/dumb/include/internal/it.h
+++ b/dumb/include/internal/it.h
@@ -54,7 +54,7 @@
* handle ambiguities in the format specification. The correct code in each
* case will be determined most likely by experimentation.
*/
-#define STEREO_SAMPLES_COUNT_AS_TWO
+//#define STEREO_SAMPLES_COUNT_AS_TWO
#define INVALID_ORDERS_END_SONG
#define INVALID_NOTES_CAUSE_NOTE_CUT
#define SUSTAIN_LOOP_OVERRIDES_NORMAL_LOOP
@@ -894,5 +894,7 @@
void _dumb_it_ptm_convert_effect(int effect, int value, IT_ENTRY *entry);
long _dumb_it_read_sample_data_adpcm4(IT_SAMPLE *sample, DUMBFILE *f);
+
+void _dumb_it_interleave_stereo_sample(IT_SAMPLE *sample);
#endif /* INTERNAL_IT_H */
--- a/dumb/src/it/itread.c
+++ b/dumb/src/it/itread.c
@@ -681,15 +681,36 @@
else
decompress8(f, sample->data, datasize, ((cmwt >= 0x215) && (convert & 4)));
} else if (sample->flags & IT_SAMPLE_16BIT) {
- if (convert & 2)
+ if (sample->flags & IT_SAMPLE_STEREO) {
+ if (convert & 2) {
+ for (n = 0; n < datasize; n += 2)
+ ((short *)sample->data)[n] = dumbfile_mgetw(f);
+ for (n = 1; n < datasize; n += 2)
+ ((short *)sample->data)[n] = dumbfile_mgetw(f);
+ } else {
+ for (n = 0; n < datasize; n += 2)
+ ((short *)sample->data)[n] = dumbfile_igetw(f);
+ for (n = 1; n < datasize; n += 2)
+ ((short *)sample->data)[n] = dumbfile_igetw(f);
+ }
+ } else {
+ if (convert & 2)
+ for (n = 0; n < datasize; n++)
+ ((short *)sample->data)[n] = dumbfile_mgetw(f);
+ else
+ for (n = 0; n < datasize; n++)
+ ((short *)sample->data)[n] = dumbfile_igetw(f);
+ }
+ } else {
+ if (sample->flags & IT_SAMPLE_STEREO) {
+ for (n = 0; n < datasize; n += 2)
+ ((signed char *)sample->data)[n] = dumbfile_getc(f);
+ for (n = 1; n < datasize; n += 2)
+ ((signed char *)sample->data)[n] = dumbfile_getc(f);
+ } else
for (n = 0; n < datasize; n++)
- ((short *)sample->data)[n] = dumbfile_mgetw(f);
- else
- for (n = 0; n < datasize; n++)
- ((short *)sample->data)[n] = dumbfile_igetw(f);
- } else
- for (n = 0; n < datasize; n++)
- ((signed char *)sample->data)[n] = dumbfile_getc(f);
+ ((signed char *)sample->data)[n] = dumbfile_getc(f);
+ }
if (dumbfile_error(f))
return -1;