Mercurial > audlegacy-plugins
diff src/CoreAudio/audio.c @ 62:4a352dd2a91c trunk
[svn] - be a little smarter about this
author | nenolod |
---|---|
date | Sat, 30 Sep 2006 21:40:46 -0700 |
parents | a69b14abbc65 |
children | 023b3e4147c0 |
line wrap: on
line diff
--- 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); }