| 1 | audiopy - a program to control the Solaris audio device.
|
|---|
| 2 |
|
|---|
| 3 | Contact: Barry Warsaw
|
|---|
| 4 | Email: bwarsaw@python.org
|
|---|
| 5 | Version: 1.1
|
|---|
| 6 |
|
|---|
| 7 | Introduction
|
|---|
| 8 |
|
|---|
| 9 | Audiopy is a program to control the Solaris audio device, allowing
|
|---|
| 10 | you to choose both the input and output devices, and to set the
|
|---|
| 11 | output volume. It can be run either as a standalone command-line
|
|---|
| 12 | script, or as a Tkinter based GUI application.
|
|---|
| 13 |
|
|---|
| 14 | Note that your version of Python must have been built with the
|
|---|
| 15 | sunaudiodev module enabled. It is not enabled by default however!
|
|---|
| 16 | You will need to edit your Modules/Setup file, uncomment the
|
|---|
| 17 | sunaudiodev module spec line and rebuild Python.
|
|---|
| 18 |
|
|---|
| 19 | Using audiopy, you can select one of three possible input devices:
|
|---|
| 20 | the microphone, the line-in jack, or the CD in. These choices are
|
|---|
| 21 | mutually exclusive; you can only have one active input device at
|
|---|
| 22 | any one time (this is enforced by the underlying device). Some
|
|---|
| 23 | input devices may not be supported on all Solaris machines.
|
|---|
| 24 |
|
|---|
| 25 | You can also choose to enable any of the three possible output
|
|---|
| 26 | devices: the headphone jack, the speakers, or the line-out jack.
|
|---|
| 27 | You can enable any combination of these three devices.
|
|---|
| 28 |
|
|---|
| 29 | You can also set the output gain (volume) level.
|
|---|
| 30 |
|
|---|
| 31 | Running as a GUI
|
|---|
| 32 |
|
|---|
| 33 | Simply start audiopy with no arguments to start it as a Tkinter
|
|---|
| 34 | based GUI application. It will pop up a window with two sections:
|
|---|
| 35 | the top portion contains three radio buttons indicating your
|
|---|
| 36 | selected input device; the middle portion contains three
|
|---|
| 37 | checkboxes indicating your selected output devices; the bottom
|
|---|
| 38 | portion contains a slider that changes the output gain.
|
|---|
| 39 |
|
|---|
| 40 | Note the underlined characters in the button labels. These
|
|---|
| 41 | indicate keyboard accelerators so that pressing Alt+character you
|
|---|
| 42 | can select that device. For example, Alt-s toggles the Speaker
|
|---|
| 43 | device. The Alt accelerators are the same as those you'd use in
|
|---|
| 44 | as the short-form command line switches (see below).
|
|---|
| 45 |
|
|---|
| 46 | Alt-q is also an accelerator for selecting Quit from the File
|
|---|
| 47 | menu.
|
|---|
| 48 |
|
|---|
| 49 | Unsupported devices will appear dimmed out in the GUI. When run
|
|---|
| 50 | as a GUI, audiopy monitors the audio device and automatically
|
|---|
| 51 | updates its display if the state of the device is changed by some
|
|---|
| 52 | other means. With Python versions before 1.5.2 this is done by
|
|---|
| 53 | occasionally polling the device, but in Python 1.5.2 no polling is
|
|---|
| 54 | necessary (you don't really need to know this, but I thought I'd
|
|---|
| 55 | plug 1.5.2 :-).
|
|---|
| 56 |
|
|---|
| 57 | Running as a Command Line Program
|
|---|
| 58 |
|
|---|
| 59 | You can run audiopy from the command line to select any
|
|---|
| 60 | combination of input or output device, by using the command line
|
|---|
| 61 | options. Actually, any option forces audiopy to run as a command
|
|---|
| 62 | line program and not display its GUI.
|
|---|
| 63 |
|
|---|
| 64 | Options have the general form
|
|---|
| 65 |
|
|---|
| 66 | --device[={0,1}]
|
|---|
| 67 | -d[-{0,1}]
|
|---|
| 68 |
|
|---|
| 69 | meaning there is both a long-form and short-form of the switch,
|
|---|
| 70 | where `device' or `d' is one of the following:
|
|---|
| 71 |
|
|---|
| 72 | (input)
|
|---|
| 73 | microphone -- m
|
|---|
| 74 | linein -- i
|
|---|
| 75 | cd -- c
|
|---|
| 76 |
|
|---|
| 77 | (output)
|
|---|
| 78 | headphones -- p
|
|---|
| 79 | speaker -- s
|
|---|
| 80 | lineout -- o
|
|---|
| 81 |
|
|---|
| 82 | When no value is given, the switch just toggles the specified
|
|---|
| 83 | device. With a value, 0 turns the device off and 1 turns the
|
|---|
| 84 | device on. Any other value is an error.
|
|---|
| 85 |
|
|---|
| 86 | For example, to turn the speakers off, turn the headphones on, and
|
|---|
| 87 | toggle the cd input device, run audiopy from the command line like
|
|---|
| 88 | so:
|
|---|
| 89 |
|
|---|
| 90 | % ./audiopy -s=0 -p=1 -c
|
|---|
| 91 |
|
|---|
| 92 | Audiopy understands these other command line options:
|
|---|
| 93 |
|
|---|
| 94 | --gain volume
|
|---|
| 95 | -g volume
|
|---|
| 96 | Sets the output volume to the specified gain level. This must
|
|---|
| 97 | be an integer between MIN_GAIN and MAX_GAIN (usually [0..255],
|
|---|
| 98 | but use the -h option to find the exact values).
|
|---|
| 99 |
|
|---|
| 100 | --version
|
|---|
| 101 | -v
|
|---|
| 102 | Print the version number and exit
|
|---|
| 103 |
|
|---|
| 104 | --help
|
|---|
| 105 | -h
|
|---|
| 106 | Print a help message and exit
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 | |
|---|
| 110 |
|
|---|
| 111 | Local Variables:
|
|---|
| 112 | indent-tabs-mode: nil
|
|---|
| 113 | End:
|
|---|