Lines Matching refs:alsa
2 * QEMU ALSA audio driver
25 #include <alsa/asoundlib.h>
34 #define AUDIO_CAP "alsa"
270 /* XXX: ALSA example uses initial count, not the one returned by
301 audio_run ("alsa run (prepared)");
305 audio_run ("alsa run (running)");
376 ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
378 return alsa_poll_helper (alsa->handle, &alsa->pollhlp, POLLOUT);
383 ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
385 return alsa_poll_helper (alsa->handle, &alsa->pollhlp, POLLIN);
782 static void alsa_write_pending (ALSAVoiceOut *alsa)
784 HWVoiceOut *hw = &alsa->hw;
786 while (alsa->pending) {
787 int left_till_end_samples = hw->samples - alsa->wpos;
788 int len = audio_MIN (alsa->pending, left_till_end_samples);
789 char *src = advance (alsa->pcm_buf, alsa->wpos << hw->info.shift);
794 written = FF(snd_pcm_writei) (alsa->handle, src, len);
805 if (alsa_recover (alsa->handle)) {
818 if (alsa_resume (alsa->handle)) {
838 alsa->wpos = (alsa->wpos + written) % hw->samples;
839 alsa->pending -= written;
847 ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
851 avail = alsa_get_avail (alsa->handle);
858 decr = audio_pcm_hw_clip_out (hw, alsa->pcm_buf, decr, alsa->pending);
859 alsa->pending += decr;
860 alsa_write_pending (alsa);
866 ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
869 alsa_anal_close (&alsa->handle, &alsa->pollhlp);
871 if (alsa->pcm_buf) {
872 qemu_free (alsa->pcm_buf);
873 alsa->pcm_buf = NULL;
879 ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
886 /* shut alsa debug spew */
912 alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift);
913 if (!alsa->pcm_buf) {
920 alsa->handle = handle;
954 ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
971 return alsa_voice_ctl (alsa->handle, "playback", 0);
976 return alsa_voice_ctl (alsa->handle, "playback", 1);
984 ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
991 /* shut alsa debug spew */
1017 alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
1018 if (!alsa->pcm_buf) {
1025 alsa->handle = handle;
1037 ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
1039 alsa_anal_close (&alsa->handle, &alsa->pollhlp);
1041 if (alsa->pcm_buf) {
1042 qemu_free (alsa->pcm_buf);
1043 alsa->pcm_buf = NULL;
1049 ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
1069 avail = alsa_get_avail (alsa->handle);
1078 state = FF(snd_pcm_state) (alsa->handle);
1085 if (alsa_resume (alsa->handle)) {
1095 dolog ("No frames available and ALSA state is %d\n", state);
1122 src = advance (alsa->pcm_buf, bufs[i].add << hwshift);
1126 nread = FF(snd_pcm_readi) (alsa->handle, src, len);
1137 if (alsa_recover (alsa->handle)) {
1182 ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
1200 return alsa_voice_ctl (alsa->handle, "capture", 0);
1207 alsa_fini_poll (&alsa->pollhlp);
1209 return alsa_voice_ctl (alsa->handle, "capture", 1);
1335 .name = "alsa",
1336 .descr = "ALSA http://www.alsa-project.org",