diff options
182 files changed, 9460 insertions, 1 deletions
diff --git a/activity/activity.info b/activity/activity.info index b0e60de..353b3c2 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -3,7 +3,7 @@ name = Turtle Art activity_version = 35 license = MIT bundle_id = org.laptop.TurtleArtActivity -exec = sugar-activity TurtleArtActivity.TurtleArtActivity +exec = wrapper sugar-activity TurtleArtActivity.TurtleArtActivity icon = activity-turtleart show_launcher = yes update_url = http://wiki.laptop.org/go/Activities/G1G1 diff --git a/arch_src/Makefile b/arch_src/Makefile new file mode 100644 index 0000000..2f915d5 --- /dev/null +++ b/arch_src/Makefile @@ -0,0 +1,7 @@ + +all: + cd pyalsaaudio-0.2 ; python setup.py build + +install: + cd pyalsaaudio-0.2 ; python setup.py install --prefix="${PREFIX}" + diff --git a/arch_src/pyalsaaudio-0.2/.svn/README.txt b/arch_src/pyalsaaudio-0.2/.svn/README.txt new file mode 100644 index 0000000..271a8ce --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/README.txt @@ -0,0 +1,2 @@ +This is a Subversion working copy administrative directory. +Visit http://subversion.tigris.org/ for more information. diff --git a/arch_src/pyalsaaudio-0.2/.svn/dir-wcprops b/arch_src/pyalsaaudio-0.2/.svn/dir-wcprops new file mode 100644 index 0000000..3a0f0d0 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/dir-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/Shtoom/!svn/ver/1322/trunk/audio/pyalsaaudio +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/empty-file b/arch_src/pyalsaaudio-0.2/.svn/empty-file new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/empty-file diff --git a/arch_src/pyalsaaudio-0.2/.svn/entries b/arch_src/pyalsaaudio-0.2/.svn/entries new file mode 100644 index 0000000..d3f4356 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/entries @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="utf-8"?> +<wc-entries + xmlns="svn:"> +<entry + committed-rev="1322" + name="" + committed-date="2005-03-30T20:44:55.828503Z" + url="http://casperr@divmod.org/svn/Shtoom/trunk/audio/pyalsaaudio" + last-author="casper" + kind="dir" + uuid="0b994b0e-dcd6-0310-80a8-c5aa5be65e87" + revision="1584"/> +<entry + committed-rev="1585" + name="LICENSE" + text-time="2005-07-09T21:02:54.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="1a3b161aa0fcec32a0c8907a2219ad9d" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="alsaaudio.c" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="e72939bb5f268025aff2154d77b96201" + last-author="casper" + kind="file" + prop-time="2005-03-30T19:37:29.000000Z" + revision="1585"/> +<entry + committed-rev="1585" + name="TODO" + text-time="2005-07-09T21:13:24.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="4bda164e9f66fbab7b8c102ef5dbcdca" + last-author="casper" + kind="file" + prop-time="2004-10-05T08:43:24.000000Z" + revision="1585"/> +<entry + committed-rev="1585" + name="recordtest.py" + text-time="2005-07-09T20:46:17.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="36fd98bef1a4e935dfd404f8896cbc80" + last-author="casper" + kind="file" + prop-time="2004-10-05T08:43:24.000000Z" + revision="1585"/> +<entry + name="doc" + kind="dir"/> +<entry + committed-rev="820" + name="setup.py" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2004-10-04T13:28:33.537193Z" + checksum="3a808cedfedf7ee095bf912c4a9dc0c9" + last-author="anthony" + kind="file" + prop-time="2004-10-05T08:43:24.000000Z"/> +<entry + committed-rev="1585" + name="CHANGES" + text-time="2005-07-09T21:10:57.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="6018069ddf6e383385a283cf25218c1f" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="835" + name="mixertest.py" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2004-10-05T21:43:58.007506Z" + checksum="a7c859a05658506b14bbdb3367c2f490" + last-author="casper" + kind="file"/> +<entry + committed-rev="1585" + name="playbacktest.py" + text-time="2005-07-09T21:23:10.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="9e47bb9e5f3a0d7a00d23f82fce377be" + last-author="casper" + kind="file" + prop-time="2004-10-05T08:43:24.000000Z" + revision="1585"/> +<entry + committed-rev="1585" + name="README" + text-time="2005-07-09T21:20:32.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="2a402227ae1fb28f39d59f143df562dc" + last-author="casper" + kind="file" + prop-time="2004-10-05T08:43:24.000000Z" + revision="1585"/> +</wc-entries> diff --git a/arch_src/pyalsaaudio-0.2/.svn/format b/arch_src/pyalsaaudio-0.2/.svn/format new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/format @@ -0,0 +1 @@ +4 diff --git a/arch_src/pyalsaaudio-0.2/.svn/prop-base/README.svn-base b/arch_src/pyalsaaudio-0.2/.svn/prop-base/README.svn-base new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/prop-base/README.svn-base @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/prop-base/TODO.svn-base b/arch_src/pyalsaaudio-0.2/.svn/prop-base/TODO.svn-base new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/prop-base/TODO.svn-base @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/prop-base/alsaaudio.c.svn-base b/arch_src/pyalsaaudio-0.2/.svn/prop-base/alsaaudio.c.svn-base new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/prop-base/alsaaudio.c.svn-base @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/prop-base/playbacktest.py.svn-base b/arch_src/pyalsaaudio-0.2/.svn/prop-base/playbacktest.py.svn-base new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/prop-base/playbacktest.py.svn-base @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/prop-base/recordtest.py.svn-base b/arch_src/pyalsaaudio-0.2/.svn/prop-base/recordtest.py.svn-base new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/prop-base/recordtest.py.svn-base @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/prop-base/setup.py.svn-base b/arch_src/pyalsaaudio-0.2/.svn/prop-base/setup.py.svn-base new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/prop-base/setup.py.svn-base @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/props/README.svn-work b/arch_src/pyalsaaudio-0.2/.svn/props/README.svn-work new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/props/README.svn-work @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/props/TODO.svn-work b/arch_src/pyalsaaudio-0.2/.svn/props/TODO.svn-work new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/props/TODO.svn-work @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/props/alsaaudio.c.svn-work b/arch_src/pyalsaaudio-0.2/.svn/props/alsaaudio.c.svn-work new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/props/alsaaudio.c.svn-work @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/props/playbacktest.py.svn-work b/arch_src/pyalsaaudio-0.2/.svn/props/playbacktest.py.svn-work new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/props/playbacktest.py.svn-work @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/props/recordtest.py.svn-work b/arch_src/pyalsaaudio-0.2/.svn/props/recordtest.py.svn-work new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/props/recordtest.py.svn-work @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/props/setup.py.svn-work b/arch_src/pyalsaaudio-0.2/.svn/props/setup.py.svn-work new file mode 100644 index 0000000..dce2c1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/props/setup.py.svn-work @@ -0,0 +1 @@ +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/CHANGES.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/CHANGES.svn-base new file mode 100644 index 0000000..6ce8463 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/CHANGES.svn-base @@ -0,0 +1,8 @@ +VERSION 0.1 +- Initial version + + +VERSION 0.2 +- Many bugfixes related to playback in particular +- Module documentation in the doc subdirectory + diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/LICENSE.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/LICENSE.svn-base new file mode 100644 index 0000000..8aa69f7 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/LICENSE.svn-base @@ -0,0 +1,54 @@ +PyAlsaAudio is released under the same conditions as Python itself. +The original wording of this license can be found below. + + +PSF LICENSE AGREEMENT FOR PYTHON 2.4 +------------------------------------ + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using Python 2.4 software in source or binary form and its +associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 2.4 +alone or in any derivative version, provided, however, that PSF's +License Agreement and PSF's notice of copyright, i.e., "Copyright (c) +2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved" +are retained in Python 2.4 alone or in any derivative version prepared +by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 2.4 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 2.4. + +4. PSF is making Python 2.4 available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.4 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +2.4 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.4, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python 2.4, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/README.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/README.svn-base new file mode 100644 index 0000000..179cb79 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/README.svn-base @@ -0,0 +1,55 @@ +PyAlsaAudio +=========== + +Author: Casper Wilstrup (cwi@unispeed.dk) + +This package contains wrappers for accessing the ALSA api from Python. It +is currently fairly complete for PCM devices. My next goal is to have +complete mixer supports as well. MIDI sequencer support is low on my +priority list, but volunteers are welcome. + +If you find bugs in the wrappers please notify me on email. Please +don't send bug reports regarding ALSA specifically. There are several +bugs in this api, and those should be reported to the ALSA team - not +me. + +This software is licensed under the PSF license - the same one used +by the majority of the python distribution. Basically you can use it +for anything you wish (even commercial purposes). There is no warranty +whatsoever. + + +Installation +============ + +Note: the wrappers link with the alsasound library alsa (from the alsa-lib +package). Verify that this is installed by looking for /usr/lib/libasound.so +before building. The libasound development files are also neccesary. On debian +and derivatives, this is achieved by installing the alsalib-dev package. + +Naturally you also need to use a kernel with proper ALSA +support. This is the default in Linux kernel 2.6 and later. If you are using +kernel version 2.4 you may need to install the ALSA patches yourself - although +most distributions ship with ALSA kernels. + +To install, execute the following: + $ python setup.py build + +And then as root: + # python setup.py install + + +Using the API +============= +There is a reasonably usefull API documentation included in the module +documentation, which can be found in the doc subdirectory of the source +distribution. + +There are also three example programs included with the source: +'playbacktest.py' which plays back raw sound data read from +stdin + +'recordtest.py' which captures sound from the microphone at writes +it raw to stdout. + +'mixertest.py' which can be used to manipulate the mixers diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/TODO.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/TODO.svn-base new file mode 100644 index 0000000..710a8a3 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/TODO.svn-base @@ -0,0 +1,3 @@ +- Better example code (aplay,arecord,amixer workalike for example) +- Implement MIDI/sequencer support. + diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/alsaaudio.c.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/alsaaudio.c.svn-base new file mode 100644 index 0000000..1828148 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/alsaaudio.c.svn-base @@ -0,0 +1,1013 @@ +/* + * alsaaudio -- Python interface to ALSA (Advanced Linux Sound Architecture). + * The standard audio API for Linux since kernel 2.6 + * + * Contributed by Unispeed A/S (http://www.unispeed.com) + * Author: Casper Wilstup (cwi@unispeed.dk) + * + * License: Python Software Foundation License + * + */ + +#include "Python.h" +#include <alsa/asoundlib.h> +#include <stdio.h> + +PyDoc_STRVAR(alsaaudio_module_doc, + "This modules provides support for the ALSA audio API.\n" + "\n" + "To control the PCM device, use the PCM class, Mixers\n" + "are controlled using the Mixer class.\n" + "\n" + "The following functions are also provided:\n" + "mixers() -- Return a list of available mixer names\n" + ); + +typedef struct { + PyObject_HEAD; + int pcmtype; + int pcmmode; + char *cardname; + + snd_pcm_t *handle; + + // Configurable parameters + int channels; + int rate; + int format; + snd_pcm_uframes_t periodsize; + int framesize; + +} alsapcm_t; + +typedef struct { + PyObject_HEAD; + + /* Mixer identification */ + char *cardname; + char *controlname; + int controlid; + + /* Capabilities */ + unsigned int volume_cap; + unsigned int switch_cap; + unsigned int pchannels; + unsigned int cchannels; + + /* min and max values for playback and capture volumes */ + long pmin; + long pmax; + long cmin; + long cmax; + snd_mixer_t *handle; + +} alsamixer_t; + +static PyObject *ALSAAudioError; + + +/******************************************/ +/* PCM object wrapper */ +/******************************************/ + +static PyTypeObject ALSAPCMType; + +static int alsapcm_setup(alsapcm_t *self) { + int res,dir; + unsigned int val; + snd_pcm_uframes_t frames; + snd_pcm_hw_params_t *hwparams; + + if (self->handle) { + snd_pcm_close(self->handle); + self->handle = 0; + } + res = snd_pcm_open(&(self->handle),self->cardname,self->pcmtype,self->pcmmode); + if (res < 0) return res; + + /* Allocate a hwparam structure, and fill it in with configuration space */ + snd_pcm_hw_params_alloca(&hwparams); + res = snd_pcm_hw_params_any(self->handle, hwparams); + if (res < 0) return res; + + /* Fill it in with default values. */ + snd_pcm_hw_params_any(self->handle, hwparams); + snd_pcm_hw_params_set_access(self->handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); + snd_pcm_hw_params_set_format(self->handle, hwparams, self->format); + snd_pcm_hw_params_set_channels(self->handle, hwparams, self->channels); + dir = 0; + snd_pcm_hw_params_set_rate(self->handle, hwparams, self->rate, dir); + snd_pcm_hw_params_set_period_size(self->handle, hwparams, self->periodsize, dir); + snd_pcm_hw_params_set_periods(self->handle,hwparams,4,0); + + /* Write it to the device */ + res = snd_pcm_hw_params(self->handle, hwparams); + if (res) return res; + + /* Query current settings. These may differ from the requested values, + which should therefore be sync'ed with actual values */ + snd_pcm_hw_params_current(self->handle,hwparams); + + snd_pcm_hw_params_get_format(hwparams,&val); self->format = val; + snd_pcm_hw_params_get_channels(hwparams,&val); self->channels = val; + snd_pcm_hw_params_get_rate(hwparams,&val,&dir); self->rate = val; + snd_pcm_hw_params_get_period_size(hwparams,&frames,&dir); self->periodsize = (int) frames; + + self->framesize = self->channels * snd_pcm_hw_params_get_sbits(hwparams)/8; + return res; +} + +static PyObject * +alsapcm_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { + int res; + alsapcm_t *self; + int pcmtype=0; + int pcmmode=0; + char *cardname = "default"; + if (!PyArg_ParseTuple(args,"|iis",&pcmtype,&pcmmode,&cardname)) return NULL; + if (!(self = (alsapcm_t *)PyObject_New(alsapcm_t, &ALSAPCMType))) return NULL; + + if (pcmtype != SND_PCM_STREAM_PLAYBACK && pcmtype != SND_PCM_STREAM_CAPTURE) { + PyErr_SetString(ALSAAudioError, "PCM type must be PCM_PLAYBACK (0) or PCM_CAPTUPE (1)"); + return NULL; + } + if (pcmmode < 0 || pcmmode > SND_PCM_ASYNC) { + PyErr_SetString(ALSAAudioError, "Invalid PCM mode"); + return NULL; + } + self->pcmtype = pcmtype; + self->pcmmode = pcmmode; + self->cardname = strdup(cardname); + + self->channels = 2; + self->rate = 44100; + self->format = SND_PCM_FORMAT_S16_LE; + self->periodsize = 32; + + self->handle = 0; + res = alsapcm_setup(self); + + if (res < 0) { + if (self->handle) { + snd_pcm_close(self->handle); + self->handle = 0; + } + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return (PyObject *)self; +} + +static void alsapcm_dealloc(alsapcm_t *self) { + if (self->handle) { + snd_pcm_drain(self->handle); + snd_pcm_close(self->handle); + } + free(self->cardname); + PyObject_Del(self); +} + +static PyObject * +alsapcm_dumpinfo(alsapcm_t *self, PyObject *args) { + unsigned int val,val2; + int dir; + snd_pcm_uframes_t frames; + snd_pcm_hw_params_t *hwparams; + snd_pcm_hw_params_alloca(&hwparams); + snd_pcm_hw_params_current(self->handle,hwparams); + + + if (!PyArg_ParseTuple(args,"")) return NULL; + + printf("PCM handle name = '%s'\n", snd_pcm_name(self->handle)); + printf("PCM state = %s\n", snd_pcm_state_name(snd_pcm_state(self->handle))); + + snd_pcm_hw_params_get_access(hwparams, (snd_pcm_access_t *) &val); + printf("access type = %s\n", snd_pcm_access_name((snd_pcm_access_t)val)); + + snd_pcm_hw_params_get_format(hwparams, &val); + printf("format = '%s' (%s)\n", + snd_pcm_format_name((snd_pcm_format_t)val), + snd_pcm_format_description((snd_pcm_format_t)val)); + + snd_pcm_hw_params_get_subformat(hwparams, (snd_pcm_subformat_t *)&val); + printf("subformat = '%s' (%s)\n", + snd_pcm_subformat_name((snd_pcm_subformat_t)val), + snd_pcm_subformat_description((snd_pcm_subformat_t)val)); + + snd_pcm_hw_params_get_channels(hwparams, &val); + printf("channels = %d\n", val); + + snd_pcm_hw_params_get_rate(hwparams, &val, &dir); + printf("rate = %d bps\n", val); + + snd_pcm_hw_params_get_period_time(hwparams, &val, &dir); + printf("period time = %d us\n", val); + + snd_pcm_hw_params_get_period_size(hwparams, &frames, &dir); + printf("period size = %d frames\n", (int)frames); + + snd_pcm_hw_params_get_buffer_time(hwparams, &val, &dir); + printf("buffer time = %d us\n", val); + + snd_pcm_hw_params_get_buffer_size(hwparams, (snd_pcm_uframes_t *) &val); + printf("buffer size = %d frames\n", val); + + snd_pcm_hw_params_get_periods(hwparams, &val, &dir); + printf("periods per buffer = %d frames\n", val); + + snd_pcm_hw_params_get_rate_numden(hwparams, &val, &val2); + printf("exact rate = %d/%d bps\n", val, val2); + + val = snd_pcm_hw_params_get_sbits(hwparams); + printf("significant bits = %d\n", val); + + snd_pcm_hw_params_get_tick_time(hwparams, &val, &dir); + printf("tick time = %d us\n", val); + + val = snd_pcm_hw_params_is_batch(hwparams); + printf("is batch = %d\n", val); + + val = snd_pcm_hw_params_is_block_transfer(hwparams); + printf("is block transfer = %d\n", val); + + val = snd_pcm_hw_params_is_double(hwparams); + printf("is double = %d\n", val); + + val = snd_pcm_hw_params_is_half_duplex(hwparams); + printf("is half duplex = %d\n", val); + + val = snd_pcm_hw_params_is_joint_duplex(hwparams); + printf("is joint duplex = %d\n", val); + + val = snd_pcm_hw_params_can_overrange(hwparams); + printf("can overrange = %d\n", val); + + val = snd_pcm_hw_params_can_mmap_sample_resolution(hwparams); + printf("can mmap = %d\n", val); + + val = snd_pcm_hw_params_can_pause(hwparams); + printf("can pause = %d\n", val); + + val = snd_pcm_hw_params_can_resume(hwparams); + printf("can resume = %d\n", val); + + val = snd_pcm_hw_params_can_sync_start(hwparams); + printf("can sync start = %d\n", val); + + Py_INCREF(Py_None); + return Py_None; + +} + +static PyObject * +alsapcm_pcmtype(alsapcm_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyInt_FromLong(self->pcmtype); +} + +static PyObject * +alsapcm_pcmmode(alsapcm_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyInt_FromLong(self->pcmmode); +} + +static PyObject * +alsapcm_cardname(alsapcm_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyString_FromString(self->cardname); +} + +static PyObject * +alsapcm_setchannels(alsapcm_t *self, PyObject *args) { + int channels; + int res; + if (!PyArg_ParseTuple(args,"i",&channels)) return NULL; + self->channels = channels; + res = alsapcm_setup(self); + if (res < 0) { + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(self->channels); +} + +static PyObject * +alsapcm_setrate(alsapcm_t *self, PyObject *args) { + int rate; + int res; + if (!PyArg_ParseTuple(args,"i",&rate)) return NULL; + self->rate = rate; + res = alsapcm_setup(self); + if (res < 0) { + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(self->rate); +} + +static PyObject * +alsapcm_setformat(alsapcm_t *self, PyObject *args) { + int format; + int res; + if (!PyArg_ParseTuple(args,"i",&format)) return NULL; + self->format = format; + res = alsapcm_setup(self); + if (res < 0) { + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(self->format); +} + +static PyObject * +alsapcm_setperiodsize(alsapcm_t *self, PyObject *args) { + int periodsize; + int res; + if (!PyArg_ParseTuple(args,"i",&periodsize)) return NULL; + self->periodsize = periodsize; + res = alsapcm_setup(self); + if (res < 0) { + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(self->periodsize); +} + + +static PyObject * +alsapcm_read(alsapcm_t *self, PyObject *args) { + int res; + char buffer[8000]; + + if (self->framesize * self->periodsize > 8000) { + PyErr_SetString(ALSAAudioError,"Capture data too large. Try decreasing period size"); + return NULL; + } + + if (!PyArg_ParseTuple(args,"")) return NULL; + if (self->pcmtype != SND_PCM_STREAM_CAPTURE) { + PyErr_SetString(ALSAAudioError,"Cannot read from playback PCM"); + return NULL; + } + + res = snd_pcm_readi(self->handle, buffer, self->periodsize); + if (res == -EPIPE) { + /* EPIPE means overrun */ + snd_pcm_prepare(self->handle); + } + else if (res == -EAGAIN) { + res = 0; + } + else if (res < 0) { + PyErr_SetString(ALSAAudioError,snd_strerror(res)); + return NULL; + } + + return Py_BuildValue("is#",res,buffer,res*self->framesize); +} + +static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args) { + char *data; + int datalen; + int res; + if (!PyArg_ParseTuple(args,"s#",&data,&datalen)) return NULL; + if (datalen%self->framesize) { + PyErr_SetString(ALSAAudioError,"Data size must be a multiple of framesize"); + return NULL; + } + res = snd_pcm_writei(self->handle, data, datalen/self->framesize); + if (res == -EPIPE) { + /* EPIPE means underrun */ + snd_pcm_prepare(self->handle); + snd_pcm_writei(self->handle, data, datalen/self->framesize); + snd_pcm_writei(self->handle, data, datalen/self->framesize); + } + else if (res == -EAGAIN) { + return PyInt_FromLong(0); + } + else if (res < 0) { + PyErr_SetString(ALSAAudioError,snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(res); +} + + +/* ALSA PCM Object Bureaucracy */ + +static PyMethodDef alsapcm_methods[] = { + {"pcmtype", (PyCFunction)alsapcm_pcmtype, METH_VARARGS}, + {"pcmmode", (PyCFunction)alsapcm_pcmmode, METH_VARARGS}, + {"cardname", (PyCFunction)alsapcm_cardname, METH_VARARGS}, + {"setchannels", (PyCFunction)alsapcm_setchannels, METH_VARARGS}, + {"setrate", (PyCFunction)alsapcm_setrate, METH_VARARGS}, + {"setformat", (PyCFunction)alsapcm_setformat, METH_VARARGS}, + {"setperiodsize", (PyCFunction)alsapcm_setperiodsize, METH_VARARGS}, + + {"dumpinfo", (PyCFunction)alsapcm_dumpinfo, METH_VARARGS}, + + {"read", (PyCFunction)alsapcm_read, METH_VARARGS}, + {"write", (PyCFunction)alsapcm_write, METH_VARARGS}, + + {NULL, NULL} +}; + +static PyObject * +alsapcm_getattr(alsapcm_t *self, char *name) { + return Py_FindMethod(alsapcm_methods, (PyObject *)self, name); +} + +static PyTypeObject ALSAPCMType = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /*ob_size*/ + "alsaaudio.pcm", /*tp_name*/ + sizeof(alsapcm_t), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor) alsapcm_dealloc, /*tp_dealloc*/ + 0, /*print*/ + (getattrfunc)alsapcm_getattr, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "ALSA PCM device", /*tp_doc*/ +}; + + +/******************************************/ +/* Mixer object wrapper */ +/******************************************/ + +static PyTypeObject ALSAMixerType; + +#define MIXER_CAP_VOLUME 0x0001 +#define MIXER_CAP_VOLUME_JOINED 0x0002 +#define MIXER_CAP_PVOLUME 0x0004 +#define MIXER_CAP_PVOLUME_JOINED 0x0008 +#define MIXER_CAP_CVOLUME 0x0010 +#define MIXER_CAP_CVOLUME_JOINED 0x0020 + +#define MIXER_CAP_SWITCH 0x0001 +#define MIXER_CAP_SWITCH_JOINED 0x0002 +#define MIXER_CAP_PSWITCH 0x0004 +#define MIXER_CAP_PSWITCH_JOINED 0x0008 +#define MIXER_CAP_CSWITCH 0x0010 +#define MIXER_CAP_CSWITCH_JOINED 0x0020 +#define MIXER_CAP_CSWITCH_EXCLUSIVE 0x0040 + +#define MIXER_CHANNEL_ALL -1 + +int +alsamixer_gethandle(char *cardname, snd_mixer_t **handle) { + int err; + if ((err = snd_mixer_open(handle, 0)) < 0) return err; + if ((err = snd_mixer_attach(*handle, cardname)) < 0) return err; + if ((err = snd_mixer_selem_register(*handle, NULL, NULL)) < 0) return err; + if ((err = snd_mixer_load(*handle)) < 0) return err; + + return 0; +} + +static PyObject * +alsamixer_list(PyObject *self, PyObject *args) { + snd_mixer_t *handle; + snd_mixer_selem_id_t *sid; + snd_mixer_elem_t *elem; + int err; + char *cardname = "default"; + PyObject *result = PyList_New(0); + + if (!PyArg_ParseTuple(args,"|s",&cardname)) return NULL; + + snd_mixer_selem_id_alloca(&sid); + err = alsamixer_gethandle(cardname,&handle); + if (err < 0) { + PyErr_SetString(ALSAAudioError,snd_strerror(err)); + snd_mixer_close(handle); + return NULL; + } + for (elem = snd_mixer_first_elem(handle); elem; elem = snd_mixer_elem_next(elem)) { + PyObject *mixer; + snd_mixer_selem_get_id(elem, sid); + mixer = PyString_FromString(snd_mixer_selem_id_get_name(sid)); + PyList_Append(result,mixer); + Py_DECREF(mixer); + } + snd_mixer_close(handle); + + return result; +} + +static snd_mixer_elem_t * +alsamixer_find_elem(snd_mixer_t *handle, char *control, int id) { + snd_mixer_selem_id_t *sid; + + snd_mixer_selem_id_alloca(&sid); + snd_mixer_selem_id_set_index(sid, id); + snd_mixer_selem_id_set_name(sid, control); + return snd_mixer_find_selem(handle, sid); +} + +static PyObject * +alsamixer_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { + alsamixer_t *self; + int err; + char *cardname = "default"; + char *control = "Master"; + int id = 0; + snd_mixer_elem_t *elem; + int channel; + + if (!PyArg_ParseTuple(args,"|sis",&control,&id,&cardname)) return NULL; + if (!(self = (alsamixer_t *)PyObject_New(alsamixer_t, &ALSAMixerType))) return NULL; + + err = alsamixer_gethandle(cardname,&self->handle); + if (err<0) { + PyErr_SetString(ALSAAudioError,snd_strerror(err)); + return NULL; + } + self->cardname = strdup(cardname); + self->controlname = strdup(control); + self->controlid = id; + + elem = alsamixer_find_elem(self->handle,control,id); + if (!elem) { + char errtext[128]; + sprintf(errtext,"Unable to find mixer control '%s',%i",self->controlname,self->controlid); + snd_mixer_close(self->handle); + PyErr_SetString(ALSAAudioError,errtext); + return NULL; + } + /* Determine mixer capabilities */ + self->volume_cap = self->switch_cap = 0; + if (snd_mixer_selem_has_common_volume(elem)) { + self->volume_cap |= MIXER_CAP_VOLUME; + if (snd_mixer_selem_has_playback_volume_joined(elem)) self->volume_cap |= MIXER_CAP_VOLUME_JOINED; + } + else { + if (snd_mixer_selem_has_playback_volume(elem)) { + self->volume_cap |= MIXER_CAP_PVOLUME; + if (snd_mixer_selem_has_playback_volume_joined(elem)) self->volume_cap |= MIXER_CAP_PVOLUME_JOINED; + } + if (snd_mixer_selem_has_capture_volume(elem)) { + self->volume_cap |= MIXER_CAP_CVOLUME; + if (snd_mixer_selem_has_capture_volume_joined(elem)) self->volume_cap |= MIXER_CAP_CVOLUME_JOINED; + } + } + + if (snd_mixer_selem_has_common_switch(elem)) { + self->switch_cap |= MIXER_CAP_SWITCH; + if (snd_mixer_selem_has_playback_switch_joined(elem)) self->switch_cap |= MIXER_CAP_SWITCH_JOINED; + } + else { + if (snd_mixer_selem_has_playback_switch(elem)) { + self->switch_cap |= MIXER_CAP_PSWITCH; + if (snd_mixer_selem_has_playback_switch_joined(elem)) self->switch_cap |= MIXER_CAP_PSWITCH_JOINED; + } + if (snd_mixer_selem_has_capture_switch(elem)) { + self->switch_cap |= MIXER_CAP_CSWITCH; + if (snd_mixer_selem_has_capture_switch_joined(elem)) self->switch_cap |= MIXER_CAP_CSWITCH_JOINED; + if (snd_mixer_selem_has_capture_switch_exclusive(elem)) self->switch_cap |= MIXER_CAP_CSWITCH_EXCLUSIVE; + } + } + self->pchannels = 0; + if (self->volume_cap | MIXER_CAP_PVOLUME || self->switch_cap | MIXER_CAP_PSWITCH) { + if (snd_mixer_selem_is_playback_mono(elem)) self->pchannels = 1; + else { + for (channel=0; channel <= SND_MIXER_SCHN_LAST; channel++) { + if (snd_mixer_selem_has_playback_channel(elem, channel)) self->pchannels++; + else break; + } + } + } + self->cchannels = 0; + if (self->volume_cap | MIXER_CAP_CVOLUME || self->switch_cap | MIXER_CAP_CSWITCH) { + if (snd_mixer_selem_is_capture_mono(elem)) self->cchannels = 1; + else { + for (channel=0; channel <= SND_MIXER_SCHN_LAST; channel++) { + if (snd_mixer_selem_has_capture_channel(elem, channel)) self->cchannels++; + else break; + } + } + } + snd_mixer_selem_get_playback_volume_range(elem, &self->pmin, &self->pmax); + snd_mixer_selem_get_capture_volume_range(elem, &self->cmin, &self->cmax); + return (PyObject *)self; +} + +static void alsamixer_dealloc(alsamixer_t *self) { + if (self->handle) { + snd_mixer_close(self->handle); + free(self->cardname); + free(self->controlname); + self->handle = 0; + } + PyObject_Del(self); +} + +static PyObject * +alsamixer_cardname(alsamixer_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyString_FromString(self->cardname); +} + +static PyObject * +alsamixer_mixer(alsamixer_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyString_FromString(self->controlname); +} + +static PyObject * +alsamixer_mixerid(alsamixer_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyInt_FromLong(self->controlid); +} + +static PyObject * +alsamixer_volumecap(alsamixer_t *self, PyObject *args) { + PyObject *result; + if (!PyArg_ParseTuple(args,"")) return NULL; + result = PyList_New(0); + if (self->volume_cap&MIXER_CAP_VOLUME) + PyList_Append(result,PyString_FromString("Volume")); + if (self->volume_cap&MIXER_CAP_VOLUME_JOINED) + PyList_Append(result,PyString_FromString("Joined Volume")); + if (self->volume_cap&MIXER_CAP_PVOLUME) + PyList_Append(result,PyString_FromString("Playback Volume")); + if (self->volume_cap&MIXER_CAP_PVOLUME_JOINED) + PyList_Append(result,PyString_FromString("Joined Playback Volume")); + if (self->volume_cap&MIXER_CAP_CVOLUME) + PyList_Append(result,PyString_FromString("Capture Volume")); + if (self->volume_cap&MIXER_CAP_CVOLUME_JOINED) + PyList_Append(result,PyString_FromString("Joined Capture Volume")); + + return result; +} +static PyObject * +alsamixer_switchcap(alsamixer_t *self, PyObject *args) { + PyObject *result; + if (!PyArg_ParseTuple(args,"")) return NULL; + result = PyList_New(0); + if (self->volume_cap&MIXER_CAP_SWITCH) + PyList_Append(result,PyString_FromString("Mute")); + if (self->volume_cap&MIXER_CAP_SWITCH_JOINED) + PyList_Append(result,PyString_FromString("Joined Mute")); + if (self->volume_cap&MIXER_CAP_PSWITCH) + PyList_Append(result,PyString_FromString("Playback Mute")); + if (self->volume_cap&MIXER_CAP_PSWITCH_JOINED) + PyList_Append(result,PyString_FromString("Joined Playback Mute")); + if (self->volume_cap&MIXER_CAP_CSWITCH) + PyList_Append(result,PyString_FromString("Capture Mute")); + if (self->volume_cap&MIXER_CAP_CSWITCH_JOINED) + PyList_Append(result,PyString_FromString("Joined Capture Mute")); + if (self->volume_cap&MIXER_CAP_CSWITCH_EXCLUSIVE) + PyList_Append(result,PyString_FromString("Capture Exclusive")); + return result; +} + +static int alsamixer_getpercentage(long min, long max, long value) { + /* Convert from number in range to percentage */ + int range = max - min; + int tmp; + + if (range == 0) return 0; + value -= min; + tmp = rint((double)value/(double)range * 100); + return tmp; + +} + +static long alsamixer_getphysvolume(long min, long max, int percentage) { + /* Convert from percentage to number in range */ + int range = max - min; + int tmp; + + if (range == 0) return 0; + tmp = rint((double)range * ((double)percentage*.01)) + min; + return tmp; +} + +static PyObject * +alsamixer_getvolume(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int direction; + int channel; + long ival; + char *dirstr = 0; + PyObject *result; + + if (!PyArg_ParseTuple(args,"|s",&dirstr)) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + + if (!dirstr) { + if (self->pchannels) direction = 0; + else direction = 1; + } + else if (strcasecmp(dirstr,"playback")==0) direction = 0; + else if (strcasecmp(dirstr,"capture")==0) direction = 1; + else { + PyErr_SetString(ALSAAudioError,"Invalid direction argument for mixer"); + return NULL; + } + result = PyList_New(0); + for (channel = 0; channel <= SND_MIXER_SCHN_LAST; channel++) { + if (direction == 0 && snd_mixer_selem_has_playback_channel(elem, channel)) { + snd_mixer_selem_get_playback_volume(elem, channel, &ival); + PyList_Append(result,PyInt_FromLong(alsamixer_getpercentage(self->pmin,self->pmax,ival))); + } + else if (direction == 1 && snd_mixer_selem_has_capture_channel(elem, channel) + && snd_mixer_selem_has_capture_volume(elem)) { + snd_mixer_selem_get_capture_volume(elem, channel, &ival); + PyList_Append(result,PyInt_FromLong(alsamixer_getpercentage(self->cmin,self->cmax,ival))); + } + } + return result; +} + +static PyObject * +alsamixer_getmute(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int i; + int ival; + PyObject *result; + if (!PyArg_ParseTuple(args,"")) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + if (!snd_mixer_selem_has_playback_switch(elem)) { + PyErr_SetString(ALSAAudioError,"Mixer has no mute switch"); + return NULL; + } + result = PyList_New(0); + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (snd_mixer_selem_has_playback_channel(elem, i)) { + snd_mixer_selem_get_playback_switch(elem, i, &ival); + PyList_Append(result,PyInt_FromLong(!ival)); + } + } + return result; +} + +static PyObject * +alsamixer_getrec(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int i; + int ival; + PyObject *result; + if (!PyArg_ParseTuple(args,"")) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + if (!snd_mixer_selem_has_capture_switch(elem)) { + PyErr_SetString(ALSAAudioError,"Mixer has no record switch"); + return NULL; + } + result = PyList_New(0); + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (snd_mixer_selem_has_capture_channel(elem, i)) { + snd_mixer_selem_get_capture_switch(elem, i, &ival); + PyList_Append(result,PyInt_FromLong(!ival)); + } + } + return result; +} + +static PyObject * +alsamixer_setvolume(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int direction; + int i; + long volume; + int physvolume; + char *dirstr = 0; + int channel = MIXER_CHANNEL_ALL; + int done = 0; + + if (!PyArg_ParseTuple(args,"l|is",&volume,&channel,&dirstr)) return NULL; + if (volume < 0 || volume > 100) { + PyErr_SetString(ALSAAudioError,"Volume must be between 0 and 100"); + return NULL; + } + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + + if (!dirstr) { + if (self->pchannels) direction = 0; + else direction = 1; + } + else if (strcasecmp(dirstr,"playback")==0) direction = 0; + else if (strcasecmp(dirstr,"capture")==0) direction = 1; + else { + PyErr_SetString(ALSAAudioError,"Invalid direction argument. Use 'playback' or 'capture'"); + return NULL; + } + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (channel == -1 || channel == i) { + if (direction == 0 && snd_mixer_selem_has_playback_channel(elem, i)) { + physvolume = alsamixer_getphysvolume(self->pmin,self->pmax,volume); + snd_mixer_selem_set_playback_volume(elem, i, physvolume); + done++; + } + else if (direction == 1 && snd_mixer_selem_has_capture_channel(elem, channel) + && snd_mixer_selem_has_capture_volume(elem)) { + physvolume = alsamixer_getphysvolume(self->cmin,self->cmax,volume); + snd_mixer_selem_set_capture_volume(elem, i, physvolume); + done++; + } + } + } + if(!done) { + PyErr_SetString(ALSAAudioError,"No such channel"); + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +alsamixer_setmute(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int i; + int mute = 0; + int done = 0; + int channel = MIXER_CHANNEL_ALL; + if (!PyArg_ParseTuple(args,"i|i",&mute,&channel)) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + if (!snd_mixer_selem_has_playback_switch(elem)) { + PyErr_SetString(ALSAAudioError,"Mixer has no mute switch"); + return NULL; + } + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (channel == MIXER_CHANNEL_ALL || channel == i) { + if (snd_mixer_selem_has_playback_channel(elem, i)) { + snd_mixer_selem_set_playback_switch(elem, i, !mute); + done++; + } + } + } + if (!done) { + PyErr_SetString(ALSAAudioError,"Invalid channel number"); + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +alsamixer_setrec(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int i; + int rec = 0; + int done = 0; + int channel = MIXER_CHANNEL_ALL; + if (!PyArg_ParseTuple(args,"i|i",&rec,&channel)) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + if (!snd_mixer_selem_has_capture_switch(elem)) { + PyErr_SetString(ALSAAudioError,"Mixer has no record switch"); + return NULL; + } + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (channel == MIXER_CHANNEL_ALL || channel == i) { + if (snd_mixer_selem_has_capture_channel(elem, i)) { + snd_mixer_selem_set_playback_switch(elem, i, rec); + done++; + } + } + } + if (!done) { + PyErr_SetString(ALSAAudioError,"Invalid channel number"); + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef alsamixer_methods[] = { + {"cardname", (PyCFunction)alsamixer_cardname, METH_VARARGS}, + {"mixer", (PyCFunction)alsamixer_mixer, METH_VARARGS}, + {"mixerid", (PyCFunction)alsamixer_mixerid, METH_VARARGS}, + {"switchcap", (PyCFunction)alsamixer_switchcap, METH_VARARGS}, + {"volumecap", (PyCFunction)alsamixer_volumecap, METH_VARARGS}, + {"getvolume", (PyCFunction)alsamixer_getvolume, METH_VARARGS}, + {"getmute", (PyCFunction)alsamixer_getmute, METH_VARARGS}, + {"getrec", (PyCFunction)alsamixer_getrec, METH_VARARGS}, + {"setvolume", (PyCFunction)alsamixer_setvolume, METH_VARARGS}, + {"setmute", (PyCFunction)alsamixer_setmute, METH_VARARGS}, + {"setrec", (PyCFunction)alsamixer_setrec, METH_VARARGS}, + {NULL, NULL} +}; + + +static PyObject * +alsamixer_getattr(alsapcm_t *self, char *name) { + return Py_FindMethod(alsamixer_methods, (PyObject *)self, name); +} + +static PyTypeObject ALSAMixerType = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /*ob_size*/ + "alsaaudio.mixer", /*tp_name*/ + sizeof(alsamixer_t), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor) alsamixer_dealloc, /*tp_dealloc*/ + 0, /*print*/ + (getattrfunc)alsamixer_getattr, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "ALSA Mixer Control", /*tp_doc*/ +}; + + +/******************************************/ +/* Module initialization */ +/******************************************/ + +static PyMethodDef alsaaudio_methods[] = { + { "mixers", alsamixer_list, METH_VARARGS }, + { 0, 0 }, +}; + +#define _EXPORT_INT(mod, name, value) \ + if (PyModule_AddIntConstant(mod, name, (long) value) == -1) return; + +void initalsaaudio(void) { + PyObject *m; + ALSAPCMType.tp_new = alsapcm_new; + ALSAMixerType.tp_new = alsamixer_new; + m = Py_InitModule3("alsaaudio",alsaaudio_methods,alsaaudio_module_doc); + + ALSAAudioError = PyErr_NewException("alsaaudio.ALSAAudioError", NULL, NULL); + if (ALSAAudioError) { + /* Each call to PyModule_AddObject decrefs it; compensate: */ + + Py_INCREF(&ALSAPCMType); + PyModule_AddObject(m,"PCM",(PyObject *)&ALSAPCMType); + + Py_INCREF(&ALSAMixerType); + PyModule_AddObject(m,"Mixer",(PyObject *)&ALSAMixerType); + + Py_INCREF(ALSAAudioError); + PyModule_AddObject(m, "ALSAAudioError", ALSAAudioError); + } + + + _EXPORT_INT(m,"PCM_PLAYBACK",SND_PCM_STREAM_PLAYBACK); + _EXPORT_INT(m,"PCM_CAPTURE",SND_PCM_STREAM_CAPTURE); + + _EXPORT_INT(m,"PCM_NORMAL",0); + _EXPORT_INT(m,"PCM_NONBLOCK",SND_PCM_NONBLOCK); + _EXPORT_INT(m,"PCM_ASYNC",SND_PCM_ASYNC); + + /* PCM Formats */ + _EXPORT_INT(m,"PCM_FORMAT_S8",SND_PCM_FORMAT_S8); + _EXPORT_INT(m,"PCM_FORMAT_U8",SND_PCM_FORMAT_U8); + _EXPORT_INT(m,"PCM_FORMAT_S16_LE",SND_PCM_FORMAT_S16_LE); + _EXPORT_INT(m,"PCM_FORMAT_S16_BE",SND_PCM_FORMAT_S16_BE); + _EXPORT_INT(m,"PCM_FORMAT_U16_LE",SND_PCM_FORMAT_U16_LE); + _EXPORT_INT(m,"PCM_FORMAT_U16_BE",SND_PCM_FORMAT_U16_BE); + _EXPORT_INT(m,"PCM_FORMAT_S24_LE",SND_PCM_FORMAT_S24_LE); + _EXPORT_INT(m,"PCM_FORMAT_S24_BE",SND_PCM_FORMAT_S24_BE); + _EXPORT_INT(m,"PCM_FORMAT_U24_LE",SND_PCM_FORMAT_U24_LE); + _EXPORT_INT(m,"PCM_FORMAT_U24_BE",SND_PCM_FORMAT_U24_BE); + _EXPORT_INT(m,"PCM_FORMAT_S32_LE",SND_PCM_FORMAT_S32_LE); + _EXPORT_INT(m,"PCM_FORMAT_S32_BE",SND_PCM_FORMAT_S32_BE); + _EXPORT_INT(m,"PCM_FORMAT_U32_LE",SND_PCM_FORMAT_U32_LE); + _EXPORT_INT(m,"PCM_FORMAT_U32_BE",SND_PCM_FORMAT_U32_BE); + _EXPORT_INT(m,"PCM_FORMAT_FLOAT_LE",SND_PCM_FORMAT_FLOAT_LE); + _EXPORT_INT(m,"PCM_FORMAT_FLOAT_BE",SND_PCM_FORMAT_FLOAT_BE); + _EXPORT_INT(m,"PCM_FORMAT_FLOAT64_LE",SND_PCM_FORMAT_FLOAT64_LE); + _EXPORT_INT(m,"PCM_FORMAT_FLOAT64_BE",SND_PCM_FORMAT_FLOAT64_BE); + _EXPORT_INT(m,"PCM_FORMAT_MU_LAW",SND_PCM_FORMAT_MU_LAW); + _EXPORT_INT(m,"PCM_FORMAT_A_LAW",SND_PCM_FORMAT_A_LAW); + _EXPORT_INT(m,"PCM_FORMAT_IMA_ADPCM",SND_PCM_FORMAT_IMA_ADPCM); + _EXPORT_INT(m,"PCM_FORMAT_MPEG",SND_PCM_FORMAT_MPEG); + _EXPORT_INT(m,"PCM_FORMAT_GSM",SND_PCM_FORMAT_GSM); + + /* Mixer stuff */ + _EXPORT_INT(m,"MIXER_CHANNEL_ALL",MIXER_CHANNEL_ALL); + +} diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/mixertest.py.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/mixertest.py.svn-base new file mode 100644 index 0000000..642ae10 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/mixertest.py.svn-base @@ -0,0 +1,88 @@ +## mixertest.py +## +## This is an example of using the ALSA mixer API +## +## The script will set the volume or mute switch of the specified Mixer +## depending on command line options. +## +## Examples: +## python mixertest.py # list available mixers +## python mixertest.py Master # show Master mixer settings +## python mixertest.py Master 80 # set the master volume to 80% +## python mixertest.py Master 1,90 # set channel 1 volume to 90% +## python mixertest.py Master mute # mute the master mixer +## python mixertest.py Master unmute # unmute the master mixer + +import alsaaudio +import sys + +if len(sys.argv) == 1: + # Demonstrates how to read the available mixers + print "Available mixer controls:" + for m in alsaaudio.mixers(): + print " '%s'" % m + +if len(sys.argv) == 2: + # Demonstrates how mixer settings are queried. + name = sys.argv[1] + try: + mixer = alsaaudio.Mixer(name) + except alsaaudio.ALSAAudioError: + print "No such mixer" + sys.exit(1) + + print "Mixer name: '%s'"%mixer.mixer() + print "Capabilities",mixer.volumecap()+mixer.switchcap() + volumes = mixer.getvolume() + for i in range(len(volumes)): + print "Channel %i volume: %i%%"%(i,volumes[i]) + + try: + mutes = mixer.getmute() + for i in range(len(mutes)): + if mutes[i]: print "Channel %i is muted"%i + except alsaaudio.ALSAAudioError: + # May not support muting + pass + + try: + recs = mixer.getrec() + for i in range(len(recs)): + if recs[i]: print "Channel %i is recording"%i + except alsaaudio.ALSAAudioError: + # May not support recording + pass + +if (len(sys.argv)) == 3: + # Demonstrates how to set mixer settings + name = sys.argv[1] + try: + mixer = alsaaudio.Mixer(name) + except alsaaudio.ALSAAudioError: + print "No such mixer" + sys.exit(1) + + args = sys.argv[2] + if args in ['mute','unmute']: + # Mute/unmute the mixer + if args == 'mute': mixer.setmute(1) + else: mixer.setmute(0) + sys.exit(0) + if args in ['rec','unrec']: + # Enable/disable recording + if args == 'rec': mixer.setrec(1) + else: mixer.setrec(0) + sys.exit(0) + + + if args.find(',')!=-1: + channel,volume = map(int,args.split(',')) + else: + channel = alsaaudio.MIXER_CHANNEL_ALL + volume = int(args) + # Set volume for specified channel. MIXER_CHANNEL_ALL means set + # volume for all channels + mixer.setvolume(volume,channel) + + + diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/playbacktest.py.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/playbacktest.py.svn-base new file mode 100644 index 0000000..06e0fe9 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/playbacktest.py.svn-base @@ -0,0 +1,36 @@ +## recordtest.py +## +## This is an example of a simple sound playback script. +## +## The script opens an ALSA pcm for sound playback. Set +## various attributes of the device. It then reads data +## from stdin and writes it to the device. +## +## To test it out do the following: +## python recordtest.py > out.raw # talk to the microphone +## python playbacktest.py < out.raw +## +## If you have Gnome, you could also just test by doing something like: +## python playbacktest.py < /usr/share/sounds/gnibbles/laughter.wav +import alsaaudio +import sys +import time + +# Open the device in playback mode. +out = alsaaudio.PCM(alsaaudio.PCM_PLAYBACK) + +# Set attributes: Mono, 8000 Hz, 16 bit little endian frames +out.setchannels(1) +out.setrate(8000) +out.setformat(alsaaudio.PCM_FORMAT_S16_LE) + +# The period size controls the internal number of frames per period. +# The significance of this parameter is documented in the ALSA api. +out.setperiodsize(160) + +loops = 10000 +while loops > 0: + loops -= 1 + # Read data from stdin + data = sys.stdin.read(320) + out.write(data) diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/recordtest.py.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/recordtest.py.svn-base new file mode 100644 index 0000000..216d627 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/recordtest.py.svn-base @@ -0,0 +1,45 @@ +## recordtest.py +## +## This is an example of a simple sound capture script. +## +## The script opens an ALSA pcm forsound capture. Set +## various attributes of the capture, and reads in a loop, +## writing the data to standard out. +## +## To test it out do the following: +## python recordtest.py > out.raw # talk to the microphone +## aplay -r 8000 -f S16_LE -c 1 out.raw + +import alsaaudio +import sys +import time + +# Open the device in nonblocking capture mode. The last argument could +# just as well have been zero for blocking mode. Then we could have +# left out the sleep call in the bottom of the loop +inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE,alsaaudio.PCM_NONBLOCK) + +# Set attributes: Mono, 8000 Hz, 16 bit little endian samples +inp.setchannels(1) +inp.setrate(8000) +inp.setformat(alsaaudio.PCM_FORMAT_S16_LE) + +# The period size controls the internal number of frames per period. +# The significance of this parameter is documented in the ALSA api. +# For our purposes, it is suficcient to know that reads from the device +# will return this many frames. Each frame being 2 bytes long. +# This means that the reads below will return either 320 bytes of data +# or 0 bytes of data. The latter is possible because we are in nonblocking +# mode. +inp.setperiodsize(160) + +loops = 1000000 +while loops > 0: + loops -= 1 + # Read data from device + l,data = inp.read() + + if l: + # actual data read. Write it to stdout + sys.stdout.write(data) + time.sleep(.001) diff --git a/arch_src/pyalsaaudio-0.2/.svn/text-base/setup.py.svn-base b/arch_src/pyalsaaudio-0.2/.svn/text-base/setup.py.svn-base new file mode 100644 index 0000000..d2534a7 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/text-base/setup.py.svn-base @@ -0,0 +1,14 @@ +from distutils.core import setup +from distutils.extension import Extension + +setup( + name = "alsaaudio", + version = "0.1", + description = "alsa bindings", + author = "Casper Wilstrup", + author_email="cwi@unispeed.com", + ext_modules=[Extension("alsaaudio",["alsaaudio.c"],libraries=['asound']) + ] + ) + + diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/CHANGES.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/CHANGES.svn-work new file mode 100644 index 0000000..6859ec8 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/CHANGES.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/CHANGES +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/LICENSE.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/LICENSE.svn-work new file mode 100644 index 0000000..ca474ba --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/LICENSE.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/LICENSE +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/README.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/README.svn-work new file mode 100644 index 0000000..31f6d9b --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/README.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/README +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/TODO.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/TODO.svn-work new file mode 100644 index 0000000..5182281 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/TODO.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/TODO +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/alsaaudio.c.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/alsaaudio.c.svn-work new file mode 100644 index 0000000..00079a1 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/alsaaudio.c.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 61 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/alsaaudio.c +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/mixertest.py.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/mixertest.py.svn-work new file mode 100644 index 0000000..45321b3 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/mixertest.py.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 61 +/svn/Shtoom/!svn/ver/835/trunk/audio/pyalsaaudio/mixertest.py +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/playbacktest.py.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/playbacktest.py.svn-work new file mode 100644 index 0000000..5ca8d71 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/playbacktest.py.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 65 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/playbacktest.py +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/recordtest.py.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/recordtest.py.svn-work new file mode 100644 index 0000000..53db42e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/recordtest.py.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 63 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/recordtest.py +END diff --git a/arch_src/pyalsaaudio-0.2/.svn/wcprops/setup.py.svn-work b/arch_src/pyalsaaudio-0.2/.svn/wcprops/setup.py.svn-work new file mode 100644 index 0000000..f428267 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/.svn/wcprops/setup.py.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/Shtoom/!svn/ver/820/trunk/audio/pyalsaaudio/setup.py +END diff --git a/arch_src/pyalsaaudio-0.2/CHANGES b/arch_src/pyalsaaudio-0.2/CHANGES new file mode 100644 index 0000000..6ce8463 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/CHANGES @@ -0,0 +1,8 @@ +VERSION 0.1 +- Initial version + + +VERSION 0.2 +- Many bugfixes related to playback in particular +- Module documentation in the doc subdirectory + diff --git a/arch_src/pyalsaaudio-0.2/LICENSE b/arch_src/pyalsaaudio-0.2/LICENSE new file mode 100644 index 0000000..8aa69f7 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/LICENSE @@ -0,0 +1,54 @@ +PyAlsaAudio is released under the same conditions as Python itself. +The original wording of this license can be found below. + + +PSF LICENSE AGREEMENT FOR PYTHON 2.4 +------------------------------------ + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using Python 2.4 software in source or binary form and its +associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 2.4 +alone or in any derivative version, provided, however, that PSF's +License Agreement and PSF's notice of copyright, i.e., "Copyright (c) +2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved" +are retained in Python 2.4 alone or in any derivative version prepared +by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 2.4 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 2.4. + +4. PSF is making Python 2.4 available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.4 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +2.4 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.4, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python 2.4, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + diff --git a/arch_src/pyalsaaudio-0.2/README b/arch_src/pyalsaaudio-0.2/README new file mode 100644 index 0000000..179cb79 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/README @@ -0,0 +1,55 @@ +PyAlsaAudio +=========== + +Author: Casper Wilstrup (cwi@unispeed.dk) + +This package contains wrappers for accessing the ALSA api from Python. It +is currently fairly complete for PCM devices. My next goal is to have +complete mixer supports as well. MIDI sequencer support is low on my +priority list, but volunteers are welcome. + +If you find bugs in the wrappers please notify me on email. Please +don't send bug reports regarding ALSA specifically. There are several +bugs in this api, and those should be reported to the ALSA team - not +me. + +This software is licensed under the PSF license - the same one used +by the majority of the python distribution. Basically you can use it +for anything you wish (even commercial purposes). There is no warranty +whatsoever. + + +Installation +============ + +Note: the wrappers link with the alsasound library alsa (from the alsa-lib +package). Verify that this is installed by looking for /usr/lib/libasound.so +before building. The libasound development files are also neccesary. On debian +and derivatives, this is achieved by installing the alsalib-dev package. + +Naturally you also need to use a kernel with proper ALSA +support. This is the default in Linux kernel 2.6 and later. If you are using +kernel version 2.4 you may need to install the ALSA patches yourself - although +most distributions ship with ALSA kernels. + +To install, execute the following: + $ python setup.py build + +And then as root: + # python setup.py install + + +Using the API +============= +There is a reasonably usefull API documentation included in the module +documentation, which can be found in the doc subdirectory of the source +distribution. + +There are also three example programs included with the source: +'playbacktest.py' which plays back raw sound data read from +stdin + +'recordtest.py' which captures sound from the microphone at writes +it raw to stdout. + +'mixertest.py' which can be used to manipulate the mixers diff --git a/arch_src/pyalsaaudio-0.2/TODO b/arch_src/pyalsaaudio-0.2/TODO new file mode 100644 index 0000000..710a8a3 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/TODO @@ -0,0 +1,3 @@ +- Better example code (aplay,arecord,amixer workalike for example) +- Implement MIDI/sequencer support. + diff --git a/arch_src/pyalsaaudio-0.2/alsaaudio.c b/arch_src/pyalsaaudio-0.2/alsaaudio.c new file mode 100644 index 0000000..1828148 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/alsaaudio.c @@ -0,0 +1,1013 @@ +/* + * alsaaudio -- Python interface to ALSA (Advanced Linux Sound Architecture). + * The standard audio API for Linux since kernel 2.6 + * + * Contributed by Unispeed A/S (http://www.unispeed.com) + * Author: Casper Wilstup (cwi@unispeed.dk) + * + * License: Python Software Foundation License + * + */ + +#include "Python.h" +#include <alsa/asoundlib.h> +#include <stdio.h> + +PyDoc_STRVAR(alsaaudio_module_doc, + "This modules provides support for the ALSA audio API.\n" + "\n" + "To control the PCM device, use the PCM class, Mixers\n" + "are controlled using the Mixer class.\n" + "\n" + "The following functions are also provided:\n" + "mixers() -- Return a list of available mixer names\n" + ); + +typedef struct { + PyObject_HEAD; + int pcmtype; + int pcmmode; + char *cardname; + + snd_pcm_t *handle; + + // Configurable parameters + int channels; + int rate; + int format; + snd_pcm_uframes_t periodsize; + int framesize; + +} alsapcm_t; + +typedef struct { + PyObject_HEAD; + + /* Mixer identification */ + char *cardname; + char *controlname; + int controlid; + + /* Capabilities */ + unsigned int volume_cap; + unsigned int switch_cap; + unsigned int pchannels; + unsigned int cchannels; + + /* min and max values for playback and capture volumes */ + long pmin; + long pmax; + long cmin; + long cmax; + snd_mixer_t *handle; + +} alsamixer_t; + +static PyObject *ALSAAudioError; + + +/******************************************/ +/* PCM object wrapper */ +/******************************************/ + +static PyTypeObject ALSAPCMType; + +static int alsapcm_setup(alsapcm_t *self) { + int res,dir; + unsigned int val; + snd_pcm_uframes_t frames; + snd_pcm_hw_params_t *hwparams; + + if (self->handle) { + snd_pcm_close(self->handle); + self->handle = 0; + } + res = snd_pcm_open(&(self->handle),self->cardname,self->pcmtype,self->pcmmode); + if (res < 0) return res; + + /* Allocate a hwparam structure, and fill it in with configuration space */ + snd_pcm_hw_params_alloca(&hwparams); + res = snd_pcm_hw_params_any(self->handle, hwparams); + if (res < 0) return res; + + /* Fill it in with default values. */ + snd_pcm_hw_params_any(self->handle, hwparams); + snd_pcm_hw_params_set_access(self->handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); + snd_pcm_hw_params_set_format(self->handle, hwparams, self->format); + snd_pcm_hw_params_set_channels(self->handle, hwparams, self->channels); + dir = 0; + snd_pcm_hw_params_set_rate(self->handle, hwparams, self->rate, dir); + snd_pcm_hw_params_set_period_size(self->handle, hwparams, self->periodsize, dir); + snd_pcm_hw_params_set_periods(self->handle,hwparams,4,0); + + /* Write it to the device */ + res = snd_pcm_hw_params(self->handle, hwparams); + if (res) return res; + + /* Query current settings. These may differ from the requested values, + which should therefore be sync'ed with actual values */ + snd_pcm_hw_params_current(self->handle,hwparams); + + snd_pcm_hw_params_get_format(hwparams,&val); self->format = val; + snd_pcm_hw_params_get_channels(hwparams,&val); self->channels = val; + snd_pcm_hw_params_get_rate(hwparams,&val,&dir); self->rate = val; + snd_pcm_hw_params_get_period_size(hwparams,&frames,&dir); self->periodsize = (int) frames; + + self->framesize = self->channels * snd_pcm_hw_params_get_sbits(hwparams)/8; + return res; +} + +static PyObject * +alsapcm_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { + int res; + alsapcm_t *self; + int pcmtype=0; + int pcmmode=0; + char *cardname = "default"; + if (!PyArg_ParseTuple(args,"|iis",&pcmtype,&pcmmode,&cardname)) return NULL; + if (!(self = (alsapcm_t *)PyObject_New(alsapcm_t, &ALSAPCMType))) return NULL; + + if (pcmtype != SND_PCM_STREAM_PLAYBACK && pcmtype != SND_PCM_STREAM_CAPTURE) { + PyErr_SetString(ALSAAudioError, "PCM type must be PCM_PLAYBACK (0) or PCM_CAPTUPE (1)"); + return NULL; + } + if (pcmmode < 0 || pcmmode > SND_PCM_ASYNC) { + PyErr_SetString(ALSAAudioError, "Invalid PCM mode"); + return NULL; + } + self->pcmtype = pcmtype; + self->pcmmode = pcmmode; + self->cardname = strdup(cardname); + + self->channels = 2; + self->rate = 44100; + self->format = SND_PCM_FORMAT_S16_LE; + self->periodsize = 32; + + self->handle = 0; + res = alsapcm_setup(self); + + if (res < 0) { + if (self->handle) { + snd_pcm_close(self->handle); + self->handle = 0; + } + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return (PyObject *)self; +} + +static void alsapcm_dealloc(alsapcm_t *self) { + if (self->handle) { + snd_pcm_drain(self->handle); + snd_pcm_close(self->handle); + } + free(self->cardname); + PyObject_Del(self); +} + +static PyObject * +alsapcm_dumpinfo(alsapcm_t *self, PyObject *args) { + unsigned int val,val2; + int dir; + snd_pcm_uframes_t frames; + snd_pcm_hw_params_t *hwparams; + snd_pcm_hw_params_alloca(&hwparams); + snd_pcm_hw_params_current(self->handle,hwparams); + + + if (!PyArg_ParseTuple(args,"")) return NULL; + + printf("PCM handle name = '%s'\n", snd_pcm_name(self->handle)); + printf("PCM state = %s\n", snd_pcm_state_name(snd_pcm_state(self->handle))); + + snd_pcm_hw_params_get_access(hwparams, (snd_pcm_access_t *) &val); + printf("access type = %s\n", snd_pcm_access_name((snd_pcm_access_t)val)); + + snd_pcm_hw_params_get_format(hwparams, &val); + printf("format = '%s' (%s)\n", + snd_pcm_format_name((snd_pcm_format_t)val), + snd_pcm_format_description((snd_pcm_format_t)val)); + + snd_pcm_hw_params_get_subformat(hwparams, (snd_pcm_subformat_t *)&val); + printf("subformat = '%s' (%s)\n", + snd_pcm_subformat_name((snd_pcm_subformat_t)val), + snd_pcm_subformat_description((snd_pcm_subformat_t)val)); + + snd_pcm_hw_params_get_channels(hwparams, &val); + printf("channels = %d\n", val); + + snd_pcm_hw_params_get_rate(hwparams, &val, &dir); + printf("rate = %d bps\n", val); + + snd_pcm_hw_params_get_period_time(hwparams, &val, &dir); + printf("period time = %d us\n", val); + + snd_pcm_hw_params_get_period_size(hwparams, &frames, &dir); + printf("period size = %d frames\n", (int)frames); + + snd_pcm_hw_params_get_buffer_time(hwparams, &val, &dir); + printf("buffer time = %d us\n", val); + + snd_pcm_hw_params_get_buffer_size(hwparams, (snd_pcm_uframes_t *) &val); + printf("buffer size = %d frames\n", val); + + snd_pcm_hw_params_get_periods(hwparams, &val, &dir); + printf("periods per buffer = %d frames\n", val); + + snd_pcm_hw_params_get_rate_numden(hwparams, &val, &val2); + printf("exact rate = %d/%d bps\n", val, val2); + + val = snd_pcm_hw_params_get_sbits(hwparams); + printf("significant bits = %d\n", val); + + snd_pcm_hw_params_get_tick_time(hwparams, &val, &dir); + printf("tick time = %d us\n", val); + + val = snd_pcm_hw_params_is_batch(hwparams); + printf("is batch = %d\n", val); + + val = snd_pcm_hw_params_is_block_transfer(hwparams); + printf("is block transfer = %d\n", val); + + val = snd_pcm_hw_params_is_double(hwparams); + printf("is double = %d\n", val); + + val = snd_pcm_hw_params_is_half_duplex(hwparams); + printf("is half duplex = %d\n", val); + + val = snd_pcm_hw_params_is_joint_duplex(hwparams); + printf("is joint duplex = %d\n", val); + + val = snd_pcm_hw_params_can_overrange(hwparams); + printf("can overrange = %d\n", val); + + val = snd_pcm_hw_params_can_mmap_sample_resolution(hwparams); + printf("can mmap = %d\n", val); + + val = snd_pcm_hw_params_can_pause(hwparams); + printf("can pause = %d\n", val); + + val = snd_pcm_hw_params_can_resume(hwparams); + printf("can resume = %d\n", val); + + val = snd_pcm_hw_params_can_sync_start(hwparams); + printf("can sync start = %d\n", val); + + Py_INCREF(Py_None); + return Py_None; + +} + +static PyObject * +alsapcm_pcmtype(alsapcm_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyInt_FromLong(self->pcmtype); +} + +static PyObject * +alsapcm_pcmmode(alsapcm_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyInt_FromLong(self->pcmmode); +} + +static PyObject * +alsapcm_cardname(alsapcm_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyString_FromString(self->cardname); +} + +static PyObject * +alsapcm_setchannels(alsapcm_t *self, PyObject *args) { + int channels; + int res; + if (!PyArg_ParseTuple(args,"i",&channels)) return NULL; + self->channels = channels; + res = alsapcm_setup(self); + if (res < 0) { + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(self->channels); +} + +static PyObject * +alsapcm_setrate(alsapcm_t *self, PyObject *args) { + int rate; + int res; + if (!PyArg_ParseTuple(args,"i",&rate)) return NULL; + self->rate = rate; + res = alsapcm_setup(self); + if (res < 0) { + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(self->rate); +} + +static PyObject * +alsapcm_setformat(alsapcm_t *self, PyObject *args) { + int format; + int res; + if (!PyArg_ParseTuple(args,"i",&format)) return NULL; + self->format = format; + res = alsapcm_setup(self); + if (res < 0) { + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(self->format); +} + +static PyObject * +alsapcm_setperiodsize(alsapcm_t *self, PyObject *args) { + int periodsize; + int res; + if (!PyArg_ParseTuple(args,"i",&periodsize)) return NULL; + self->periodsize = periodsize; + res = alsapcm_setup(self); + if (res < 0) { + PyErr_SetString(ALSAAudioError, snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(self->periodsize); +} + + +static PyObject * +alsapcm_read(alsapcm_t *self, PyObject *args) { + int res; + char buffer[8000]; + + if (self->framesize * self->periodsize > 8000) { + PyErr_SetString(ALSAAudioError,"Capture data too large. Try decreasing period size"); + return NULL; + } + + if (!PyArg_ParseTuple(args,"")) return NULL; + if (self->pcmtype != SND_PCM_STREAM_CAPTURE) { + PyErr_SetString(ALSAAudioError,"Cannot read from playback PCM"); + return NULL; + } + + res = snd_pcm_readi(self->handle, buffer, self->periodsize); + if (res == -EPIPE) { + /* EPIPE means overrun */ + snd_pcm_prepare(self->handle); + } + else if (res == -EAGAIN) { + res = 0; + } + else if (res < 0) { + PyErr_SetString(ALSAAudioError,snd_strerror(res)); + return NULL; + } + + return Py_BuildValue("is#",res,buffer,res*self->framesize); +} + +static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args) { + char *data; + int datalen; + int res; + if (!PyArg_ParseTuple(args,"s#",&data,&datalen)) return NULL; + if (datalen%self->framesize) { + PyErr_SetString(ALSAAudioError,"Data size must be a multiple of framesize"); + return NULL; + } + res = snd_pcm_writei(self->handle, data, datalen/self->framesize); + if (res == -EPIPE) { + /* EPIPE means underrun */ + snd_pcm_prepare(self->handle); + snd_pcm_writei(self->handle, data, datalen/self->framesize); + snd_pcm_writei(self->handle, data, datalen/self->framesize); + } + else if (res == -EAGAIN) { + return PyInt_FromLong(0); + } + else if (res < 0) { + PyErr_SetString(ALSAAudioError,snd_strerror(res)); + return NULL; + } + return PyInt_FromLong(res); +} + + +/* ALSA PCM Object Bureaucracy */ + +static PyMethodDef alsapcm_methods[] = { + {"pcmtype", (PyCFunction)alsapcm_pcmtype, METH_VARARGS}, + {"pcmmode", (PyCFunction)alsapcm_pcmmode, METH_VARARGS}, + {"cardname", (PyCFunction)alsapcm_cardname, METH_VARARGS}, + {"setchannels", (PyCFunction)alsapcm_setchannels, METH_VARARGS}, + {"setrate", (PyCFunction)alsapcm_setrate, METH_VARARGS}, + {"setformat", (PyCFunction)alsapcm_setformat, METH_VARARGS}, + {"setperiodsize", (PyCFunction)alsapcm_setperiodsize, METH_VARARGS}, + + {"dumpinfo", (PyCFunction)alsapcm_dumpinfo, METH_VARARGS}, + + {"read", (PyCFunction)alsapcm_read, METH_VARARGS}, + {"write", (PyCFunction)alsapcm_write, METH_VARARGS}, + + {NULL, NULL} +}; + +static PyObject * +alsapcm_getattr(alsapcm_t *self, char *name) { + return Py_FindMethod(alsapcm_methods, (PyObject *)self, name); +} + +static PyTypeObject ALSAPCMType = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /*ob_size*/ + "alsaaudio.pcm", /*tp_name*/ + sizeof(alsapcm_t), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor) alsapcm_dealloc, /*tp_dealloc*/ + 0, /*print*/ + (getattrfunc)alsapcm_getattr, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "ALSA PCM device", /*tp_doc*/ +}; + + +/******************************************/ +/* Mixer object wrapper */ +/******************************************/ + +static PyTypeObject ALSAMixerType; + +#define MIXER_CAP_VOLUME 0x0001 +#define MIXER_CAP_VOLUME_JOINED 0x0002 +#define MIXER_CAP_PVOLUME 0x0004 +#define MIXER_CAP_PVOLUME_JOINED 0x0008 +#define MIXER_CAP_CVOLUME 0x0010 +#define MIXER_CAP_CVOLUME_JOINED 0x0020 + +#define MIXER_CAP_SWITCH 0x0001 +#define MIXER_CAP_SWITCH_JOINED 0x0002 +#define MIXER_CAP_PSWITCH 0x0004 +#define MIXER_CAP_PSWITCH_JOINED 0x0008 +#define MIXER_CAP_CSWITCH 0x0010 +#define MIXER_CAP_CSWITCH_JOINED 0x0020 +#define MIXER_CAP_CSWITCH_EXCLUSIVE 0x0040 + +#define MIXER_CHANNEL_ALL -1 + +int +alsamixer_gethandle(char *cardname, snd_mixer_t **handle) { + int err; + if ((err = snd_mixer_open(handle, 0)) < 0) return err; + if ((err = snd_mixer_attach(*handle, cardname)) < 0) return err; + if ((err = snd_mixer_selem_register(*handle, NULL, NULL)) < 0) return err; + if ((err = snd_mixer_load(*handle)) < 0) return err; + + return 0; +} + +static PyObject * +alsamixer_list(PyObject *self, PyObject *args) { + snd_mixer_t *handle; + snd_mixer_selem_id_t *sid; + snd_mixer_elem_t *elem; + int err; + char *cardname = "default"; + PyObject *result = PyList_New(0); + + if (!PyArg_ParseTuple(args,"|s",&cardname)) return NULL; + + snd_mixer_selem_id_alloca(&sid); + err = alsamixer_gethandle(cardname,&handle); + if (err < 0) { + PyErr_SetString(ALSAAudioError,snd_strerror(err)); + snd_mixer_close(handle); + return NULL; + } + for (elem = snd_mixer_first_elem(handle); elem; elem = snd_mixer_elem_next(elem)) { + PyObject *mixer; + snd_mixer_selem_get_id(elem, sid); + mixer = PyString_FromString(snd_mixer_selem_id_get_name(sid)); + PyList_Append(result,mixer); + Py_DECREF(mixer); + } + snd_mixer_close(handle); + + return result; +} + +static snd_mixer_elem_t * +alsamixer_find_elem(snd_mixer_t *handle, char *control, int id) { + snd_mixer_selem_id_t *sid; + + snd_mixer_selem_id_alloca(&sid); + snd_mixer_selem_id_set_index(sid, id); + snd_mixer_selem_id_set_name(sid, control); + return snd_mixer_find_selem(handle, sid); +} + +static PyObject * +alsamixer_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { + alsamixer_t *self; + int err; + char *cardname = "default"; + char *control = "Master"; + int id = 0; + snd_mixer_elem_t *elem; + int channel; + + if (!PyArg_ParseTuple(args,"|sis",&control,&id,&cardname)) return NULL; + if (!(self = (alsamixer_t *)PyObject_New(alsamixer_t, &ALSAMixerType))) return NULL; + + err = alsamixer_gethandle(cardname,&self->handle); + if (err<0) { + PyErr_SetString(ALSAAudioError,snd_strerror(err)); + return NULL; + } + self->cardname = strdup(cardname); + self->controlname = strdup(control); + self->controlid = id; + + elem = alsamixer_find_elem(self->handle,control,id); + if (!elem) { + char errtext[128]; + sprintf(errtext,"Unable to find mixer control '%s',%i",self->controlname,self->controlid); + snd_mixer_close(self->handle); + PyErr_SetString(ALSAAudioError,errtext); + return NULL; + } + /* Determine mixer capabilities */ + self->volume_cap = self->switch_cap = 0; + if (snd_mixer_selem_has_common_volume(elem)) { + self->volume_cap |= MIXER_CAP_VOLUME; + if (snd_mixer_selem_has_playback_volume_joined(elem)) self->volume_cap |= MIXER_CAP_VOLUME_JOINED; + } + else { + if (snd_mixer_selem_has_playback_volume(elem)) { + self->volume_cap |= MIXER_CAP_PVOLUME; + if (snd_mixer_selem_has_playback_volume_joined(elem)) self->volume_cap |= MIXER_CAP_PVOLUME_JOINED; + } + if (snd_mixer_selem_has_capture_volume(elem)) { + self->volume_cap |= MIXER_CAP_CVOLUME; + if (snd_mixer_selem_has_capture_volume_joined(elem)) self->volume_cap |= MIXER_CAP_CVOLUME_JOINED; + } + } + + if (snd_mixer_selem_has_common_switch(elem)) { + self->switch_cap |= MIXER_CAP_SWITCH; + if (snd_mixer_selem_has_playback_switch_joined(elem)) self->switch_cap |= MIXER_CAP_SWITCH_JOINED; + } + else { + if (snd_mixer_selem_has_playback_switch(elem)) { + self->switch_cap |= MIXER_CAP_PSWITCH; + if (snd_mixer_selem_has_playback_switch_joined(elem)) self->switch_cap |= MIXER_CAP_PSWITCH_JOINED; + } + if (snd_mixer_selem_has_capture_switch(elem)) { + self->switch_cap |= MIXER_CAP_CSWITCH; + if (snd_mixer_selem_has_capture_switch_joined(elem)) self->switch_cap |= MIXER_CAP_CSWITCH_JOINED; + if (snd_mixer_selem_has_capture_switch_exclusive(elem)) self->switch_cap |= MIXER_CAP_CSWITCH_EXCLUSIVE; + } + } + self->pchannels = 0; + if (self->volume_cap | MIXER_CAP_PVOLUME || self->switch_cap | MIXER_CAP_PSWITCH) { + if (snd_mixer_selem_is_playback_mono(elem)) self->pchannels = 1; + else { + for (channel=0; channel <= SND_MIXER_SCHN_LAST; channel++) { + if (snd_mixer_selem_has_playback_channel(elem, channel)) self->pchannels++; + else break; + } + } + } + self->cchannels = 0; + if (self->volume_cap | MIXER_CAP_CVOLUME || self->switch_cap | MIXER_CAP_CSWITCH) { + if (snd_mixer_selem_is_capture_mono(elem)) self->cchannels = 1; + else { + for (channel=0; channel <= SND_MIXER_SCHN_LAST; channel++) { + if (snd_mixer_selem_has_capture_channel(elem, channel)) self->cchannels++; + else break; + } + } + } + snd_mixer_selem_get_playback_volume_range(elem, &self->pmin, &self->pmax); + snd_mixer_selem_get_capture_volume_range(elem, &self->cmin, &self->cmax); + return (PyObject *)self; +} + +static void alsamixer_dealloc(alsamixer_t *self) { + if (self->handle) { + snd_mixer_close(self->handle); + free(self->cardname); + free(self->controlname); + self->handle = 0; + } + PyObject_Del(self); +} + +static PyObject * +alsamixer_cardname(alsamixer_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyString_FromString(self->cardname); +} + +static PyObject * +alsamixer_mixer(alsamixer_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyString_FromString(self->controlname); +} + +static PyObject * +alsamixer_mixerid(alsamixer_t *self, PyObject *args) { + if (!PyArg_ParseTuple(args,"")) return NULL; + return PyInt_FromLong(self->controlid); +} + +static PyObject * +alsamixer_volumecap(alsamixer_t *self, PyObject *args) { + PyObject *result; + if (!PyArg_ParseTuple(args,"")) return NULL; + result = PyList_New(0); + if (self->volume_cap&MIXER_CAP_VOLUME) + PyList_Append(result,PyString_FromString("Volume")); + if (self->volume_cap&MIXER_CAP_VOLUME_JOINED) + PyList_Append(result,PyString_FromString("Joined Volume")); + if (self->volume_cap&MIXER_CAP_PVOLUME) + PyList_Append(result,PyString_FromString("Playback Volume")); + if (self->volume_cap&MIXER_CAP_PVOLUME_JOINED) + PyList_Append(result,PyString_FromString("Joined Playback Volume")); + if (self->volume_cap&MIXER_CAP_CVOLUME) + PyList_Append(result,PyString_FromString("Capture Volume")); + if (self->volume_cap&MIXER_CAP_CVOLUME_JOINED) + PyList_Append(result,PyString_FromString("Joined Capture Volume")); + + return result; +} +static PyObject * +alsamixer_switchcap(alsamixer_t *self, PyObject *args) { + PyObject *result; + if (!PyArg_ParseTuple(args,"")) return NULL; + result = PyList_New(0); + if (self->volume_cap&MIXER_CAP_SWITCH) + PyList_Append(result,PyString_FromString("Mute")); + if (self->volume_cap&MIXER_CAP_SWITCH_JOINED) + PyList_Append(result,PyString_FromString("Joined Mute")); + if (self->volume_cap&MIXER_CAP_PSWITCH) + PyList_Append(result,PyString_FromString("Playback Mute")); + if (self->volume_cap&MIXER_CAP_PSWITCH_JOINED) + PyList_Append(result,PyString_FromString("Joined Playback Mute")); + if (self->volume_cap&MIXER_CAP_CSWITCH) + PyList_Append(result,PyString_FromString("Capture Mute")); + if (self->volume_cap&MIXER_CAP_CSWITCH_JOINED) + PyList_Append(result,PyString_FromString("Joined Capture Mute")); + if (self->volume_cap&MIXER_CAP_CSWITCH_EXCLUSIVE) + PyList_Append(result,PyString_FromString("Capture Exclusive")); + return result; +} + +static int alsamixer_getpercentage(long min, long max, long value) { + /* Convert from number in range to percentage */ + int range = max - min; + int tmp; + + if (range == 0) return 0; + value -= min; + tmp = rint((double)value/(double)range * 100); + return tmp; + +} + +static long alsamixer_getphysvolume(long min, long max, int percentage) { + /* Convert from percentage to number in range */ + int range = max - min; + int tmp; + + if (range == 0) return 0; + tmp = rint((double)range * ((double)percentage*.01)) + min; + return tmp; +} + +static PyObject * +alsamixer_getvolume(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int direction; + int channel; + long ival; + char *dirstr = 0; + PyObject *result; + + if (!PyArg_ParseTuple(args,"|s",&dirstr)) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + + if (!dirstr) { + if (self->pchannels) direction = 0; + else direction = 1; + } + else if (strcasecmp(dirstr,"playback")==0) direction = 0; + else if (strcasecmp(dirstr,"capture")==0) direction = 1; + else { + PyErr_SetString(ALSAAudioError,"Invalid direction argument for mixer"); + return NULL; + } + result = PyList_New(0); + for (channel = 0; channel <= SND_MIXER_SCHN_LAST; channel++) { + if (direction == 0 && snd_mixer_selem_has_playback_channel(elem, channel)) { + snd_mixer_selem_get_playback_volume(elem, channel, &ival); + PyList_Append(result,PyInt_FromLong(alsamixer_getpercentage(self->pmin,self->pmax,ival))); + } + else if (direction == 1 && snd_mixer_selem_has_capture_channel(elem, channel) + && snd_mixer_selem_has_capture_volume(elem)) { + snd_mixer_selem_get_capture_volume(elem, channel, &ival); + PyList_Append(result,PyInt_FromLong(alsamixer_getpercentage(self->cmin,self->cmax,ival))); + } + } + return result; +} + +static PyObject * +alsamixer_getmute(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int i; + int ival; + PyObject *result; + if (!PyArg_ParseTuple(args,"")) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + if (!snd_mixer_selem_has_playback_switch(elem)) { + PyErr_SetString(ALSAAudioError,"Mixer has no mute switch"); + return NULL; + } + result = PyList_New(0); + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (snd_mixer_selem_has_playback_channel(elem, i)) { + snd_mixer_selem_get_playback_switch(elem, i, &ival); + PyList_Append(result,PyInt_FromLong(!ival)); + } + } + return result; +} + +static PyObject * +alsamixer_getrec(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int i; + int ival; + PyObject *result; + if (!PyArg_ParseTuple(args,"")) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + if (!snd_mixer_selem_has_capture_switch(elem)) { + PyErr_SetString(ALSAAudioError,"Mixer has no record switch"); + return NULL; + } + result = PyList_New(0); + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (snd_mixer_selem_has_capture_channel(elem, i)) { + snd_mixer_selem_get_capture_switch(elem, i, &ival); + PyList_Append(result,PyInt_FromLong(!ival)); + } + } + return result; +} + +static PyObject * +alsamixer_setvolume(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int direction; + int i; + long volume; + int physvolume; + char *dirstr = 0; + int channel = MIXER_CHANNEL_ALL; + int done = 0; + + if (!PyArg_ParseTuple(args,"l|is",&volume,&channel,&dirstr)) return NULL; + if (volume < 0 || volume > 100) { + PyErr_SetString(ALSAAudioError,"Volume must be between 0 and 100"); + return NULL; + } + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + + if (!dirstr) { + if (self->pchannels) direction = 0; + else direction = 1; + } + else if (strcasecmp(dirstr,"playback")==0) direction = 0; + else if (strcasecmp(dirstr,"capture")==0) direction = 1; + else { + PyErr_SetString(ALSAAudioError,"Invalid direction argument. Use 'playback' or 'capture'"); + return NULL; + } + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (channel == -1 || channel == i) { + if (direction == 0 && snd_mixer_selem_has_playback_channel(elem, i)) { + physvolume = alsamixer_getphysvolume(self->pmin,self->pmax,volume); + snd_mixer_selem_set_playback_volume(elem, i, physvolume); + done++; + } + else if (direction == 1 && snd_mixer_selem_has_capture_channel(elem, channel) + && snd_mixer_selem_has_capture_volume(elem)) { + physvolume = alsamixer_getphysvolume(self->cmin,self->cmax,volume); + snd_mixer_selem_set_capture_volume(elem, i, physvolume); + done++; + } + } + } + if(!done) { + PyErr_SetString(ALSAAudioError,"No such channel"); + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +alsamixer_setmute(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int i; + int mute = 0; + int done = 0; + int channel = MIXER_CHANNEL_ALL; + if (!PyArg_ParseTuple(args,"i|i",&mute,&channel)) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + if (!snd_mixer_selem_has_playback_switch(elem)) { + PyErr_SetString(ALSAAudioError,"Mixer has no mute switch"); + return NULL; + } + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (channel == MIXER_CHANNEL_ALL || channel == i) { + if (snd_mixer_selem_has_playback_channel(elem, i)) { + snd_mixer_selem_set_playback_switch(elem, i, !mute); + done++; + } + } + } + if (!done) { + PyErr_SetString(ALSAAudioError,"Invalid channel number"); + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +alsamixer_setrec(alsamixer_t *self, PyObject *args) { + snd_mixer_elem_t *elem; + int i; + int rec = 0; + int done = 0; + int channel = MIXER_CHANNEL_ALL; + if (!PyArg_ParseTuple(args,"i|i",&rec,&channel)) return NULL; + + elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid); + if (!snd_mixer_selem_has_capture_switch(elem)) { + PyErr_SetString(ALSAAudioError,"Mixer has no record switch"); + return NULL; + } + for (i = 0; i <= SND_MIXER_SCHN_LAST; i++) { + if (channel == MIXER_CHANNEL_ALL || channel == i) { + if (snd_mixer_selem_has_capture_channel(elem, i)) { + snd_mixer_selem_set_playback_switch(elem, i, rec); + done++; + } + } + } + if (!done) { + PyErr_SetString(ALSAAudioError,"Invalid channel number"); + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef alsamixer_methods[] = { + {"cardname", (PyCFunction)alsamixer_cardname, METH_VARARGS}, + {"mixer", (PyCFunction)alsamixer_mixer, METH_VARARGS}, + {"mixerid", (PyCFunction)alsamixer_mixerid, METH_VARARGS}, + {"switchcap", (PyCFunction)alsamixer_switchcap, METH_VARARGS}, + {"volumecap", (PyCFunction)alsamixer_volumecap, METH_VARARGS}, + {"getvolume", (PyCFunction)alsamixer_getvolume, METH_VARARGS}, + {"getmute", (PyCFunction)alsamixer_getmute, METH_VARARGS}, + {"getrec", (PyCFunction)alsamixer_getrec, METH_VARARGS}, + {"setvolume", (PyCFunction)alsamixer_setvolume, METH_VARARGS}, + {"setmute", (PyCFunction)alsamixer_setmute, METH_VARARGS}, + {"setrec", (PyCFunction)alsamixer_setrec, METH_VARARGS}, + {NULL, NULL} +}; + + +static PyObject * +alsamixer_getattr(alsapcm_t *self, char *name) { + return Py_FindMethod(alsamixer_methods, (PyObject *)self, name); +} + +static PyTypeObject ALSAMixerType = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /*ob_size*/ + "alsaaudio.mixer", /*tp_name*/ + sizeof(alsamixer_t), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor) alsamixer_dealloc, /*tp_dealloc*/ + 0, /*print*/ + (getattrfunc)alsamixer_getattr, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "ALSA Mixer Control", /*tp_doc*/ +}; + + +/******************************************/ +/* Module initialization */ +/******************************************/ + +static PyMethodDef alsaaudio_methods[] = { + { "mixers", alsamixer_list, METH_VARARGS }, + { 0, 0 }, +}; + +#define _EXPORT_INT(mod, name, value) \ + if (PyModule_AddIntConstant(mod, name, (long) value) == -1) return; + +void initalsaaudio(void) { + PyObject *m; + ALSAPCMType.tp_new = alsapcm_new; + ALSAMixerType.tp_new = alsamixer_new; + m = Py_InitModule3("alsaaudio",alsaaudio_methods,alsaaudio_module_doc); + + ALSAAudioError = PyErr_NewException("alsaaudio.ALSAAudioError", NULL, NULL); + if (ALSAAudioError) { + /* Each call to PyModule_AddObject decrefs it; compensate: */ + + Py_INCREF(&ALSAPCMType); + PyModule_AddObject(m,"PCM",(PyObject *)&ALSAPCMType); + + Py_INCREF(&ALSAMixerType); + PyModule_AddObject(m,"Mixer",(PyObject *)&ALSAMixerType); + + Py_INCREF(ALSAAudioError); + PyModule_AddObject(m, "ALSAAudioError", ALSAAudioError); + } + + + _EXPORT_INT(m,"PCM_PLAYBACK",SND_PCM_STREAM_PLAYBACK); + _EXPORT_INT(m,"PCM_CAPTURE",SND_PCM_STREAM_CAPTURE); + + _EXPORT_INT(m,"PCM_NORMAL",0); + _EXPORT_INT(m,"PCM_NONBLOCK",SND_PCM_NONBLOCK); + _EXPORT_INT(m,"PCM_ASYNC",SND_PCM_ASYNC); + + /* PCM Formats */ + _EXPORT_INT(m,"PCM_FORMAT_S8",SND_PCM_FORMAT_S8); + _EXPORT_INT(m,"PCM_FORMAT_U8",SND_PCM_FORMAT_U8); + _EXPORT_INT(m,"PCM_FORMAT_S16_LE",SND_PCM_FORMAT_S16_LE); + _EXPORT_INT(m,"PCM_FORMAT_S16_BE",SND_PCM_FORMAT_S16_BE); + _EXPORT_INT(m,"PCM_FORMAT_U16_LE",SND_PCM_FORMAT_U16_LE); + _EXPORT_INT(m,"PCM_FORMAT_U16_BE",SND_PCM_FORMAT_U16_BE); + _EXPORT_INT(m,"PCM_FORMAT_S24_LE",SND_PCM_FORMAT_S24_LE); + _EXPORT_INT(m,"PCM_FORMAT_S24_BE",SND_PCM_FORMAT_S24_BE); + _EXPORT_INT(m,"PCM_FORMAT_U24_LE",SND_PCM_FORMAT_U24_LE); + _EXPORT_INT(m,"PCM_FORMAT_U24_BE",SND_PCM_FORMAT_U24_BE); + _EXPORT_INT(m,"PCM_FORMAT_S32_LE",SND_PCM_FORMAT_S32_LE); + _EXPORT_INT(m,"PCM_FORMAT_S32_BE",SND_PCM_FORMAT_S32_BE); + _EXPORT_INT(m,"PCM_FORMAT_U32_LE",SND_PCM_FORMAT_U32_LE); + _EXPORT_INT(m,"PCM_FORMAT_U32_BE",SND_PCM_FORMAT_U32_BE); + _EXPORT_INT(m,"PCM_FORMAT_FLOAT_LE",SND_PCM_FORMAT_FLOAT_LE); + _EXPORT_INT(m,"PCM_FORMAT_FLOAT_BE",SND_PCM_FORMAT_FLOAT_BE); + _EXPORT_INT(m,"PCM_FORMAT_FLOAT64_LE",SND_PCM_FORMAT_FLOAT64_LE); + _EXPORT_INT(m,"PCM_FORMAT_FLOAT64_BE",SND_PCM_FORMAT_FLOAT64_BE); + _EXPORT_INT(m,"PCM_FORMAT_MU_LAW",SND_PCM_FORMAT_MU_LAW); + _EXPORT_INT(m,"PCM_FORMAT_A_LAW",SND_PCM_FORMAT_A_LAW); + _EXPORT_INT(m,"PCM_FORMAT_IMA_ADPCM",SND_PCM_FORMAT_IMA_ADPCM); + _EXPORT_INT(m,"PCM_FORMAT_MPEG",SND_PCM_FORMAT_MPEG); + _EXPORT_INT(m,"PCM_FORMAT_GSM",SND_PCM_FORMAT_GSM); + + /* Mixer stuff */ + _EXPORT_INT(m,"MIXER_CHANNEL_ALL",MIXER_CHANNEL_ALL); + +} diff --git a/arch_src/pyalsaaudio-0.2/alsaaudio.o b/arch_src/pyalsaaudio-0.2/alsaaudio.o Binary files differnew file mode 100755 index 0000000..ea1483d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/alsaaudio.o diff --git a/arch_src/pyalsaaudio-0.2/debian/changelog b/arch_src/pyalsaaudio-0.2/debian/changelog new file mode 100644 index 0000000..3d68d40 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/changelog @@ -0,0 +1,44 @@ +pyalsaaudio (0.2-1ubuntu1) feisty; urgency=low + + [ Cesare Tirabassi ] + * Include documentation in package (LP: #81347) + + [ Michael Bienia ] + * debian/control: Change Maintainer/XSBC-Original-Maintainer field. + + -- Michael Bienia <geser@ubuntu.com> Fri, 23 Mar 2007 00:18:10 +0100 + +pyalsaaudio (0.2-1build1) edgy; urgency=low + + * Rebuild to add support for python2.5. + + -- Matthias Klose <doko@ubuntu.com> Fri, 8 Sep 2006 18:26:30 +0000 + +pyalsaaudio (0.2-1) unstable; urgency=low + + * New upstream release + * Add a watch file + * Use debian/examples and debian/docs + * Merge changelog with ubuntu + * Add myself to uploaders field + * Upload to debian (closes: #382796) + + -- Paul Brossier <piem@debian.org> Sun, 13 Aug 2006 17:08:01 +0200 + +pyalsaaudio (0.1-1) unstable; urgency=low + + * Initial release. + + -- Florian Ragwitz <rafl@debian.org> Wed, 9 Aug 2006 00:18:33 +0200 + +pyalsaaudio (0.1-1ubuntu1) hoary; urgency=low + + * Upload to hoary with python2.4 support + + -- Thom May <thom@ubuntu.com> Sat, 29 Jan 2005 12:47:04 +0000 + +pyalsaaudio (0.1-1) unstable; urgency=low + + * First upload. + + -- Thom May <thom@debian.org> Fri, 07 Jan 2005 19:19:49 +0000 diff --git a/arch_src/pyalsaaudio-0.2/debian/compat b/arch_src/pyalsaaudio-0.2/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/compat @@ -0,0 +1 @@ +5 diff --git a/arch_src/pyalsaaudio-0.2/debian/control b/arch_src/pyalsaaudio-0.2/debian/control new file mode 100644 index 0000000..4472b72 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/control @@ -0,0 +1,16 @@ +Source: pyalsaaudio +Section: sound +Priority: optional +Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> +XSBC-Original-Maintainer: Florian Ragwitz <rafl@debian.org> +Uploaders: Paul Brossier <piem@debian.org> +Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python-support (>= 0.3), libasound2-dev +XS-Python-Version: all +Standards-Version: 3.7.2 + +Package: python-alsaaudio +Architecture: any +Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends} +XB-Python-Version: ${python:Versions} +Description: Alsa bindings for Python + The PyAlsaAudio package contains bindings for the ALSA sound api. diff --git a/arch_src/pyalsaaudio-0.2/debian/copyright b/arch_src/pyalsaaudio-0.2/debian/copyright new file mode 100644 index 0000000..d4459e9 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/copyright @@ -0,0 +1,67 @@ +This package was first debianized by Thom May <thom@debian.org> on Fri, 07 Jan +2005 19:19:49 +0000. + +This package was refactored to the new python policy by Florian Ragwitz +<rafl@debian.org> on Wed, 09 Aug 2006 01:00:49 +0200. + +Copyright holder: Casper Wilstrup <cwi@unispeed.dk> + +Upstream author: Casper Wilstrup <cwi@unispeed.dk> + +License: + +From the README: +This software is licensed under the PSF license - the same one used +by the majority of the python distribution. Basically you can use it +for anything you wish (even commercial purposes). There is no warranty +whatsoever. + +PSF LICENSE AGREEMENT FOR PYTHON 2.3 +------------------------------------ + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using Python 2.3 software in source or binary form and its +associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 2.3 +alone or in any derivative version, provided, however, that PSF's +License Agreement and PSF's notice of copyright, i.e., "Copyright (c) +2001, 2002 Python Software Foundation; All Rights Reserved" are +retained in Python 2.3 alone or in any derivative version prepared by +Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 2.3 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 2.3. + +4. PSF is making Python 2.3 available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.3 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +2.3 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.3, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python 2.3, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + diff --git a/arch_src/pyalsaaudio-0.2/debian/docs b/arch_src/pyalsaaudio-0.2/debian/docs new file mode 100644 index 0000000..dc83c22 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/docs @@ -0,0 +1,33 @@ +README +TODO +doc/about.html +doc/blank.gif +doc/blank.png +doc/contents.gif +doc/contents.html +doc/contents.png +doc/front.html +doc/index.dat +doc/index.gif +doc/index.html +doc/index.png +doc/mixer-objects.html +doc/module-alsaaudio.html +doc/modules.gif +doc/modules.png +doc/next.gif +doc/next.png +doc/node3.html +doc/node4.html +doc/node5.html +doc/node7.html +doc/pcm-example.html +doc/pcm-objects.html +doc/previous.gif +doc/previous.png +doc/pyalsaaudio.css +doc/pyalsaaudio.html +doc/pyfav.gif +doc/pyfav.png +doc/up.gif +doc/up.png diff --git a/arch_src/pyalsaaudio-0.2/debian/examples b/arch_src/pyalsaaudio-0.2/debian/examples new file mode 100644 index 0000000..2cc55bb --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/examples @@ -0,0 +1,4 @@ +mixertest.py +playbacktest.py +recordtest.py +test.py diff --git a/arch_src/pyalsaaudio-0.2/debian/pycompat b/arch_src/pyalsaaudio-0.2/debian/pycompat new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/pycompat @@ -0,0 +1 @@ +2 diff --git a/arch_src/pyalsaaudio-0.2/debian/rules b/arch_src/pyalsaaudio-0.2/debian/rules new file mode 100755 index 0000000..e7c42c8 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/rules @@ -0,0 +1,55 @@ +#! /usr/bin/make -f + +PYDEF=$(shell pyversions -d) +PYVERS=$(shell pyversions -r) + +build: build-stamp +build-stamp: + dh_testdir + set -e; \ + for python in $(PYVERS); do \ + python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \ + $$python setup.py build; \ + done + touch build-stamp + +clean: + dh_testdir + for python in $(PYVERS); do \ + python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \ + $$python setup.py clean; \ + done + rm -rf build build-stamp + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + set -e; \ + for python in $(PYVERS); do \ + python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \ + $$python setup.py install --root=$(CURDIR)/debian/python-alsaaudio --no-compile; \ + done + +binary-indep: build install + # nothing to do here + +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installchangelogs + dh_installexamples + dh_strip + dh_compress + dh_fixperms + dh_pysupport + dh_python + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-arch binary-indep diff --git a/arch_src/pyalsaaudio-0.2/debian/watch b/arch_src/pyalsaaudio-0.2/debian/watch new file mode 100644 index 0000000..63fdc1d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://sf.net/pyalsaaudio/pyalsaaudio-(.*)\.tgz debian uupdate diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/README.txt b/arch_src/pyalsaaudio-0.2/doc/.svn/README.txt new file mode 100644 index 0000000..271a8ce --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/README.txt @@ -0,0 +1,2 @@ +This is a Subversion working copy administrative directory. +Visit http://subversion.tigris.org/ for more information. diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/dir-wcprops b/arch_src/pyalsaaudio-0.2/doc/.svn/dir-wcprops new file mode 100644 index 0000000..4238dab --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/dir-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/empty-file b/arch_src/pyalsaaudio-0.2/doc/.svn/empty-file new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/empty-file diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/entries b/arch_src/pyalsaaudio-0.2/doc/.svn/entries new file mode 100644 index 0000000..b80e28b --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/entries @@ -0,0 +1,247 @@ +<?xml version="1.0" encoding="utf-8"?> +<wc-entries + xmlns="svn:"> +<entry + committed-rev="1274" + name="" + committed-date="2005-03-25T23:37:10.228413Z" + url="http://casperr@divmod.org/svn/Shtoom/trunk/audio/pyalsaaudio/doc" + last-author="casper" + kind="dir" + revision="1584"/> +<entry + committed-rev="1585" + name="node7.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="a093f4493a8d1b19db8a5dc6db96aee2" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="previous.gif" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="57ccc2604089b7eb759578897d5f2e3c" + last-author="casper" + kind="file" + prop-time="2005-07-07T13:49:38.000000Z"/> +<entry + committed-rev="1274" + name="next.gif" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="9b81d8d96d2a76040ed1ffe5605c886f" + last-author="casper" + kind="file" + prop-time="2005-07-07T13:49:38.000000Z"/> +<entry + name="src" + kind="dir"/> +<entry + committed-rev="1585" + name="intlabels.pl" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="733eff09971a24ecb4fbaf5d74c0927d" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="up.gif" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="f0a4d04e0c6e11f2e557da65776e6645" + last-author="casper" + kind="file" + prop-time="2005-07-07T13:49:38.000000Z"/> +<entry + committed-rev="1585" + name="module-alsaaudio.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="4975c5b625113000380888c5a1d57cd7" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="pyfav.gif" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="3ec327b4e2b2d3b712efbbe000e18a5a" + last-author="casper" + kind="file" + prop-time="2005-07-07T13:49:38.000000Z"/> +<entry + committed-rev="1585" + name="front.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="3628ea13543589ec8c6f9ae6dccd5831" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="blank.gif" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="34edb7b43fe856a1d7d7402504f81797" + last-author="casper" + kind="file" + prop-time="2005-07-07T13:49:38.000000Z"/> +<entry + committed-rev="1585" + name="contents.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="272cfe13d2d53cc591ccd913b042f724" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="contents.gif" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="103f27b271c293edd555cff65a2bee53" + last-author="casper" + kind="file" + prop-time="2005-07-07T13:49:38.000000Z"/> +<entry + committed-rev="1585" + name="pyalsaaudio.css" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="0e22fb5bbc524eb380193ba758127487" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="pcm-objects.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="4106fe70fd35683a4014ba273ca9f51e" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="internals.pl" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="ca2b5426eb4a9d57e3545ac596eac928" + last-author="casper" + kind="file"/> +<entry + committed-rev="1585" + name="index.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="149bd2deba94b730700b015eeaa2b8c0" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="node3.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="661561d381936e676afeb7f4b28dc309" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="index.gif" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="a58f486cd4242b6f3d178647388381a1" + last-author="casper" + kind="file" + prop-time="2005-07-07T13:49:38.000000Z"/> +<entry + committed-rev="1585" + name="pcm-example.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="ed057e8959cf036b6e74bf849a5f98e6" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="node4.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="112c37da67fb3e1945b67f5c8f308b9a" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="labels.pl" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="a8a08423337783320e04965d81b628cc" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="modules.gif" + text-time="2005-07-07T13:49:38.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="a0a980c08c5489be525614583336f06a" + last-author="casper" + kind="file" + prop-time="2005-07-07T13:49:38.000000Z"/> +<entry + committed-rev="1585" + name="about.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="85baafc25f77c50890c476a27392f034" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="node5.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="bfaf209f678b544ce893ae593111d6ea" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="pyalsaaudio.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="149bd2deba94b730700b015eeaa2b8c0" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="mixer-objects.html" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="4a655786c2c9b88caa1e5a10498de48c" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1274" + name="index.dat" + text-time="2005-07-09T21:14:56.000000Z" + committed-date="2005-03-25T23:37:10.228413Z" + checksum="06106f07b3e2cfe4e1694cabf5de8e8a" + last-author="casper" + kind="file"/> +</wc-entries> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/format b/arch_src/pyalsaaudio-0.2/doc/.svn/format new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/format @@ -0,0 +1 @@ +4 diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/blank.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/blank.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/blank.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/contents.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/contents.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/contents.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/index.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/index.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/index.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/modules.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/modules.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/modules.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/next.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/next.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/next.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/previous.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/previous.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/previous.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/pyfav.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/pyfav.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/pyfav.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/up.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/up.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/prop-base/up.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/props/blank.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/props/blank.gif.svn-work new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/props/blank.gif.svn-work @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/props/contents.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/props/contents.gif.svn-work new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/props/contents.gif.svn-work @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/props/index.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/props/index.gif.svn-work new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/props/index.gif.svn-work @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/props/modules.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/props/modules.gif.svn-work new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/props/modules.gif.svn-work @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/props/next.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/props/next.gif.svn-work new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/props/next.gif.svn-work @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/props/previous.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/props/previous.gif.svn-work new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/props/previous.gif.svn-work @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/props/pyfav.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/props/pyfav.gif.svn-work new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/props/pyfav.gif.svn-work @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/props/up.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/props/up.gif.svn-work new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/props/up.gif.svn-work @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/about.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/about.html.svn-base new file mode 100644 index 0000000..c47ebca --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/about.html.svn-base @@ -0,0 +1,110 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="prev" href="contents.html" /> +<link rel="parent" href="pyalsaaudio.html" /> +<meta name='aesop' content='information' /> +<title>About this document ...</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.4 ALSA Examples" + href="pcm-example.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pcm-example.html">4.4 ALSA Examples</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION003000000000000000000"> +About this document ...</A> +</H1> + <strong>PyAlsaAudio</strong> +<p> This document was generated using the <a + href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/"> + <strong>LaTeX</strong>2<tt>HTML</tt></a> translator. +</p> + +<p> <a + href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/"> + <strong>LaTeX</strong>2<tt>HTML</tt></a> is Copyright © + 1993, 1994, 1995, 1996, 1997, <a + href="http://cbl.leeds.ac.uk/nikos/personal.html">Nikos + Drakos</a>, Computer Based Learning Unit, University of + Leeds, and Copyright © 1997, 1998, <a + href="http://www.maths.mq.edu.au/~ross/">Ross + Moore</a>, Mathematics Department, Macquarie University, + Sydney. +</p> + +<p> The application of <a + href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/"> + <strong>LaTeX</strong>2<tt>HTML</tt></a> to the Python + documentation has been heavily tailored by Fred L. Drake, + Jr. Original navigation icons were contributed by Christopher + Petrilli. +</p> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.4 ALSA Examples" + href="pcm-example.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pcm-example.html">4.4 ALSA Examples</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/blank.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/blank.gif.svn-base Binary files differnew file mode 100644 index 0000000..2e31f4e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/blank.gif.svn-base diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/contents.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/contents.gif.svn-base Binary files differnew file mode 100644 index 0000000..6d299c4 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/contents.gif.svn-base diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/contents.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/contents.html.svn-base new file mode 100644 index 0000000..7f5eb2a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/contents.html.svn-base @@ -0,0 +1,106 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="about.html" /> +<link rel="prev" href="front.html" /> +<link rel="parent" href="pyalsaaudio.html" /> +<link rel="next" href="node3.html" /> +<meta name='aesop' content='information' /> +<title>Contents</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="Front Matter" + href="front.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="1 What is ALSA" + href="node3.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="front.html">Front Matter</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node3.html">1 What is ALSA</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> +<BR><h2><A NAME="SECTION002000000000000000000"> +Contents</A> +</h2> +<!--Table of Contents--> + +<UL CLASS="TofC"> +<LI><UL> +<LI><A href="node3.html">1 What is ALSA</a> +<LI><A href="node4.html">2 ALSA and Python</a> +<LI><A href="node5.html">3 Installation</a> +<LI><A href="module-alsaaudio.html">4 alsaaudio</a> +<UL> +<LI><A href="node7.html">4.1 PCM Terminology and Concepts</a> +<LI><A href="pcm-objects.html">4.2 PCM Objects</a> +<LI><A href="mixer-objects.html">4.3 Mixer Objects</a> +<LI><A href="pcm-example.html">4.4 ALSA Examples</a> +</ul></ul></ul> +<!--End of Table of Contents--> +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="Front Matter" + href="front.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="1 What is ALSA" + href="node3.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="front.html">Front Matter</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node3.html">1 What is ALSA</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/front.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/front.html.svn-base new file mode 100644 index 0000000..bbcdbc5 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/front.html.svn-base @@ -0,0 +1,119 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="contents.html" /> +<link rel="prev" href="pyalsaaudio.html" /> +<link rel="parent" href="pyalsaaudio.html" /> +<link rel="next" href="contents.html" /> +<meta name='aesop' content='information' /> +<title>Front Matter</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="Contents" + href="contents.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="contents.html">Contents</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION001000000000000000000"></A><A NAME="front"></A> +<BR> +Front Matter +</H1> + +<P> +This software is licensed under the PSF license - the same one used +by the majority of the python distribution. Basically you can use it +for anything you wish (even commercial purposes). There is no warranty +whatsoever. + +<P> + +<H3>Abstract:</H3> +<DIV CLASS="ABSTRACT"> + +This package contains wrappers for accessing the ALSA api from Python. It +is currently fairly complete for PCM devices and Mixer access. MIDI sequencer +support is low on my priority list, but volunteers are welcome. + +<P> +If you find bugs in the wrappers please notify me on email. Please +don't send bug reports regarding ALSA specifically. There are several +bugs in this api, and those should be reported to the ALSA team - not +me. +</DIV> +<P> + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="Contents" + href="contents.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="contents.html">Contents</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.dat.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.dat.svn-base new file mode 100644 index 0000000..8efff3f --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.dat.svn-base @@ -0,0 +1,27 @@ +<a href="node6.html"><tt class="module">alsaaudio</tt> (extension module)###DEF0000000608 +<a href="node6.html#l2h-2"><tt class="function">mixers()</tt> (in module alsaaudio)###0000000609 +<a href="node6.html#l2h-3"><tt class="class">PCM</tt> (class in alsaaudio)###0000000610 +<a href="node6.html#l2h-4"><tt class="class">Mixer</tt> (class in alsaaudio)###0000000611 +<a href="node6.html#l2h-5"><tt class="exception">ALSAAudioError</tt>###0000000612 +<a href="node8.html#l2h-6"><tt class="class">PCM</tt> (class in alsaaudio)###0000000622 +<a href="node8.html#l2h-7"><tt class="method">pcmtype()</tt> (PCM method)###0000000623 +<a href="node8.html#l2h-8"><tt class="method">pcmmode()</tt> (PCM method)###0000000624 +<a href="node8.html#l2h-9"><tt class="method">cardname()</tt> (PCM method)###0000000625 +<a href="node8.html#l2h-10"><tt class="method">setchannels()</tt> (PCM method)###0000000626 +<a href="node8.html#l2h-11"><tt class="method">setrate()</tt> (PCM method)###0000000627 +<a href="node8.html#l2h-12"><tt class="method">setformat()</tt> (PCM method)###0000000628 +<a href="node8.html#l2h-13"><tt class="method">setperiodsize()</tt> (PCM method)###0000000629 +<a href="node8.html#l2h-14"><tt class="method">read()</tt> (PCM method)###0000000630 +<a href="node8.html#l2h-15"><tt class="method">write()</tt> (PCM method)###0000000631 +<a href="node9.html#l2h-16"><tt class="class">Mixer</tt> (class in alsaaudio)###0000000633 +<a href="node9.html#l2h-17"><tt class="method">cardname()</tt> (Mixer method)###0000000634 +<a href="node9.html#l2h-18"><tt class="method">mixer()</tt> (Mixer method)###0000000635 +<a href="node9.html#l2h-19"><tt class="method">mixerid()</tt> (Mixer method)###0000000636 +<a href="node9.html#l2h-20"><tt class="method">switchcap()</tt> (Mixer method)###0000000637 +<a href="node9.html#l2h-21"><tt class="method">volumecap()</tt> (Mixer method)###0000000638 +<a href="node9.html#l2h-22"><tt class="method">getvolume()</tt> (Mixer method)###0000000639 +<a href="node9.html#l2h-23"><tt class="method">getmute()</tt> (Mixer method)###0000000640 +<a href="node9.html#l2h-24"><tt class="method">getrec()</tt> (Mixer method)###0000000641 +<a href="node9.html#l2h-25"><tt class="method">setvolume()</tt> (Mixer method)###0000000642 +<a href="node9.html#l2h-26"><tt class="method">setmute()</tt> (Mixer method)###0000000643 +<a href="node9.html#l2h-27"><tt class="method">setrec()</tt> (Mixer method)###0000000644 diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.gif.svn-base Binary files differnew file mode 100644 index 0000000..32eecfb --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.gif.svn-base diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.html.svn-base new file mode 100644 index 0000000..fc3e86f --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/index.html.svn-base @@ -0,0 +1,110 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="front.html" /> +<meta name='aesop' content='information' /> +<title>PyAlsaAudio</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></td> +<td class='online-navigation'><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></td> +<td class='online-navigation'><a rel="next" title="Front Matter" + href="front.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="front.html">Front Matter</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<div class="titlepage"> +<div class='center'> +<h1>PyAlsaAudio</h1> +<p><b><font size="+2">Casper Wilstrup</font></b></p> +<p>cwi@unispeed.com</p> +<p></p> +</div> +</div> + +<P> + +<p><br /></p><hr class='online-navigation' /> +<div class='online-navigation'> +<!--Table of Child-Links--> +<A NAME="CHILD_LINKS"></a> + +<UL CLASS="ChildLinks"> +<LI><A href="front.html">Front Matter</a> +<LI><A href="contents.html">Contents</a> +<UL> +<LI><A href="node3.html">1 What is ALSA</a> +<LI><A href="node4.html">2 ALSA and Python</a> +<LI><A href="node5.html">3 Installation</a> +<LI><A href="module-alsaaudio.html">4 <tt class="module">alsaaudio</tt></a> +<UL> +<LI><A href="node7.html">4.1 PCM Terminology and Concepts</a> +<LI><A href="pcm-objects.html">4.2 PCM Objects</a> +<LI><A href="mixer-objects.html">4.3 Mixer Objects</a> +<LI><A href="pcm-example.html">4.4 ALSA Examples</a> +</ul> +</ul> +<LI><A href="about.html">About this document ...</a> +</ul> +<!--End of Table of Child-Links--> +</div> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></td> +<td class='online-navigation'><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></td> +<td class='online-navigation'><a rel="next" title="Front Matter" + href="front.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="front.html">Front Matter</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/internals.pl.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/internals.pl.svn-base new file mode 100644 index 0000000..4864f4b --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/internals.pl.svn-base @@ -0,0 +1,34 @@ +# LaTeX2HTML 2002-2 (1.70) +# Associate internals original text with physical files. + + +$key = q/module-alsaaudio/; +$ref_files{$key} = "$dir".q|node6.html|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-objects/; +$ref_files{$key} = "$dir".q|node8.html|; +$noresave{$key} = "$nosave"; + +$key = q/front/; +$ref_files{$key} = "$dir".q|node1.html|; +$noresave{$key} = "$nosave"; + +$key = q/contents/; +$ref_files{$key} = "$dir".q|node2.html|; +$noresave{$key} = "$nosave"; + +$key = q/mixer-objects/; +$ref_files{$key} = "$dir".q|node9.html|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-example/; +$ref_files{$key} = "$dir".q|node10.html|; +$noresave{$key} = "$nosave"; + +$key = q/about/; +$ref_files{$key} = "$dir".q|node11.html|; +$noresave{$key} = "$nosave"; + +1; + diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/intlabels.pl.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/intlabels.pl.svn-base new file mode 100644 index 0000000..972ec5a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/intlabels.pl.svn-base @@ -0,0 +1,30 @@ +%internal_labels = (); +1; # hack in case there are no entries + +$internal_labels{"l2h-1"} = "/node6.html"; +$internal_labels{"l2h-2"} = "/node6.html"; +$internal_labels{"l2h-3"} = "/node6.html"; +$internal_labels{"l2h-4"} = "/node6.html"; +$internal_labels{"l2h-5"} = "/node6.html"; +$internal_labels{"l2h-6"} = "/node8.html"; +$internal_labels{"l2h-7"} = "/node8.html"; +$internal_labels{"l2h-8"} = "/node8.html"; +$internal_labels{"l2h-9"} = "/node8.html"; +$internal_labels{"l2h-10"} = "/node8.html"; +$internal_labels{"l2h-11"} = "/node8.html"; +$internal_labels{"l2h-12"} = "/node8.html"; +$internal_labels{"l2h-13"} = "/node8.html"; +$internal_labels{"l2h-14"} = "/node8.html"; +$internal_labels{"l2h-15"} = "/node8.html"; +$internal_labels{"l2h-16"} = "/node9.html"; +$internal_labels{"l2h-17"} = "/node9.html"; +$internal_labels{"l2h-18"} = "/node9.html"; +$internal_labels{"l2h-19"} = "/node9.html"; +$internal_labels{"l2h-20"} = "/node9.html"; +$internal_labels{"l2h-21"} = "/node9.html"; +$internal_labels{"l2h-22"} = "/node9.html"; +$internal_labels{"l2h-23"} = "/node9.html"; +$internal_labels{"l2h-24"} = "/node9.html"; +$internal_labels{"l2h-25"} = "/node9.html"; +$internal_labels{"l2h-26"} = "/node9.html"; +$internal_labels{"l2h-27"} = "/node9.html"; diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/labels.pl.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/labels.pl.svn-base new file mode 100644 index 0000000..f3d0859 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/labels.pl.svn-base @@ -0,0 +1,57 @@ +# LaTeX2HTML 2002-2-1 (1.70) +# Associate labels original text with physical files. + + +$key = q/module-alsaaudio/; +$external_labels{$key} = "$URL/" . q|node6.html|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-objects/; +$external_labels{$key} = "$URL/" . q|node8.html|; +$noresave{$key} = "$nosave"; + +$key = q/front/; +$external_labels{$key} = "$URL/" . q|node1.html|; +$noresave{$key} = "$nosave"; + +$key = q/contents/; +$external_labels{$key} = "$URL/" . q|node2.html|; +$noresave{$key} = "$nosave"; + +$key = q/mixer-objects/; +$external_labels{$key} = "$URL/" . q|node9.html|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-example/; +$external_labels{$key} = "$URL/" . q|node10.html|; +$noresave{$key} = "$nosave"; + +$key = q/about/; +$external_labels{$key} = "$URL/" . q|node11.html|; +$noresave{$key} = "$nosave"; + +1; + + +# LaTeX2HTML 2002-2-1 (1.70) +# labels from external_latex_labels array. + + +$key = q/module-alsaaudio/; +$external_latex_labels{$key} = q|4|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-objects/; +$external_latex_labels{$key} = q|4.2|; +$noresave{$key} = "$nosave"; + +$key = q/mixer-objects/; +$external_latex_labels{$key} = q|4.3|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-example/; +$external_latex_labels{$key} = q|4.4|; +$noresave{$key} = "$nosave"; + +1; + diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/mixer-objects.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/mixer-objects.html.svn-base new file mode 100644 index 0000000..5a4d516 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/mixer-objects.html.svn-base @@ -0,0 +1,327 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="pcm-example.html" /> +<link rel="prev" href="pcm-objects.html" /> +<link rel="parent" href="module-alsaaudio.html" /> +<link rel="next" href="pcm-example.html" /> +<meta name='aesop' content='information' /> +<title>4.3 Mixer Objects</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.2 PCM Objects" + href="pcm-objects.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.4 ALSA Examples" + href="pcm-example.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pcm-objects.html">4.2 PCM Objects</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="pcm-example.html">4.4 ALSA Examples</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H2><A NAME="SECTION002430000000000000000"></A> +<A NAME="mixer-objects"></A> +<BR> +4.3 Mixer Objects +</H2> + +<P> +Mixer objects provides access to the ALSA mixer API. + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-16' xml:id='l2h-16' class="class">Mixer</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>control</var><big>]</big><var>, </var><big>[</big><var>id</var><big>]</big><var>, </var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +<var>control</var> - specifies which control to manipulate using this mixer object. The list +of available controls can be found with the <tt class="module">alsaaudio</tt>.<tt class="function">mixers</tt> function. +The default value is 'Master' - other common controls include 'Master Mono', 'PCM', 'Line', etc. + +<P> +<var>id</var> - the id of the mixer control. Default is 0 + +<P> +<var>cardname</var> - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +</dl> + +<P> +Mixer objects have the following methods: + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-17' xml:id='l2h-17' class="method">cardname</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the name of the sound card used by this Mixer object +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-18' xml:id='l2h-18' class="method">mixer</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the name of the specific mixer controlled by this object, For example 'Master' +or 'PCM' +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-19' xml:id='l2h-19' class="method">mixerid</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the ID of the ALSA mixer controlled by this object. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-20' xml:id='l2h-20' class="method">switchcap</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Returns a list of the switches which are defined by this specific mixer. Possible values in +this list are: + +<P> +<div class="center"><table class="realtable"> + <thead> + <tr> + <th class="left" >Switch</th> + <th class="left" >Description</th> + </tr> + </thead> + <tbody> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Mute'</Volume></td> + <td class="left" >This mixer can be muted</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Mute'</Volume></td> + <td class="left" >This mixer can mute all channels at the same time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Playback Mute'</Volume></td> + <td class="left" >This mixer can mute the playback output</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Playback Mute'</Volume></td> + <td class="left" >Mute playback for all channels at the same time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Capture Mute'</Volume></td> + <td class="left" >Mute sound capture</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Capture Mute'</Volume></td> + <td class="left" >Mute sound capture for all channels at a time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Capture Exclusive'</Volume></td> + <td class="left" >Not quite sure what this is</td></tr></tbody> +</table></div> + +<P> +To manipulate these swithes use the <tt class="method">setrec</tt> or <tt class="method">setmute</tt> methods +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-21' xml:id='l2h-21' class="method">volumecap</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Returns a list of the volume control capabilities of this mixer. Possible values in +the list are: + +<P> +<div class="center"><table class="realtable"> + <thead> + <tr> + <th class="left" >Capability</th> + <th class="left" >Description</th> + </tr> + </thead> + <tbody> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Volume'</Volume></td> + <td class="left" >This mixer can control volume</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Volume'</Volume></td> + <td class="left" >This mixer can control volume for all channels at the same time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Playback Volume'</Volume></td> + <td class="left" >This mixer can manipulate the playback volume</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Playback Volume'</Volume></td> + <td class="left" >Manipulate playback volumne for all channels at the same time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Capture Volume'</Volume></td> + <td class="left" >Manipulate sound capture volume</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Capture Volume'</Volume></td> + <td class="left" >Manipulate sound capture volume for all channels at a time</td></tr></tbody> +</table></div> + +<P> +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-22' xml:id='l2h-22' class="method">getvolume</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>direction</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +Returns a list with the current volume settings for each channel. The list elements +are integer percentages. + +<P> +The optional <var>direction</var> argument can be either 'playback' or 'capture', which is relevant +if the mixer can control both playback and capture volume. The default value is 'playback' +if the mixer has this capability, otherwise 'capture' + +<P> +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-23' xml:id='l2h-23' class="method">getmute</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return a list indicating the current mute setting for each channel. 0 means not muted, 1 means muted. + +<P> +This method will fail if the mixer has no playback switch capabilities. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-24' xml:id='l2h-24' class="method">getrec</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return a list indicating the current record mute setting for each channel. 0 means not recording, 1 +means not recording. + +<P> +This method will fail if the mixer has no capture switch capabilities. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-25' xml:id='l2h-25' class="method">setvolume</tt></b>(</nobr></td> + <td><var>volume,</var><big>[</big><var>channel</var><big>]</big><var>,</var><big>[</big><var>direction</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +Change the current volume settings for this mixer. The <var>volume</var> argument controls +the new volume setting as an integer percentage. + +<P> +If the optional argument <var>channel</var> is present, the volume is set only for this channel. This +assumes that the mixer can control the volume for the channels independently. + +<P> +The optional <var>direction</var> argument can be either 'playback' or 'capture' is relevant if the mixer +has independent playback and capture volume capabilities, and controls which of the volumes +if changed. The default is 'playback' if the mixer has this capability, otherwise 'capture'. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-26' xml:id='l2h-26' class="method">setmute</tt></b>(</nobr></td> + <td><var>mute, </var><big>[</big><var>channel</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +Sets the mute flag to a new value. The <var>mute</var> argument is either 0 for not muted, or 1 for muted. + +<P> +The optional <var>channel</var> argument controls which channel is muted. The default is to set the mute flag +for all channels. + +<P> +This method will fail if the mixer has no playback mute capabilities +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-27' xml:id='l2h-27' class="method">setrec</tt></b>(</nobr></td> + <td><var>capture,</var><big>[</big><var>channel</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +Sets the capture mute flag to a new value. The <var>capture</var> argument is either 0 for no capture, +or 1 for capture. + +<P> +The optional <var>channel</var> argument controls which channel is changed. The default is to set the capture flag +for all channels. + +<P> +This method will fail if the mixer has no capture switch capabilities +</dl> + +<P> +<b>A Note on the ALSA Mixer API</b> + +<P> +The ALSA mixer API is extremely complicated - and hardly documented at all. <tt class="module">alsaaudio</tt> implements +a much simplified way to access this API. In designing the API I've had to make some choices which +may limit what can and cannot be controlled through the API. However, If I had chosen to implement the +full API, I would have reexposed the horrible complexity/documentation ratio of the underlying API. +At least the <tt class="module">alsaaudio</tt> API is easy to understand and use. + +<P> +If my design choises prevents you from doing something that the underlying API would have allowed, +please let me know, so I can incorporate these need into future versions. + +<P> +If the current state of affairs annoy you, the best you can do is to write a HOWTO on the API and +make this available on the net. Until somebody does this, the availability of ALSA mixer capable +devices will stay quite limited. + +<P> +Unfortunately, I'm not able to create such a HOWTO myself, since I only understand half of the API, +and that which I do understand has come from a painful trial and error process. + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.2 PCM Objects" + href="pcm-objects.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.4 ALSA Examples" + href="pcm-example.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pcm-objects.html">4.2 PCM Objects</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="pcm-example.html">4.4 ALSA Examples</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/module-alsaaudio.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/module-alsaaudio.html.svn-base new file mode 100644 index 0000000..c3673ee --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/module-alsaaudio.html.svn-base @@ -0,0 +1,167 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="prev" href="node5.html" /> +<link rel="parent" href="contents.html" /> +<link rel="next" href="node7.html" /> +<meta name='aesop' content='information' /> +<title>4 alsaaudio</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="3 Installation" + href="node5.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.1 PCM Terminology and" + href="node7.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node5.html">3 Installation</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node7.html">4.1 PCM Terminology and</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION002400000000000000000"> +4 <tt class="module">alsaaudio</tt></A> +</H1> + +<P> +<A NAME="module-alsaaudio"></A> +<P> + +<p class="availability">Availability: <span + class="platform">Linux</span>.</p> + +<P> + +<P> + +<P> +The <tt class="module">alsaaudio</tt> module defines functions and classes for using +ALSA. + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-2' xml:id='l2h-2' class="function">mixers</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +List the available mixers. The optional <var>cardname</var> specifies which +card should be queried (this is only relevant if you have more than one +sound card). Omit to use the default sound card +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3' xml:id='l2h-3' class="class">PCM</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>type</var><big>]</big><var>, </var><big>[</big><var>mode</var><big>]</big><var>, </var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +This class is used to represent a PCM device (both playback and capture devices). +The arguments are: +<BR><var>type</var> - can be either PCM_CAPTURE or PCM_PLAYBACK (default). +<BR><var>mode</var> - can be either PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL (the default). +<BR><var>cardname</var> - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-4' xml:id='l2h-4' class="class">Mixer</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>control</var><big>]</big><var>, </var><big>[</big><var>id</var><big>]</big><var>, </var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +This class is used to access a specific ALSA mixer. +The arguments are: +<BR><var>control</var> - Name of the chosen mixed (default is Master). +<BR><var>id</var> - id of mixer (default is 0) - More explaniation needed here +<BR><var>cardname</var> specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +</dl> + +<P> +<dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-5' xml:id='l2h-5' class="exception">ALSAAudioError</tt></b></dt> +<dd> +Exception raised when an operation fails for a ALSA specific reason. +The exception argument is a string describing the reason of the +failure. +</dd></dl> + +<P> + +<p><br /></p><hr class='online-navigation' /> +<div class='online-navigation'> +<!--Table of Child-Links--> +<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> + +<UL CLASS="ChildLinks"> +<LI><A href="node7.html">4.1 PCM Terminology and Concepts</a> +<LI><A href="pcm-objects.html">4.2 PCM Objects</a> +<LI><A href="mixer-objects.html">4.3 Mixer Objects</a> +<LI><A href="pcm-example.html">4.4 ALSA Examples</a> +</ul> +<!--End of Table of Child-Links--> +</div> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="3 Installation" + href="node5.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.1 PCM Terminology and" + href="node7.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node5.html">3 Installation</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node7.html">4.1 PCM Terminology and</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/modules.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/modules.gif.svn-base Binary files differnew file mode 100644 index 0000000..f5860b6 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/modules.gif.svn-base diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/next.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/next.gif.svn-base Binary files differnew file mode 100644 index 0000000..5dcaff8 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/next.gif.svn-base diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node3.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node3.html.svn-base new file mode 100644 index 0000000..e848a78 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node3.html.svn-base @@ -0,0 +1,120 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="node4.html" /> +<link rel="prev" href="contents.html" /> +<link rel="parent" href="contents.html" /> +<link rel="next" href="node4.html" /> +<meta name='aesop' content='information' /> +<title>1 What is ALSA</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="Contents" + href="contents.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="2 ALSA and Python" + href="node4.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="contents.html">Contents</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node4.html">2 ALSA and Python</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION002100000000000000000"> +1 What is ALSA</A> +</H1> + +<P> +The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI +functionality to the Linux operating system. + +<P> +Logically ALSA consists of these components: + +<UL> +<LI>A set of kernel drivers. +<BR> +These drivers are responsible for handling the physical sound + hardware from within the Linux kernel, and have been the standard + sound implementation in Linux since kernel version 2.5 +</LI> +<LI>A kernel level API for manipulating the ALSA devices. +</LI> +<LI>A user-space C library for simplified access to the sound hardware + from userspace applications. This library is called <i>libasound</i> + and is required by all ALSA capable applications. +</LI> +</UL> + +<P> +More information about ALSA may be found on the project homepage +<a class="url" href="http://www.alsa-project.org">http://www.alsa-project.org</a> +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="Contents" + href="contents.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="2 ALSA and Python" + href="node4.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="contents.html">Contents</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node4.html">2 ALSA and Python</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node4.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node4.html.svn-base new file mode 100644 index 0000000..9c6ab01 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node4.html.svn-base @@ -0,0 +1,116 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="node5.html" /> +<link rel="prev" href="node3.html" /> +<link rel="parent" href="contents.html" /> +<link rel="next" href="node5.html" /> +<meta name='aesop' content='information' /> +<title>2 ALSA and Python</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="1 What is ALSA" + href="node3.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="3 Installation" + href="node5.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node3.html">1 What is ALSA</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node5.html">3 Installation</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION002200000000000000000"> +2 ALSA and Python</A> +</H1> + +<P> +The older Linux sound API (OSS) which is now deprecated is well supported +from the standard Python library, through the ossaudiodev module. No native +ALSA support exists in the standard library (yet). + +<P> +There are a few other ``ALSA for Python'' projects available, including at +least two different projects called pyAlsa. Neither of these seem to be under +active development at the time - and neither are very feature complete. + +<P> +I wrote PyAlsaAudio to fill this gap. My long term goal is to have the module +included in the standard Python library, but that is probably a while of yet. + +<P> +PyAlsaAudio hass full support for sound capture, playback of sound, as well as +the ALSA Mixer API. + +<P> +MIDI support is not available, and since I don't own any MIDI hardware, it's +difficult for me to implement it. Volunteers to work on this would be greatly +appreciated + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="1 What is ALSA" + href="node3.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="3 Installation" + href="node5.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node3.html">1 What is ALSA</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node5.html">3 Installation</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node5.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node5.html.svn-base new file mode 100644 index 0000000..923ac75 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node5.html.svn-base @@ -0,0 +1,115 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="module-alsaaudio.html" /> +<link rel="prev" href="node4.html" /> +<link rel="parent" href="contents.html" /> +<link rel="next" href="module-alsaaudio.html" /> +<meta name='aesop' content='information' /> +<title>3 Installation</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="2 ALSA and Python" + href="node4.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node4.html">2 ALSA and Python</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="module-alsaaudio.html">4 alsaaudio</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION002300000000000000000"> +3 Installation</A> +</H1> + +<P> +Note: the wrappers link with the alsasound library (from the alsa-lib +package). Verify that this is installed by looking for /usr/lib/libasound.so +before building. Naturally you also need to use a kernel with proper ALSA +support. This is the default in Linux kernel 2.6 and later. If you are using +kernel version 2.4 you may need to install the ALSA patches yourself - although +most distributions ship with ALSA kernels. + +<P> +To install, execute the following: +<BR><div class="verbatim"><pre> +$ python setup.py build +</pre></div> + +<P> +And then as root: +<BR><div class="verbatim"><pre> +# python setup.py install +</pre></div> + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="2 ALSA and Python" + href="node4.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node4.html">2 ALSA and Python</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="module-alsaaudio.html">4 alsaaudio</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node7.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node7.html.svn-base new file mode 100644 index 0000000..f58333a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/node7.html.svn-base @@ -0,0 +1,169 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="pcm-objects.html" /> +<link rel="prev" href="module-alsaaudio.html" /> +<link rel="parent" href="module-alsaaudio.html" /> +<link rel="next" href="pcm-objects.html" /> +<meta name='aesop' content='information' /> +<title>4.1 PCM Terminology and Concepts</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.2 PCM Objects" + href="pcm-objects.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="pcm-objects.html">4.2 PCM Objects</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H2><A NAME="SECTION002410000000000000000"> +4.1 PCM Terminology and Concepts</A> +</H2> + +<P> +In order to use PCM devices it is useful to be familiar with some concepts and +terminology. + +<P> +<DL> +<DT><STRONG>Sample</STRONG></DT> +<DD>PCM audio, whether it is input or output, consists at the lowest level +of a number of single samples. A sample represents the sound in a single channel in +a brief interval. If more than one channel is in use, more than one sample is required +for each interval to describe the sound. Samples can be of many different sizes, ranging +from 8 bit to 64 bit presition. The specific format of each sample can also vary - they +can be big endian byte order, little endian byte order, or even floats. + +<P> +</DD> +<DT><STRONG>Frame</STRONG></DT> +<DD>A frame consists of exactly one sample per channel. If there is only one +channel (Mono sound) a frame is simply a single sample. If the sound is stereo, each frame +consists of two samples, etc. + +<P> +</DD> +<DT><STRONG>Frame size</STRONG></DT> +<DD>This is the size in bytes of each frame. This can vary a lot: if each sample is +8 bits, and we're handling mono sound, the frame size is one byte. Similarly in 6 channel audio with +64 bit floating point samples, the frame size is 48 bytes + +<P> +</DD> +<DT><STRONG>Rate</STRONG></DT> +<DD>PCM sound consists of a flow of sound frames. The sound rate controls how often +the current frame is replaced. For example, a rate of 8000 Hz means that a new frame is played +or captured 8000 times per second. + +<P> +</DD> +<DT><STRONG>Data rate</STRONG></DT> +<DD>This is the number of bytes, which must be recorded or provided per second +at a certain frame size and rate. + +<P> +8000 Hz mono sound with 8 bit (1 byte) samples has a data rate of 8000 * 1 * 1 = 8 kb/s + +<P> +At the other end of the scale, 96000 Hz, 6 channel sound with 64 bit (8 bytes) samples +has a data rate of 96000 * 6 * 8 = 4608 kb/s (almost 5 Mb sound data per second) + +<P> +</DD> +<DT><STRONG>Period</STRONG></DT> +<DD>When the hardware processes data this is done in chunks of frames. The time interval +between each processing (A/D or D/A conversion) is known as the period. The size of the period has +direct implication on the latency of the sound input or output. For low-latency the period size should +be very small, while low CPU resource usage would usually demand larger period sizes. With ALSA, the +CPU utilization is not impacted much by the period size, since the kernel layer buffers multiple +periods internally, so each period generates an interrupt and a memory copy, but userspace can be +slower and read or write multiple periods at the same time. + +<P> +</DD> +<DT><STRONG>Period size</STRONG></DT> +<DD>This is the size of each period in Hz. <em>Not bytes, but Hz!.</em> In <tt class="module">alsaaudio</tt> +the period size is set directly, and it is therefore important to understand the significance of this +number. If the period size is configured to for example 32, each write should contain exactly 32 frames +of sound data, and each read will return either 32 frames of data or nothing at all. + +<P> +</DD> +</DL> + +<P> +Once you understand these concepts, you will be ready to actually utilize PCM API. Read on. + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.2 PCM Objects" + href="pcm-objects.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="pcm-objects.html">4.2 PCM Objects</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pcm-example.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pcm-example.html.svn-base new file mode 100644 index 0000000..d458bac --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pcm-example.html.svn-base @@ -0,0 +1,99 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="prev" href="mixer-objects.html" /> +<link rel="parent" href="module-alsaaudio.html" /> +<link rel="next" href="about.html" /> +<meta name='aesop' content='information' /> +<title>4.4 ALSA Examples </title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.3 Mixer Objects" + href="mixer-objects.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="About this document ..." + href="about.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="mixer-objects.html">4.3 Mixer Objects</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="about.html">About this document ...</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H2><A NAME="SECTION002440000000000000000"></A><A NAME="pcm-example"></A> +<BR> +4.4 ALSA Examples +</H2> + +<P> +For now, the only examples available are the 'playbacktest.py' and the 'recordtest.py' programs included. +This will change in a future version. + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.3 Mixer Objects" + href="mixer-objects.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="About this document ..." + href="about.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="mixer-objects.html">4.3 Mixer Objects</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="about.html">About this document ...</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pcm-objects.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pcm-objects.html.svn-base new file mode 100644 index 0000000..3fc5d78 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pcm-objects.html.svn-base @@ -0,0 +1,331 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="mixer-objects.html" /> +<link rel="prev" href="node7.html" /> +<link rel="parent" href="module-alsaaudio.html" /> +<link rel="next" href="mixer-objects.html" /> +<meta name='aesop' content='information' /> +<title>4.2 PCM Objects</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.1 PCM Terminology and" + href="node7.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.3 Mixer Objects" + href="mixer-objects.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node7.html">4.1 PCM Terminology and</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="mixer-objects.html">4.3 Mixer Objects</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H2><A NAME="SECTION002420000000000000000"></A> +<A NAME="pcm-objects"></A> +<BR> +4.2 PCM Objects +</H2> + +<P> +The acronym PCM is short for Pulse Code Modulation and is the method used in ALSA +and many other places to handle playback and capture of sampled sound data. + +<P> +PCM objects in <tt class="module">alsaaudio</tt> are used to do exactly that, either play sample based +sound or capture sound from some input source (perhaps a microphone). The PCM object +constructor takes the following arguments: + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-6' xml:id='l2h-6' class="class">PCM</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>type</var><big>]</big><var>, </var><big>[</big><var>mode</var><big>]</big><var>, </var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> + +<P> +<var>type</var> - can be either PCM_CAPTURE or PCM_PLAYBACK (default). + +<P> +<var>mode</var> - can be either PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL (the default). +In PCM_NONBLOCK mode, calls to read will return immediately independent of wether +there is any actual data to read. Similarly, write calls will return immediately +without actually writing anything to the playout buffer if the buffer is full. + +<P> +In the current version of <tt class="module">alsaaudio</tt> PCM_ASYNC is useless, since it relies +on a callback procedure, which can't be specified from Python. + +<P> +<var>cardname</var> - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card + +<P> +This will construct a PCM object with default settings: + +<P> +Sample format: PCM_FORMAT_S16_LE +<BR> +Rate: 8000 Hz +<BR> +Channels: 2 +<BR> +Period size: 32 frames +<BR></dl> + +<P> +PCM objects have the following methods: + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-7' xml:id='l2h-7' class="method">pcmtype</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Returns the type of PCM object. Either PCM_CAPTURE or PCM_PLAYBACK. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-8' xml:id='l2h-8' class="method">pcmmode</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the mode of the PCM object. One of PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-9' xml:id='l2h-9' class="method">cardname</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the name of the sound card used by this PCM object. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-10' xml:id='l2h-10' class="method">setchannels</tt></b>(</nobr></td> + <td><var>nchannels</var>)</td></tr></table></dt> +<dd> +Used to set the number of capture or playback channels. Common values are: 1 = mono, 2 = stereo, +and 6 = full 6 channel audio. Few sound cards support more than 2 channels +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-11' xml:id='l2h-11' class="method">setrate</tt></b>(</nobr></td> + <td><var>rate</var>)</td></tr></table></dt> +<dd> +Set the sample rate in Hz for the device. Typical values are 8000 (poor sound), 16000, 44100 (cd quality), +and 96000 +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-12' xml:id='l2h-12' class="method">setformat</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +The sound format of the device. Sound format controls how the PCM device interpret data for playback, +and how data is encoded in captures. + +<P> +The following formats are provided by ALSA: +<div class="center"><table class="realtable"> + <thead> + <tr> + <th class="left" >Format</th> + <th class="left" >Description</th> + </tr> + </thead> + <tbody> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S8</Formats></td> + <td class="left" >Signed 8 bit samples for each channel</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U8</Formats></td> + <td class="left" >Signed 8 bit samples for each channel</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S16_LE</Formats></td> + <td class="left" >Signed 16 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S16_BE</Formats></td> + <td class="left" >Signed 16 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U16_LE</Formats></td> + <td class="left" >Unsigned 16 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U16_BE</Formats></td> + <td class="left" >Unsigned 16 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S24_LE</Formats></td> + <td class="left" >Signed 24 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S24_BE</Formats></td> + <td class="left" >Signed 24 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U24_LE</Formats></td> + <td class="left" >Unsigned 24 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U24_BE</Formats></td> + <td class="left" >Unsigned 24 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S32_LE</Formats></td> + <td class="left" >Signed 32 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S32_BE</Formats></td> + <td class="left" >Signed 32 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U32_LE</Formats></td> + <td class="left" >Unsigned 32 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U32_BE</Formats></td> + <td class="left" >Unsigned 32 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_FLOAT_LE</Formats></td> + <td class="left" >32 bit samples encoded as float. (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_FLOAT_BE</Formats></td> + <td class="left" >32 bit samples encoded as float (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_FLOAT64_LE</Formats></td> + <td class="left" >64 bit samples encoded as float. (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_FLOAT64_BE</Formats></td> + <td class="left" >64 bit samples encoded as float. (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_MU_LAW</Formats></td> + <td class="left" >A logarithmic encoding (used by Sun .au files)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_A_LAW</Formats></td> + <td class="left" >Another logarithmic encoding</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_IMA_ADPCM</Formats></td> + <td class="left" >a 4:1 compressed format defined by the Interactive Multimedia Association</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_MPEG</Formats></td> + <td class="left" >MPEG encoded audio?</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_GSM</Formats></td> + <td class="left" >9600 constant rate encoding well suitet for speech</td></tr></tbody> +</table></div> + +<P> +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-13' xml:id='l2h-13' class="method">setperiodsize</tt></b>(</nobr></td> + <td><var>period</var>)</td></tr></table></dt> +<dd> +Sets the actual period size in frames. Each write should consist of exactly this number of frames, and +each read will return this number of frames (unless the device is in PCM_NONBLOCK mode, in which case +it may return nothing at all) +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-14' xml:id='l2h-14' class="method">read</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +In PCM_NORMAL mode, this function blocks until a full period is available, and then returns a +tuple (length,data) where <em>length</em> is the size in bytes of the captured data, and <em>data</em> +is the captured sound frames as a string. The length of the returned data will be periodsize*framesize +bytes. + +<P> +In PCM_NONBLOCK mode, the call will not block, but will return <code>(0,'')</code> if no new period +has become available since the last call to read. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-15' xml:id='l2h-15' class="method">write</tt></b>(</nobr></td> + <td><var>data</var>)</td></tr></table></dt> +<dd> +Writes (plays) the sound in data. The length of data <em>must</em> be a multiple of the frame size, and +<em>should</em> be exactly the size of a period. If less than 'period size' frames are provided, the actual +playout will not happen until more data is written. + +<P> +If the device is not in PCM_NONBLOCK mode, this call will block if the kernel buffer is full, and +until enough sound has been played to allow the sound data to be buffered. The call always returns +the size of the data provided + +<P> +In PCM_NONBLOCK mode, the call will return immediately, with a return value of zero, if the buffer is +full. In this case, the data should be written at a later time. + +<P> +</dl> + +<P> +<strong>A few hints on using PCM devices for playback</strong> + +<P> +The most common reason for problems with playback of PCM audio, is that the people don't properly understand +that writes to PCM devices must match <em>exactly</em> the data rate of the device. + +<P> +If too little data is written to the device, it will underrun, and ugly clicking sounds will occur. Conversely, +of too much data is written to the device, the write function will either block (PCM_NORMAL mode) or return zero +(PCM_NONBLOCK mode). + +<P> +If your program does nothing, but play sound, the easiest way is to put the device in PCM_NORMAL mode, and just +write as much data to the device as possible. This strategy can also be achieved by using a separate thread +with the sole task of playing out sound. + +<P> +In GUI programs, however, it may be a better strategy to setup the device, preload the buffer with a few +periods by calling write a couple of times, and then use some timer method to write one period size of data to +the device every period. The purpose of the preloading is to avoid underrun clicks if the used timer +doesn't expire exactly on time. + +<P> +Also note, that most timer API's that you can find for Python will cummulate time delays: If you set the timer +to expire after 1/10'th of a second, the actual timeout will happen slightly later, which will accumulate to +quite a lot after a few seconds. Hint: use time.time() to check how much time has really passed, and add +extra writes as nessecary. + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.1 PCM Terminology and" + href="node7.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.3 Mixer Objects" + href="mixer-objects.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node7.html">4.1 PCM Terminology and</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="mixer-objects.html">4.3 Mixer Objects</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/previous.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/previous.gif.svn-base Binary files differnew file mode 100644 index 0000000..de1da16 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/previous.gif.svn-base diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyalsaaudio.css.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyalsaaudio.css.svn-base new file mode 100644 index 0000000..06a613c --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyalsaaudio.css.svn-base @@ -0,0 +1,243 @@ +/* + * The first part of this is the standard CSS generated by LaTeX2HTML, + * with the "empty" declarations removed. + */ + +/* Century Schoolbook font is very similar to Computer Modern Math: cmmi */ +.math { font-family: "Century Schoolbook", serif; } +.math i { font-family: "Century Schoolbook", serif; + font-weight: bold } +.boldmath { font-family: "Century Schoolbook", serif; + font-weight: bold } + +/* + * Implement both fixed-size and relative sizes. + * + * I think these can be safely removed, as it doesn't appear that + * LaTeX2HTML ever generates these, even though these are carried + * over from the LaTeX2HTML stylesheet. + */ +small.xtiny { font-size : xx-small; } +small.tiny { font-size : x-small; } +small.scriptsize { font-size : smaller; } +small.footnotesize { font-size : small; } +big.xlarge { font-size : large; } +big.xxlarge { font-size : x-large; } +big.huge { font-size : larger; } +big.xhuge { font-size : xx-large; } + +/* + * Document-specific styles come next; + * these are added for the Python documentation. + * + * Note that the size specifications for the H* elements are because + * Netscape on Solaris otherwise doesn't get it right; they all end up + * the normal text size. + */ + +body { color: #000000; + background-color: #ffffff; } + +a:link:active { color: #ff0000; } +a:link:hover { background-color: #bbeeff; } +a:visited:hover { background-color: #bbeeff; } +a:visited { color: #551a8b; } +a:link { color: #0000bb; } + +h1, h2, h3, h4, h5, h6 { font-family: avantgarde, sans-serif; + font-weight: bold; } +h1 { font-size: 180%; } +h2 { font-size: 150%; } +h3, h4 { font-size: 120%; } + +/* These are section titles used in navigation links, so make sure we + * match the section header font here, even it not the weight. + */ +.sectref { font-family: avantgarde, sans-serif; } +/* And the label before the titles in navigation: */ +.navlabel { font-size: 85%; } + + +/* LaTeX2HTML insists on inserting <br> elements into headers which + * are marked with \label. This little bit of CSS magic ensures that + * these elements don't cause spurious whitespace to be added. + */ +h1>br, h2>br, h3>br, +h4>br, h5>br, h6>br { display: none; } + +code, tt { font-family: "lucida typewriter", lucidatypewriter, + monospace; } +var { font-family: times, serif; + font-style: italic; + font-weight: normal; } + +.Unix { font-variant: small-caps; } + +.typelabel { font-family: lucida, sans-serif; } + +.navigation td { background-color: #99ccff; + font-weight: bold; + font-family: avantgarde, sans-serif; + font-size: 110%; } + +div.warning { background-color: #fffaf0; + border: thin solid black; + padding: 1em; + margin-left: 2em; + margin-right: 2em; } + +div.warning .label { font-family: sans-serif; + font-size: 110%; + margin-right: 0.5em; } + +div.note { background-color: #fffaf0; + border: thin solid black; + padding: 1em; + margin-left: 2em; + margin-right: 2em; } + +div.note .label { margin-right: 0.5em; + font-family: sans-serif; } + +address { font-size: 80%; } +.release-info { font-style: italic; + font-size: 80%; } + +.titlegraphic { vertical-align: top; } + +.verbatim pre { color: #00008b; + font-family: "lucida typewriter", lucidatypewriter, + monospace; + font-size: 90%; } +.verbatim { margin-left: 2em; } +.verbatim .footer { padding: 0.05in; + font-size: 85%; + background-color: #99ccff; + margin-right: 0.5in; } + +.grammar { background-color: #99ccff; + margin-right: 0.5in; + padding: 0.05in; } +.grammar-footer { padding: 0.05in; + font-size: 85%; } +.grammartoken { font-family: "lucida typewriter", lucidatypewriter, + monospace; } + +.productions { background-color: #bbeeff; } +.productions a:active { color: #ff0000; } +.productions a:link:hover { background-color: #99ccff; } +.productions a:visited:hover { background-color: #99ccff; } +.productions a:visited { color: #551a8b; } +.productions a:link { color: #0000bb; } +.productions table { vertical-align: baseline; + empty-cells: show; } +.productions > table td, +.productions > table th { padding: 2px; } +.productions > table td:first-child, +.productions > table td:last-child { + font-family: "lucida typewriter", + lucidatypewriter, + monospace; + } +/* same as the second selector above, but expressed differently for Opera */ +.productions > table td:first-child + td + td { + font-family: "lucida typewriter", + lucidatypewriter, + monospace; + vertical-align: baseline; + } +.productions > table td:first-child + td { + padding-left: 1em; + padding-right: 1em; + } +.productions > table tr { vertical-align: baseline; } + +.email { font-family: avantgarde, sans-serif; } +.mailheader { font-family: avantgarde, sans-serif; } +.mimetype { font-family: avantgarde, sans-serif; } +.newsgroup { font-family: avantgarde, sans-serif; } +.url { font-family: avantgarde, sans-serif; } +.file { font-family: avantgarde, sans-serif; } +.guilabel { font-family: avantgarde, sans-serif; } + +.realtable { border-collapse: collapse; + border-color: black; + border-style: solid; + border-width: 0px 0px 2px 0px; + empty-cells: show; + margin-left: auto; + margin-right: auto; + padding-left: 0.4em; + padding-right: 0.4em; + } +.realtable tbody { vertical-align: baseline; } +.realtable tfoot { display: table-footer-group; } +.realtable thead { background-color: #99ccff; + border-width: 0px 0px 2px 1px; + display: table-header-group; + font-family: avantgarde, sans-serif; + font-weight: bold; + vertical-align: baseline; + } +.realtable thead :first-child { + border-width: 0px 0px 2px 0px; + } +.realtable thead th { border-width: 0px 0px 2px 1px } +.realtable td, +.realtable th { border-color: black; + border-style: solid; + border-width: 0px 0px 1px 1px; + padding-left: 0.4em; + padding-right: 0.4em; + } +.realtable td:first-child, +.realtable th:first-child { + border-left-width: 0px; + vertical-align: baseline; + } +.center { text-align: center; } +.left { text-align: left; } +.right { text-align: right; } + +.refcount-info { font-style: italic; } +.refcount-info .value { font-weight: bold; + color: #006600; } + +/* + * Some decoration for the "See also:" blocks, in part inspired by some of + * the styling on Lars Marius Garshol's XSA pages. + * (The blue in the navigation bars is #99CCFF.) + */ +.seealso { background-color: #fffaf0; + border: thin solid black; + padding: 0pt 1em 4pt 1em; } + +.seealso > .heading { font-size: 110%; + font-weight: bold; } + +/* + * Class 'availability' is used for module availability statements at + * the top of modules. + */ +.availability .platform { font-weight: bold; } + + +/* + * Additional styles for the distutils package. + */ +.du-command { font-family: monospace; } +.du-option { font-family: avantgarde, sans-serif; } +.du-filevar { font-family: avantgarde, sans-serif; + font-style: italic; } +.du-xxx:before { content: "** "; + font-weight: bold; } +.du-xxx:after { content: " **"; + font-weight: bold; } + + +/* + * Some specialization for printed output. + */ +@media print { + .online-navigation { display: none; } + } diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyalsaaudio.html.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyalsaaudio.html.svn-base new file mode 100644 index 0000000..fc3e86f --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyalsaaudio.html.svn-base @@ -0,0 +1,110 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="front.html" /> +<meta name='aesop' content='information' /> +<title>PyAlsaAudio</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></td> +<td class='online-navigation'><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></td> +<td class='online-navigation'><a rel="next" title="Front Matter" + href="front.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="front.html">Front Matter</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<div class="titlepage"> +<div class='center'> +<h1>PyAlsaAudio</h1> +<p><b><font size="+2">Casper Wilstrup</font></b></p> +<p>cwi@unispeed.com</p> +<p></p> +</div> +</div> + +<P> + +<p><br /></p><hr class='online-navigation' /> +<div class='online-navigation'> +<!--Table of Child-Links--> +<A NAME="CHILD_LINKS"></a> + +<UL CLASS="ChildLinks"> +<LI><A href="front.html">Front Matter</a> +<LI><A href="contents.html">Contents</a> +<UL> +<LI><A href="node3.html">1 What is ALSA</a> +<LI><A href="node4.html">2 ALSA and Python</a> +<LI><A href="node5.html">3 Installation</a> +<LI><A href="module-alsaaudio.html">4 <tt class="module">alsaaudio</tt></a> +<UL> +<LI><A href="node7.html">4.1 PCM Terminology and Concepts</a> +<LI><A href="pcm-objects.html">4.2 PCM Objects</a> +<LI><A href="mixer-objects.html">4.3 Mixer Objects</a> +<LI><A href="pcm-example.html">4.4 ALSA Examples</a> +</ul> +</ul> +<LI><A href="about.html">About this document ...</a> +</ul> +<!--End of Table of Child-Links--> +</div> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></td> +<td class='online-navigation'><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></td> +<td class='online-navigation'><a rel="next" title="Front Matter" + href="front.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="front.html">Front Matter</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyfav.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyfav.gif.svn-base Binary files differnew file mode 100644 index 0000000..58271ed --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/pyfav.gif.svn-base diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/up.gif.svn-base b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/up.gif.svn-base Binary files differnew file mode 100644 index 0000000..a9d3e13 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/text-base/up.gif.svn-base diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/about.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/about.html.svn-work new file mode 100644 index 0000000..d2c4115 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/about.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/about.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/blank.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/blank.gif.svn-work new file mode 100644 index 0000000..52ec074 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/blank.gif.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 63 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/blank.gif +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/contents.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/contents.gif.svn-work new file mode 100644 index 0000000..ac50bbd --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/contents.gif.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 66 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/contents.gif +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/contents.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/contents.html.svn-work new file mode 100644 index 0000000..443432d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/contents.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 67 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/contents.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/front.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/front.html.svn-work new file mode 100644 index 0000000..abbbcfc --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/front.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/front.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.dat.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.dat.svn-work new file mode 100644 index 0000000..fd24f9a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.dat.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 63 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/index.dat +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.gif.svn-work new file mode 100644 index 0000000..a2f5186 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.gif.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 63 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/index.gif +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.html.svn-work new file mode 100644 index 0000000..92d1677 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/index.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/index.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/internals.pl.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/internals.pl.svn-work new file mode 100644 index 0000000..b9d814a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/internals.pl.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 66 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/internals.pl +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/intlabels.pl.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/intlabels.pl.svn-work new file mode 100644 index 0000000..5d25e60 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/intlabels.pl.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 66 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/intlabels.pl +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/labels.pl.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/labels.pl.svn-work new file mode 100644 index 0000000..64dd582 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/labels.pl.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 63 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/labels.pl +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/mixer-objects.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/mixer-objects.html.svn-work new file mode 100644 index 0000000..ac8fdd4 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/mixer-objects.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 72 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/mixer-objects.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/module-alsaaudio.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/module-alsaaudio.html.svn-work new file mode 100644 index 0000000..2d9603a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/module-alsaaudio.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 75 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/module-alsaaudio.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/modules.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/modules.gif.svn-work new file mode 100644 index 0000000..d8101b2 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/modules.gif.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 65 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/modules.gif +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/next.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/next.gif.svn-work new file mode 100644 index 0000000..c5cafe7 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/next.gif.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 62 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/next.gif +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node3.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node3.html.svn-work new file mode 100644 index 0000000..a6cf231 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node3.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/node3.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node4.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node4.html.svn-work new file mode 100644 index 0000000..4046589 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node4.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/node4.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node5.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node5.html.svn-work new file mode 100644 index 0000000..63c0f62 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node5.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/node5.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node7.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node7.html.svn-work new file mode 100644 index 0000000..c5d1273 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/node7.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/node7.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pcm-example.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pcm-example.html.svn-work new file mode 100644 index 0000000..af3e8f0 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pcm-example.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 70 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/pcm-example.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pcm-objects.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pcm-objects.html.svn-work new file mode 100644 index 0000000..2c2e3d0 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pcm-objects.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 70 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/pcm-objects.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/previous.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/previous.gif.svn-work new file mode 100644 index 0000000..101dadf --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/previous.gif.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 66 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/previous.gif +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyalsaaudio.css.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyalsaaudio.css.svn-work new file mode 100644 index 0000000..0667b51 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyalsaaudio.css.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 69 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/pyalsaaudio.css +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyalsaaudio.html.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyalsaaudio.html.svn-work new file mode 100644 index 0000000..5967be8 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyalsaaudio.html.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 70 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/pyalsaaudio.html +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyfav.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyfav.gif.svn-work new file mode 100644 index 0000000..57581c8 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/pyfav.gif.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 63 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/pyfav.gif +END diff --git a/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/up.gif.svn-work b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/up.gif.svn-work new file mode 100644 index 0000000..3a936ad --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/.svn/wcprops/up.gif.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 60 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/up.gif +END diff --git a/arch_src/pyalsaaudio-0.2/doc/about.html b/arch_src/pyalsaaudio-0.2/doc/about.html new file mode 100644 index 0000000..c47ebca --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/about.html @@ -0,0 +1,110 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="prev" href="contents.html" /> +<link rel="parent" href="pyalsaaudio.html" /> +<meta name='aesop' content='information' /> +<title>About this document ...</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.4 ALSA Examples" + href="pcm-example.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pcm-example.html">4.4 ALSA Examples</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION003000000000000000000"> +About this document ...</A> +</H1> + <strong>PyAlsaAudio</strong> +<p> This document was generated using the <a + href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/"> + <strong>LaTeX</strong>2<tt>HTML</tt></a> translator. +</p> + +<p> <a + href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/"> + <strong>LaTeX</strong>2<tt>HTML</tt></a> is Copyright © + 1993, 1994, 1995, 1996, 1997, <a + href="http://cbl.leeds.ac.uk/nikos/personal.html">Nikos + Drakos</a>, Computer Based Learning Unit, University of + Leeds, and Copyright © 1997, 1998, <a + href="http://www.maths.mq.edu.au/~ross/">Ross + Moore</a>, Mathematics Department, Macquarie University, + Sydney. +</p> + +<p> The application of <a + href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/"> + <strong>LaTeX</strong>2<tt>HTML</tt></a> to the Python + documentation has been heavily tailored by Fred L. Drake, + Jr. Original navigation icons were contributed by Christopher + Petrilli. +</p> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.4 ALSA Examples" + href="pcm-example.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pcm-example.html">4.4 ALSA Examples</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/blank.gif b/arch_src/pyalsaaudio-0.2/doc/blank.gif Binary files differnew file mode 100644 index 0000000..2e31f4e --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/blank.gif diff --git a/arch_src/pyalsaaudio-0.2/doc/blank.png b/arch_src/pyalsaaudio-0.2/doc/blank.png Binary files differnew file mode 100644 index 0000000..2af5639 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/blank.png diff --git a/arch_src/pyalsaaudio-0.2/doc/contents.gif b/arch_src/pyalsaaudio-0.2/doc/contents.gif Binary files differnew file mode 100644 index 0000000..6d299c4 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/contents.gif diff --git a/arch_src/pyalsaaudio-0.2/doc/contents.html b/arch_src/pyalsaaudio-0.2/doc/contents.html new file mode 100644 index 0000000..7f5eb2a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/contents.html @@ -0,0 +1,106 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="about.html" /> +<link rel="prev" href="front.html" /> +<link rel="parent" href="pyalsaaudio.html" /> +<link rel="next" href="node3.html" /> +<meta name='aesop' content='information' /> +<title>Contents</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="Front Matter" + href="front.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="1 What is ALSA" + href="node3.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="front.html">Front Matter</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node3.html">1 What is ALSA</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> +<BR><h2><A NAME="SECTION002000000000000000000"> +Contents</A> +</h2> +<!--Table of Contents--> + +<UL CLASS="TofC"> +<LI><UL> +<LI><A href="node3.html">1 What is ALSA</a> +<LI><A href="node4.html">2 ALSA and Python</a> +<LI><A href="node5.html">3 Installation</a> +<LI><A href="module-alsaaudio.html">4 alsaaudio</a> +<UL> +<LI><A href="node7.html">4.1 PCM Terminology and Concepts</a> +<LI><A href="pcm-objects.html">4.2 PCM Objects</a> +<LI><A href="mixer-objects.html">4.3 Mixer Objects</a> +<LI><A href="pcm-example.html">4.4 ALSA Examples</a> +</ul></ul></ul> +<!--End of Table of Contents--> +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="Front Matter" + href="front.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="1 What is ALSA" + href="node3.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="front.html">Front Matter</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node3.html">1 What is ALSA</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/contents.png b/arch_src/pyalsaaudio-0.2/doc/contents.png Binary files differnew file mode 100644 index 0000000..3429be0 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/contents.png diff --git a/arch_src/pyalsaaudio-0.2/doc/front.html b/arch_src/pyalsaaudio-0.2/doc/front.html new file mode 100644 index 0000000..bbcdbc5 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/front.html @@ -0,0 +1,119 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="contents.html" /> +<link rel="prev" href="pyalsaaudio.html" /> +<link rel="parent" href="pyalsaaudio.html" /> +<link rel="next" href="contents.html" /> +<meta name='aesop' content='information' /> +<title>Front Matter</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="Contents" + href="contents.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="contents.html">Contents</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION001000000000000000000"></A><A NAME="front"></A> +<BR> +Front Matter +</H1> + +<P> +This software is licensed under the PSF license - the same one used +by the majority of the python distribution. Basically you can use it +for anything you wish (even commercial purposes). There is no warranty +whatsoever. + +<P> + +<H3>Abstract:</H3> +<DIV CLASS="ABSTRACT"> + +This package contains wrappers for accessing the ALSA api from Python. It +is currently fairly complete for PCM devices and Mixer access. MIDI sequencer +support is low on my priority list, but volunteers are welcome. + +<P> +If you find bugs in the wrappers please notify me on email. Please +don't send bug reports regarding ALSA specifically. There are several +bugs in this api, and those should be reported to the ALSA team - not +me. +</DIV> +<P> + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="PyAlsaAudio" + href="pyalsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="Contents" + href="contents.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="pyalsaaudio.html">PyAlsaAudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="contents.html">Contents</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/index.dat b/arch_src/pyalsaaudio-0.2/doc/index.dat new file mode 100644 index 0000000..8efff3f --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/index.dat @@ -0,0 +1,27 @@ +<a href="node6.html"><tt class="module">alsaaudio</tt> (extension module)###DEF0000000608 +<a href="node6.html#l2h-2"><tt class="function">mixers()</tt> (in module alsaaudio)###0000000609 +<a href="node6.html#l2h-3"><tt class="class">PCM</tt> (class in alsaaudio)###0000000610 +<a href="node6.html#l2h-4"><tt class="class">Mixer</tt> (class in alsaaudio)###0000000611 +<a href="node6.html#l2h-5"><tt class="exception">ALSAAudioError</tt>###0000000612 +<a href="node8.html#l2h-6"><tt class="class">PCM</tt> (class in alsaaudio)###0000000622 +<a href="node8.html#l2h-7"><tt class="method">pcmtype()</tt> (PCM method)###0000000623 +<a href="node8.html#l2h-8"><tt class="method">pcmmode()</tt> (PCM method)###0000000624 +<a href="node8.html#l2h-9"><tt class="method">cardname()</tt> (PCM method)###0000000625 +<a href="node8.html#l2h-10"><tt class="method">setchannels()</tt> (PCM method)###0000000626 +<a href="node8.html#l2h-11"><tt class="method">setrate()</tt> (PCM method)###0000000627 +<a href="node8.html#l2h-12"><tt class="method">setformat()</tt> (PCM method)###0000000628 +<a href="node8.html#l2h-13"><tt class="method">setperiodsize()</tt> (PCM method)###0000000629 +<a href="node8.html#l2h-14"><tt class="method">read()</tt> (PCM method)###0000000630 +<a href="node8.html#l2h-15"><tt class="method">write()</tt> (PCM method)###0000000631 +<a href="node9.html#l2h-16"><tt class="class">Mixer</tt> (class in alsaaudio)###0000000633 +<a href="node9.html#l2h-17"><tt class="method">cardname()</tt> (Mixer method)###0000000634 +<a href="node9.html#l2h-18"><tt class="method">mixer()</tt> (Mixer method)###0000000635 +<a href="node9.html#l2h-19"><tt class="method">mixerid()</tt> (Mixer method)###0000000636 +<a href="node9.html#l2h-20"><tt class="method">switchcap()</tt> (Mixer method)###0000000637 +<a href="node9.html#l2h-21"><tt class="method">volumecap()</tt> (Mixer method)###0000000638 +<a href="node9.html#l2h-22"><tt class="method">getvolume()</tt> (Mixer method)###0000000639 +<a href="node9.html#l2h-23"><tt class="method">getmute()</tt> (Mixer method)###0000000640 +<a href="node9.html#l2h-24"><tt class="method">getrec()</tt> (Mixer method)###0000000641 +<a href="node9.html#l2h-25"><tt class="method">setvolume()</tt> (Mixer method)###0000000642 +<a href="node9.html#l2h-26"><tt class="method">setmute()</tt> (Mixer method)###0000000643 +<a href="node9.html#l2h-27"><tt class="method">setrec()</tt> (Mixer method)###0000000644 diff --git a/arch_src/pyalsaaudio-0.2/doc/index.gif b/arch_src/pyalsaaudio-0.2/doc/index.gif Binary files differnew file mode 100644 index 0000000..32eecfb --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/index.gif diff --git a/arch_src/pyalsaaudio-0.2/doc/index.html b/arch_src/pyalsaaudio-0.2/doc/index.html new file mode 100644 index 0000000..fc3e86f --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/index.html @@ -0,0 +1,110 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="front.html" /> +<meta name='aesop' content='information' /> +<title>PyAlsaAudio</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></td> +<td class='online-navigation'><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></td> +<td class='online-navigation'><a rel="next" title="Front Matter" + href="front.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="front.html">Front Matter</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<div class="titlepage"> +<div class='center'> +<h1>PyAlsaAudio</h1> +<p><b><font size="+2">Casper Wilstrup</font></b></p> +<p>cwi@unispeed.com</p> +<p></p> +</div> +</div> + +<P> + +<p><br /></p><hr class='online-navigation' /> +<div class='online-navigation'> +<!--Table of Child-Links--> +<A NAME="CHILD_LINKS"></a> + +<UL CLASS="ChildLinks"> +<LI><A href="front.html">Front Matter</a> +<LI><A href="contents.html">Contents</a> +<UL> +<LI><A href="node3.html">1 What is ALSA</a> +<LI><A href="node4.html">2 ALSA and Python</a> +<LI><A href="node5.html">3 Installation</a> +<LI><A href="module-alsaaudio.html">4 <tt class="module">alsaaudio</tt></a> +<UL> +<LI><A href="node7.html">4.1 PCM Terminology and Concepts</a> +<LI><A href="pcm-objects.html">4.2 PCM Objects</a> +<LI><A href="mixer-objects.html">4.3 Mixer Objects</a> +<LI><A href="pcm-example.html">4.4 ALSA Examples</a> +</ul> +</ul> +<LI><A href="about.html">About this document ...</a> +</ul> +<!--End of Table of Child-Links--> +</div> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></td> +<td class='online-navigation'><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></td> +<td class='online-navigation'><a rel="next" title="Front Matter" + href="front.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="front.html">Front Matter</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/index.png b/arch_src/pyalsaaudio-0.2/doc/index.png Binary files differnew file mode 100644 index 0000000..cd918af --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/index.png diff --git a/arch_src/pyalsaaudio-0.2/doc/internals.pl b/arch_src/pyalsaaudio-0.2/doc/internals.pl new file mode 100644 index 0000000..4864f4b --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/internals.pl @@ -0,0 +1,34 @@ +# LaTeX2HTML 2002-2 (1.70) +# Associate internals original text with physical files. + + +$key = q/module-alsaaudio/; +$ref_files{$key} = "$dir".q|node6.html|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-objects/; +$ref_files{$key} = "$dir".q|node8.html|; +$noresave{$key} = "$nosave"; + +$key = q/front/; +$ref_files{$key} = "$dir".q|node1.html|; +$noresave{$key} = "$nosave"; + +$key = q/contents/; +$ref_files{$key} = "$dir".q|node2.html|; +$noresave{$key} = "$nosave"; + +$key = q/mixer-objects/; +$ref_files{$key} = "$dir".q|node9.html|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-example/; +$ref_files{$key} = "$dir".q|node10.html|; +$noresave{$key} = "$nosave"; + +$key = q/about/; +$ref_files{$key} = "$dir".q|node11.html|; +$noresave{$key} = "$nosave"; + +1; + diff --git a/arch_src/pyalsaaudio-0.2/doc/intlabels.pl b/arch_src/pyalsaaudio-0.2/doc/intlabels.pl new file mode 100644 index 0000000..972ec5a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/intlabels.pl @@ -0,0 +1,30 @@ +%internal_labels = (); +1; # hack in case there are no entries + +$internal_labels{"l2h-1"} = "/node6.html"; +$internal_labels{"l2h-2"} = "/node6.html"; +$internal_labels{"l2h-3"} = "/node6.html"; +$internal_labels{"l2h-4"} = "/node6.html"; +$internal_labels{"l2h-5"} = "/node6.html"; +$internal_labels{"l2h-6"} = "/node8.html"; +$internal_labels{"l2h-7"} = "/node8.html"; +$internal_labels{"l2h-8"} = "/node8.html"; +$internal_labels{"l2h-9"} = "/node8.html"; +$internal_labels{"l2h-10"} = "/node8.html"; +$internal_labels{"l2h-11"} = "/node8.html"; +$internal_labels{"l2h-12"} = "/node8.html"; +$internal_labels{"l2h-13"} = "/node8.html"; +$internal_labels{"l2h-14"} = "/node8.html"; +$internal_labels{"l2h-15"} = "/node8.html"; +$internal_labels{"l2h-16"} = "/node9.html"; +$internal_labels{"l2h-17"} = "/node9.html"; +$internal_labels{"l2h-18"} = "/node9.html"; +$internal_labels{"l2h-19"} = "/node9.html"; +$internal_labels{"l2h-20"} = "/node9.html"; +$internal_labels{"l2h-21"} = "/node9.html"; +$internal_labels{"l2h-22"} = "/node9.html"; +$internal_labels{"l2h-23"} = "/node9.html"; +$internal_labels{"l2h-24"} = "/node9.html"; +$internal_labels{"l2h-25"} = "/node9.html"; +$internal_labels{"l2h-26"} = "/node9.html"; +$internal_labels{"l2h-27"} = "/node9.html"; diff --git a/arch_src/pyalsaaudio-0.2/doc/labels.pl b/arch_src/pyalsaaudio-0.2/doc/labels.pl new file mode 100644 index 0000000..f3d0859 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/labels.pl @@ -0,0 +1,57 @@ +# LaTeX2HTML 2002-2-1 (1.70) +# Associate labels original text with physical files. + + +$key = q/module-alsaaudio/; +$external_labels{$key} = "$URL/" . q|node6.html|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-objects/; +$external_labels{$key} = "$URL/" . q|node8.html|; +$noresave{$key} = "$nosave"; + +$key = q/front/; +$external_labels{$key} = "$URL/" . q|node1.html|; +$noresave{$key} = "$nosave"; + +$key = q/contents/; +$external_labels{$key} = "$URL/" . q|node2.html|; +$noresave{$key} = "$nosave"; + +$key = q/mixer-objects/; +$external_labels{$key} = "$URL/" . q|node9.html|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-example/; +$external_labels{$key} = "$URL/" . q|node10.html|; +$noresave{$key} = "$nosave"; + +$key = q/about/; +$external_labels{$key} = "$URL/" . q|node11.html|; +$noresave{$key} = "$nosave"; + +1; + + +# LaTeX2HTML 2002-2-1 (1.70) +# labels from external_latex_labels array. + + +$key = q/module-alsaaudio/; +$external_latex_labels{$key} = q|4|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-objects/; +$external_latex_labels{$key} = q|4.2|; +$noresave{$key} = "$nosave"; + +$key = q/mixer-objects/; +$external_latex_labels{$key} = q|4.3|; +$noresave{$key} = "$nosave"; + +$key = q/pcm-example/; +$external_latex_labels{$key} = q|4.4|; +$noresave{$key} = "$nosave"; + +1; + diff --git a/arch_src/pyalsaaudio-0.2/doc/mixer-objects.html b/arch_src/pyalsaaudio-0.2/doc/mixer-objects.html new file mode 100644 index 0000000..5a4d516 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/mixer-objects.html @@ -0,0 +1,327 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="pcm-example.html" /> +<link rel="prev" href="pcm-objects.html" /> +<link rel="parent" href="module-alsaaudio.html" /> +<link rel="next" href="pcm-example.html" /> +<meta name='aesop' content='information' /> +<title>4.3 Mixer Objects</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.2 PCM Objects" + href="pcm-objects.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.4 ALSA Examples" + href="pcm-example.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pcm-objects.html">4.2 PCM Objects</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="pcm-example.html">4.4 ALSA Examples</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H2><A NAME="SECTION002430000000000000000"></A> +<A NAME="mixer-objects"></A> +<BR> +4.3 Mixer Objects +</H2> + +<P> +Mixer objects provides access to the ALSA mixer API. + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-16' xml:id='l2h-16' class="class">Mixer</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>control</var><big>]</big><var>, </var><big>[</big><var>id</var><big>]</big><var>, </var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +<var>control</var> - specifies which control to manipulate using this mixer object. The list +of available controls can be found with the <tt class="module">alsaaudio</tt>.<tt class="function">mixers</tt> function. +The default value is 'Master' - other common controls include 'Master Mono', 'PCM', 'Line', etc. + +<P> +<var>id</var> - the id of the mixer control. Default is 0 + +<P> +<var>cardname</var> - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +</dl> + +<P> +Mixer objects have the following methods: + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-17' xml:id='l2h-17' class="method">cardname</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the name of the sound card used by this Mixer object +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-18' xml:id='l2h-18' class="method">mixer</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the name of the specific mixer controlled by this object, For example 'Master' +or 'PCM' +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-19' xml:id='l2h-19' class="method">mixerid</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the ID of the ALSA mixer controlled by this object. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-20' xml:id='l2h-20' class="method">switchcap</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Returns a list of the switches which are defined by this specific mixer. Possible values in +this list are: + +<P> +<div class="center"><table class="realtable"> + <thead> + <tr> + <th class="left" >Switch</th> + <th class="left" >Description</th> + </tr> + </thead> + <tbody> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Mute'</Volume></td> + <td class="left" >This mixer can be muted</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Mute'</Volume></td> + <td class="left" >This mixer can mute all channels at the same time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Playback Mute'</Volume></td> + <td class="left" >This mixer can mute the playback output</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Playback Mute'</Volume></td> + <td class="left" >Mute playback for all channels at the same time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Capture Mute'</Volume></td> + <td class="left" >Mute sound capture</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Capture Mute'</Volume></td> + <td class="left" >Mute sound capture for all channels at a time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Capture Exclusive'</Volume></td> + <td class="left" >Not quite sure what this is</td></tr></tbody> +</table></div> + +<P> +To manipulate these swithes use the <tt class="method">setrec</tt> or <tt class="method">setmute</tt> methods +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-21' xml:id='l2h-21' class="method">volumecap</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Returns a list of the volume control capabilities of this mixer. Possible values in +the list are: + +<P> +<div class="center"><table class="realtable"> + <thead> + <tr> + <th class="left" >Capability</th> + <th class="left" >Description</th> + </tr> + </thead> + <tbody> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Volume'</Volume></td> + <td class="left" >This mixer can control volume</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Volume'</Volume></td> + <td class="left" >This mixer can control volume for all channels at the same time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Playback Volume'</Volume></td> + <td class="left" >This mixer can manipulate the playback volume</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Playback Volume'</Volume></td> + <td class="left" >Manipulate playback volumne for all channels at the same time</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Capture Volume'</Volume></td> + <td class="left" >Manipulate sound capture volume</td></tr> + <tr><td class="left" valign="baseline"><Volume Capabilities>'Joined Capture Volume'</Volume></td> + <td class="left" >Manipulate sound capture volume for all channels at a time</td></tr></tbody> +</table></div> + +<P> +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-22' xml:id='l2h-22' class="method">getvolume</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>direction</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +Returns a list with the current volume settings for each channel. The list elements +are integer percentages. + +<P> +The optional <var>direction</var> argument can be either 'playback' or 'capture', which is relevant +if the mixer can control both playback and capture volume. The default value is 'playback' +if the mixer has this capability, otherwise 'capture' + +<P> +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-23' xml:id='l2h-23' class="method">getmute</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return a list indicating the current mute setting for each channel. 0 means not muted, 1 means muted. + +<P> +This method will fail if the mixer has no playback switch capabilities. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-24' xml:id='l2h-24' class="method">getrec</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return a list indicating the current record mute setting for each channel. 0 means not recording, 1 +means not recording. + +<P> +This method will fail if the mixer has no capture switch capabilities. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-25' xml:id='l2h-25' class="method">setvolume</tt></b>(</nobr></td> + <td><var>volume,</var><big>[</big><var>channel</var><big>]</big><var>,</var><big>[</big><var>direction</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +Change the current volume settings for this mixer. The <var>volume</var> argument controls +the new volume setting as an integer percentage. + +<P> +If the optional argument <var>channel</var> is present, the volume is set only for this channel. This +assumes that the mixer can control the volume for the channels independently. + +<P> +The optional <var>direction</var> argument can be either 'playback' or 'capture' is relevant if the mixer +has independent playback and capture volume capabilities, and controls which of the volumes +if changed. The default is 'playback' if the mixer has this capability, otherwise 'capture'. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-26' xml:id='l2h-26' class="method">setmute</tt></b>(</nobr></td> + <td><var>mute, </var><big>[</big><var>channel</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +Sets the mute flag to a new value. The <var>mute</var> argument is either 0 for not muted, or 1 for muted. + +<P> +The optional <var>channel</var> argument controls which channel is muted. The default is to set the mute flag +for all channels. + +<P> +This method will fail if the mixer has no playback mute capabilities +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-27' xml:id='l2h-27' class="method">setrec</tt></b>(</nobr></td> + <td><var>capture,</var><big>[</big><var>channel</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +Sets the capture mute flag to a new value. The <var>capture</var> argument is either 0 for no capture, +or 1 for capture. + +<P> +The optional <var>channel</var> argument controls which channel is changed. The default is to set the capture flag +for all channels. + +<P> +This method will fail if the mixer has no capture switch capabilities +</dl> + +<P> +<b>A Note on the ALSA Mixer API</b> + +<P> +The ALSA mixer API is extremely complicated - and hardly documented at all. <tt class="module">alsaaudio</tt> implements +a much simplified way to access this API. In designing the API I've had to make some choices which +may limit what can and cannot be controlled through the API. However, If I had chosen to implement the +full API, I would have reexposed the horrible complexity/documentation ratio of the underlying API. +At least the <tt class="module">alsaaudio</tt> API is easy to understand and use. + +<P> +If my design choises prevents you from doing something that the underlying API would have allowed, +please let me know, so I can incorporate these need into future versions. + +<P> +If the current state of affairs annoy you, the best you can do is to write a HOWTO on the API and +make this available on the net. Until somebody does this, the availability of ALSA mixer capable +devices will stay quite limited. + +<P> +Unfortunately, I'm not able to create such a HOWTO myself, since I only understand half of the API, +and that which I do understand has come from a painful trial and error process. + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.2 PCM Objects" + href="pcm-objects.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.4 ALSA Examples" + href="pcm-example.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="pcm-objects.html">4.2 PCM Objects</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="pcm-example.html">4.4 ALSA Examples</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/module-alsaaudio.html b/arch_src/pyalsaaudio-0.2/doc/module-alsaaudio.html new file mode 100644 index 0000000..c3673ee --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/module-alsaaudio.html @@ -0,0 +1,167 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="prev" href="node5.html" /> +<link rel="parent" href="contents.html" /> +<link rel="next" href="node7.html" /> +<meta name='aesop' content='information' /> +<title>4 alsaaudio</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="3 Installation" + href="node5.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.1 PCM Terminology and" + href="node7.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node5.html">3 Installation</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node7.html">4.1 PCM Terminology and</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION002400000000000000000"> +4 <tt class="module">alsaaudio</tt></A> +</H1> + +<P> +<A NAME="module-alsaaudio"></A> +<P> + +<p class="availability">Availability: <span + class="platform">Linux</span>.</p> + +<P> + +<P> + +<P> +The <tt class="module">alsaaudio</tt> module defines functions and classes for using +ALSA. + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-2' xml:id='l2h-2' class="function">mixers</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +List the available mixers. The optional <var>cardname</var> specifies which +card should be queried (this is only relevant if you have more than one +sound card). Omit to use the default sound card +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3' xml:id='l2h-3' class="class">PCM</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>type</var><big>]</big><var>, </var><big>[</big><var>mode</var><big>]</big><var>, </var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +This class is used to represent a PCM device (both playback and capture devices). +The arguments are: +<BR><var>type</var> - can be either PCM_CAPTURE or PCM_PLAYBACK (default). +<BR><var>mode</var> - can be either PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL (the default). +<BR><var>cardname</var> - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-4' xml:id='l2h-4' class="class">Mixer</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>control</var><big>]</big><var>, </var><big>[</big><var>id</var><big>]</big><var>, </var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> +This class is used to access a specific ALSA mixer. +The arguments are: +<BR><var>control</var> - Name of the chosen mixed (default is Master). +<BR><var>id</var> - id of mixer (default is 0) - More explaniation needed here +<BR><var>cardname</var> specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +</dl> + +<P> +<dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-5' xml:id='l2h-5' class="exception">ALSAAudioError</tt></b></dt> +<dd> +Exception raised when an operation fails for a ALSA specific reason. +The exception argument is a string describing the reason of the +failure. +</dd></dl> + +<P> + +<p><br /></p><hr class='online-navigation' /> +<div class='online-navigation'> +<!--Table of Child-Links--> +<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> + +<UL CLASS="ChildLinks"> +<LI><A href="node7.html">4.1 PCM Terminology and Concepts</a> +<LI><A href="pcm-objects.html">4.2 PCM Objects</a> +<LI><A href="mixer-objects.html">4.3 Mixer Objects</a> +<LI><A href="pcm-example.html">4.4 ALSA Examples</a> +</ul> +<!--End of Table of Child-Links--> +</div> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="3 Installation" + href="node5.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.1 PCM Terminology and" + href="node7.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node5.html">3 Installation</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node7.html">4.1 PCM Terminology and</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/modules.gif b/arch_src/pyalsaaudio-0.2/doc/modules.gif Binary files differnew file mode 100644 index 0000000..f5860b6 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/modules.gif diff --git a/arch_src/pyalsaaudio-0.2/doc/modules.png b/arch_src/pyalsaaudio-0.2/doc/modules.png Binary files differnew file mode 100644 index 0000000..8fa8b75 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/modules.png diff --git a/arch_src/pyalsaaudio-0.2/doc/next.gif b/arch_src/pyalsaaudio-0.2/doc/next.gif Binary files differnew file mode 100644 index 0000000..5dcaff8 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/next.gif diff --git a/arch_src/pyalsaaudio-0.2/doc/next.png b/arch_src/pyalsaaudio-0.2/doc/next.png Binary files differnew file mode 100644 index 0000000..cfe5e51 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/next.png diff --git a/arch_src/pyalsaaudio-0.2/doc/node3.html b/arch_src/pyalsaaudio-0.2/doc/node3.html new file mode 100644 index 0000000..e848a78 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/node3.html @@ -0,0 +1,120 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="node4.html" /> +<link rel="prev" href="contents.html" /> +<link rel="parent" href="contents.html" /> +<link rel="next" href="node4.html" /> +<meta name='aesop' content='information' /> +<title>1 What is ALSA</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="Contents" + href="contents.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="2 ALSA and Python" + href="node4.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="contents.html">Contents</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node4.html">2 ALSA and Python</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION002100000000000000000"> +1 What is ALSA</A> +</H1> + +<P> +The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI +functionality to the Linux operating system. + +<P> +Logically ALSA consists of these components: + +<UL> +<LI>A set of kernel drivers. +<BR> +These drivers are responsible for handling the physical sound + hardware from within the Linux kernel, and have been the standard + sound implementation in Linux since kernel version 2.5 +</LI> +<LI>A kernel level API for manipulating the ALSA devices. +</LI> +<LI>A user-space C library for simplified access to the sound hardware + from userspace applications. This library is called <i>libasound</i> + and is required by all ALSA capable applications. +</LI> +</UL> + +<P> +More information about ALSA may be found on the project homepage +<a class="url" href="http://www.alsa-project.org">http://www.alsa-project.org</a> +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="Contents" + href="contents.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="2 ALSA and Python" + href="node4.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="contents.html">Contents</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node4.html">2 ALSA and Python</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/node4.html b/arch_src/pyalsaaudio-0.2/doc/node4.html new file mode 100644 index 0000000..9c6ab01 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/node4.html @@ -0,0 +1,116 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="node5.html" /> +<link rel="prev" href="node3.html" /> +<link rel="parent" href="contents.html" /> +<link rel="next" href="node5.html" /> +<meta name='aesop' content='information' /> +<title>2 ALSA and Python</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="1 What is ALSA" + href="node3.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="3 Installation" + href="node5.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node3.html">1 What is ALSA</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node5.html">3 Installation</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION002200000000000000000"> +2 ALSA and Python</A> +</H1> + +<P> +The older Linux sound API (OSS) which is now deprecated is well supported +from the standard Python library, through the ossaudiodev module. No native +ALSA support exists in the standard library (yet). + +<P> +There are a few other ``ALSA for Python'' projects available, including at +least two different projects called pyAlsa. Neither of these seem to be under +active development at the time - and neither are very feature complete. + +<P> +I wrote PyAlsaAudio to fill this gap. My long term goal is to have the module +included in the standard Python library, but that is probably a while of yet. + +<P> +PyAlsaAudio hass full support for sound capture, playback of sound, as well as +the ALSA Mixer API. + +<P> +MIDI support is not available, and since I don't own any MIDI hardware, it's +difficult for me to implement it. Volunteers to work on this would be greatly +appreciated + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="1 What is ALSA" + href="node3.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="3 Installation" + href="node5.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node3.html">1 What is ALSA</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="node5.html">3 Installation</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/node5.html b/arch_src/pyalsaaudio-0.2/doc/node5.html new file mode 100644 index 0000000..923ac75 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/node5.html @@ -0,0 +1,115 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="module-alsaaudio.html" /> +<link rel="prev" href="node4.html" /> +<link rel="parent" href="contents.html" /> +<link rel="next" href="module-alsaaudio.html" /> +<meta name='aesop' content='information' /> +<title>3 Installation</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="2 ALSA and Python" + href="node4.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node4.html">2 ALSA and Python</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="module-alsaaudio.html">4 alsaaudio</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H1><A NAME="SECTION002300000000000000000"> +3 Installation</A> +</H1> + +<P> +Note: the wrappers link with the alsasound library (from the alsa-lib +package). Verify that this is installed by looking for /usr/lib/libasound.so +before building. Naturally you also need to use a kernel with proper ALSA +support. This is the default in Linux kernel 2.6 and later. If you are using +kernel version 2.4 you may need to install the ALSA patches yourself - although +most distributions ship with ALSA kernels. + +<P> +To install, execute the following: +<BR><div class="verbatim"><pre> +$ python setup.py build +</pre></div> + +<P> +And then as root: +<BR><div class="verbatim"><pre> +# python setup.py install +</pre></div> + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="2 ALSA and Python" + href="node4.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="Contents" + href="contents.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node4.html">2 ALSA and Python</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="contents.html">Contents</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="module-alsaaudio.html">4 alsaaudio</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/node7.html b/arch_src/pyalsaaudio-0.2/doc/node7.html new file mode 100644 index 0000000..f58333a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/node7.html @@ -0,0 +1,169 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="pcm-objects.html" /> +<link rel="prev" href="module-alsaaudio.html" /> +<link rel="parent" href="module-alsaaudio.html" /> +<link rel="next" href="pcm-objects.html" /> +<meta name='aesop' content='information' /> +<title>4.1 PCM Terminology and Concepts</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.2 PCM Objects" + href="pcm-objects.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="pcm-objects.html">4.2 PCM Objects</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H2><A NAME="SECTION002410000000000000000"> +4.1 PCM Terminology and Concepts</A> +</H2> + +<P> +In order to use PCM devices it is useful to be familiar with some concepts and +terminology. + +<P> +<DL> +<DT><STRONG>Sample</STRONG></DT> +<DD>PCM audio, whether it is input or output, consists at the lowest level +of a number of single samples. A sample represents the sound in a single channel in +a brief interval. If more than one channel is in use, more than one sample is required +for each interval to describe the sound. Samples can be of many different sizes, ranging +from 8 bit to 64 bit presition. The specific format of each sample can also vary - they +can be big endian byte order, little endian byte order, or even floats. + +<P> +</DD> +<DT><STRONG>Frame</STRONG></DT> +<DD>A frame consists of exactly one sample per channel. If there is only one +channel (Mono sound) a frame is simply a single sample. If the sound is stereo, each frame +consists of two samples, etc. + +<P> +</DD> +<DT><STRONG>Frame size</STRONG></DT> +<DD>This is the size in bytes of each frame. This can vary a lot: if each sample is +8 bits, and we're handling mono sound, the frame size is one byte. Similarly in 6 channel audio with +64 bit floating point samples, the frame size is 48 bytes + +<P> +</DD> +<DT><STRONG>Rate</STRONG></DT> +<DD>PCM sound consists of a flow of sound frames. The sound rate controls how often +the current frame is replaced. For example, a rate of 8000 Hz means that a new frame is played +or captured 8000 times per second. + +<P> +</DD> +<DT><STRONG>Data rate</STRONG></DT> +<DD>This is the number of bytes, which must be recorded or provided per second +at a certain frame size and rate. + +<P> +8000 Hz mono sound with 8 bit (1 byte) samples has a data rate of 8000 * 1 * 1 = 8 kb/s + +<P> +At the other end of the scale, 96000 Hz, 6 channel sound with 64 bit (8 bytes) samples +has a data rate of 96000 * 6 * 8 = 4608 kb/s (almost 5 Mb sound data per second) + +<P> +</DD> +<DT><STRONG>Period</STRONG></DT> +<DD>When the hardware processes data this is done in chunks of frames. The time interval +between each processing (A/D or D/A conversion) is known as the period. The size of the period has +direct implication on the latency of the sound input or output. For low-latency the period size should +be very small, while low CPU resource usage would usually demand larger period sizes. With ALSA, the +CPU utilization is not impacted much by the period size, since the kernel layer buffers multiple +periods internally, so each period generates an interrupt and a memory copy, but userspace can be +slower and read or write multiple periods at the same time. + +<P> +</DD> +<DT><STRONG>Period size</STRONG></DT> +<DD>This is the size of each period in Hz. <em>Not bytes, but Hz!.</em> In <tt class="module">alsaaudio</tt> +the period size is set directly, and it is therefore important to understand the significance of this +number. If the period size is configured to for example 32, each write should contain exactly 32 frames +of sound data, and each read will return either 32 frames of data or nothing at all. + +<P> +</DD> +</DL> + +<P> +Once you understand these concepts, you will be ready to actually utilize PCM API. Read on. + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.2 PCM Objects" + href="pcm-objects.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="pcm-objects.html">4.2 PCM Objects</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/pcm-example.html b/arch_src/pyalsaaudio-0.2/doc/pcm-example.html new file mode 100644 index 0000000..d458bac --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/pcm-example.html @@ -0,0 +1,99 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="prev" href="mixer-objects.html" /> +<link rel="parent" href="module-alsaaudio.html" /> +<link rel="next" href="about.html" /> +<meta name='aesop' content='information' /> +<title>4.4 ALSA Examples </title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.3 Mixer Objects" + href="mixer-objects.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="About this document ..." + href="about.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="mixer-objects.html">4.3 Mixer Objects</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="about.html">About this document ...</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H2><A NAME="SECTION002440000000000000000"></A><A NAME="pcm-example"></A> +<BR> +4.4 ALSA Examples +</H2> + +<P> +For now, the only examples available are the 'playbacktest.py' and the 'recordtest.py' programs included. +This will change in a future version. + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.3 Mixer Objects" + href="mixer-objects.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="About this document ..." + href="about.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="mixer-objects.html">4.3 Mixer Objects</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="about.html">About this document ...</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/pcm-objects.html b/arch_src/pyalsaaudio-0.2/doc/pcm-objects.html new file mode 100644 index 0000000..3fc5d78 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/pcm-objects.html @@ -0,0 +1,331 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="mixer-objects.html" /> +<link rel="prev" href="node7.html" /> +<link rel="parent" href="module-alsaaudio.html" /> +<link rel="next" href="mixer-objects.html" /> +<meta name='aesop' content='information' /> +<title>4.2 PCM Objects</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.1 PCM Terminology and" + href="node7.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.3 Mixer Objects" + href="mixer-objects.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node7.html">4.1 PCM Terminology and</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="mixer-objects.html">4.3 Mixer Objects</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<H2><A NAME="SECTION002420000000000000000"></A> +<A NAME="pcm-objects"></A> +<BR> +4.2 PCM Objects +</H2> + +<P> +The acronym PCM is short for Pulse Code Modulation and is the method used in ALSA +and many other places to handle playback and capture of sampled sound data. + +<P> +PCM objects in <tt class="module">alsaaudio</tt> are used to do exactly that, either play sample based +sound or capture sound from some input source (perhaps a microphone). The PCM object +constructor takes the following arguments: + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-6' xml:id='l2h-6' class="class">PCM</tt></b>(</nobr></td> + <td><var></var><big>[</big><var>type</var><big>]</big><var>, </var><big>[</big><var>mode</var><big>]</big><var>, </var><big>[</big><var>cardname</var><big>]</big><var></var>)</td></tr></table></dt> +<dd> + +<P> +<var>type</var> - can be either PCM_CAPTURE or PCM_PLAYBACK (default). + +<P> +<var>mode</var> - can be either PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL (the default). +In PCM_NONBLOCK mode, calls to read will return immediately independent of wether +there is any actual data to read. Similarly, write calls will return immediately +without actually writing anything to the playout buffer if the buffer is full. + +<P> +In the current version of <tt class="module">alsaaudio</tt> PCM_ASYNC is useless, since it relies +on a callback procedure, which can't be specified from Python. + +<P> +<var>cardname</var> - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card + +<P> +This will construct a PCM object with default settings: + +<P> +Sample format: PCM_FORMAT_S16_LE +<BR> +Rate: 8000 Hz +<BR> +Channels: 2 +<BR> +Period size: 32 frames +<BR></dl> + +<P> +PCM objects have the following methods: + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-7' xml:id='l2h-7' class="method">pcmtype</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Returns the type of PCM object. Either PCM_CAPTURE or PCM_PLAYBACK. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-8' xml:id='l2h-8' class="method">pcmmode</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the mode of the PCM object. One of PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-9' xml:id='l2h-9' class="method">cardname</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +Return the name of the sound card used by this PCM object. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-10' xml:id='l2h-10' class="method">setchannels</tt></b>(</nobr></td> + <td><var>nchannels</var>)</td></tr></table></dt> +<dd> +Used to set the number of capture or playback channels. Common values are: 1 = mono, 2 = stereo, +and 6 = full 6 channel audio. Few sound cards support more than 2 channels +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-11' xml:id='l2h-11' class="method">setrate</tt></b>(</nobr></td> + <td><var>rate</var>)</td></tr></table></dt> +<dd> +Set the sample rate in Hz for the device. Typical values are 8000 (poor sound), 16000, 44100 (cd quality), +and 96000 +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-12' xml:id='l2h-12' class="method">setformat</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +The sound format of the device. Sound format controls how the PCM device interpret data for playback, +and how data is encoded in captures. + +<P> +The following formats are provided by ALSA: +<div class="center"><table class="realtable"> + <thead> + <tr> + <th class="left" >Format</th> + <th class="left" >Description</th> + </tr> + </thead> + <tbody> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S8</Formats></td> + <td class="left" >Signed 8 bit samples for each channel</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U8</Formats></td> + <td class="left" >Signed 8 bit samples for each channel</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S16_LE</Formats></td> + <td class="left" >Signed 16 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S16_BE</Formats></td> + <td class="left" >Signed 16 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U16_LE</Formats></td> + <td class="left" >Unsigned 16 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U16_BE</Formats></td> + <td class="left" >Unsigned 16 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S24_LE</Formats></td> + <td class="left" >Signed 24 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S24_BE</Formats></td> + <td class="left" >Signed 24 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U24_LE</Formats></td> + <td class="left" >Unsigned 24 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U24_BE</Formats></td> + <td class="left" >Unsigned 24 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S32_LE</Formats></td> + <td class="left" >Signed 32 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_S32_BE</Formats></td> + <td class="left" >Signed 32 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U32_LE</Formats></td> + <td class="left" >Unsigned 32 bit samples for each channel (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_U32_BE</Formats></td> + <td class="left" >Unsigned 32 bit samples for each channel (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_FLOAT_LE</Formats></td> + <td class="left" >32 bit samples encoded as float. (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_FLOAT_BE</Formats></td> + <td class="left" >32 bit samples encoded as float (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_FLOAT64_LE</Formats></td> + <td class="left" >64 bit samples encoded as float. (Little Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_FLOAT64_BE</Formats></td> + <td class="left" >64 bit samples encoded as float. (Big Endian byte order)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_MU_LAW</Formats></td> + <td class="left" >A logarithmic encoding (used by Sun .au files)</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_A_LAW</Formats></td> + <td class="left" >Another logarithmic encoding</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_IMA_ADPCM</Formats></td> + <td class="left" >a 4:1 compressed format defined by the Interactive Multimedia Association</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_MPEG</Formats></td> + <td class="left" >MPEG encoded audio?</td></tr> + <tr><td class="left" valign="baseline"><Formats>PCM_FORMAT_GSM</Formats></td> + <td class="left" >9600 constant rate encoding well suitet for speech</td></tr></tbody> +</table></div> + +<P> +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-13' xml:id='l2h-13' class="method">setperiodsize</tt></b>(</nobr></td> + <td><var>period</var>)</td></tr></table></dt> +<dd> +Sets the actual period size in frames. Each write should consist of exactly this number of frames, and +each read will return this number of frames (unless the device is in PCM_NONBLOCK mode, in which case +it may return nothing at all) +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-14' xml:id='l2h-14' class="method">read</tt></b>(</nobr></td> + <td><var></var>)</td></tr></table></dt> +<dd> +In PCM_NORMAL mode, this function blocks until a full period is available, and then returns a +tuple (length,data) where <em>length</em> is the size in bytes of the captured data, and <em>data</em> +is the captured sound frames as a string. The length of the returned data will be periodsize*framesize +bytes. + +<P> +In PCM_NONBLOCK mode, the call will not block, but will return <code>(0,'')</code> if no new period +has become available since the last call to read. +</dl> + +<P> +<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> + <td><nobr><b><tt id='l2h-15' xml:id='l2h-15' class="method">write</tt></b>(</nobr></td> + <td><var>data</var>)</td></tr></table></dt> +<dd> +Writes (plays) the sound in data. The length of data <em>must</em> be a multiple of the frame size, and +<em>should</em> be exactly the size of a period. If less than 'period size' frames are provided, the actual +playout will not happen until more data is written. + +<P> +If the device is not in PCM_NONBLOCK mode, this call will block if the kernel buffer is full, and +until enough sound has been played to allow the sound data to be buffered. The call always returns +the size of the data provided + +<P> +In PCM_NONBLOCK mode, the call will return immediately, with a return value of zero, if the buffer is +full. In this case, the data should be written at a later time. + +<P> +</dl> + +<P> +<strong>A few hints on using PCM devices for playback</strong> + +<P> +The most common reason for problems with playback of PCM audio, is that the people don't properly understand +that writes to PCM devices must match <em>exactly</em> the data rate of the device. + +<P> +If too little data is written to the device, it will underrun, and ugly clicking sounds will occur. Conversely, +of too much data is written to the device, the write function will either block (PCM_NORMAL mode) or return zero +(PCM_NONBLOCK mode). + +<P> +If your program does nothing, but play sound, the easiest way is to put the device in PCM_NORMAL mode, and just +write as much data to the device as possible. This strategy can also be achieved by using a separate thread +with the sole task of playing out sound. + +<P> +In GUI programs, however, it may be a better strategy to setup the device, preload the buffer with a few +periods by calling write a couple of times, and then use some timer method to write one period size of data to +the device every period. The purpose of the preloading is to avoid underrun clicks if the used timer +doesn't expire exactly on time. + +<P> +Also note, that most timer API's that you can find for Python will cummulate time delays: If you set the timer +to expire after 1/10'th of a second, the actual timeout will happen slightly later, which will accumulate to +quite a lot after a few seconds. Hint: use time.time() to check how much time has really passed, and add +extra writes as nessecary. + +<P> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><a rel="prev" title="4.1 PCM Terminology and" + href="node7.html"><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></A></td> +<td class='online-navigation'><a rel="parent" title="4 alsaaudio" + href="module-alsaaudio.html"><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></A></td> +<td class='online-navigation'><a rel="next" title="4.3 Mixer Objects" + href="mixer-objects.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Previous:</b> +<a class="sectref" rel="prev" href="node7.html">4.1 PCM Terminology and</A> +<b class="navlabel">Up:</b> +<a class="sectref" rel="parent" href="module-alsaaudio.html">4 alsaaudio</A> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="mixer-objects.html">4.3 Mixer Objects</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/previous.gif b/arch_src/pyalsaaudio-0.2/doc/previous.gif Binary files differnew file mode 100644 index 0000000..de1da16 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/previous.gif diff --git a/arch_src/pyalsaaudio-0.2/doc/previous.png b/arch_src/pyalsaaudio-0.2/doc/previous.png Binary files differnew file mode 100644 index 0000000..497def4 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/previous.png diff --git a/arch_src/pyalsaaudio-0.2/doc/pyalsaaudio.css b/arch_src/pyalsaaudio-0.2/doc/pyalsaaudio.css new file mode 100644 index 0000000..06a613c --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/pyalsaaudio.css @@ -0,0 +1,243 @@ +/* + * The first part of this is the standard CSS generated by LaTeX2HTML, + * with the "empty" declarations removed. + */ + +/* Century Schoolbook font is very similar to Computer Modern Math: cmmi */ +.math { font-family: "Century Schoolbook", serif; } +.math i { font-family: "Century Schoolbook", serif; + font-weight: bold } +.boldmath { font-family: "Century Schoolbook", serif; + font-weight: bold } + +/* + * Implement both fixed-size and relative sizes. + * + * I think these can be safely removed, as it doesn't appear that + * LaTeX2HTML ever generates these, even though these are carried + * over from the LaTeX2HTML stylesheet. + */ +small.xtiny { font-size : xx-small; } +small.tiny { font-size : x-small; } +small.scriptsize { font-size : smaller; } +small.footnotesize { font-size : small; } +big.xlarge { font-size : large; } +big.xxlarge { font-size : x-large; } +big.huge { font-size : larger; } +big.xhuge { font-size : xx-large; } + +/* + * Document-specific styles come next; + * these are added for the Python documentation. + * + * Note that the size specifications for the H* elements are because + * Netscape on Solaris otherwise doesn't get it right; they all end up + * the normal text size. + */ + +body { color: #000000; + background-color: #ffffff; } + +a:link:active { color: #ff0000; } +a:link:hover { background-color: #bbeeff; } +a:visited:hover { background-color: #bbeeff; } +a:visited { color: #551a8b; } +a:link { color: #0000bb; } + +h1, h2, h3, h4, h5, h6 { font-family: avantgarde, sans-serif; + font-weight: bold; } +h1 { font-size: 180%; } +h2 { font-size: 150%; } +h3, h4 { font-size: 120%; } + +/* These are section titles used in navigation links, so make sure we + * match the section header font here, even it not the weight. + */ +.sectref { font-family: avantgarde, sans-serif; } +/* And the label before the titles in navigation: */ +.navlabel { font-size: 85%; } + + +/* LaTeX2HTML insists on inserting <br> elements into headers which + * are marked with \label. This little bit of CSS magic ensures that + * these elements don't cause spurious whitespace to be added. + */ +h1>br, h2>br, h3>br, +h4>br, h5>br, h6>br { display: none; } + +code, tt { font-family: "lucida typewriter", lucidatypewriter, + monospace; } +var { font-family: times, serif; + font-style: italic; + font-weight: normal; } + +.Unix { font-variant: small-caps; } + +.typelabel { font-family: lucida, sans-serif; } + +.navigation td { background-color: #99ccff; + font-weight: bold; + font-family: avantgarde, sans-serif; + font-size: 110%; } + +div.warning { background-color: #fffaf0; + border: thin solid black; + padding: 1em; + margin-left: 2em; + margin-right: 2em; } + +div.warning .label { font-family: sans-serif; + font-size: 110%; + margin-right: 0.5em; } + +div.note { background-color: #fffaf0; + border: thin solid black; + padding: 1em; + margin-left: 2em; + margin-right: 2em; } + +div.note .label { margin-right: 0.5em; + font-family: sans-serif; } + +address { font-size: 80%; } +.release-info { font-style: italic; + font-size: 80%; } + +.titlegraphic { vertical-align: top; } + +.verbatim pre { color: #00008b; + font-family: "lucida typewriter", lucidatypewriter, + monospace; + font-size: 90%; } +.verbatim { margin-left: 2em; } +.verbatim .footer { padding: 0.05in; + font-size: 85%; + background-color: #99ccff; + margin-right: 0.5in; } + +.grammar { background-color: #99ccff; + margin-right: 0.5in; + padding: 0.05in; } +.grammar-footer { padding: 0.05in; + font-size: 85%; } +.grammartoken { font-family: "lucida typewriter", lucidatypewriter, + monospace; } + +.productions { background-color: #bbeeff; } +.productions a:active { color: #ff0000; } +.productions a:link:hover { background-color: #99ccff; } +.productions a:visited:hover { background-color: #99ccff; } +.productions a:visited { color: #551a8b; } +.productions a:link { color: #0000bb; } +.productions table { vertical-align: baseline; + empty-cells: show; } +.productions > table td, +.productions > table th { padding: 2px; } +.productions > table td:first-child, +.productions > table td:last-child { + font-family: "lucida typewriter", + lucidatypewriter, + monospace; + } +/* same as the second selector above, but expressed differently for Opera */ +.productions > table td:first-child + td + td { + font-family: "lucida typewriter", + lucidatypewriter, + monospace; + vertical-align: baseline; + } +.productions > table td:first-child + td { + padding-left: 1em; + padding-right: 1em; + } +.productions > table tr { vertical-align: baseline; } + +.email { font-family: avantgarde, sans-serif; } +.mailheader { font-family: avantgarde, sans-serif; } +.mimetype { font-family: avantgarde, sans-serif; } +.newsgroup { font-family: avantgarde, sans-serif; } +.url { font-family: avantgarde, sans-serif; } +.file { font-family: avantgarde, sans-serif; } +.guilabel { font-family: avantgarde, sans-serif; } + +.realtable { border-collapse: collapse; + border-color: black; + border-style: solid; + border-width: 0px 0px 2px 0px; + empty-cells: show; + margin-left: auto; + margin-right: auto; + padding-left: 0.4em; + padding-right: 0.4em; + } +.realtable tbody { vertical-align: baseline; } +.realtable tfoot { display: table-footer-group; } +.realtable thead { background-color: #99ccff; + border-width: 0px 0px 2px 1px; + display: table-header-group; + font-family: avantgarde, sans-serif; + font-weight: bold; + vertical-align: baseline; + } +.realtable thead :first-child { + border-width: 0px 0px 2px 0px; + } +.realtable thead th { border-width: 0px 0px 2px 1px } +.realtable td, +.realtable th { border-color: black; + border-style: solid; + border-width: 0px 0px 1px 1px; + padding-left: 0.4em; + padding-right: 0.4em; + } +.realtable td:first-child, +.realtable th:first-child { + border-left-width: 0px; + vertical-align: baseline; + } +.center { text-align: center; } +.left { text-align: left; } +.right { text-align: right; } + +.refcount-info { font-style: italic; } +.refcount-info .value { font-weight: bold; + color: #006600; } + +/* + * Some decoration for the "See also:" blocks, in part inspired by some of + * the styling on Lars Marius Garshol's XSA pages. + * (The blue in the navigation bars is #99CCFF.) + */ +.seealso { background-color: #fffaf0; + border: thin solid black; + padding: 0pt 1em 4pt 1em; } + +.seealso > .heading { font-size: 110%; + font-weight: bold; } + +/* + * Class 'availability' is used for module availability statements at + * the top of modules. + */ +.availability .platform { font-weight: bold; } + + +/* + * Additional styles for the distutils package. + */ +.du-command { font-family: monospace; } +.du-option { font-family: avantgarde, sans-serif; } +.du-filevar { font-family: avantgarde, sans-serif; + font-style: italic; } +.du-xxx:before { content: "** "; + font-weight: bold; } +.du-xxx:after { content: " **"; + font-weight: bold; } + + +/* + * Some specialization for printed output. + */ +@media print { + .online-navigation { display: none; } + } diff --git a/arch_src/pyalsaaudio-0.2/doc/pyalsaaudio.html b/arch_src/pyalsaaudio-0.2/doc/pyalsaaudio.html new file mode 100644 index 0000000..fc3e86f --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/pyalsaaudio.html @@ -0,0 +1,110 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<link rel="STYLESHEET" href="pyalsaaudio.css" type='text/css' /> +<link rel="first" href="pyalsaaudio.html" title='PyAlsaAudio' /> +<link rel='contents' href='contents.html' title="Contents" /> +<link rel='last' href='about.html' title='About this document...' /> +<link rel='help' href='about.html' title='About this document...' /> +<link rel="next" href="front.html" /> +<meta name='aesop' content='information' /> +<title>PyAlsaAudio</title> +</head> +<body> +<DIV CLASS="navigation"> +<div id='top-navigation-panel' xml:id='top-navigation-panel'> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></td> +<td class='online-navigation'><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></td> +<td class='online-navigation'><a rel="next" title="Front Matter" + href="front.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="front.html">Front Matter</A> +</div> +<hr /></div> +</DIV> +<!--End of Navigation Panel--> + +<div class="titlepage"> +<div class='center'> +<h1>PyAlsaAudio</h1> +<p><b><font size="+2">Casper Wilstrup</font></b></p> +<p>cwi@unispeed.com</p> +<p></p> +</div> +</div> + +<P> + +<p><br /></p><hr class='online-navigation' /> +<div class='online-navigation'> +<!--Table of Child-Links--> +<A NAME="CHILD_LINKS"></a> + +<UL CLASS="ChildLinks"> +<LI><A href="front.html">Front Matter</a> +<LI><A href="contents.html">Contents</a> +<UL> +<LI><A href="node3.html">1 What is ALSA</a> +<LI><A href="node4.html">2 ALSA and Python</a> +<LI><A href="node5.html">3 Installation</a> +<LI><A href="module-alsaaudio.html">4 <tt class="module">alsaaudio</tt></a> +<UL> +<LI><A href="node7.html">4.1 PCM Terminology and Concepts</a> +<LI><A href="pcm-objects.html">4.2 PCM Objects</a> +<LI><A href="mixer-objects.html">4.3 Mixer Objects</a> +<LI><A href="pcm-example.html">4.4 ALSA Examples</a> +</ul> +</ul> +<LI><A href="about.html">About this document ...</a> +</ul> +<!--End of Table of Child-Links--> +</div> + +<DIV CLASS="navigation"> +<div class='online-navigation'> +<p></p><hr /> +<table align="center" width="100%" cellpadding="0" cellspacing="2"> +<tr> +<td class='online-navigation'><img src='previous.png' + border='0' height='32' alt='Previous Page' width='32' /></td> +<td class='online-navigation'><img src='up.png' + border='0' height='32' alt='Up One Level' width='32' /></td> +<td class='online-navigation'><a rel="next" title="Front Matter" + href="front.html"><img src='next.png' + border='0' height='32' alt='Next Page' width='32' /></A></td> +<td align="center" width="100%">PyAlsaAudio</td> +<td class='online-navigation'><a rel="contents" title="Table of Contents" + href="contents.html"><img src='contents.png' + border='0' height='32' alt='Contents' width='32' /></A></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +<td class='online-navigation'><img src='blank.png' + border='0' height='32' alt='' width='32' /></td> +</tr></table> +<div class='online-navigation'> +<b class="navlabel">Next:</b> +<a class="sectref" rel="next" href="front.html">Front Matter</A> +</div> +</div> +<hr /> +<span class="release-info">Release 0.2.</span> +</DIV> +<!--End of Navigation Panel--> + +</BODY> +</HTML> diff --git a/arch_src/pyalsaaudio-0.2/doc/pyfav.gif b/arch_src/pyalsaaudio-0.2/doc/pyfav.gif Binary files differnew file mode 100644 index 0000000..58271ed --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/pyfav.gif diff --git a/arch_src/pyalsaaudio-0.2/doc/pyfav.png b/arch_src/pyalsaaudio-0.2/doc/pyfav.png Binary files differnew file mode 100644 index 0000000..d2d8669 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/pyfav.png diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/README.txt b/arch_src/pyalsaaudio-0.2/doc/src/.svn/README.txt new file mode 100644 index 0000000..271a8ce --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/README.txt @@ -0,0 +1,2 @@ +This is a Subversion working copy administrative directory. +Visit http://subversion.tigris.org/ for more information. diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/dir-wcprops b/arch_src/pyalsaaudio-0.2/doc/src/.svn/dir-wcprops new file mode 100644 index 0000000..208849d --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/dir-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/Shtoom/!svn/ver/1274/trunk/audio/pyalsaaudio/doc/src +END diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/empty-file b/arch_src/pyalsaaudio-0.2/doc/src/.svn/empty-file new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/empty-file diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/entries b/arch_src/pyalsaaudio-0.2/doc/src/.svn/entries new file mode 100644 index 0000000..3bd9b4c --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/entries @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<wc-entries + xmlns="svn:"> +<entry + committed-rev="1274" + name="" + committed-date="2005-03-25T23:37:10.228413Z" + url="http://casperr@divmod.org/svn/Shtoom/trunk/audio/pyalsaaudio/doc/src" + last-author="casper" + kind="dir" + revision="1584"/> +<entry + committed-rev="1585" + name="libalsaaudio.tex" + text-time="2005-07-09T21:08:46.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="757600e4551bc4d9367fcbfe79a0b144" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="pyalsaaudio.tex" + text-time="2005-07-09T21:08:58.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="43e07db73c7507adde7404d63a2b42f6" + last-author="casper" + kind="file" + revision="1585"/> +<entry + committed-rev="1585" + name="Makefile" + text-time="2005-07-09T21:14:53.000000Z" + committed-date="2005-07-09T21:26:15.500773Z" + checksum="350ef37c7f1fcf3e2ff2c4a05eec328d" + last-author="casper" + kind="file" + revision="1585"/> +</wc-entries> diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/format b/arch_src/pyalsaaudio-0.2/doc/src/.svn/format new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/format @@ -0,0 +1 @@ +4 diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/Makefile.svn-base b/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/Makefile.svn-base new file mode 100644 index 0000000..44c3313 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/Makefile.svn-base @@ -0,0 +1,20 @@ +# Makefile for PyAlsaAudio documentation +# +# In order to use this you need an unpacked version of the +# Python source available. Set the source path below +# +# You also need a working latex installation, and the latex2html +# tool installed. +PYTHONSOURCE = /usr/src/Python-2.4.1/ + +# Shouldn't need to change anything below here! + +MKHOWTO = $(PYTHONSOURCE)/Doc/tools/mkhowto + +all: + $(MKHOWTO) --dir .. --html pyalsaaudio.tex + +text: + $(MKHOWTO) --dir .. --text pyalsaaudio.tex + + diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/libalsaaudio.tex.svn-base b/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/libalsaaudio.tex.svn-base new file mode 100644 index 0000000..c50ffe5 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/libalsaaudio.tex.svn-base @@ -0,0 +1,397 @@ +\section{\module{alsaaudio}} + +%\declaremodule{builtin}{alsaaudio} % standard library, in C +\declaremodule{extension}{alsaaudio} % not standard, in C + +\platform{Linux} + +\moduleauthor{Casper Wilstrup}{cwi@unispeed.com} % Author of the module code; + + +\modulesynopsis{ALSA sound support} + + +The \module{alsaaudio} module defines functions and classes for using +ALSA. + +% ---- 3.1. ---- +% For each function, use a ``funcdesc'' block. This has exactly two +% parameters (each parameters is contained in a set of curly braces): +% the first parameter is the function name (this automatically +% generates an index entry); the second parameter is the function's +% argument list. If there are no arguments, use an empty pair of +% curly braces. If there is more than one argument, separate the +% arguments with backslash-comma. Optional parts of the parameter +% list are contained in \optional{...} (this generates a set of square +% brackets around its parameter). Arguments are automatically set in +% italics in the parameter list. Each argument should be mentioned at +% least once in the description; each usage (even inside \code{...}) +% should be enclosed in \var{...}. + +\begin{funcdesc}{mixers}{\optional{cardname}} +List the available mixers. The optional \var{cardname} specifies which +card should be queried (this is only relevant if you have more than one +sound card). Omit to use the default sound card +\end{funcdesc} + +\begin{classdesc}{PCM}{\optional{type}, \optional{mode}, \optional{cardname}} +This class is used to represent a PCM device (both playback and capture devices). +The arguments are: \\ +\var{type} - can be either PCM_CAPTURE or PCM_PLAYBACK (default). \\ +\var{mode} - can be either PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL (the default).\\ +\var{cardname} - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +\end{classdesc} + +\begin{classdesc}{Mixer}{\optional{control}, \optional{id}, \optional{cardname}} +This class is used to access a specific ALSA mixer. +The arguments are: \\ +\var{control} - Name of the chosen mixed (default is Master). \\ +\var{id} - id of mixer (default is 0) -- More explaniation needed here\\ +\var{cardname} specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +\end{classdesc} + + +\begin{excdesc}{ALSAAudioError} +Exception raised when an operation fails for a ALSA specific reason. +The exception argument is a string describing the reason of the +failure. +\end{excdesc} + +\subsection{PCM Terminology and Concepts} + +In order to use PCM devices it is useful to be familiar with some concepts and +terminology. + +\begin{description} +\item[Sample] PCM audio, whether it is input or output, consists at the lowest level +of a number of single samples. A sample represents the sound in a single channel in +a brief interval. If more than one channel is in use, more than one sample is required +for each interval to describe the sound. Samples can be of many different sizes, ranging +from 8 bit to 64 bit presition. The specific format of each sample can also vary - they +can be big endian byte order, little endian byte order, or even floats. + +\item[Frame] A frame consists of exactly one sample per channel. If there is only one +channel (Mono sound) a frame is simply a single sample. If the sound is stereo, each frame +consists of two samples, etc. + +\item[Frame size] This is the size in bytes of each frame. This can vary a lot: if each sample is +8 bits, and we're handling mono sound, the frame size is one byte. Similarly in 6 channel audio with +64 bit floating point samples, the frame size is 48 bytes + +\item[Rate] PCM sound consists of a flow of sound frames. The sound rate controls how often +the current frame is replaced. For example, a rate of 8000 Hz means that a new frame is played +or captured 8000 times per second. + +\item[Data rate] This is the number of bytes, which must be recorded or provided per second +at a certain frame size and rate. + +8000 Hz mono sound with 8 bit (1 byte) samples has a data rate of 8000 * 1 * 1 = 8 kb/s + +At the other end of the scale, 96000 Hz, 6 channel sound with 64 bit (8 bytes) samples +has a data rate of 96000 * 6 * 8 = 4608 kb/s (almost 5 Mb sound data per second) + +\item[Period] When the hardware processes data this is done in chunks of frames. The time interval +between each processing (A/D or D/A conversion) is known as the period. The size of the period has +direct implication on the latency of the sound input or output. For low-latency the period size should +be very small, while low CPU resource usage would usually demand larger period sizes. With ALSA, the +CPU utilization is not impacted much by the period size, since the kernel layer buffers multiple +periods internally, so each period generates an interrupt and a memory copy, but userspace can be +slower and read or write multiple periods at the same time. + +\item[Period size] This is the size of each period in Hz. \emph{Not bytes, but Hz!.} In \module{alsaaudio} +the period size is set directly, and it is therefore important to understand the significance of this +number. If the period size is configured to for example 32, each write should contain exactly 32 frames +of sound data, and each read will return either 32 frames of data or nothing at all. + +\end{description} + +Once you understand these concepts, you will be ready to actually utilize PCM API. Read on. + +\subsection{PCM Objects} +\label{pcm-objects} + +The acronym PCM is short for Pulse Code Modulation and is the method used in ALSA +and many other places to handle playback and capture of sampled sound data. + +PCM objects in \module{alsaaudio} are used to do exactly that, either play sample based +sound or capture sound from some input source (perhaps a microphone). The PCM object +constructor takes the following arguments: + +\begin{classdesc}{PCM}{\optional{type}, \optional{mode}, \optional{cardname}} + +\var{type} - can be either PCM_CAPTURE or PCM_PLAYBACK (default). + +\var{mode} - can be either PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL (the default). +In PCM_NONBLOCK mode, calls to read will return immediately independent of wether +there is any actual data to read. Similarly, write calls will return immediately +without actually writing anything to the playout buffer if the buffer is full. + +In the current version of \module{alsaaudio} PCM_ASYNC is useless, since it relies +on a callback procedure, which can't be specified from Python. + +\var{cardname} - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card + +This will construct a PCM object with default settings: + +Sample format: PCM_FORMAT_S16_LE \\ +Rate: 8000 Hz \\ +Channels: 2 \\ +Period size: 32 frames \\ +\end{classdesc} + +PCM objects have the following methods: + +\begin{methoddesc}[PCM]{pcmtype}{} +Returns the type of PCM object. Either PCM_CAPTURE or PCM_PLAYBACK. +\end{methoddesc} + +\begin{methoddesc}[PCM]{pcmmode}{} +Return the mode of the PCM object. One of PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL +\end{methoddesc} + +\begin{methoddesc}[PCM]{cardname}{} +Return the name of the sound card used by this PCM object. +\end{methoddesc} + +\begin{methoddesc}[PCM]{setchannels}{nchannels} +Used to set the number of capture or playback channels. Common values are: 1 = mono, 2 = stereo, +and 6 = full 6 channel audio. Few sound cards support more than 2 channels +\end{methoddesc} + +\begin{methoddesc}[PCM]{setrate}{rate} +Set the sample rate in Hz for the device. Typical values are 8000 (poor sound), 16000, 44100 (cd quality), +and 96000 +\end{methoddesc} + +\begin{methoddesc}[PCM]{setformat}{} +The sound format of the device. Sound format controls how the PCM device interpret data for playback, +and how data is encoded in captures. + +The following formats are provided by ALSA: +\begin{tableii}{l|l}{Formats}{Format}{Description} + \lineii{PCM_FORMAT_S8}{Signed 8 bit samples for each channel} + \lineii{PCM_FORMAT_U8}{Signed 8 bit samples for each channel} + \lineii{PCM_FORMAT_S16_LE}{Signed 16 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_S16_BE}{Signed 16 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_U16_LE}{Unsigned 16 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_U16_BE}{Unsigned 16 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_S24_LE}{Signed 24 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_S24_BE}{Signed 24 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_U24_LE}{Unsigned 24 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_U24_BE}{Unsigned 24 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_S32_LE}{Signed 32 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_S32_BE}{Signed 32 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_U32_LE}{Unsigned 32 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_U32_BE}{Unsigned 32 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_FLOAT_LE}{32 bit samples encoded as float. (Little Endian byte order)} + \lineii{PCM_FORMAT_FLOAT_BE}{32 bit samples encoded as float (Big Endian byte order)} + \lineii{PCM_FORMAT_FLOAT64_LE}{64 bit samples encoded as float. (Little Endian byte order)} + \lineii{PCM_FORMAT_FLOAT64_BE}{64 bit samples encoded as float. (Big Endian byte order)} + \lineii{PCM_FORMAT_MU_LAW}{A logarithmic encoding (used by Sun .au files)} + \lineii{PCM_FORMAT_A_LAW}{Another logarithmic encoding} + \lineii{PCM_FORMAT_IMA_ADPCM}{a 4:1 compressed format defined by the Interactive Multimedia Association} + \lineii{PCM_FORMAT_MPEG}{MPEG encoded audio?} + \lineii{PCM_FORMAT_GSM}{9600 constant rate encoding well suitet for speech} +\end{tableii} + +\end{methoddesc} + +\begin{methoddesc}[PCM]{setperiodsize}{period} +Sets the actual period size in frames. Each write should consist of exactly this number of frames, and +each read will return this number of frames (unless the device is in PCM_NONBLOCK mode, in which case +it may return nothing at all) +\end{methoddesc} + +\begin{methoddesc}[PCM]{read}{} +In PCM_NORMAL mode, this function blocks until a full period is available, and then returns a +tuple (length,data) where \emph{length} is the size in bytes of the captured data, and \emph{data} +is the captured sound frames as a string. The length of the returned data will be periodsize*framesize +bytes. + +In PCM_NONBLOCK mode, the call will not block, but will return \code{(0,'')} if no new period +has become available since the last call to read. +\end{methoddesc} + +\begin{methoddesc}[PCM]{write}{data} +Writes (plays) the sound in data. The length of data \emph{must} be a multiple of the frame size, and +\emph{should} be exactly the size of a period. If less than 'period size' frames are provided, the actual +playout will not happen until more data is written. + +If the device is not in PCM_NONBLOCK mode, this call will block if the kernel buffer is full, and +until enough sound has been played to allow the sound data to be buffered. The call always returns +the size of the data provided + +In PCM_NONBLOCK mode, the call will return immediately, with a return value of zero, if the buffer is +full. In this case, the data should be written at a later time. + +\end{methoddesc} + +\strong{A few hints on using PCM devices for playback} + +The most common reason for problems with playback of PCM audio, is that the people don't properly understand +that writes to PCM devices must match \emph{exactly} the data rate of the device. + +If too little data is written to the device, it will underrun, and ugly clicking sounds will occur. Conversely, +of too much data is written to the device, the write function will either block (PCM_NORMAL mode) or return zero +(PCM_NONBLOCK mode). + +If your program does nothing, but play sound, the easiest way is to put the device in PCM_NORMAL mode, and just +write as much data to the device as possible. This strategy can also be achieved by using a separate thread +with the sole task of playing out sound. + +In GUI programs, however, it may be a better strategy to setup the device, preload the buffer with a few +periods by calling write a couple of times, and then use some timer method to write one period size of data to +the device every period. The purpose of the preloading is to avoid underrun clicks if the used timer +doesn't expire exactly on time. + +Also note, that most timer API's that you can find for Python will cummulate time delays: If you set the timer +to expire after 1/10'th of a second, the actual timeout will happen slightly later, which will accumulate to +quite a lot after a few seconds. Hint: use time.time() to check how much time has really passed, and add +extra writes as nessecary. + +\subsection{Mixer Objects} +\label{mixer-objects} + +Mixer objects provides access to the ALSA mixer API. + +\begin{classdesc}{Mixer}{\optional{control}, \optional{id}, \optional{cardname}} +\var{control} - specifies which control to manipulate using this mixer object. The list +of available controls can be found with the \module{alsaaudio}.\function{mixers} function. +The default value is 'Master' - other common controls include 'Master Mono', 'PCM', 'Line', etc. + +\var{id} - the id of the mixer control. Default is 0 + +\var{cardname} - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +\end{classdesc} + +Mixer objects have the following methods: + +\begin{methoddesc}[Mixer]{cardname}{} +Return the name of the sound card used by this Mixer object +\end{methoddesc} + +\begin{methoddesc}[Mixer]{mixer}{} +Return the name of the specific mixer controlled by this object, For example 'Master' +or 'PCM' +\end{methoddesc} + +\begin{methoddesc}[Mixer]{mixerid}{} +Return the ID of the ALSA mixer controlled by this object. +\end{methoddesc} + +\begin{methoddesc}[Mixer]{switchcap}{} +Returns a list of the switches which are defined by this specific mixer. Possible values in +this list are: + +\begin{tableii}{l|l}{Switches}{Switch}{Description} + \lineii{'Mute'}{This mixer can be muted} + \lineii{'Joined Mute'}{This mixer can mute all channels at the same time} + \lineii{'Playback Mute'}{This mixer can mute the playback output} + \lineii{'Joined Playback Mute'}{Mute playback for all channels at the same time} + \lineii{'Capture Mute'}{Mute sound capture} + \lineii{'Joined Capture Mute'}{Mute sound capture for all channels at a time} + \lineii{'Capture Exclusive'}{Not quite sure what this is} +\end{tableii} + +To manipulate these swithes use the \method{setrec} or \method{setmute} methods +\end{methoddesc} + +\begin{methoddesc}[Mixer]{volumecap}{} +Returns a list of the volume control capabilities of this mixer. Possible values in +the list are: + +\begin{tableii}{l|l}{Volume Capabilities}{Capability}{Description} + \lineii{'Volume'}{This mixer can control volume} + \lineii{'Joined Volume'}{This mixer can control volume for all channels at the same time} + \lineii{'Playback Volume'}{This mixer can manipulate the playback volume} + \lineii{'Joined Playback Volume'}{Manipulate playback volumne for all channels at the same time} + \lineii{'Capture Volume'}{Manipulate sound capture volume} + \lineii{'Joined Capture Volume'}{Manipulate sound capture volume for all channels at a time} +\end{tableii} + +\end{methoddesc} + +\begin{methoddesc}[Mixer]{getvolume}{\optional{direction}} +Returns a list with the current volume settings for each channel. The list elements +are integer percentages. + +The optional \var{direction} argument can be either 'playback' or 'capture', which is relevant +if the mixer can control both playback and capture volume. The default value is 'playback' +if the mixer has this capability, otherwise 'capture' + +\end{methoddesc} + +\begin{methoddesc}[Mixer]{getmute}{} +Return a list indicating the current mute setting for each channel. 0 means not muted, 1 means muted. + +This method will fail if the mixer has no playback switch capabilities. +\end{methoddesc} + +\begin{methoddesc}[Mixer]{getrec}{} +Return a list indicating the current record mute setting for each channel. 0 means not recording, 1 +means not recording. + +This method will fail if the mixer has no capture switch capabilities. +\end{methoddesc} + +\begin{methoddesc}[Mixer]{setvolume}{volume,\optional{channel},\optional{direction}} +Change the current volume settings for this mixer. The \var{volume} argument controls +the new volume setting as an integer percentage. + +If the optional argument \var{channel} is present, the volume is set only for this channel. This +assumes that the mixer can control the volume for the channels independently. + +The optional \var{direction} argument can be either 'playback' or 'capture' is relevant if the mixer +has independent playback and capture volume capabilities, and controls which of the volumes +if changed. The default is 'playback' if the mixer has this capability, otherwise 'capture'. +\end{methoddesc} + +\begin{methoddesc}[Mixer]{setmute}{mute, \optional{channel}} +Sets the mute flag to a new value. The \var{mute} argument is either 0 for not muted, or 1 for muted. + +The optional \var{channel} argument controls which channel is muted. The default is to set the mute flag +for all channels. + +This method will fail if the mixer has no playback mute capabilities +\end{methoddesc} + +\begin{methoddesc}[Mixer]{setrec}{capture,\optional{channel}} +Sets the capture mute flag to a new value. The \var{capture} argument is either 0 for no capture, +or 1 for capture. + +The optional \var{channel} argument controls which channel is changed. The default is to set the capture flag +for all channels. + +This method will fail if the mixer has no capture switch capabilities +\end{methoddesc} + + +\textbf{A Note on the ALSA Mixer API} + +The ALSA mixer API is extremely complicated - and hardly documented at all. \module{alsaaudio} implements +a much simplified way to access this API. In designing the API I've had to make some choices which +may limit what can and cannot be controlled through the API. However, If I had chosen to implement the +full API, I would have reexposed the horrible complexity/documentation ratio of the underlying API. +At least the \module{alsaaudio} API is easy to understand and use. + +If my design choises prevents you from doing something that the underlying API would have allowed, +please let me know, so I can incorporate these need into future versions. + +If the current state of affairs annoy you, the best you can do is to write a HOWTO on the API and +make this available on the net. Until somebody does this, the availability of ALSA mixer capable +devices will stay quite limited. + +Unfortunately, I'm not able to create such a HOWTO myself, since I only understand half of the API, +and that which I do understand has come from a painful trial and error process. + + + +% ==== 4. ==== +\subsection{ALSA Examples \label{pcm-example}} + +For now, the only examples available are the 'playbacktest.py' and the 'recordtest.py' programs included. +This will change in a future version. diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/pyalsaaudio.tex.svn-base b/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/pyalsaaudio.tex.svn-base new file mode 100644 index 0000000..1a5a4b0 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/text-base/pyalsaaudio.tex.svn-base @@ -0,0 +1,107 @@ +\documentclass{howto} + +\title{PyAlsaAudio} + +\release{0.2} + +% At minimum, give your name and an email address. You can include a +% snail-mail address if you like. +\author{Casper Wilstrup} +\authoraddress{cwi@unispeed.com} + +\begin{document} +\maketitle + +% This makes the Abstract go on a separate page in the HTML version; +% if a copyright notice is used, it should go immediately after this. +% +\ifhtml +\chapter*{Front Matter\label{front}} +\fi + +% Copyright statement should go here, if needed. +This software is licensed under the PSF license - the same one used +by the majority of the python distribution. Basically you can use it +for anything you wish (even commercial purposes). There is no warranty +whatsoever. + +% The abstract should be a paragraph or two long, and describe the +% scope of the document. +\begin{abstract} +\noindent +This package contains wrappers for accessing the ALSA api from Python. It +is currently fairly complete for PCM devices and Mixer access. MIDI sequencer +support is low on my priority list, but volunteers are welcome. + +If you find bugs in the wrappers please notify me on email. Please +don't send bug reports regarding ALSA specifically. There are several +bugs in this api, and those should be reported to the ALSA team - not +me. +\end{abstract} + +\tableofcontents + +\section{What is ALSA} + +The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI +functionality to the Linux operating system. + +Logically ALSA consists of these components: +\begin{itemize} + \item A set of kernel drivers.\\ + These drivers are responsible for handling the physical sound + hardware from within the Linux kernel, and have been the standard + sound implementation in Linux since kernel version 2.5 + \item A kernel level API for manipulating the ALSA devices. + \item A user-space C library for simplified access to the sound hardware + from userspace applications. This library is called \textit{libasound} + and is required by all ALSA capable applications. +\end{itemize} + +More information about ALSA may be found on the project homepage +\url{http://www.alsa-project.org} + +\section{ALSA and Python} + +The older Linux sound API (OSS) which is now deprecated is well supported +from the standard Python library, through the ossaudiodev module. No native +ALSA support exists in the standard library (yet). + +There are a few other ``ALSA for Python'' projects available, including at +least two different projects called pyAlsa. Neither of these seem to be under +active development at the time - and neither are very feature complete. + +I wrote PyAlsaAudio to fill this gap. My long term goal is to have the module +included in the standard Python library, but that is probably a while of yet. + +PyAlsaAudio hass full support for sound capture, playback of sound, as well as +the ALSA Mixer API. + +MIDI support is not available, and since I don't own any MIDI hardware, it's +difficult for me to implement it. Volunteers to work on this would be greatly +appreciated +\section{Installation} + +Note: the wrappers link with the alsasound library (from the alsa-lib +package). Verify that this is installed by looking for /usr/lib/libasound.so +before building. Naturally you also need to use a kernel with proper ALSA +support. This is the default in Linux kernel 2.6 and later. If you are using +kernel version 2.4 you may need to install the ALSA patches yourself - although +most distributions ship with ALSA kernels. + +To install, execute the following: \\ +\begin{verbatim} +$ python setup.py build +\end{verbatim} + +And then as root: \\ +\begin{verbatim} +# python setup.py install +\end{verbatim} + +\input{libalsaaudio} + + + + +\end{document} diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/Makefile.svn-work b/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/Makefile.svn-work new file mode 100644 index 0000000..5af62dd --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/Makefile.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 66 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/src/Makefile +END diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/libalsaaudio.tex.svn-work b/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/libalsaaudio.tex.svn-work new file mode 100644 index 0000000..a30dac2 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/libalsaaudio.tex.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 74 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/src/libalsaaudio.tex +END diff --git a/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/pyalsaaudio.tex.svn-work b/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/pyalsaaudio.tex.svn-work new file mode 100644 index 0000000..b1bf388 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/.svn/wcprops/pyalsaaudio.tex.svn-work @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 73 +/svn/Shtoom/!svn/ver/1585/trunk/audio/pyalsaaudio/doc/src/pyalsaaudio.tex +END diff --git a/arch_src/pyalsaaudio-0.2/doc/src/Makefile b/arch_src/pyalsaaudio-0.2/doc/src/Makefile new file mode 100644 index 0000000..44c3313 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/Makefile @@ -0,0 +1,20 @@ +# Makefile for PyAlsaAudio documentation +# +# In order to use this you need an unpacked version of the +# Python source available. Set the source path below +# +# You also need a working latex installation, and the latex2html +# tool installed. +PYTHONSOURCE = /usr/src/Python-2.4.1/ + +# Shouldn't need to change anything below here! + +MKHOWTO = $(PYTHONSOURCE)/Doc/tools/mkhowto + +all: + $(MKHOWTO) --dir .. --html pyalsaaudio.tex + +text: + $(MKHOWTO) --dir .. --text pyalsaaudio.tex + + diff --git a/arch_src/pyalsaaudio-0.2/doc/src/libalsaaudio.tex b/arch_src/pyalsaaudio-0.2/doc/src/libalsaaudio.tex new file mode 100644 index 0000000..c50ffe5 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/libalsaaudio.tex @@ -0,0 +1,397 @@ +\section{\module{alsaaudio}} + +%\declaremodule{builtin}{alsaaudio} % standard library, in C +\declaremodule{extension}{alsaaudio} % not standard, in C + +\platform{Linux} + +\moduleauthor{Casper Wilstrup}{cwi@unispeed.com} % Author of the module code; + + +\modulesynopsis{ALSA sound support} + + +The \module{alsaaudio} module defines functions and classes for using +ALSA. + +% ---- 3.1. ---- +% For each function, use a ``funcdesc'' block. This has exactly two +% parameters (each parameters is contained in a set of curly braces): +% the first parameter is the function name (this automatically +% generates an index entry); the second parameter is the function's +% argument list. If there are no arguments, use an empty pair of +% curly braces. If there is more than one argument, separate the +% arguments with backslash-comma. Optional parts of the parameter +% list are contained in \optional{...} (this generates a set of square +% brackets around its parameter). Arguments are automatically set in +% italics in the parameter list. Each argument should be mentioned at +% least once in the description; each usage (even inside \code{...}) +% should be enclosed in \var{...}. + +\begin{funcdesc}{mixers}{\optional{cardname}} +List the available mixers. The optional \var{cardname} specifies which +card should be queried (this is only relevant if you have more than one +sound card). Omit to use the default sound card +\end{funcdesc} + +\begin{classdesc}{PCM}{\optional{type}, \optional{mode}, \optional{cardname}} +This class is used to represent a PCM device (both playback and capture devices). +The arguments are: \\ +\var{type} - can be either PCM_CAPTURE or PCM_PLAYBACK (default). \\ +\var{mode} - can be either PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL (the default).\\ +\var{cardname} - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +\end{classdesc} + +\begin{classdesc}{Mixer}{\optional{control}, \optional{id}, \optional{cardname}} +This class is used to access a specific ALSA mixer. +The arguments are: \\ +\var{control} - Name of the chosen mixed (default is Master). \\ +\var{id} - id of mixer (default is 0) -- More explaniation needed here\\ +\var{cardname} specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +\end{classdesc} + + +\begin{excdesc}{ALSAAudioError} +Exception raised when an operation fails for a ALSA specific reason. +The exception argument is a string describing the reason of the +failure. +\end{excdesc} + +\subsection{PCM Terminology and Concepts} + +In order to use PCM devices it is useful to be familiar with some concepts and +terminology. + +\begin{description} +\item[Sample] PCM audio, whether it is input or output, consists at the lowest level +of a number of single samples. A sample represents the sound in a single channel in +a brief interval. If more than one channel is in use, more than one sample is required +for each interval to describe the sound. Samples can be of many different sizes, ranging +from 8 bit to 64 bit presition. The specific format of each sample can also vary - they +can be big endian byte order, little endian byte order, or even floats. + +\item[Frame] A frame consists of exactly one sample per channel. If there is only one +channel (Mono sound) a frame is simply a single sample. If the sound is stereo, each frame +consists of two samples, etc. + +\item[Frame size] This is the size in bytes of each frame. This can vary a lot: if each sample is +8 bits, and we're handling mono sound, the frame size is one byte. Similarly in 6 channel audio with +64 bit floating point samples, the frame size is 48 bytes + +\item[Rate] PCM sound consists of a flow of sound frames. The sound rate controls how often +the current frame is replaced. For example, a rate of 8000 Hz means that a new frame is played +or captured 8000 times per second. + +\item[Data rate] This is the number of bytes, which must be recorded or provided per second +at a certain frame size and rate. + +8000 Hz mono sound with 8 bit (1 byte) samples has a data rate of 8000 * 1 * 1 = 8 kb/s + +At the other end of the scale, 96000 Hz, 6 channel sound with 64 bit (8 bytes) samples +has a data rate of 96000 * 6 * 8 = 4608 kb/s (almost 5 Mb sound data per second) + +\item[Period] When the hardware processes data this is done in chunks of frames. The time interval +between each processing (A/D or D/A conversion) is known as the period. The size of the period has +direct implication on the latency of the sound input or output. For low-latency the period size should +be very small, while low CPU resource usage would usually demand larger period sizes. With ALSA, the +CPU utilization is not impacted much by the period size, since the kernel layer buffers multiple +periods internally, so each period generates an interrupt and a memory copy, but userspace can be +slower and read or write multiple periods at the same time. + +\item[Period size] This is the size of each period in Hz. \emph{Not bytes, but Hz!.} In \module{alsaaudio} +the period size is set directly, and it is therefore important to understand the significance of this +number. If the period size is configured to for example 32, each write should contain exactly 32 frames +of sound data, and each read will return either 32 frames of data or nothing at all. + +\end{description} + +Once you understand these concepts, you will be ready to actually utilize PCM API. Read on. + +\subsection{PCM Objects} +\label{pcm-objects} + +The acronym PCM is short for Pulse Code Modulation and is the method used in ALSA +and many other places to handle playback and capture of sampled sound data. + +PCM objects in \module{alsaaudio} are used to do exactly that, either play sample based +sound or capture sound from some input source (perhaps a microphone). The PCM object +constructor takes the following arguments: + +\begin{classdesc}{PCM}{\optional{type}, \optional{mode}, \optional{cardname}} + +\var{type} - can be either PCM_CAPTURE or PCM_PLAYBACK (default). + +\var{mode} - can be either PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL (the default). +In PCM_NONBLOCK mode, calls to read will return immediately independent of wether +there is any actual data to read. Similarly, write calls will return immediately +without actually writing anything to the playout buffer if the buffer is full. + +In the current version of \module{alsaaudio} PCM_ASYNC is useless, since it relies +on a callback procedure, which can't be specified from Python. + +\var{cardname} - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card + +This will construct a PCM object with default settings: + +Sample format: PCM_FORMAT_S16_LE \\ +Rate: 8000 Hz \\ +Channels: 2 \\ +Period size: 32 frames \\ +\end{classdesc} + +PCM objects have the following methods: + +\begin{methoddesc}[PCM]{pcmtype}{} +Returns the type of PCM object. Either PCM_CAPTURE or PCM_PLAYBACK. +\end{methoddesc} + +\begin{methoddesc}[PCM]{pcmmode}{} +Return the mode of the PCM object. One of PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL +\end{methoddesc} + +\begin{methoddesc}[PCM]{cardname}{} +Return the name of the sound card used by this PCM object. +\end{methoddesc} + +\begin{methoddesc}[PCM]{setchannels}{nchannels} +Used to set the number of capture or playback channels. Common values are: 1 = mono, 2 = stereo, +and 6 = full 6 channel audio. Few sound cards support more than 2 channels +\end{methoddesc} + +\begin{methoddesc}[PCM]{setrate}{rate} +Set the sample rate in Hz for the device. Typical values are 8000 (poor sound), 16000, 44100 (cd quality), +and 96000 +\end{methoddesc} + +\begin{methoddesc}[PCM]{setformat}{} +The sound format of the device. Sound format controls how the PCM device interpret data for playback, +and how data is encoded in captures. + +The following formats are provided by ALSA: +\begin{tableii}{l|l}{Formats}{Format}{Description} + \lineii{PCM_FORMAT_S8}{Signed 8 bit samples for each channel} + \lineii{PCM_FORMAT_U8}{Signed 8 bit samples for each channel} + \lineii{PCM_FORMAT_S16_LE}{Signed 16 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_S16_BE}{Signed 16 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_U16_LE}{Unsigned 16 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_U16_BE}{Unsigned 16 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_S24_LE}{Signed 24 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_S24_BE}{Signed 24 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_U24_LE}{Unsigned 24 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_U24_BE}{Unsigned 24 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_S32_LE}{Signed 32 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_S32_BE}{Signed 32 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_U32_LE}{Unsigned 32 bit samples for each channel (Little Endian byte order)} + \lineii{PCM_FORMAT_U32_BE}{Unsigned 32 bit samples for each channel (Big Endian byte order)} + \lineii{PCM_FORMAT_FLOAT_LE}{32 bit samples encoded as float. (Little Endian byte order)} + \lineii{PCM_FORMAT_FLOAT_BE}{32 bit samples encoded as float (Big Endian byte order)} + \lineii{PCM_FORMAT_FLOAT64_LE}{64 bit samples encoded as float. (Little Endian byte order)} + \lineii{PCM_FORMAT_FLOAT64_BE}{64 bit samples encoded as float. (Big Endian byte order)} + \lineii{PCM_FORMAT_MU_LAW}{A logarithmic encoding (used by Sun .au files)} + \lineii{PCM_FORMAT_A_LAW}{Another logarithmic encoding} + \lineii{PCM_FORMAT_IMA_ADPCM}{a 4:1 compressed format defined by the Interactive Multimedia Association} + \lineii{PCM_FORMAT_MPEG}{MPEG encoded audio?} + \lineii{PCM_FORMAT_GSM}{9600 constant rate encoding well suitet for speech} +\end{tableii} + +\end{methoddesc} + +\begin{methoddesc}[PCM]{setperiodsize}{period} +Sets the actual period size in frames. Each write should consist of exactly this number of frames, and +each read will return this number of frames (unless the device is in PCM_NONBLOCK mode, in which case +it may return nothing at all) +\end{methoddesc} + +\begin{methoddesc}[PCM]{read}{} +In PCM_NORMAL mode, this function blocks until a full period is available, and then returns a +tuple (length,data) where \emph{length} is the size in bytes of the captured data, and \emph{data} +is the captured sound frames as a string. The length of the returned data will be periodsize*framesize +bytes. + +In PCM_NONBLOCK mode, the call will not block, but will return \code{(0,'')} if no new period +has become available since the last call to read. +\end{methoddesc} + +\begin{methoddesc}[PCM]{write}{data} +Writes (plays) the sound in data. The length of data \emph{must} be a multiple of the frame size, and +\emph{should} be exactly the size of a period. If less than 'period size' frames are provided, the actual +playout will not happen until more data is written. + +If the device is not in PCM_NONBLOCK mode, this call will block if the kernel buffer is full, and +until enough sound has been played to allow the sound data to be buffered. The call always returns +the size of the data provided + +In PCM_NONBLOCK mode, the call will return immediately, with a return value of zero, if the buffer is +full. In this case, the data should be written at a later time. + +\end{methoddesc} + +\strong{A few hints on using PCM devices for playback} + +The most common reason for problems with playback of PCM audio, is that the people don't properly understand +that writes to PCM devices must match \emph{exactly} the data rate of the device. + +If too little data is written to the device, it will underrun, and ugly clicking sounds will occur. Conversely, +of too much data is written to the device, the write function will either block (PCM_NORMAL mode) or return zero +(PCM_NONBLOCK mode). + +If your program does nothing, but play sound, the easiest way is to put the device in PCM_NORMAL mode, and just +write as much data to the device as possible. This strategy can also be achieved by using a separate thread +with the sole task of playing out sound. + +In GUI programs, however, it may be a better strategy to setup the device, preload the buffer with a few +periods by calling write a couple of times, and then use some timer method to write one period size of data to +the device every period. The purpose of the preloading is to avoid underrun clicks if the used timer +doesn't expire exactly on time. + +Also note, that most timer API's that you can find for Python will cummulate time delays: If you set the timer +to expire after 1/10'th of a second, the actual timeout will happen slightly later, which will accumulate to +quite a lot after a few seconds. Hint: use time.time() to check how much time has really passed, and add +extra writes as nessecary. + +\subsection{Mixer Objects} +\label{mixer-objects} + +Mixer objects provides access to the ALSA mixer API. + +\begin{classdesc}{Mixer}{\optional{control}, \optional{id}, \optional{cardname}} +\var{control} - specifies which control to manipulate using this mixer object. The list +of available controls can be found with the \module{alsaaudio}.\function{mixers} function. +The default value is 'Master' - other common controls include 'Master Mono', 'PCM', 'Line', etc. + +\var{id} - the id of the mixer control. Default is 0 + +\var{cardname} - specifies which card should be used (this is only relevant +if you have more than one sound card). Omit to use the default sound card +\end{classdesc} + +Mixer objects have the following methods: + +\begin{methoddesc}[Mixer]{cardname}{} +Return the name of the sound card used by this Mixer object +\end{methoddesc} + +\begin{methoddesc}[Mixer]{mixer}{} +Return the name of the specific mixer controlled by this object, For example 'Master' +or 'PCM' +\end{methoddesc} + +\begin{methoddesc}[Mixer]{mixerid}{} +Return the ID of the ALSA mixer controlled by this object. +\end{methoddesc} + +\begin{methoddesc}[Mixer]{switchcap}{} +Returns a list of the switches which are defined by this specific mixer. Possible values in +this list are: + +\begin{tableii}{l|l}{Switches}{Switch}{Description} + \lineii{'Mute'}{This mixer can be muted} + \lineii{'Joined Mute'}{This mixer can mute all channels at the same time} + \lineii{'Playback Mute'}{This mixer can mute the playback output} + \lineii{'Joined Playback Mute'}{Mute playback for all channels at the same time} + \lineii{'Capture Mute'}{Mute sound capture} + \lineii{'Joined Capture Mute'}{Mute sound capture for all channels at a time} + \lineii{'Capture Exclusive'}{Not quite sure what this is} +\end{tableii} + +To manipulate these swithes use the \method{setrec} or \method{setmute} methods +\end{methoddesc} + +\begin{methoddesc}[Mixer]{volumecap}{} +Returns a list of the volume control capabilities of this mixer. Possible values in +the list are: + +\begin{tableii}{l|l}{Volume Capabilities}{Capability}{Description} + \lineii{'Volume'}{This mixer can control volume} + \lineii{'Joined Volume'}{This mixer can control volume for all channels at the same time} + \lineii{'Playback Volume'}{This mixer can manipulate the playback volume} + \lineii{'Joined Playback Volume'}{Manipulate playback volumne for all channels at the same time} + \lineii{'Capture Volume'}{Manipulate sound capture volume} + \lineii{'Joined Capture Volume'}{Manipulate sound capture volume for all channels at a time} +\end{tableii} + +\end{methoddesc} + +\begin{methoddesc}[Mixer]{getvolume}{\optional{direction}} +Returns a list with the current volume settings for each channel. The list elements +are integer percentages. + +The optional \var{direction} argument can be either 'playback' or 'capture', which is relevant +if the mixer can control both playback and capture volume. The default value is 'playback' +if the mixer has this capability, otherwise 'capture' + +\end{methoddesc} + +\begin{methoddesc}[Mixer]{getmute}{} +Return a list indicating the current mute setting for each channel. 0 means not muted, 1 means muted. + +This method will fail if the mixer has no playback switch capabilities. +\end{methoddesc} + +\begin{methoddesc}[Mixer]{getrec}{} +Return a list indicating the current record mute setting for each channel. 0 means not recording, 1 +means not recording. + +This method will fail if the mixer has no capture switch capabilities. +\end{methoddesc} + +\begin{methoddesc}[Mixer]{setvolume}{volume,\optional{channel},\optional{direction}} +Change the current volume settings for this mixer. The \var{volume} argument controls +the new volume setting as an integer percentage. + +If the optional argument \var{channel} is present, the volume is set only for this channel. This +assumes that the mixer can control the volume for the channels independently. + +The optional \var{direction} argument can be either 'playback' or 'capture' is relevant if the mixer +has independent playback and capture volume capabilities, and controls which of the volumes +if changed. The default is 'playback' if the mixer has this capability, otherwise 'capture'. +\end{methoddesc} + +\begin{methoddesc}[Mixer]{setmute}{mute, \optional{channel}} +Sets the mute flag to a new value. The \var{mute} argument is either 0 for not muted, or 1 for muted. + +The optional \var{channel} argument controls which channel is muted. The default is to set the mute flag +for all channels. + +This method will fail if the mixer has no playback mute capabilities +\end{methoddesc} + +\begin{methoddesc}[Mixer]{setrec}{capture,\optional{channel}} +Sets the capture mute flag to a new value. The \var{capture} argument is either 0 for no capture, +or 1 for capture. + +The optional \var{channel} argument controls which channel is changed. The default is to set the capture flag +for all channels. + +This method will fail if the mixer has no capture switch capabilities +\end{methoddesc} + + +\textbf{A Note on the ALSA Mixer API} + +The ALSA mixer API is extremely complicated - and hardly documented at all. \module{alsaaudio} implements +a much simplified way to access this API. In designing the API I've had to make some choices which +may limit what can and cannot be controlled through the API. However, If I had chosen to implement the +full API, I would have reexposed the horrible complexity/documentation ratio of the underlying API. +At least the \module{alsaaudio} API is easy to understand and use. + +If my design choises prevents you from doing something that the underlying API would have allowed, +please let me know, so I can incorporate these need into future versions. + +If the current state of affairs annoy you, the best you can do is to write a HOWTO on the API and +make this available on the net. Until somebody does this, the availability of ALSA mixer capable +devices will stay quite limited. + +Unfortunately, I'm not able to create such a HOWTO myself, since I only understand half of the API, +and that which I do understand has come from a painful trial and error process. + + + +% ==== 4. ==== +\subsection{ALSA Examples \label{pcm-example}} + +For now, the only examples available are the 'playbacktest.py' and the 'recordtest.py' programs included. +This will change in a future version. diff --git a/arch_src/pyalsaaudio-0.2/doc/src/pyalsaaudio.tex b/arch_src/pyalsaaudio-0.2/doc/src/pyalsaaudio.tex new file mode 100644 index 0000000..1a5a4b0 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/src/pyalsaaudio.tex @@ -0,0 +1,107 @@ +\documentclass{howto} + +\title{PyAlsaAudio} + +\release{0.2} + +% At minimum, give your name and an email address. You can include a +% snail-mail address if you like. +\author{Casper Wilstrup} +\authoraddress{cwi@unispeed.com} + +\begin{document} +\maketitle + +% This makes the Abstract go on a separate page in the HTML version; +% if a copyright notice is used, it should go immediately after this. +% +\ifhtml +\chapter*{Front Matter\label{front}} +\fi + +% Copyright statement should go here, if needed. +This software is licensed under the PSF license - the same one used +by the majority of the python distribution. Basically you can use it +for anything you wish (even commercial purposes). There is no warranty +whatsoever. + +% The abstract should be a paragraph or two long, and describe the +% scope of the document. +\begin{abstract} +\noindent +This package contains wrappers for accessing the ALSA api from Python. It +is currently fairly complete for PCM devices and Mixer access. MIDI sequencer +support is low on my priority list, but volunteers are welcome. + +If you find bugs in the wrappers please notify me on email. Please +don't send bug reports regarding ALSA specifically. There are several +bugs in this api, and those should be reported to the ALSA team - not +me. +\end{abstract} + +\tableofcontents + +\section{What is ALSA} + +The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI +functionality to the Linux operating system. + +Logically ALSA consists of these components: +\begin{itemize} + \item A set of kernel drivers.\\ + These drivers are responsible for handling the physical sound + hardware from within the Linux kernel, and have been the standard + sound implementation in Linux since kernel version 2.5 + \item A kernel level API for manipulating the ALSA devices. + \item A user-space C library for simplified access to the sound hardware + from userspace applications. This library is called \textit{libasound} + and is required by all ALSA capable applications. +\end{itemize} + +More information about ALSA may be found on the project homepage +\url{http://www.alsa-project.org} + +\section{ALSA and Python} + +The older Linux sound API (OSS) which is now deprecated is well supported +from the standard Python library, through the ossaudiodev module. No native +ALSA support exists in the standard library (yet). + +There are a few other ``ALSA for Python'' projects available, including at +least two different projects called pyAlsa. Neither of these seem to be under +active development at the time - and neither are very feature complete. + +I wrote PyAlsaAudio to fill this gap. My long term goal is to have the module +included in the standard Python library, but that is probably a while of yet. + +PyAlsaAudio hass full support for sound capture, playback of sound, as well as +the ALSA Mixer API. + +MIDI support is not available, and since I don't own any MIDI hardware, it's +difficult for me to implement it. Volunteers to work on this would be greatly +appreciated +\section{Installation} + +Note: the wrappers link with the alsasound library (from the alsa-lib +package). Verify that this is installed by looking for /usr/lib/libasound.so +before building. Naturally you also need to use a kernel with proper ALSA +support. This is the default in Linux kernel 2.6 and later. If you are using +kernel version 2.4 you may need to install the ALSA patches yourself - although +most distributions ship with ALSA kernels. + +To install, execute the following: \\ +\begin{verbatim} +$ python setup.py build +\end{verbatim} + +And then as root: \\ +\begin{verbatim} +# python setup.py install +\end{verbatim} + +\input{libalsaaudio} + + + + +\end{document} diff --git a/arch_src/pyalsaaudio-0.2/doc/up.gif b/arch_src/pyalsaaudio-0.2/doc/up.gif Binary files differnew file mode 100644 index 0000000..a9d3e13 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/up.gif diff --git a/arch_src/pyalsaaudio-0.2/doc/up.png b/arch_src/pyalsaaudio-0.2/doc/up.png Binary files differnew file mode 100644 index 0000000..a90e028 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/doc/up.png diff --git a/arch_src/pyalsaaudio-0.2/mixertest.py b/arch_src/pyalsaaudio-0.2/mixertest.py new file mode 100644 index 0000000..642ae10 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/mixertest.py @@ -0,0 +1,88 @@ +## mixertest.py +## +## This is an example of using the ALSA mixer API +## +## The script will set the volume or mute switch of the specified Mixer +## depending on command line options. +## +## Examples: +## python mixertest.py # list available mixers +## python mixertest.py Master # show Master mixer settings +## python mixertest.py Master 80 # set the master volume to 80% +## python mixertest.py Master 1,90 # set channel 1 volume to 90% +## python mixertest.py Master mute # mute the master mixer +## python mixertest.py Master unmute # unmute the master mixer + +import alsaaudio +import sys + +if len(sys.argv) == 1: + # Demonstrates how to read the available mixers + print "Available mixer controls:" + for m in alsaaudio.mixers(): + print " '%s'" % m + +if len(sys.argv) == 2: + # Demonstrates how mixer settings are queried. + name = sys.argv[1] + try: + mixer = alsaaudio.Mixer(name) + except alsaaudio.ALSAAudioError: + print "No such mixer" + sys.exit(1) + + print "Mixer name: '%s'"%mixer.mixer() + print "Capabilities",mixer.volumecap()+mixer.switchcap() + volumes = mixer.getvolume() + for i in range(len(volumes)): + print "Channel %i volume: %i%%"%(i,volumes[i]) + + try: + mutes = mixer.getmute() + for i in range(len(mutes)): + if mutes[i]: print "Channel %i is muted"%i + except alsaaudio.ALSAAudioError: + # May not support muting + pass + + try: + recs = mixer.getrec() + for i in range(len(recs)): + if recs[i]: print "Channel %i is recording"%i + except alsaaudio.ALSAAudioError: + # May not support recording + pass + +if (len(sys.argv)) == 3: + # Demonstrates how to set mixer settings + name = sys.argv[1] + try: + mixer = alsaaudio.Mixer(name) + except alsaaudio.ALSAAudioError: + print "No such mixer" + sys.exit(1) + + args = sys.argv[2] + if args in ['mute','unmute']: + # Mute/unmute the mixer + if args == 'mute': mixer.setmute(1) + else: mixer.setmute(0) + sys.exit(0) + if args in ['rec','unrec']: + # Enable/disable recording + if args == 'rec': mixer.setrec(1) + else: mixer.setrec(0) + sys.exit(0) + + + if args.find(',')!=-1: + channel,volume = map(int,args.split(',')) + else: + channel = alsaaudio.MIXER_CHANNEL_ALL + volume = int(args) + # Set volume for specified channel. MIXER_CHANNEL_ALL means set + # volume for all channels + mixer.setvolume(volume,channel) + + + diff --git a/arch_src/pyalsaaudio-0.2/modlibalsaaudio.ind b/arch_src/pyalsaaudio-0.2/modlibalsaaudio.ind new file mode 100644 index 0000000..8af6c8a --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/modlibalsaaudio.ind @@ -0,0 +1,4 @@ +\ +\begin{theindex} +\label{modindex} +\end{theindex} diff --git a/arch_src/pyalsaaudio-0.2/playbacktest.py b/arch_src/pyalsaaudio-0.2/playbacktest.py new file mode 100644 index 0000000..06e0fe9 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/playbacktest.py @@ -0,0 +1,36 @@ +## recordtest.py +## +## This is an example of a simple sound playback script. +## +## The script opens an ALSA pcm for sound playback. Set +## various attributes of the device. It then reads data +## from stdin and writes it to the device. +## +## To test it out do the following: +## python recordtest.py > out.raw # talk to the microphone +## python playbacktest.py < out.raw +## +## If you have Gnome, you could also just test by doing something like: +## python playbacktest.py < /usr/share/sounds/gnibbles/laughter.wav +import alsaaudio +import sys +import time + +# Open the device in playback mode. +out = alsaaudio.PCM(alsaaudio.PCM_PLAYBACK) + +# Set attributes: Mono, 8000 Hz, 16 bit little endian frames +out.setchannels(1) +out.setrate(8000) +out.setformat(alsaaudio.PCM_FORMAT_S16_LE) + +# The period size controls the internal number of frames per period. +# The significance of this parameter is documented in the ALSA api. +out.setperiodsize(160) + +loops = 10000 +while loops > 0: + loops -= 1 + # Read data from stdin + data = sys.stdin.read(320) + out.write(data) diff --git a/arch_src/pyalsaaudio-0.2/recordtest.py b/arch_src/pyalsaaudio-0.2/recordtest.py new file mode 100644 index 0000000..216d627 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/recordtest.py @@ -0,0 +1,45 @@ +## recordtest.py +## +## This is an example of a simple sound capture script. +## +## The script opens an ALSA pcm forsound capture. Set +## various attributes of the capture, and reads in a loop, +## writing the data to standard out. +## +## To test it out do the following: +## python recordtest.py > out.raw # talk to the microphone +## aplay -r 8000 -f S16_LE -c 1 out.raw + +import alsaaudio +import sys +import time + +# Open the device in nonblocking capture mode. The last argument could +# just as well have been zero for blocking mode. Then we could have +# left out the sleep call in the bottom of the loop +inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE,alsaaudio.PCM_NONBLOCK) + +# Set attributes: Mono, 8000 Hz, 16 bit little endian samples +inp.setchannels(1) +inp.setrate(8000) +inp.setformat(alsaaudio.PCM_FORMAT_S16_LE) + +# The period size controls the internal number of frames per period. +# The significance of this parameter is documented in the ALSA api. +# For our purposes, it is suficcient to know that reads from the device +# will return this many frames. Each frame being 2 bytes long. +# This means that the reads below will return either 320 bytes of data +# or 0 bytes of data. The latter is possible because we are in nonblocking +# mode. +inp.setperiodsize(160) + +loops = 1000000 +while loops > 0: + loops -= 1 + # Read data from device + l,data = inp.read() + + if l: + # actual data read. Write it to stdout + sys.stdout.write(data) + time.sleep(.001) diff --git a/arch_src/pyalsaaudio-0.2/setup.py b/arch_src/pyalsaaudio-0.2/setup.py new file mode 100644 index 0000000..d2534a7 --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/setup.py @@ -0,0 +1,14 @@ +from distutils.core import setup +from distutils.extension import Extension + +setup( + name = "alsaaudio", + version = "0.1", + description = "alsa bindings", + author = "Casper Wilstrup", + author_email="cwi@unispeed.com", + ext_modules=[Extension("alsaaudio",["alsaaudio.c"],libraries=['asound']) + ] + ) + + diff --git a/arch_src/pyalsaaudio-0.2/test.py b/arch_src/pyalsaaudio-0.2/test.py new file mode 100644 index 0000000..51707ec --- /dev/null +++ b/arch_src/pyalsaaudio-0.2/test.py @@ -0,0 +1,7 @@ +import alsaaudio +import sys +if len(sys.argv) > 1: name = sys.argv[1] +else: name = "Master" + +m = alsaaudio.Mixer(name) + diff --git a/arch_src/pyalsaaudio_0.2-1ubuntu1.dsc b/arch_src/pyalsaaudio_0.2-1ubuntu1.dsc new file mode 100644 index 0000000..a8f327b --- /dev/null +++ b/arch_src/pyalsaaudio_0.2-1ubuntu1.dsc @@ -0,0 +1,27 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: RIPEMD160 + +Format: 1.0 +Source: pyalsaaudio +Version: 0.2-1ubuntu1 +Binary: python-alsaaudio +Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> +Architecture: any +Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python-support (>= 0.3), libasound2-dev +Python-Version: all +Original-Maintainer: Florian Ragwitz <rafl@debian.org> +Uploaders: Paul Brossier <piem@debian.org> +Files: + 23163f572f8f3a0b295f48f90165e767 88819 pyalsaaudio_0.2.orig.tar.gz + 8170b2430e2d836521110ceaa76089b4 3031 pyalsaaudio_0.2-1ubuntu1.diff.gz + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.3 (GNU/Linux) + +iQCVAwUBRgMP+aPP1313boLqAQPoDAP7BbkyJT7xEXsxLvoPvrA3j+xC0Hv/qF1s +Q80rU9WTKC9jJCqNcG4evg3u7p7amlqyCt6OAB5gajZBxSMhw4FG5B/D/XcxrWp0 +q32anQEC9JVpan6wYLPvb4D1bid6Gx9A3cgyePbsv/3cfUWzghXYLNn8vom0/VSd +EwoJzNjNyRY= +=iwYv +-----END PGP SIGNATURE----- diff --git a/bin/compile-archspec b/bin/compile-archspec new file mode 100755 index 0000000..2a5a042 --- /dev/null +++ b/bin/compile-archspec @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +archsrcdir="$1" +archinstdir="$2" + +mkdir -p "${archinstdir}" +cp -a "${archsrcdir}"/* "${archinstdir}"/ +cd "${archinstdir}" +if [ -e configure ] ; then + ./configure --prefix="${archinstdir}" +fi + +make PREFIX="${archinstdir}" +make install PREFIX="${archinstdir}" + diff --git a/bin/wrapper b/bin/wrapper new file mode 100755 index 0000000..0d92661 --- /dev/null +++ b/bin/wrapper @@ -0,0 +1,22 @@ +#!/bin/bash +set -e +instflag="${SUGAR_ACTIVITY_ROOT}/data/.installed" +cpu="$(uname -m)" +archsrcdir="${SUGAR_BUNDLE_PATH}/arch_src" +archbundledir="${SUGAR_BUNDLE_PATH}/arch_${cpu}" +archinstdir="${SUGAR_ACTIVITY_ROOT}/data/.arch_${cpu}" +pythonversion="$(python -V 2>&1 | cut -d ' ' -f 2 | cut -d . -f 1-2)" + +if [ ! -e "${instflag}" ] ; then + curchecksum="$(find "${archsrcdir}" -type f -print0 | xargs -0 md5sum -- | md5sum)" + if [ "$cpu" = "unknown" -o ! -e "${archbundledir}" ] || [ "${curchecksum}" != "$(cat "${archbundledir}/checksum")" ] ; then + # unknown arch or no (current) precompiled binaries -> need to compile + compile-archspec "${archsrcdir}" "${archinstdir}" + fi + touch "${instflag}" +fi + +export LD_LIBRARY_PATH="${archinstdir}/lib:${archinstdir}/lib64:${LD_LIBRARY_PATH}" +export PYTHONPATH="${archinstdir}/lib/python${pythonversion}/site-packages:${PYTHONPATH}" + +exec "$@" |