# HG changeset patch # User nenolod # Date 1159677646 25200 # Node ID 4a352dd2a91c63997f539f80e3de383941a42c9b # Parent a69b14abbc65215257076d30b30f328b739c5fcc [svn] - be a little smarter about this diff -r a69b14abbc65 -r 4a352dd2a91c ChangeLog --- a/ChangeLog Sat Sep 30 21:33:57 2006 -0700 +++ b/ChangeLog Sat Sep 30 21:40:46 2006 -0700 @@ -1,3 +1,11 @@ +2006-10-01 04:33:57 +0000 William Pitcock + revision [122] + - conversion tables + + trunk/src/CoreAudio/audio.c | 32 +++++++++++++++++++++++++++++--- + 1 file changed, 29 insertions(+), 3 deletions(-) + + 2006-10-01 04:30:12 +0000 William Pitcock revision [120] - use xconvert to swap endianness if necessary (LE -> BE, vice versa) diff -r a69b14abbc65 -r 4a352dd2a91c src/CoreAudio/audio.c --- a/src/CoreAudio/audio.c Sat Sep 30 21:33:57 2006 -0700 +++ b/src/CoreAudio/audio.c Sat Sep 30 21:40:46 2006 -0700 @@ -93,8 +93,37 @@ return bitrate; } +static int osx_get_format(AFormat fmt) +{ + int format = 0; -static int osx_get_format(AFormat fmt) + switch (fmt) + { + case FMT_U16_NE: +#ifdef WORDS_BIGENDIAN + format = FMT_U16_BE; +#else + format = FMT_U16_LE; +#endif + break; + case FMT_S16_NE: +#ifdef WORDS_BIGENDIAN + format = FMT_S16_BE; +#else + format = FMT_S16_LE; +#endif + break; + default: + format = fmt; + break; + } + + printf("in: %d, out: %d\n", fmt, format); + + return format; +} + +static int osx_get_conv_format(AFormat fmt) { int format = 0; @@ -147,6 +176,8 @@ break; } + printf("in: %d, out: %d\n", fmt, format); + return format; } @@ -255,7 +286,10 @@ osx_set_audio_params(); - osx_convert_func = osx_get_convert_func(fmt, output.format.osx); + if (fmt != osx_get_conv_format(fmt)) + osx_convert_func = osx_get_convert_func(fmt, osx_get_conv_format(fmt)); + else + osx_convert_func = NULL; output.bps = osx_calc_bitrate(output.format.osx, output.frequency,output.channels); }