diff options
author | waker <wakeroid@gmail.com> | 2009-09-02 20:22:44 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2009-09-02 20:22:44 +0200 |
commit | 93272197daa4820fe5bce1342cd7828ed5a20299 (patch) | |
tree | 9b83e40f81ee525b382d89e04ed5ea4fb3e3cdd9 /plugins | |
parent | e2babab016f02c1c91fde27f3a7a34e5baba333f (diff) |
minor tweaks to demac decoder
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/demac/demac.c | 51 |
1 files changed, 12 insertions, 39 deletions
diff --git a/plugins/demac/demac.c b/plugins/demac/demac.c index 0d258f2b..5e29ce3e 100644 --- a/plugins/demac/demac.c +++ b/plugins/demac/demac.c @@ -31,7 +31,7 @@ static DB_decoder_t plugin; static DB_functions_t *deadbeef; -#define CALC_CRC 1 +#define CALC_CRC 0 #define BLOCKS_PER_LOOP 4608 #define MAX_CHANNELS 2 @@ -354,49 +354,22 @@ demac_read (char *buffer, int size) { } /* Convert the output samples to WAV format and write to output file */ +#if CALC_CRC uint8_t *pp = wavbuffer + bufferfill; +#endif uint8_t *p = wavbuffer + bufferfill; - if (ape_ctx.bps == 8) { - assert (0); - for (i = 0 ; i < blockstodecode ; i++) - { - /* 8 bit WAV uses unsigned samples */ - *(p++) = (decoded0[i] + 0x80) & 0xff; - - if (ape_ctx.channels == 2) { - *(p++) = (decoded1[i] + 0x80) & 0xff; - } - } - } else if (ape_ctx.bps == 16) { - for (i = 0 ; i < blockstodecode ; i++) - { - sample16 = decoded0[i]; + for (i = 0 ; i < blockstodecode ; i++) + { + sample16 = decoded0[i]; + *(p++) = sample16 & 0xff; + *(p++) = (sample16 >> 8) & 0xff; + bufferfill += 2; + + if (ape_ctx.channels == 2) { + sample16 = decoded1[i]; *(p++) = sample16 & 0xff; *(p++) = (sample16 >> 8) & 0xff; bufferfill += 2; - - if (ape_ctx.channels == 2) { - sample16 = decoded1[i]; - *(p++) = sample16 & 0xff; - *(p++) = (sample16 >> 8) & 0xff; - bufferfill += 2; - } - } - } else if (ape_ctx.bps == 24) { - assert (0); - for (i = 0 ; i < blockstodecode ; i++) - { - sample32 = decoded0[i]; - *(p++) = sample32 & 0xff; - *(p++) = (sample32 >> 8) & 0xff; - *(p++) = (sample32 >> 16) & 0xff; - - if (ape_ctx.channels == 2) { - sample32 = decoded1[i]; - *(p++) = sample32 & 0xff; - *(p++) = (sample32 >> 8) & 0xff; - *(p++) = (sample32 >> 16) & 0xff; - } } } |