Changeset 33

Show
Ignore:
Timestamp:
01/06/07 21:31:26 (2 years ago)
Author:
gbooker
Message:

Allow multiple sample rates. Fixes #21

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/A52/ACShepA52Decoder.cpp

    r16 r33  
    5757#endif 
    5858         
    59         for (int channels = 1; channels <= 6; channels++) { 
    60                 //      This decoder only takes an A/52 or AC-3 stream as it's input 
    61                 CAStreamBasicDescription theInputFormat1(48000, kAudioFormatAC3, 0, 256*6, 0, channels, 0, 0); 
    62                 AddInputFormat(theInputFormat1); 
    63                 CAStreamBasicDescription theInputFormat2(48000, kAudioFormatAVIAC3, 0, 256*6, 0, channels, 0, 0); 
    64                 AddInputFormat(theInputFormat2); 
    65                  
    66                 // Output 16-Bit Ints 
    67                 CAStreamBasicDescription theOutputFormat1(48000, kAudioFormatLinearPCM, 0, 1, 0, channels, 16, kIntPCMOutFormatFlag); 
    68                 AddOutputFormat(theOutputFormat1); 
    69                  
    70                 // And 32-Bit 
    71                 CAStreamBasicDescription theOutputFormat2(48000, kAudioFormatLinearPCM, 0, 1, 0, channels, 32, kIntPCMOutFormatFlag); 
    72                 AddOutputFormat(theOutputFormat2); 
    73                  
    74                 // And floats 
    75                 CAStreamBasicDescription theOutputFormat3(48000, kAudioFormatLinearPCM, 0, 1, 0, channels, 32, kFloatPCMOutFormatFlag); 
    76                 AddOutputFormat(theOutputFormat3); 
    77         } 
    78          
     59        static int sample_rates[] = {48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 6000, 5512, 4000}; 
     60        for (int sample_index = 0; sample_index < 12; sample_index ++) 
     61        { 
     62                for (int channels = 1; channels <= 6; channels++) { 
     63                        //      This decoder only takes an A/52 or AC-3 stream as it's input 
     64                        CAStreamBasicDescription theInputFormat1(sample_rates[sample_index], kAudioFormatAC3, 0, 256*6, 0, channels, 0, 0); 
     65                        AddInputFormat(theInputFormat1); 
     66                        CAStreamBasicDescription theInputFormat2(sample_rates[sample_index], kAudioFormatAVIAC3, 0, 256*6, 0, channels, 0, 0); 
     67                        AddInputFormat(theInputFormat2); 
     68                         
     69                        // Output 16-Bit Ints 
     70                        CAStreamBasicDescription theOutputFormat1(sample_rates[sample_index], kAudioFormatLinearPCM, 0, 1, 0, channels, 16, kIntPCMOutFormatFlag); 
     71                        AddOutputFormat(theOutputFormat1); 
     72                         
     73                        // And 32-Bit 
     74                        CAStreamBasicDescription theOutputFormat2(sample_rates[sample_index], kAudioFormatLinearPCM, 0, 1, 0, channels, 32, kIntPCMOutFormatFlag); 
     75                        AddOutputFormat(theOutputFormat2); 
     76                         
     77                        // And floats 
     78                        CAStreamBasicDescription theOutputFormat3(sample_rates[sample_index], kAudioFormatLinearPCM, 0, 1, 0, channels, 32, kFloatPCMOutFormatFlag); 
     79                        AddOutputFormat(theOutputFormat3); 
     80                } 
     81        } 
    7982         
    8083        total_bytes = 0;