comparison alt_audio_convert.c @ 421:a65440b3a057

Patched to compile.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 26 Sep 2002 04:39:41 +0000
parents 5b8a07b5162e
children 5b00e43ec23c
comparison
equal deleted inserted replaced
420:5b8a07b5162e 421:a65440b3a057
344 344
345 /*-------------------------------------------------------------------------*/ 345 /*-------------------------------------------------------------------------*/
346 static int convertMonoToStereo16Bit( AdapterC Data, int length ) 346 static int convertMonoToStereo16Bit( AdapterC Data, int length )
347 { 347 {
348 int i; 348 int i;
349 Uint16* buffer;
350 Uint16* dst;
351
349 length >>=1; 352 length >>=1;
350 Uint16* buffer = (Uint16*)Data.buffer - 1; 353 buffer = (Uint16*)Data.buffer - 1;
351 Uint16* dst = (Uint16*)Data.buffer + 2*length - 2; 354 dst = (Uint16*)Data.buffer + 2*length - 2;
352 for( i = length + 1; --i; dst-=2 ) 355 for( i = length + 1; --i; dst-=2 )
353 dst[0] = dst[1] = buffer[i]; 356 dst[0] = dst[1] = buffer[i];
354 return 4*length; 357 return 4*length;
355 } 358 }
356 359
500 } 503 }
501 504
502 static int doubleRateStereo( AdapterC Data, int length ) 505 static int doubleRateStereo( AdapterC Data, int length )
503 { 506 {
504 Sint16* r; 507 Sint16* r;
508 RateConverterBuffer rcb;
505 fprintf( stderr, "\n Buffer: %8x length: %8x\n", Data.buffer, length ); 509 fprintf( stderr, "\n Buffer: %8x length: %8x\n", Data.buffer, length );
506 RateConverterBuffer rcb;
507 initRateConverterBuffer( &rcb, &Data, length, Half ); 510 initRateConverterBuffer( &rcb, &Data, length, Half );
508 doRateConversion( &rcb, doubleRate2 ); 511 doRateConversion( &rcb, doubleRate2 );
509 nextRateConverterBuffer( &rcb ); 512 nextRateConverterBuffer( &rcb );
510 r = 2 + doRateConversion( &rcb, doubleRate2 ); 513 r = 2 + doRateConversion( &rcb, doubleRate2 );
511 clearSint16Buffer( Data.buffer, r ); 514 clearSint16Buffer( Data.buffer, r );
545 } 548 }
546 549
547 static int increaseRateStereo( AdapterC Data, int length ) 550 static int increaseRateStereo( AdapterC Data, int length )
548 { 551 {
549 Sint16* r; 552 Sint16* r;
553 RateConverterBuffer rcb;
550 fprintf( stderr, "\n Buffer: %8x length: %8x\n", Data.buffer, length ); 554 fprintf( stderr, "\n Buffer: %8x length: %8x\n", Data.buffer, length );
551 RateConverterBuffer rcb;
552 initRateConverterBuffer( &rcb, &Data, length, Data.filter->ratio ); 555 initRateConverterBuffer( &rcb, &Data, length, Data.filter->ratio );
553 doRateConversion( &rcb, increaseRate2 ); 556 doRateConversion( &rcb, increaseRate2 );
554 nextRateConverterBuffer( &rcb ); 557 nextRateConverterBuffer( &rcb );
555 r = doRateConversion( &rcb, increaseRate2 ); 558 r = doRateConversion( &rcb, increaseRate2 );
556 clearSint16Buffer( Data.buffer, r ); 559 clearSint16Buffer( Data.buffer, r );
1007 } 1010 }
1008 1011
1009 1012
1010 int Sound_BuildAudioCVT(Sound_AudioCVT *Data, 1013 int Sound_BuildAudioCVT(Sound_AudioCVT *Data,
1011 Uint16 src_format, Uint8 src_channels, int src_rate, 1014 Uint16 src_format, Uint8 src_channels, int src_rate,
1012 Uint16 dst_format, Uint8 dst_channels, int dst_rate ) 1015 Uint16 dst_format, Uint8 dst_channels, int dst_rate, Uint32 bufsize)
1013 { 1016 {
1014 SDL_AudioSpec src, dst; 1017 SDL_AudioSpec src, dst;
1015 int ret; 1018 int ret;
1016 1019
1017 fprintf (stderr, 1020 fprintf (stderr,