You can use something like this to print the API name:patest_sine_formats hangs apparently forever.Sounds weird. Works perfectly with my setup. Can you tell me which one of the underlying host APIs (JACK/OSS/ALSA) is being used?
Can you tell me how to tell?
printf("Host API: %s\n", Pa_GetHostApiInfo(Pa_GetDefaultHostApi())->name);
Unless I explicitly disable it, OSS shows up as default.
That segfaulted 1st place I put it. Putting it after the open works
Oh yeah, sorry, I forgot to mention it has to come after the Pa_Initialize call. My bad :|
It looks like you got PortAudio working at least :) You can also look up the PaDeviceInfo struct for any device, to check out the default sample rate. I think the ALSA plughw device will convert the samplerate to a hardware supported one for you, so that might be your best bet? I have never used the PCM plugin myself, but its possible to specify a custom device string with pa_linux_alsa. If you look in the pa_linux_alsa.h file, you'll see a custom stream structure, PaAlsaStreamInfo, which basically can be used like this:Can you verify that the ALSA API is in use, after configuring out OSS and[EMAIL PROTECTED]:~/portaudio> !1025 bin/patest_sine_formats PortAudio Test: output Signed 16 Bit An error occured while using the portaudio stream Error number: -9997 Error message: Invalid sample rate
My ALSA card is quite capable of doing 44100
JACK? I cannot see why this test should fail, granted your card supports
the given samplerate. If you could be bothered, perhaps you could add some
debug output to function SetApproximateSampleRate at
pa_linux_alsa/pa_linux_alsa.c: 1575? Ie. you could verify that the correct
samplerate is indeed passed to ALSA-lib, and that ALSA-lib rejects it.
SetApproximateSampleRate is @ line 1583 in my copy: Making that :
err = snd_pcm_hw_params_set_rate( pcm, hwParams, approx, dir ); printf("%s approx=%lu rate=%d dir=%d\n", __FUNCTION__,approx, err, dir);
return err;
Yields:
[EMAIL PROTECTED]:~/portaudio> bin/patest_sine_formats PortAudio Test: output Signed 16 Bit SetApproximateSampleRate approx=44100 rate=-22 dir=0 Host API: ALSA An error occured while using the portaudio stream Error number: -9997 Error message: Invalid sample rate [EMAIL PROTECTED]:~/portaudio>
Which seems sane. Changing it to:
err = snd_pcm_hw_params_set_rate_near( pcm, hwParams, &approx, &dir );
printf("%s approx=%lu rate=%d dir=%d\n",
__FUNCTION__,approx, err, dir);
return err;
Yields:
[EMAIL PROTECTED]:~/portaudio> bin/patest_sine_formats PortAudio Test: output Signed 16 Bit SetApproximateSampleRate approx=48000 rate=0 dir=0 Host API: ALSA Waiting 10 seconds for sound to finish. PortAudio Test Finished: Signed 16 Bit
So perhaps my card does _NOT_ support 44100Hz after all. This is the card as autodetected/configured by SuSE9.0's YaST. Seems there are options to play with including the clock rate but I don't know what I am doing ...
PaAlsaStreamInfo alsaStreamInfo;
PaStreamParameters outputParameters;
PaAlsa_InitializeStreamInfo(&alsaStreamInfo); alsaStreamInfo.deviceString = "plughw:0,0";
outputParameters.device = paUseHostApiSpecificDeviceSpecification; outputParameters.hostApiSpecificStreamInfo = &alsaStreamInfo;
It's device string will then be used when opening the output device.
Hope this helps
Arve Knudsen
------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel