[alsa-devel] [PATCH 13/13] libhinawa: add sample scripts
Alexander E. Patrakov
patrakov at gmail.com
Sun Jan 25 13:14:59 CET 2015
25.01.2015 16:34, Takashi Sakamoto wrote:
> +from array import array
> +
> +# helper function
> +def get_array():
> + # The width with 'L' parameter is depending on environment.
> + arr = array('L')
> + if arr.itemsize is not 4:
> + arr = array('I')
> + return arr
If you insist on using arrays, then please add an assertion that you
have actually got an array with itemsize 4 at the end. But, if I were
you, I'd go with the "ctypes" module instead, if it works. Here is how
you get a fixed-size (in the example, 10 elements) array with signed
4-byte elements:
from ctypes import *
TenInts = c_int32 * 10
ii = TenInts()
The result supports buffer protocol.
--
Alexander E. Patrakov
More information about the Alsa-devel
mailing list