Lines Matching refs:oss
2 * QEMU OSS audio driver
38 #define AUDIO_CAP "oss"
147 OSSVoiceOut *oss = (OSSVoiceOut *) hw;
149 return qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);
154 OSSVoiceIn *oss = (OSSVoiceIn *) hw;
156 return qemu_set_fd_handler (oss->fd, oss_helper_poll_in, NULL, NULL);
261 oss_logerr2 (errno, typ, "Failed to get OSS version\n");
319 dolog ("OSS version = %#x\n", version);
384 static void oss_write_pending (OSSVoiceOut *oss)
386 HWVoiceOut *hw = &oss->hw;
388 if (oss->mmapped) {
392 while (oss->pending) {
395 int samples_till_end = hw->samples - oss->wpos;
396 int samples_to_write = audio_MIN (oss->pending, samples_till_end);
398 void *pcm = advance (oss->pcm_buf, oss->wpos << hw->info.shift);
400 bytes_written = write (oss->fd, pcm, bytes_to_write);
416 oss->pending -= samples_written;
417 oss->wpos = (oss->wpos + samples_written) % hw->samples;
426 OSSVoiceOut *oss = (OSSVoiceOut *) hw;
434 if (oss->mmapped) {
437 err = ioctl (oss->fd, SNDCTL_DSP_GETOPTR, &cntinfo);
448 err = ioctl (oss->fd, SNDCTL_DSP_GETOSPACE, &abinfo);
477 decr = audio_pcm_hw_clip_out (hw, oss->pcm_buf, decr, oss->pending);
478 oss->pending += decr;
479 oss_write_pending (oss);
487 OSSVoiceOut *oss = (OSSVoiceOut *) hw;
490 oss_anal_close (&oss->fd);
492 if (oss->pcm_buf) {
493 if (oss->mmapped) {
494 err = munmap (oss->pcm_buf, hw->samples << hw->info.shift);
497 oss->pcm_buf, hw->samples << hw->info.shift);
501 qemu_free (oss->pcm_buf);
503 oss->pcm_buf = NULL;
509 OSSVoiceOut *oss = (OSSVoiceOut *) hw;
517 oss->fd = -1;
541 oss->nfrags = obt.nfrags;
542 oss->fragsize = obt.fragsize;
551 oss->mmapped = 0;
553 oss->pcm_buf = mmap (
561 if (oss->pcm_buf == MAP_FAILED) {
580 oss->mmapped = 1;
584 if (!oss->mmapped) {
585 err = munmap (oss->pcm_buf, hw->samples << hw->info.shift);
588 oss->pcm_buf, hw->samples << hw->info.shift);
594 if (!oss->mmapped) {
595 oss->pcm_buf = audio_calloc (
600 if (!oss->pcm_buf) {
611 oss->fd = fd;
618 OSSVoiceOut *oss = (OSSVoiceOut *) hw;
636 if (!oss->mmapped) {
640 audio_pcm_info_clear_buf (&hw->info, oss->pcm_buf, hw->samples);
642 if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
654 qemu_set_fd_handler (oss->fd, NULL, NULL, NULL);
658 if (!oss->mmapped) {
664 if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
675 OSSVoiceIn *oss = (OSSVoiceIn *) hw;
683 oss->fd = -1;
706 oss->nfrags = obt.nfrags;
707 oss->fragsize = obt.fragsize;
715 oss->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
716 if (!oss->pcm_buf) {
723 oss->fd = fd;
729 OSSVoiceIn *oss = (OSSVoiceIn *) hw;
731 oss_anal_close (&oss->fd);
733 if (oss->pcm_buf) {
734 qemu_free (oss->pcm_buf);
735 oss->pcm_buf = NULL;
741 OSSVoiceIn *oss = (OSSVoiceIn *) hw;
771 void *p = advance (oss->pcm_buf, bufs[i].add << hwshift);
772 nread = read (oss->fd, p, bufs[i].len);
816 OSSVoiceIn *oss = (OSSVoiceIn *) hw;
838 qemu_set_fd_handler (oss->fd, NULL, NULL, NULL);
924 .name = "oss",
925 .descr = "OSS http://www.opensound.com",