summaryrefslogtreecommitdiff
path: root/usr.bin/aucat
AgeCommit message (Collapse)Author
2008-11-07expose the block size in the sndio API by making par->round writableAlexandre Ratchov
and thus remove the ugly rate <-> block-size table from sio_setpar(3). Handle the block size negociation in aucat(1), since it has few constrains the code is overally simpler. ok jakemsr@, major crank suggested by deraadt@
2008-11-07when attaching a new stream, don't overwrite it's parametersAlexandre Ratchov
with the emulated ones (otherwise the next time it's attached conversions will not be setup).
2008-11-06drop/silence calculation is wrong when xrun occurs and client andAlexandre Ratchov
device number of channels are not the same. The bug was hidden until now, because mixer and demux input and outputs used to have the same frame size.
2008-11-04conversions are smarter now, remove corresponding ``BUGS'' itemAlexandre Ratchov
2008-11-04split code that converts any->any in two parts: one to encodeAlexandre Ratchov
native->any and one to decode any->native. It is simpler and faster this way.
2008-11-04cleanup: remove channel mapping bits from encoding conversion code.Alexandre Ratchov
As a side effect, reduce CPU usage by ~10% on envy(4) devices.
2008-11-04add "new" conversion code to map any channel range into any otherAlexandre Ratchov
channel range (based on the encoding conversion code). Will allow to unentangle channel mapping from encoding conversion. As a side effect, greatly reduces CPU usage for channel mapping. No functionnal change.
2008-11-04cleanup: resample stream while in native format and remove resamplingAlexandre Ratchov
bits from the encoding conversion code. As a side effect this reduces CPU usage by 30% on envy(4).
2008-11-04optimization: add "new" resampling code (actually based on the existingAlexandre Ratchov
conversion bits) and use it when resampling only is required (ie for clients using s16 encoding), this is the most common case. Reduces CPU usage by ~50%. No functional change.
2008-11-03rename mixxxx and subxxx fields of struct abuf to avoid confusion:Alexandre Ratchov
Add ``i'' to offsets in the input buffer and ``o'' to offsets in the output buffer. This is necessary because input and output use no more the same frame size.
2008-11-03A small optimization: handle most N-channel <-> M-channel conversionsAlexandre Ratchov
inside the mixer and the demultiplexer. This way, aucat will not trigger the heavy conversion code when only channel conversions are required. Cuts ~50% of the CPU usage on envy(4) devices, can improve surround 4.0, 5.1 and 7.1 capable devices. No functionnal change.
2008-10-30since people often ask, add BUGS entry to explain whyAlexandre Ratchov
aucat should be started automatically yet at system startup help from jmc@
2008-10-29chmod(2) the aucat socket, as if aucat(1) was started withAlexandre Ratchov
umask = 0, this allows one user to start the server and another user to use it (eg. _mpd). ok todd, deraadt, jakemsr
2008-10-28Use -Werror unconditionnaly again.Miod Vallat
2008-10-27No -Werror on m88k, hairy gcc bug generates false ``variable might be usedMiod Vallat
uninitialized'' warnings. To be removed when the compiler bug is fixed eventually.
2008-10-27rename libsa to libsndioAlexandre Ratchov
requested by many, "just go for it" deraadt@
2008-10-26zap `q' from the getopts string too,Alexandre Ratchov
requested by jmc@
2008-10-26sync SYNOPSIS and usage();Jason McIntyre
2008-10-26add minimal server capability to aucat(1). When started in serverAlexandre Ratchov
mode, it listens on an unix socket and mixes/demultiplexes any number of full-duplex streams, doing necessary format conversions and resampling on the fly. programs can use the new libsa(3) library to play and record audio. The library provides a very simple API to connect to the audio server; if aucat(1) isn't running, it uses the audio(4) driver transparently instead.
2008-08-25minor tweak for removal of "[-d devel]" (change done in r1.19 and r1.21).Igor Sobrado
ok ratchov@
2008-08-20abuf_flush() must be called only from the ``xxx_in()'' routines (ieAlexandre Ratchov
triggered by POLLIN condition). mix_pushzero() is not called from the ``xxx_in()'' chain, but calls abuf_flush() resulting in bad initialization of the mixer, which will lead to a deadlock at some point. ok jakemsr
2008-08-14fix comments suggested by eric@, remove stupid DPRINTF()Alexandre Ratchov
2008-08-14in abuf_rgetblk() the ``start'' pointer may take a value beyond theAlexandre Ratchov
end of the buffer because periodic boundary conditions of the FIFO are not met ok jakemsr
2008-08-14move all device related stuff from aucat.c to a new dev.c file.Alexandre Ratchov
The new dev_xxx() routines expose a "high level" self-contained interface to the device. At initialization, the device is opened and two chains of aproc structures are created: * a playback chain that exposes a (initially) empty mix aproc to which the rest of the code can attach new streams to be played * record chain that exposes a (initially) empty sub aproc to which the rest of the code can attach new stream to to record The rest of the code, has just to use dev_attach() routine to attach streams. While we're at it, add a ``devops'' structure containing pointers to the device-specific routines. This will allow later to add support for other type of device than the Sun API. Also, write the .wav headers in file_del(), so put all header related data in the file strucuture. This allows to close() the file, as soon as wpipe_xxx() aproc terminates. This will be useful for the server, because it will need to close() descripts of closed connections immediately. add mix_pushzero() routine to fill the mixer with silence. It will be used to avoid the mixer to underrun when there are no input streams. Since we always have at least one input stream there's no behaviour change. ok jakemsr
2008-08-14in file.c, before dereferencing pointers to in(), out(), eof(),Alexandre Ratchov
hup() routines of the aproc strucure check that the aproc structure has not desappeared. This never happens currently, but will be allowed later. No behaviour change. ok jakemsr
2008-08-14add an "AUTOQUIT" flag to mix and sub aprocs. If the flag isAlexandre Ratchov
set, the mix aproc will exit once there are no more input streams, similarly the sub aproc will exit once there are no more ouput streams. If the flag is not set, the mix aproc will generate silence, and the sub aproc will drop samples. By default this flag is set, so no behaviour change. ok jakemsr
2008-08-14add a bytes counter to abuf structures to count the number ofAlexandre Ratchov
bytes that entered the FIFO. The counter may overflow, so it should be used with "modulo 2^32" arithmetic. The counter will be used later to synchronize playback to record. No behaviour change. ok jakemsr
2008-08-14add a xxx_done() method to aproc structures, that cleans up justAlexandre Ratchov
before free()ing the aproc structure, this is cleaner and will allow to reuse wpipe_xxx() and rpipe_xxx() when defining new aprocs. No behaviour change. ok jakemsr
2008-08-14move mix/sub underrun/overrun handling code and data in theAlexandre Ratchov
generic abuf structure, so it can reused. Required for an audio server. No behaviour change. ok jakemsr
2008-08-14factor code that discards data from abuf strucure into a singleAlexandre Ratchov
abuf_rdiscard() routine. Similarly add abuf_wcommit() routine for writing. The purpose is to stop manupulating FIFO pointers in various places outiside abuf.c, its too error prone. No behaviour change. ok jakemsr
2008-06-03group the descriptions for -CcHhEeRr in such a way as to avoidJason McIntyre
unneccessarily duplicating text; ok ratchov jakemsr
2008-06-03Allow aucat to play/record from input-only or output-only devices.Dale Rahn
ok jakemsr, ratchov
2008-06-02fix up ENVIRONMENT a little;Jason McIntyre
2008-06-02- tweak previousJason McIntyre
- simplify -io descriptions
2008-06-02document latest changes: -d flag is replaced by AUCAT_DEBUGAlexandre Ratchov
environment variable, new -xX options bits from eric, ok jakemsr
2008-06-02currently, we start the device as soon as write() blocks; it's betterAlexandre Ratchov
to continue filling the play buffer until it's full. This way, the play buffer has fewer chances to underrun when the device is started. ok jakemsr
2008-06-02if aucat is suspended, then the kernel continues running the deviceAlexandre Ratchov
(produces silence) and later, once aucat is resumed the kernel starts dropping samples, it will try to drop as many samples as silence was produced. So suspending breaks the aucat process permanently. workaround this by blocking the signals ie disabling suspending of aucat from the tty. The long term solution would be to catch SIGCONT and to stop the device, resync/refill buffers and restart the device. That's really a lot of work... ok jakemsr
2008-06-02allow the user to choose the aucat behaviour when underruns/overrunsAlexandre Ratchov
occur on a per-stream basis, using -Xx flags. There are 3 possible policies: - ignore : ignores underruns/overruns, for instance, this mode could be used for creating simple pipes with utilities; like in your last cdio diff. - sync : insert/discard samples in order to keep all streams in sync, useful for multi-tracker-like apps and/or to sync midi/video/whatever on audio streams (this was the previous behaviour) - error : if overruns/underruns occur, consider it as fatal error and kill the corresponding stream (without disturbing others). Useful, for reliable recordings (and/or debugging aucat itself:). ok jakemsr
2008-06-02(remove -d, second part) use strtonum() instead of sscanf() and inlinedAlexandre Ratchov
checks suggested and ok jakemsr
2008-06-02since underruns/overruns are handled outside devices, remove code thatAlexandre Ratchov
check for xruns in devices. ok jakemsr
2008-06-02(remove -d, first part) replace -d flag by AUCAT_DEBUG environmentAlexandre Ratchov
variable. This eases turning debugging on/off when aucat is started by another program. "i like the idea" jakemsr
2008-06-02Allows any input/output stream to underrun/overrun without disturbingAlexandre Ratchov
other streams. Beside making aucat usable with slow apps (eg. cdio), this change will ease turning aucat into an audio server later if one of the input buffers underruns, then silence is generated in place of the missing samples. Later, as many samples are dropped in order to maintain the stream in sync with the rest if one of the output buffers overruns then newer samples are discarded. Later silence is generated in order to maintain the stream in sync with the rest. ok jakemsr
2008-05-29try to clearly describe interaction between -CcEeHhRr and -fiou options;Jason McIntyre
written with help from ratchov and jakemsr; ok ratchov
2008-05-28if aucat is resumed (after suspend), kernel buffers are empty, thus write()Alexandre Ratchov
syscall succedes and consumes aucat buffers until kernel buffers are full. If aucat buffers are smaller than kernel ones, they will underrun, and aucat will terminate, since underruns are not handled yet. This changes is an improvement until SIGCONT handler is implemented. The correct approach is to add a handler for SIGCONT to: call dev_stop(), reset all buffers, bring play and record in sync, fill play buffers and call dev_start(). ok jakemsr
2008-05-26signpost encodings and formats a little better;Jason McIntyre
2008-05-26put -q in the right place;Jason McIntyre
2008-05-26add -q option which enables "quiet" operation.Jacob Meuser
ok ratchov@
2008-05-25give argument to LIST_END(), don't use variable lenght arrays as lastAlexandre Ratchov
field of structures. from deraadt@
2008-05-23various fixes for aucat.1, and sync usage(); ok ratchovJason McIntyre
2008-05-23add support for:Alexandre Ratchov
- recording, full-duplex operation - format conversions and resampling on the fly - mixing on the fly of multiple inputs of different formats - up to 16 channels, simplistic "routing" of channel ranges - more linear encodings (in raw and wav files) the old behaviour is fully preserved if none of the new -i and -o options are used. code and fixes from jakemsr@ and eric@, suggestions by others. ok "go ahead" deraadt@