All of lore.kernel.org
 help / color / mirror / Atom feed
* ALSA Programming Examples
@ 2002-06-06 11:45 Philipp Vollmer
  2002-06-06 14:04 ` Paul Davis
  0 siblings, 1 reply; 12+ messages in thread
From: Philipp Vollmer @ 2002-06-06 11:45 UTC (permalink / raw)
  To: alsa-devel

Hello to all ALSA Devolpers,

I am actually starting to program with the ALSA library.
My Problem:

When I try to compile the examples of the HOWTO exactly discriped in the 
README of this directory.
So I get a message as if there was a mistake in the code. There isn't I think.
I searched for the source and I found the "open" ( for the sound device ) 
codeline where constants seemed to me inexistant.

Where is the problem?
Is there a mistake in the example or in the HOWTO.

With best regards 

Philipp Vollmer

PS: post to do1ypv@darc.de


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

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

* Re: ALSA Programming Examples
  2002-06-06 14:04 ` Paul Davis
@ 2002-06-06 12:07   ` Philipp Vollmer
  2002-06-06 14:22     ` Paul Davis
  0 siblings, 1 reply; 12+ messages in thread
From: Philipp Vollmer @ 2002-06-06 12:07 UTC (permalink / raw)
  To: alsa-devel

Hello dear Mr Davis,

My library version is 0.5.10b and the driver version is 0.5.12a.

The author of the HOWTO is Matthias Nagorni.

Best regards

Philipp Vollmer

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

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

* Re: ALSA Programming Examples
  2002-06-06 11:45 ALSA " Philipp Vollmer
@ 2002-06-06 14:04 ` Paul Davis
  2002-06-06 12:07   ` Philipp Vollmer
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Davis @ 2002-06-06 14:04 UTC (permalink / raw)
  To: do1ypv; +Cc: alsa-devel

>Hello to all ALSA Devolpers,
>
>I am actually starting to program with the ALSA library.

Please tell us which version of ALSA you are using.

I also suggest you use Matthias Nagorni's examples that are linked to
from the website. My own are there also but they have not been
completed and are incorrect right now.

--p

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

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

* Re: ALSA Programming Examples
  2002-06-06 12:07   ` Philipp Vollmer
@ 2002-06-06 14:22     ` Paul Davis
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Davis @ 2002-06-06 14:22 UTC (permalink / raw)
  To: do1ypv; +Cc: alsa-devel

>My library version is 0.5.10b and the driver version is 0.5.12a.

0.5 is no longer really supported. You should be using 0.9.X. The web
  site says on the front page:

 *** N.B. The 0.5.x series is considered deprecated and is no longer
     supported by ALSA developers ***

>The author of the HOWTO is Matthias Nagorni.

AFAIK, his HOWTO is for 0.9 ...

--p

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

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

* Alsa Programming Examples
@ 2002-06-07 20:14 Philipp Vollmer
  2002-06-07 22:43 ` Tim Goetze
  0 siblings, 1 reply; 12+ messages in thread
From: Philipp Vollmer @ 2002-06-07 20:14 UTC (permalink / raw)
  To: alsa-devel

Hello to all ALSA developers!

I had compiled the examples of the Programming HOWTO succesfully!!!
I saw many programming mistakes in these files. I don't think ANSI C supports 
polymorphism! So I had to take parts out of other running code and put it 
into the example.
But now, after a few changes I could run the program which starts to send 
Random PCM Data to the interface.

Now I have following problem:
Although the program compiled succesfully I get following output:

how1: pcm_params.c:2136: snd_pcm_hw_refine: Assertion && params failed.
Canceled

What is the problem?
( My conditions:
CMI8738
ALSA 0.90 driver and library
)

Yours Philipp Vollmer



_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

* Re: Alsa Programming Examples
  2002-06-07 20:14 Alsa Programming Examples Philipp Vollmer
@ 2002-06-07 22:43 ` Tim Goetze
  2002-06-08  7:26   ` Philipp Vollmer
  0 siblings, 1 reply; 12+ messages in thread
From: Tim Goetze @ 2002-06-07 22:43 UTC (permalink / raw)
  To: Philipp Vollmer; +Cc: alsa-devel

Philipp Vollmer wrote:

>Hello to all ALSA developers!
>
>I had compiled the examples of the Programming HOWTO succesfully!!!
>I saw many programming mistakes in these files. I don't think ANSI C supports 
>polymorphism! So I had to take parts out of other running code and put it 
>into the example.
>But now, after a few changes I could run the program which starts to send 
>Random PCM Data to the interface.
>
>Now I have following problem:
>Although the program compiled succesfully I get following output:
>
>how1: pcm_params.c:2136: snd_pcm_hw_refine: Assertion && params failed.
>Canceled
>
>What is the problem?

$ man assert

it seems params == 0 when you're calling snd_pcm_hw_refine.

tim


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

* Re: Alsa Programming Examples
  2002-06-07 22:43 ` Tim Goetze
@ 2002-06-08  7:26   ` Philipp Vollmer
  2002-06-09 10:50     ` Tim Goetze
  0 siblings, 1 reply; 12+ messages in thread
From: Philipp Vollmer @ 2002-06-08  7:26 UTC (permalink / raw)
  To: alsa-devel

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

> it seems params == 0 when you're calling snd_pcm_hw_refine.
Hello,

Sorry but there is no codeline like snd_pcm_hw_refine in the example.
I will send you the file as an attachment.

Best regards 

Philipp Vollmer
vollmer.philipp@t-online.de

[-- Attachment #2: how1.c --]
[-- Type: text/x-csrc, Size: 1503 bytes --]

      #include <stdlib.h>
      #include <alsa/asoundlib.h>
      
      main (int argc, char *argv[])
      {
           int i;
           char buf[4096];
           snd_pcm_t *playback_handle;
           snd_pcm_hw_params_t *hw_params;

           if ((playback_handle = snd_pcm_open (&playback_handle, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
                 fprintf (stderr, "cannot open audio device %s\n", argv[1]);
                 exit (1);
           }
	   // snd_pcm_open (&playback_handle, pcm_name, SND_PCM_STREAM_PLAYBACK, 0)
           
           snd_pcm_hw_params_malloc (&hw_params);
           snd_pcm_hw_params_any (playback_handle, hw_params);
           snd_pcm_hw_params_set_access (playback_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
           snd_pcm_hw_params_set_format (playback_handle, hw_params, SND_PCM_FORMAT_S16_LE);
           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, 0);
           snd_pcm_hw_params_set_channels (playback_handle, hw_params, 2);
           snd_pcm_hw_params (playback_handle, hw_params);
           snd_pcm_hw_params_free (hw_params);

           snd_pcm_prepare (playback_handle);

           for (i = 0; i < 10; ++i) {
                   snd_pcm_writei (playback_handle, buf, sizeof (buf));
		  //snd_pcm_writei (playback_handle, buf, nframes);
           }

           snd_pcm_close (playback_handle);
           exit (0);
     }


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

* Re: Alsa Programming Examples
  2002-06-08  7:26   ` Philipp Vollmer
@ 2002-06-09 10:50     ` Tim Goetze
  2002-06-09 11:12       ` tomasz motylewski
  0 siblings, 1 reply; 12+ messages in thread
From: Tim Goetze @ 2002-06-09 10:50 UTC (permalink / raw)
  To: Philipp Vollmer; +Cc: alsa-devel

Philipp Vollmer wrote:

>> it seems params == 0 when you're calling snd_pcm_hw_refine.
>Hello,
>
>Sorry but there is no codeline like snd_pcm_hw_refine in the example.
>I will send you the file as an attachment.

in your file:

  if ((playback_handle = snd_pcm_open (&playback_handle, "default", 
	SND_PCM_STREAM_PLAYBACK, 0)) < 0) {

snd_pcm_open returns 0 on success, *not* the pcm handle. have you
tried reading the docs yet ;) and haven't you wondered why you pass
the address of 'playback_handle' to snd_pcm_open()?

gcc warns you about this:

$ gcc -c how1.c 
how1.c: In function `main':
how1.c:11: warning: assignment makes pointer from integer without a
cast

and if you had endeavoured to read the sources of alsa-lib, you'd 
have discovered that (alsa-lib/src/pcm/pcm.c):

int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
  _snd_pcm_hw_params_any(params);
  return snd_pcm_hw_refine(pcm, params);
}

with all respect, i think you could have tried a little harder to find
the error.

tim



_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

* Re: Alsa Programming Examples
  2002-06-09 10:50     ` Tim Goetze
@ 2002-06-09 11:12       ` tomasz motylewski
  2002-06-09 13:41         ` Tim Goetze
  2002-06-09 18:31         ` Paul Davis
  0 siblings, 2 replies; 12+ messages in thread
From: tomasz motylewski @ 2002-06-09 11:12 UTC (permalink / raw)
  To: Tim Goetze; +Cc: Philipp Vollmer, alsa-devel

On Sun, 9 Jun 2002, Tim Goetze wrote:

> with all respect, i think you could have tried a little harder to find
> the error.

There is a prominent link on
http://www.alsa-project.org/documentation.php3#0.9doc

Howto use the ALSA API - Paul Davis has also written a brief explanation. 
http://www.op.net/~pbd/alsa-audio.html#captureex

You will find there:

 if ((capture_handle = snd_pcm_open (argv[1], SND_PCM_STREAM_CAPTURE, 0)) <0) {
         fprintf (stderr, "cannot open audio device %s\n", argv[1]);
                 exit (1);
 }

and many other errors.

While examples are the best for of developers documentation, broken examples
are the worst form of misinformation.

I have written about a week ago to pbd@users.sourceforge.net, no answer yet.

Best regards,
--
Tomasz Motylewski



_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

* Re: Alsa Programming Examples
  2002-06-09 11:12       ` tomasz motylewski
@ 2002-06-09 13:41         ` Tim Goetze
  2002-06-09 18:31         ` Paul Davis
  1 sibling, 0 replies; 12+ messages in thread
From: Tim Goetze @ 2002-06-09 13:41 UTC (permalink / raw)
  To: tomasz motylewski; +Cc: Philipp Vollmer, alsa-devel

tomasz motylewski wrote:

>On Sun, 9 Jun 2002, Tim Goetze wrote:
>
>> with all respect, i think you could have tried a little harder to find
>> the error.
>
>There is a prominent link on
>http://www.alsa-project.org/documentation.php3#0.9doc
>
>Howto use the ALSA API - Paul Davis has also written a brief explanation. 
>http://www.op.net/~pbd/alsa-audio.html#captureex
>
>You will find there:
>
> if ((capture_handle = snd_pcm_open (argv[1], SND_PCM_STREAM_CAPTURE, 0)) <0) {
>         fprintf (stderr, "cannot open audio device %s\n", argv[1]);
>                 exit (1);
> }
>
>and many other errors.
>
>While examples are the best for of developers documentation, broken examples
>are the worst form of misinformation.

i offer my apologies, i had no idea this tutorial fails its purpose so
badly.

tim


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

* Re: Alsa Programming Examples
  2002-06-09 11:12       ` tomasz motylewski
  2002-06-09 13:41         ` Tim Goetze
@ 2002-06-09 18:31         ` Paul Davis
  2002-06-10  6:16           ` Patrick Shirkey
  1 sibling, 1 reply; 12+ messages in thread
From: Paul Davis @ 2002-06-09 18:31 UTC (permalink / raw)
  To: tomasz motylewski; +Cc: Tim Goetze, Philipp Vollmer, alsa-devel

>There is a prominent link on
>http://www.alsa-project.org/documentation.php3#0.9doc
>
>Howto use the ALSA API - Paul Davis has also written a brief explanation. 
>http://www.op.net/~pbd/alsa-audio.html#captureex

Right here, on this mailing list, and in private mail to Philipp, and
in mail to LAD, I made it clear that the examples in my document are
incomplete and incorrect.

The link is included because it was felt that the non-code material in
my document was useful. 

>While examples are the best for of developers documentation, broken examples
>are the worst form of misinformation.

agreed. perhaps you can fix them, or produce a version of the document
with them removed so that a better link can be used. If you would like
to pay me to rearrange my time to get the code removed and/or fixed,
thats fine. Otherwise, please accept the limited offering thats linked
to right now.

>I have written about a week ago to pbd@users.sourceforge.net, no answer yet.

thats not my email address, and its not listed as that on the web
site. i get approximately 150 email messages per day connected with
linux audio issues. i do not have time to answer them all.

--p

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

* Re: Alsa Programming Examples
  2002-06-09 18:31         ` Paul Davis
@ 2002-06-10  6:16           ` Patrick Shirkey
  0 siblings, 0 replies; 12+ messages in thread
From: Patrick Shirkey @ 2002-06-10  6:16 UTC (permalink / raw)
  To: Paul Davis; +Cc: tomasz motylewski, Tim Goetze, Philipp Vollmer, alsa-devel

Paul Davis wrote:

> 
> agreed. perhaps you can fix them, or produce a version of the document
> with them removed so that a better link can be used. If you would like
> to pay me to rearrange my time to get the code removed and/or fixed,
> thats fine. Otherwise, please accept the limited offering thats linked
> to right now.
> 
> 

If people send in a fix to that file I'll add it in and put up the 
revision on ALSA if Paul doesn't mind.


-- 
Patrick Shirkey - Boost Hardware Ltd.
For the discerning hardware connoisseur
Http://www.boosthardware.com
Http://www.boosthardware.com/LAU/guide/
========================================


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

end of thread, other threads:[~2002-06-10  6:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-07 20:14 Alsa Programming Examples Philipp Vollmer
2002-06-07 22:43 ` Tim Goetze
2002-06-08  7:26   ` Philipp Vollmer
2002-06-09 10:50     ` Tim Goetze
2002-06-09 11:12       ` tomasz motylewski
2002-06-09 13:41         ` Tim Goetze
2002-06-09 18:31         ` Paul Davis
2002-06-10  6:16           ` Patrick Shirkey
  -- strict thread matches above, loose matches on Subject: below --
2002-06-06 11:45 ALSA " Philipp Vollmer
2002-06-06 14:04 ` Paul Davis
2002-06-06 12:07   ` Philipp Vollmer
2002-06-06 14:22     ` 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.