/* * codec.c * * Scott Wilson * rswilson@ccrma.stanford.edu * last updated: June 15, 2003 * */ #include #include #include #include #include "codec.h" #include "file.h" #include "vector.h" uint8_t g_codec_debug = 1; void codec_char_dump(char c) { int j; if (! g_codec_debug) return; printf("%2x - ",c); for (j=0;j<8; j++) { printf("%d", (1 && c & (0x80 >> j))); if (! ((j+1) % 4)) printf(" "); } printf("\n"); } void codec_short_dump(uint16_t s) { int j; if (! g_codec_debug) return; printf("%4x - ",s); for (j=0;j<16; j++) { printf("%d", (1 && s & (0x8000 >> j))); if (! ((j+1) % 4)) printf(" "); } printf("\n"); } void codec_error(const char *component, const char *fn, const char *msg) { fprintf(stderr,"%s error: (%s) %s\n",component,fn,msg); } void codec_debug(const char *component, const char *fn, const char *msg) { if (g_codec_debug) fprintf(stderr,"%s debug: (%s) %s\n",component,fn,msg); }