Bit modifiers. Well duh. Now it makes complete sense. There is no need for a default #define. The documentation made only passing reference to the SND_PCM_NONBLOCK and SND_PCM_ASYNC being flags. A defualt #define is just dumb, in that light. The documentation, however, could more clearly state that NONBLOCK and ASYNC are flags, and not mode numbers.
Sorry bout that :-) Kyle C. > On Mon, 28 Jan 2002, Kyle Centers wrote: > > > Hi. > > > > I've been playing around with the asound library for a while now, and > > there's someting that really gets under my skin. > > > > The snd_pcm_open function, requires an open mode parameter, which, > > according to the documentation, defaults to blocking mode, but can be > > set to SND_PCM_NONBLOCK, or SND_PCM_ASYNC, as well. > > > > Its great that the function defaults to blocking mode, but I still > > have to pass a mode parameter to the mode function. What am I supposed > > to pass, if blocking mode is what I want (which is most if the time > > for me, ATM)? A look at the code shows that SND_PCM_NONBLOCK and > > SND_PCM_ASYNC are #defined as 1 and 2 respectively, so I can't pass > > those values. And the sample code, test/pcm.c, provided with alsa-lib > > passes 0. > > > > Ok, problem solved. Pass zero. Fine. But that creates an inconsistent > > interface, and requires me to have access to more than documentation > > in order to use the API (a Bad Thing <TM>). A simple fix, and indeed > > one I've implimented locally, is to add > > > > #define SND_PCM_BLOCK 0x0000 > > > > to include/pcm.h in alsa/lib. that way, when I call snd_pcm_open, I > > have something to give the mode parameter, and don't have to think > > about what the underlying value is. > > > > Sounds like a good idea to me. -Or is there a reason for not adding > > that line that I'm not aware of? > > SND_PCM_NONBLOCK and SND_PCM_ASYNC are bit modifiers (can be passed > together - SND_PCM_NONBLOCK|SND_PCM_ASYNC). The right name for default > behaviour can be SND_PCM_DEFAULT or SND_PCM_NONE, but anyway passing zero > is very clear to me. > > Jaroslav > > ----- > Jaroslav Kysela <[EMAIL PROTECTED]> > SuSE Linux http://www.suse.com > ALSA Project http://www.alsa-project.org > > -- _______________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup Win a ski trip! http://ad.doubleclick.net/clk;3840379;4478627;x?http://www.nowcode.com/register.asp?affiliate=1net2phone3a _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel