All of lore.kernel.org
 help / color / mirror / Atom feed
* Simple ALSA capture/playback example and help wanted
@ 2002-03-29  2:24 Howard Abrams
  2002-03-29  4:06 ` Mark Rages
  0 siblings, 1 reply; 5+ messages in thread
From: Howard Abrams @ 2002-03-29  2:24 UTC (permalink / raw)
  To: alsa-devel


All,

I'm new to ALSA, and I'm using whatever version is in the
2.5.7 kernel w/ a Midiman Dio 2448 (cmipci driver).

I'm trying to write a simple app that reads some samples,
does a small bit of processing, and writes them back out
to the same device.

The card is full duplex, but I cannot seem to open a pcm
device for reading and writing at the same time. Even the
"latency.c" doesn't work. Is the driver just broke?

Two questions:

1. What is the best way to accomplish my task?

2. Does anyone have a simple example to do this?

Thanks,

h.

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

* Re: Simple ALSA capture/playback example and help wanted
  2002-03-29  2:24 Simple ALSA capture/playback example and help wanted Howard Abrams
@ 2002-03-29  4:06 ` Mark Rages
  2002-03-29  5:05   ` Howard Abrams
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Rages @ 2002-03-29  4:06 UTC (permalink / raw)
  To: Howard Abrams; +Cc: alsa-devel

There are several examples, but out of hubris I'll point you to my webpage: (all the examples are linked from the top)

http://mlug.missouri.edu/~markrages/wiki/index.php?WritingAnAlsaClient

In particular, I'd recommend you jook at JACK (jackit.sourceforge.net) before worrying too much about the ALSA details.

Regards,
Mark
markrages@mlug.missouril.edu

> 
> All,
> 
> I'm new to ALSA, and I'm using whatever version is in the
> 2.5.7 kernel w/ a Midiman Dio 2448 (cmipci driver).
> 
> I'm trying to write a simple app that reads some samples,
> does a small bit of processing, and writes them back out
> to the same device.
> 
> The card is full duplex, but I cannot seem to open a pcm
> device for reading and writing at the same time. Even the
> "latency.c" doesn't work. Is the driver just broke?
> 
> Two questions:
> 
> 1. What is the best way to accomplish my task?
> 
> 2. Does anyone have a simple example to do this?
> 
> Thanks,
> 
> h.
> 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel

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

* Re: Simple ALSA capture/playback example and help wanted
  2002-03-29  4:06 ` Mark Rages
@ 2002-03-29  5:05   ` Howard Abrams
  2002-03-29  5:49     ` Mark Rages
  0 siblings, 1 reply; 5+ messages in thread
From: Howard Abrams @ 2002-03-29  5:05 UTC (permalink / raw)
  To: Mark Rages; +Cc: alsa-devel

Thanks Mark. I'll take a look at jack, but in the near-term, I
copied a sample from a link off your page. It must have been
from a earlier rev of the api, but it only required very minimal
changes to compile.

The program I used was "A Minimal Full-Duplex Program", off the
page: http://www.op.net/~pbd/alsa-audio.html#duplexex

It's real basic, similar to what I had tried before. However, if
I using the 'spdif' device I run into the same problem:

ALSA lib setup.c:94:(snd_sctl_install) Cannot lock ctl elem
duplex: pcm.c:847: snd_pcm_prepare: Assertion `pcm->setup' failed.

If I use the 'plughw:0,2' device, the program returns immediately,
unless there is no audio on the spdif line, in which case it
hangs.

To me, it looks like the driver has a problem with full-duplex. Is
that correct? Again I'm using a Midiman DiO 2448 (cmipci driver).

Thanks again,

h.

Mark Rages wrote:

> There are several examples, but out of hubris I'll point you to my webpage: (all the examples are linked from the top)
> 
> http://mlug.missouri.edu/~markrages/wiki/index.php?WritingAnAlsaClient
> 
> In particular, I'd recommend you jook at JACK (jackit.sourceforge.net) before worrying too much about the ALSA details.
> 
> Regards,
> Mark
> markrages@mlug.missouril.edu
> 
> 
>>All,
>>
>>I'm new to ALSA, and I'm using whatever version is in the
>>2.5.7 kernel w/ a Midiman Dio 2448 (cmipci driver).
>>
>>I'm trying to write a simple app that reads some samples,
>>does a small bit of processing, and writes them back out
>>to the same device.
>>
>>The card is full duplex, but I cannot seem to open a pcm
>>device for reading and writing at the same time. Even the
>>"latency.c" doesn't work. Is the driver just broke?
>>
>>Two questions:
>>
>>1. What is the best way to accomplish my task?
>>
>>2. Does anyone have a simple example to do this?
>>
>>Thanks,
>>
>>h.
>>
>>
>>_______________________________________________
>>Alsa-devel mailing list
>>Alsa-devel@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/alsa-devel
>>
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
> 
> 

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

* Re: Simple ALSA capture/playback example and help wanted
  2002-03-29  5:05   ` Howard Abrams
@ 2002-03-29  5:49     ` Mark Rages
  2002-03-29  6:19       ` Howard Abrams
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Rages @ 2002-03-29  5:49 UTC (permalink / raw)
  To: Howard Abrams; +Cc: alsa-devel

On Thu, Mar 28, 2002 at 09:05:31PM -0800, Howard Abrams wrote:
> Thanks Mark. I'll take a look at jack, but in the near-term, I
> copied a sample from a link off your page. It must have been
> from a earlier rev of the api, but it only required very minimal
> changes to compile.
> 
> The program I used was "A Minimal Full-Duplex Program", off the
> page: http://www.op.net/~pbd/alsa-audio.html#duplexex

Can you tell us what changes were required? It will help improve the
documentation.

Sorry, I don't have the expertise (or the appropriate soundcard)
to help with your specific problem.

Regards,
Mark.

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

* Re: Simple ALSA capture/playback example and help wanted
  2002-03-29  5:49     ` Mark Rages
@ 2002-03-29  6:19       ` Howard Abrams
  0 siblings, 0 replies; 5+ messages in thread
From: Howard Abrams @ 2002-03-29  6:19 UTC (permalink / raw)
  To: Mark Rages; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]



Mark Rages wrote:

> On Thu, Mar 28, 2002 at 09:05:31PM -0800, Howard Abrams wrote:
> 
>>Thanks Mark. I'll take a look at jack, but in the near-term, I
>>copied a sample from a link off your page. It must have been
>>from a earlier rev of the api, but it only required very minimal
>>changes to compile.
>>
>>The program I used was "A Minimal Full-Duplex Program", off the
>>page: http://www.op.net/~pbd/alsa-audio.html#duplexex
>>
> 
> Can you tell us what changes were required? It will help improve the
> documentation.


Sure, a diff is attached.


> Sorry, I don't have the expertise (or the appropriate soundcard)
> to help with your specific problem.
> 


Is Takashi Iwai on this list? He's credited in the source for the
driver. Anyone else have one of these cards?


h.

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 1039 bytes --]

12c10
<          if ((snd_pcm_open ( &playback_handle, argv[1], SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
---
>          if ((playback_handle = snd_pcm_open (argv[1], SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
17c15
<          if ((snd_pcm_open ( &capture_handle, argv[1], SND_PCM_STREAM_CAPTURE, 0)) < 0) {
---
>          if ((capture_handle = snd_pcm_open (argv[1], SND_PCM_STREAM_CAPTURE, 0)) < 0) {
27c25
<          snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, 44100, 0);
---
>          snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, 44100);
35c33
<          snd_pcm_hw_params_set_rate_near (capture_handle, hw_params, 44100, 0);
---
>          snd_pcm_hw_params_set_rate_near (capture_handle, hw_params, 44100);
45,46c43,44
<                  snd_pcm_writei (playback_handle, pbuf, sizeof (pbuf));
<                  snd_pcm_readi (capture_handle, cbuf, sizeof (cbuf));
---
>                  snd_pcm_write (playback_handle, pbuf, sizeof (pbuf));
>                  snd_pcm_read (capture_handle, cbuf, sizeof (cbuf));

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

end of thread, other threads:[~2002-03-29  6:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-29  2:24 Simple ALSA capture/playback example and help wanted Howard Abrams
2002-03-29  4:06 ` Mark Rages
2002-03-29  5:05   ` Howard Abrams
2002-03-29  5:49     ` Mark Rages
2002-03-29  6:19       ` Howard Abrams

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.