A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-June/005122.html below:

[Python-Dev] Test results of linuxaudiodev.c

[Python-Dev] Test results of linuxaudiodev.cKa-Ping Yee pingster@ilm.com
Thu, 29 Jun 2000 17:44:35 -0700 (PDT)
On 30 Jun 2000, Michael Hudson wrote:
> Yup, that works fine.  Don't understand the details - and as I have my
> graduation ceremony tomorrow I'm going to go to bed and leave learning
> them until some other occasion!

Cool.

Okay, i just discovered sunau.py.  Here's my real shot at
test_linuxaudiodev.py.  Can you give this a try?


---- test_linuxaudiodev.py ----
from test_support import verbose, findfile, TestFailed
import linuxaudiodev
import os, sunau

formats = {("ULAW", 1): linuxaudiodev.AFMT_MU_LAW,
           ("NONE", 1): linuxaudiodev.AFMT_S8,
           ("NONE", 2): linuxaudiodev.AFMT_S16_BE}

def play_au_file(path):
    au = sunau.open(path, "r")
    data = au.readframes(sunau.AUDIO_UNKNOWN_SIZE)
    au.close()

    spec = (au.getcomptype(), au.getsampwidth())
    if not has_key(formats, spec):
        raise "audio format not supported by linuxaudiodev"
        
    dsp = linuxaudiodev.open("w")
    dsp.setparameters(au.getframerate(), au.getsampwidth() * 8,
                      au.getnchannels(), formats[spec])
    dsp.write(data)
    dsp.close()

def test():
    play_au_file(findfile('audiotest.au'))

test()
---- test_linuxaudiodev.py ----



-- ?!ng




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4