Hi, Sorry if this came up before, the archives are so full of spam that I didn't spend too much time browsing them. :-( I'm writing several programs in C++ which use sound. (For non-C++ people, don't worry, there's not much non-C about this question.) In a wrapper library I want to hide all the nasty details. I'm having some trouble with that part. When setting up the device, I use the code below. Depending on the sound card, I get "unable to set period size to 1024". I can't imagine that no valid size can be found. Can someone tell me what's wrong with the code? This is using the plughw device, so I'm extra surprised that even the set_*_near function doesn't manage to find a usable value. A sound card on which it fails is: Intel 82801DB-ICH4 with AD1981B at 0xfebff800, irq 201 For some context, the full code is available at https://pcbcn10.phys.rug.nl/cgi-bin/trac.cgi/browser/trunk/libshevek/sound-player.cc (function player::thread::l_setup_device) Please don't use it for your own projects yet, I intend to make major changes to the interface. :-) Thanks, Bas Ps: shevek_error is a macro which is usually defined equivalently to #define shevek_error(x) do { std::cerr << x; exit (1); } while (0) so all the left-shift-operators are really insertions to standard error. err = snd_pcm_hw_params_any (m_handle, m_hwparams); if (err < 0) { shevek_error ("unable to initialise parameter structure: " << snd_strerror (err)); return; } ..... err = snd_pcm_hw_params_set_channels (m_handle, m_hwparams, m_settings.channels); if (err < 0) { shevek_error ("unable to set channels: " << snd_strerror (err)); return; } snd_pcm_uframes_t frames = 1 << (m_periodsize_log2 - m_frame_size_log2); err = snd_pcm_hw_params_set_period_size_near (m_handle, m_hwparams, &frames, 0); if (err < 0) { shevek_error ("unable to set period size to " << frames << ": " << snd_strerror (err)); return; } err = snd_pcm_hw_params (m_handle, m_hwparams); if (err < 0) { shevek_error ("unable to set parameter structure: " << snd_strerror (err)); return; } -- I encourage people to send encrypted e-mail (see http://www.gnupg.org). If you have problems reading my e-mail, use a better reader. Please send the central message of e-mails as plain text in the message body, not as HTML and definitely not as MS Word. Please do not use the MS Word format for attachments either. For more information, see http://pcbcn10.phys.rug.nl/e-mail.html
Attachment:
signature.asc
Description: Digital signature
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-devel