コード例 #1
0
ファイル: paqa_devs.c プロジェクト: Excalibur201010/sharpsdr
/*******************************************************************
* Try each output device, through its full range of capabilities. */
static void TestDevices( int mode )
{
    int id, jc, i;
    int maxChannels;
    const PaDeviceInfo *pdi;
    static double standardSampleRates[] = {  8000.0,  9600.0, 11025.0, 12000.0,
                                            16000.0,          22050.0, 24000.0,
                                            32000.0,          44100.0, 48000.0,
                                                              88200.0, 96000.0,
                                               -1.0 }; /* Negative terminated list. */
    int numDevices = Pa_GetDeviceCount();
    for( id=0; id<numDevices; id++ )            /* Iterate through all devices. */
    {
        pdi = Pa_GetDeviceInfo( id );
        /* Try 1 to maxChannels on each device. */
        maxChannels = (( mode == MODE_INPUT ) ? pdi->maxInputChannels : pdi->maxOutputChannels);
        
        for( jc=1; jc<=maxChannels; jc++ )
        {
            printf("Name         = %s\n", pdi->name );
            /* Try each standard sample rate. */
            for( i=0; standardSampleRates[i] > 0; i++ )
            {
                TestFormats( mode, (PaDeviceIndex)id, standardSampleRates[i], jc );
            }
        }
    }
}
コード例 #2
0
ファイル: paqa_devs.c プロジェクト: dirocco/portaudio
/*******************************************************************
* Try each output device, through its full range of capabilities. */
static void TestDevices( int mode )
{
    int id,jc,kr;
    int maxChannels;
    const PaDeviceInfo *pdi;
    int numDevices  = Pa_CountDevices();
    /* Iterate through all devices. */
    for( id=0; id<numDevices; id++ )
    {
        pdi = Pa_GetDeviceInfo( id );
        /* Try 1 to maxChannels on each device. */
        maxChannels = ( mode == MODE_INPUT ) ? pdi->maxInputChannels : pdi->maxOutputChannels;
        for( jc=1; jc<=maxChannels; jc++ )
        {
            printf("Name         = %s\n", pdi->name );
            /* Try each legal sample rate. */
            if( pdi->numSampleRates == -1 )
            {
                double low, high;
                low = pdi->sampleRates[0];
                high = pdi->sampleRates[1];
                if( low < 8000.0 ) low = 8000.0;
                TestFormats( mode, id, low, jc );
#define TESTSR(sr) {if(((sr)>=low) && ((sr)<=high)) TestFormats( mode, id, (sr), jc ); }

                TESTSR(11025.0);
                TESTSR(22050.0);
                TESTSR(34567.0);
                TESTSR(44100.0);
                TestFormats( mode, id, high, jc );
            }
            else
            {
                for( kr=0; kr<pdi->numSampleRates; kr++ )
                {
                    TestFormats( mode, id, pdi->sampleRates[kr], jc );
                }
            }
        }
    }
}