changeset 35277:4e9d5dc30c00

Simplify some ao_win32 code.
author reimar
date Fri, 09 Nov 2012 21:20:11 +0000
parents 0f09dd8843bf
children aae43c07d98c
files libao2/ao_win32.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_win32.c	Fri Nov 09 21:03:30 2012 +0000
+++ b/libao2/ao_win32.c	Fri Nov 09 21:20:11 2012 +0000
@@ -165,8 +165,7 @@
 	ao_data.samplerate=rate;
 	ao_data.format=format;
 	ao_data.bps=channels*rate;
-	if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8)
-	  ao_data.bps*=2;
+	ao_data.bps*=af_fmt2bits(format)/8;
 	ao_data.outburst = BUFFER_SIZE;
 	if(ao_data.buffersize==-1)
 	{
@@ -182,16 +181,15 @@
     wformat.Format.cbSize          = (channels>2)?sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX):0;
     wformat.Format.nChannels       = channels;
     wformat.Format.nSamplesPerSec  = rate;
+    wformat.Format.wBitsPerSample  = af_fmt2bits(format);
     if(AF_FORMAT_IS_AC3(format))
     {
         wformat.Format.wFormatTag      = WAVE_FORMAT_DOLBY_AC3_SPDIF;
-        wformat.Format.wBitsPerSample  = 16;
         wformat.Format.nBlockAlign     = 4;
     }
     else
     {
         wformat.Format.wFormatTag      = (channels>2)?WAVE_FORMAT_EXTENSIBLE:WAVE_FORMAT_PCM;
-        wformat.Format.wBitsPerSample  = af_fmt2bits(format);
         wformat.Format.nBlockAlign     = wformat.Format.nChannels * (wformat.Format.wBitsPerSample >> 3);
     }
 	if(channels>2)