use Pa_OpenStream rather than Pa_IsFormatSupported as it is believed to work in more cases
Adrian Smith
10 years ago
428 | 428 | outputParameters.hostApiSpecificStreamInfo = NULL; |
429 | 429 | |
430 | 430 | // check supported sample rates |
431 | // Note this does not appear to work on OSX - it always returns paNoError... | |
431 | // Note use Pa_OpenStream as it appears more reliable than Pa_OpenStream on some windows apis | |
432 | 432 | for (i = 0; rates[i]; ++i) { |
433 | if (Pa_IsFormatSupported(NULL, &outputParameters, (double)rates[i]) == paNoError) { | |
433 | err = Pa_OpenStream(&pa.stream, NULL, &outputParameters, (double)rates[i], paFramesPerBufferUnspecified, paNoFlag, | |
434 | pa_callback, NULL); | |
435 | if (err == paNoError) { | |
436 | Pa_CloseStream(pa.stream); | |
434 | 437 | *max_rate = rates[i]; |
435 | 438 | break; |
436 | 439 | } |
440 | } | |
441 | ||
442 | if (!rates[i]) { | |
443 | LOG_WARN("no available rate found"); | |
444 | return false; | |
437 | 445 | } |
438 | 446 | |
439 | 447 | if ((err = Pa_OpenStream(&pa.stream, NULL, &outputParameters, (double)*max_rate, paFramesPerBufferUnspecified, |