Re: pcm_min.c trouble with modification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michał Kowalczyk wrote:> 	SND_PCM_FORMAT_U8, //changing this type for any other gives an error in the output: segmentation fault.
U8 has one byte per sample; if you try to use a bigger sample format,you have to enlarge the buffer accordingly.
> 	1, //argument responsible for channels; if I change it to 2(stereo) program gives an segmentation fault error.
Using two channels would double the buffer size, too.
> 	48000, //sampling rate; works good but if I modify this to lower value the time of generating noise will be longer, don't know why.
If the sample rate is lower, you need more timer to play the same numberof samples.
>                 frames = snd_pcm_writei(handle, buffer, sizeof(buffer));
The last parameter is measued in frames, not in bytes.  When you useanother sample format than U8/S8 or more then one channel, you have todivide the buffer size by the number of bytes per frame.

HTHClemens
------------------------------------------------------------------------------Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p_______________________________________________Alsa-user mailing listAlsa-user@xxxxxxxxxxxxxxxxxxxxxxxxxx://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux