goto out;
for (i = 0; i < padd->frame_info.samples; i++) {
short *s = (short *)outbuffer;
- write_int16_host_endian(fn->buf + fn->loaded, s);
- fn->loaded += 2;
+ fn->buf[fn->loaded++] = s[i] & 0xff;
+ fn->buf[fn->loaded++] = (s[i] >> 8) & 0xff;
}
success:
ret = consumed;
*/
void *(*parse_config)(int argc, char **argv);
};
-
-
-static inline void write_int16_host_endian(char *buf, int16_t val)
-{
-#ifndef BIGENDIAN
- *buf = val >> 8;
- *(buf + 1) = val & 0xff;
-#else
- *buf = val & 0xff;
- *(buf + 1) = val >> 8;
-#endif
-}
-
-
/** \cond */
extern struct filter filters[];
#define DECLARE_EXTERN_FILTER_INIT(name) \
AACDEC_FILTER \
OGGDEC_FILTER \
{ .name = NULL } };
-
-
mad_synth_frame(&pmd->synth, &pmd->frame);
for (i = 0; i < pmd->synth.pcm.length; i++) {
+ /* output format: unsigned 16 bit little endian */
signed short s = MAD_TO_SHORT(pmd->synth.pcm.samples[0][i]);
- write_int16_host_endian(fn->buf + fn->loaded, s);
- fn->loaded += 2;
+ fn->buf[fn->loaded++] = s & 0xff;
+ fn->buf[fn->loaded++] = s >> 8;
if (MAD_NCHANNELS(&pmd->frame.header) == 2) { /* stereo */
s = MAD_TO_SHORT(pmd->synth.pcm.samples[1][i]);
- write_int16_host_endian(fn->buf + fn->loaded, s);
- fn->loaded += 2;
+ fn->buf[fn->loaded++] = s & 0xff;
+ fn->buf[fn->loaded++] = s >> 8;
}
if (fn->loaded != fn->bufsize) /* output buffer not full */
continue;
b->size = size;
}
dest = b->buffer;
- while (size--)
+ while (size--) {
+ char *tmp = (char *)source;
+ char c = *tmp;
+ *tmp = *(tmp + 1);
+ *(tmp + 1) = c;
+ /* *dest++ = ((*source++) + 32768) / 65536.0; */
*dest++ = (*source++) / 32768.0;
+ }
b->ptr = b->buffer;
b->remaining = b->size;
}