mirror of
https://github.com/larsimmisch/pyalsaaudio.git
synced 2026-04-17 08:25:31 +00:00
loopback.py: bugfixes
Retroactively add to CHANGES.md
This commit is contained in:
13
CHANGES.md
13
CHANGES.md
@@ -1,3 +1,10 @@
|
||||
# Version 0.10.1
|
||||
- restore previous xrun behaviour, #131
|
||||
- type hints
|
||||
|
||||
# Version 0.10.0
|
||||
- assorted improvements, (#123 from @ossilator)
|
||||
|
||||
# Version 0.9.2
|
||||
- Fix alsamixer_getvolume (#112 from @stephensp)
|
||||
|
||||
@@ -15,15 +22,15 @@
|
||||
supported formats - e.g. `{"U8": 1, "S16_LE": 2}`,
|
||||
- `getchannels()` returns a list of the supported channel numbers, e.g. `[1, 2]`,
|
||||
- `getrates()` returns supported sample rates for the device, e.g. `[48000]`,
|
||||
- `getratebounds()` returns the device's official minimum and maximum supported
|
||||
- `getratebounds()` returns the device's official minimum and maximum supported
|
||||
sample rates as a tuple, e.g. `(4000, 48000)`.
|
||||
|
||||
|
||||
(#82 contributed by @jdstmporter)
|
||||
|
||||
- Prevent hang on close after capturing audio (#80 contributed by @daym)
|
||||
|
||||
# Version 0.8.5:
|
||||
- Return an empty string/bytestring when `read()` detects an
|
||||
- Return an empty string/bytestring when `read()` detects an
|
||||
overrun. Previously the returned data was undefined (contributed by @jcea)
|
||||
|
||||
- Unlimited setperiod buffer size when reading frames (contributed by @jcea)
|
||||
|
||||
15
loopback.py
15
loopback.py
@@ -8,7 +8,7 @@ import re
|
||||
import struct
|
||||
import subprocess
|
||||
from datetime import datetime, timedelta
|
||||
from alsaaudio import (PCM, pcms, PCM_PLAYBACK, PCM_CAPTURE, PCM_FORMAT_S16_LE, PCM_NONBLOCK, Mixer,
|
||||
from alsaaudio import (PCM, pcms, PCM_PLAYBACK, PCM_CAPTURE, PCM_NONBLOCK, Mixer,
|
||||
PCM_STATE_OPEN, PCM_STATE_SETUP, PCM_STATE_PREPARED, PCM_STATE_RUNNING, PCM_STATE_XRUN, PCM_STATE_DRAINING,
|
||||
PCM_STATE_PAUSED, PCM_STATE_SUSPENDED, ALSAAudioError)
|
||||
from argparse import ArgumentParser
|
||||
@@ -63,6 +63,7 @@ class Loopback(object):
|
||||
def __init__(self, capture, playback_args, run_after_stop=None, run_before_start=None):
|
||||
self.playback_args = playback_args
|
||||
self.playback = None
|
||||
self.playback_control = playback_control
|
||||
self.capture_started = None
|
||||
self.last_capture_event = None
|
||||
|
||||
@@ -299,6 +300,7 @@ if __name__ == '__main__':
|
||||
parser.add_argument('-O', '--output-mixer', help='Control of the output mixer, can contain the card index, e.g. PCM:1')
|
||||
parser.add_argument('-A', '--run-after-stop', help='command to run when the capture device is idle/silent')
|
||||
parser.add_argument('-B', '--run-before-start', help='command to run when the capture device becomes active')
|
||||
parser.add_argument('-V', '--volume', help='Initial volume (default is leave unchanged)')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -363,9 +365,12 @@ if __name__ == '__main__':
|
||||
volume_handler = VolumeForwarder(capture_control, playback_control)
|
||||
reactor.register(PollDescriptor.from_alsa_object('capture_control', capture_control, select.POLLIN), volume_handler)
|
||||
|
||||
if capture and playback:
|
||||
loopback = Loopback(capture, playback_args, args.run_after_stop, args.run_before_start)
|
||||
loopback.register(reactor)
|
||||
loopback.start()
|
||||
if args.volume and playback_control:
|
||||
playback_control.setvolume(int(args.volume))
|
||||
|
||||
loopback = Loopback(capture, playback_args, playback_control, capture_control,
|
||||
args.run_after_stop, args.run_before_start)
|
||||
loopback.register(reactor)
|
||||
loopback.start()
|
||||
|
||||
reactor.run()
|
||||
|
||||
6
setup.py
6
setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
|
||||
from setuptools.extension import Extension
|
||||
from sys import version
|
||||
|
||||
pyalsa_version = '0.10.0'
|
||||
pyalsa_version = '0.10.1'
|
||||
|
||||
if __name__ == '__main__':
|
||||
setup(
|
||||
@@ -29,12 +29,12 @@ if __name__ == '__main__':
|
||||
'License :: OSI Approved :: Python Software Foundation License',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Topic :: Multimedia :: Sound/Audio',
|
||||
'Topic :: Multimedia :: Sound/Audio :: Mixers',
|
||||
'Topic :: Multimedia :: Sound/Audio :: Players',
|
||||
'Topic :: Multimedia :: Sound/Audio :: Capture/Recording',
|
||||
],
|
||||
ext_modules=[Extension('alsaaudio',['alsaaudio.c'],
|
||||
ext_modules=[Extension('alsaaudio',['alsaaudio.c'],
|
||||
libraries=['asound'])]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user