All of lore.kernel.org
 help / color / mirror / Atom feed
* snd_pcm_start fails
@ 2002-07-04 22:06 Joshua Haberman
  2002-07-04 22:27 ` Joshua Haberman
  0 siblings, 1 reply; 3+ messages in thread
From: Joshua Haberman @ 2002-07-04 22:06 UTC (permalink / raw)
  To: alsa-devel

I am stumped.  This short and simple program fails for me:

---

#include <alsa/asoundlib.h>

#include <assert.h>

#define NOFAIL == 0 || (assert(0), 1)

int main() {
    snd_pcm_t *playback_handle;
    snd_pcm_hw_params_t *hw_params;
    snd_output_t *debug;

    snd_output_stdio_attach(&debug, stdout, 0) NOFAIL;

    /* I have tried both hw:0 and plughw:0 */
    snd_pcm_open( &playback_handle, "hw:0", SND_PCM_STREAM_PLAYBACK, 0) NOFAIL;

    snd_pcm_hw_params_malloc( &hw_params ) NOFAIL;

    snd_pcm_hw_params_any( playback_handle, hw_params ) NOFAIL;
    snd_pcm_hw_params_set_access( playback_handle, hw_params, SND_PCM_ACCESS_MMAP_INTERLEAVED ) NOFAIL;
    snd_pcm_hw_params_set_format( playback_handle, hw_params,SND_PCM_FORMAT_S16 ) NOFAIL;
    snd_pcm_hw_params_set_rate( playback_handle, hw_params, 44100, 0 ) NOFAIL;
    snd_pcm_hw_params_set_channels( playback_handle, hw_params, 2 ) NOFAIL;
    snd_pcm_hw_params_set_period_size( playback_handle, hw_params, 2048, 0 ) NOFAIL;
    snd_pcm_hw_params( playback_handle, hw_params ) NOFAIL;

    snd_pcm_prepare( playback_handle ) NOFAIL;
    snd_pcm_dump( playback_handle, debug );
    snd_pcm_start( playback_handle ) NOFAIL;
}

---

Everything seems to be in good shape up until the call to snd_pcm_start,
but then the snd_pcm_start fails.  Here is the output:

---

Hardware PCM card 0 'Sound Blaster Live!' device 0 subdevice -1

Its setup is:
stream       : PLAYBACK
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 2
rate         : 44100
exact rate   : 44100 (44100/1)
msbits       : 16
buffer_size  : 16384
period_size  : 2048
period_time  : 46439
tick_time    : 10000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 2048
xfer_align   : 2048
start_threshold  : 1
stop_threshold   : 16384
silence_threshold: 0
silence_size : 0
boundary     : 1073741824
ALSA lib pcm_hw.c:384:(snd_pcm_hw_start) SNDRV_PCM_IOCTL_START failed: Broken pipe
display: display.c:29: main: Assertion `0' failed.
Aborted

---

Any ideas??  This is ALSA 0.9.0rc1, kernel 2.4.17, emu10k1 as you can
see.  Other ALSA apps such as alsaplayer and JACK work fine.

Josh


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: snd_pcm_start fails
  2002-07-04 22:06 snd_pcm_start fails Joshua Haberman
@ 2002-07-04 22:27 ` Joshua Haberman
  2002-07-05 15:49   ` Paul Davis
  0 siblings, 1 reply; 3+ messages in thread
From: Joshua Haberman @ 2002-07-04 22:27 UTC (permalink / raw)
  To: alsa-devel

* To alsa-devel@lists.sourceforge.net (joshua@haberman.com) wrote:
> I am stumped.  This short and simple program fails for me:

Wingo solved the mystery for me.  Apparently you are required to do an
mmap_begin and mmap_commit before you can call snd_pcm_start.

Josh


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: snd_pcm_start fails
  2002-07-04 22:27 ` Joshua Haberman
@ 2002-07-05 15:49   ` Paul Davis
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Davis @ 2002-07-05 15:49 UTC (permalink / raw)
  To: Joshua Haberman; +Cc: alsa-devel

>* To alsa-devel@lists.sourceforge.net (joshua@haberman.com) wrote:
>> I am stumped.  This short and simple program fails for me:
>
>Wingo solved the mystery for me.  Apparently you are required to do an
>mmap_begin and mmap_commit before you can call snd_pcm_start.

or more generally: you have to put some data in place (somehow) before
calling start, unless you used the "start on data ready" flag during
setup. 

--p


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Bringing you mounds of caffeinated joy.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-07-05 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-04 22:06 snd_pcm_start fails Joshua Haberman
2002-07-04 22:27 ` Joshua Haberman
2002-07-05 15:49   ` Paul Davis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.