Results of my latest debug: dmix is reporting an error in routine snd_pcm_dmix_sync_ptr() complaining that the pipe is in the running state. Here is a snippet of code: if (avail >= pcm->stop_threshold) { struct timeval tv; snd_timer_stop(dmix->timer); gettimeofday(&tv, 0); dmix->trigger_tstamp.tv_sec = tv.tv_sec; dmix->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L; if (dmix->state == SND_PCM_STATE_RUNNING) { dmix->state = SND_PCM_STATE_XRUN; printf("%16s:%4i:(%32s): -EPIPE error.\n\n", __FILE__, __LINE__, __FUNCTION__ ); return -EPIPE; } dmix->state = SND_PCM_STATE_SETUP; /* clear queue to remove pending poll events */ snd_pcm_direct_clear_timer_queue(dmix); } Any suggestions how to fix this? This is with version 1.0.11. Attached is my version of pcm_dmix.c with debug statements added, in case you want to line up the debug statements with their line numbers from the below output. ~ # aplay content/pcm48khz_2ch_stereo.wav pcm_dmix.c: 914:( snd_pcm_dmix_open): first_instance 1 pcm_dmix.c: 977:( snd_pcm_dmix_open) Playing WAVE 'content/pcm48khz_2ch_stereo.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo pcm_dmix.c: 510:( snd_pcm_dmix_prepare) pcm_direct.c:1177:( snd_pcm_direct_set_timer_params) pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 4000, *pcm->hw.ptr 0, *pcm->appl.ptr 0 pcm_mmap.c: 116:( snd_pcm_mmap_write_areas): offset 0, size 2000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 4000, *pcm->hw.ptr 0, *pcm->appl.ptr 0 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 4000, *pcm->hw.ptr 0, *pcm->appl.ptr 0 pcm.c:2701:( snd_pcm_areas_copy): dst_offset 0, src_offset 0, channels 2, frames 2000, format 2 pcm.c:2570:( snd_pcm_area_copy): bytes 8000 pcm.c:6357:( snd_pcm_mmap_commit): offset 0, frames 2000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 4000, *pcm->hw.ptr 0, *pcm->appl.ptr 0 pcm_dmix.c: 727:( snd_pcm_dmix_mmap_commit): size 2000 state 2 pcm_mmap.c: 78:( snd_pcm_mmap_appl_forward): appl_ptr 0, frames 2000, appl_ptr 2000 pcm_dmix.c: 746:( snd_pcm_dmix_mmap_commit): size 2000 state 2 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 2000, *pcm->hw.ptr 0, *pcm->appl.ptr 2000 pcm_mmap.c: 116:( snd_pcm_mmap_write_areas): offset 0, size 2000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 2000, *pcm->hw.ptr 0, *pcm->appl.ptr 2000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 2000, *pcm->hw.ptr 0, *pcm->appl.ptr 2000 pcm.c:2701:( snd_pcm_areas_copy): dst_offset 2000, src_offset 0, channels 2, frames 2000 pcm.c:2570:( snd_pcm_area_copy): bytes 8000 pcm.c:6357:( snd_pcm_mmap_commit): offset 2000, frames 2000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 2000, *pcm->hw.ptr 0, *pcm->appl.ptr 2000 pcm_dmix.c: 727:( snd_pcm_dmix_mmap_commit): size 2000 state 2 pcm_mmap.c: 78:( snd_pcm_mmap_appl_forward): appl_ptr 2000, frames 2000, appl_ptr 4000 pcm_dmix.c: 746:( snd_pcm_dmix_mmap_commit): size 2000 state 2 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 0, *pcm->hw.ptr 0, *pcm->appl.ptr 4000 pcm_local.h: 341:( snd_pcm_mmap_playback_hw_avail): avail 4000 pcm_dmix.c: 569:( snd_pcm_dmix_start): state 2, avail 4000 pcm_dmix.c: 545:( snd_pcm_dmix_start_timer): old state 2, new 3 pcm_dmix.c: 279:( snd_pcm_dmix_sync_area): size 4000, state 3 pcm_dmix.c: 314:( snd_pcm_dmix_sync_area): state 3 pcm_dmix.c: 584:( snd_pcm_dmix_start): dmix->state 3 pcm_dmix.c: 486:( snd_pcm_dmix_hwsync): dmix->state 3 pcm_dmix.c: 361:( snd_pcm_dmix_sync_ptr): diff 0, dmix->slowptr 0 pcm_dmix.c: 361:( snd_pcm_dmix_sync_ptr): diff 0, dmix->slowptr 0 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 0, *pcm->hw.ptr 0, *pcm->appl.ptr 4000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 0, *pcm->hw.ptr 0, *pcm->appl.ptr 4000 pcm_dmix.c: 279:( snd_pcm_dmix_sync_area): size 0, state 3 pcm_dmix.c: 361:( snd_pcm_dmix_sync_ptr): diff 0, dmix->slowptr 0 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 0, *pcm->hw.ptr 0, *pcm->appl.ptr 4000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 0, *pcm->hw.ptr 0, *pcm->appl.ptr 4000 pcm_dmix.c: 279:( snd_pcm_dmix_sync_area): size 0, state 3 pcm_dmix.c: 361:( snd_pcm_dmix_sync_ptr): diff 4000, dmix->slowptr 0 pcm_dmix.c: 378:( snd_pcm_dmix_sync_ptr): pcm->stop_threshold 4000, pcm->boundary 40000000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 4000, *pcm->hw.ptr 4000, *pcm->appl.ptr 4000 pcm_dmix.c: 394:( snd_pcm_dmix_sync_ptr): -EPIPE error. pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 4000, *pcm->hw.ptr 4000, *pcm->appl.ptr 4000 pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 4000, *pcm->hw.ptr 4000, *pcm->appl.ptr 4000 pcm_dmix.c: 486:( snd_pcm_dmix_hwsync): dmix->state 4 pcm_dmix.c: 433:( snd_pcm_dmix_status) pcm_local.h: 309:( snd_pcm_mmap_playback_avail): avail 4000, *pcm->hw.ptr 4000, *pcm->appl.ptr 4000 pcm_dmix.c: 451:( snd_pcm_dmix_status): avail 4000 underrun!!! (at least 1.032 ms long) Daniel Cardenas wrote: > Takashi Iwai wrote: >> At Thu, 8 Feb 2007 10:44:10 -0800, >> wrote: >>> Hi, >>> >>> I'm working on an unannounced SOC audio driver on an ARM system. >>> I have a problem were audio works fine with out dmix, but when I try >>> to use dmix, no audio data gets to the driver. >>> The dmix plug-in does work when attaching external usb audio device. >>> Trying to use dmix so that more then one application can generate >>> audio simultaneously. >>> >>> If I try with version 1.0.11 of ALSA the audio driver doesn't receive >>> any data after the snd_pcm_period_elapsed() function call. > > Actually it is before or after. > >> >> So, actually it's a problem of driver / alsa-lib hw layer rather than >> dmix? You can get more verbose messages by setting LIBASOUND_DEBUG >> variable. See alsa-lib/NOTES for details. > > I set the environment variable and I did not see additional output. For > version > > >> >>> Here is how the driver is set up: >>> static snd_pcm_hardware_t snd_oloriver_playback_hw = { >>> .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | >>> SNDRV_PCM_INFO_MMAP_VALID), >>> .formats = SNDRV_PCM_FMTBIT_S16_LE, >>> .rates = SNDRV_PCM_RATE_48000, >>> .rate_min = 48000, .rate_max = 48000, >>> .channels_min = 2, >>> .channels_max = 2, >>> .buffer_bytes_max = 65536, >>> .period_bytes_min = 32768, >>> .period_bytes_max = 32768, >>> .periods_min = 2, >>> .periods_max = 2, >> >> My rough guess is that the buffer and period size constraints are too >> restrictive. You can try to pass the exact period/buffer sizes to >> aplay via --period-size=8192 --buffer-size=16384 options. >> >> Takashi > Thanks, Daniel