> it seems params == 0 when you're calling snd_pcm_hw_refine.
Hello,
Sorry but there is no codeline like snd_pcm_hw_refine in the example.
I will send you the file as an attachment.
Best regards
Philipp Vollmer
[EMAIL PROTECTED]
#include <stdlib.h>
#include <alsa/asoundlib.h>
main (int argc, char *argv[])
{
int i;
char buf[4096];
snd_pcm_t *playback_handle;
snd_pcm_hw_params_t *hw_params;
if ((playback_handle = snd_pcm_open (&playback_handle, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
fprintf (stderr, "cannot open audio device %s\n", argv[1]);
exit (1);
}
// snd_pcm_open (&playback_handle, pcm_name, SND_PCM_STREAM_PLAYBACK, 0)
snd_pcm_hw_params_malloc (&hw_params);
snd_pcm_hw_params_any (playback_handle, hw_params);
snd_pcm_hw_params_set_access (playback_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
snd_pcm_hw_params_set_format (playback_handle, hw_params, SND_PCM_FORMAT_S16_LE);
snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, 44100, 0);
//snd_pcm_hw_params_set_rate_near(playback_handle, hw_params, 44100, 0);
snd_pcm_hw_params_set_channels (playback_handle, hw_params, 2);
snd_pcm_hw_params (playback_handle, hw_params);
snd_pcm_hw_params_free (hw_params);
snd_pcm_prepare (playback_handle);
for (i = 0; i < 10; ++i) {
snd_pcm_writei (playback_handle, buf, sizeof (buf));
//snd_pcm_writei (playback_handle, buf, nframes);
}
snd_pcm_close (playback_handle);
exit (0);
}