Re: [PATCH] SND_SEQ_BLOCK and SND_SEQ_PORT_CAP_NONE defines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 31 Jan 2008, Aldrin Martoq wrote:

> Hey hackers,
> 
> While developing pyalsa sequencer API, I found that sometimes 0 is
> used instead of a #defined value or constant.
> 
> In my opinion, given that the alsa API is opaque (hides internal
> structure and provides methods for accessing them), we should define
> those missing "constants" for being consistent. So far I found:
> SND_SEQ_BLOCK 0 (blocking mode)
> SND_SEQ_PORT_CAP_NONE (the port defines no access capabilites)

Note that SND_SEQ_NONBLOCK is flag (bitmask). Also SND_SEQ_PORT_CAP_* 
defines are bitmasks. I don't see usage to have defined for 0 because it 
always mean "off state" rather than a direct value. Correct tests are:

val&SND_SEQ_NONBLOCK		- nonblocking behaviour
(val&SND_SEQ_NONBLOCK)==0	- blocking behaviour

Regarding python. I think that we need to settle naming scheme. I just 
moved my code to follow standard python rules (only class names have upper 
letters and constants).

I also chose a different organization for constants in my code to have 
possibility to enumerate all related bitmasks or numbers using 
dictionaries. See my python modules.

It meas to define SEQ_ADDRESS_* like:

seq_address = {'BROADCAST': 0xff, 'SUBSCRIBERS': 0xfe, 'UNKNOWN': 0xfd}
open_mode = {'NONBLOCK': 1}
etc...

				Jaroslav

-----
Jaroslav Kysela <perex@xxxxxxxx>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux