summaryrefslogtreecommitdiff
path: root/usr.bin/aucat/aproc.c
AgeCommit message (Collapse)Author
2011-05-26make clipping less ugly, from Sviatoslav ChagaevAlexandre Ratchov
2011-05-26add a new -w flag to control whether master volume is automaticallyAlexandre Ratchov
adjusted when new streams are connected and disconnected. Disabling automatic volume adjustment makes sense if all streams are recorded with properly lowered volumes.
2011-04-28remove deadcode, use err(1, "%s", str) instead of err(1, str)Alexandre Ratchov
from Michael W. Bombardieri <mb at ii.net>, thanks!
2010-11-04Replace ``short'' by a new ``adata_t'' typedef corresponding toAlexandre Ratchov
audio samples and cleanup ADATA_XXX macros. This allows easilly switching to 24 bit fixed point arithmetic by simply redefining the adata_t typedef to int and updating ADATA_XXX macros. No object change.
2010-10-21When the end of a stream is reached (ie mix_eof() called) otherAlexandre Ratchov
possibly blocked streams are processed. If during this phase the end of another stream is reached then stop the processing because the job will be already finished by the second stream. Otherwise we may end up running a destroyed stream. help from Edward Wandasiewicz <w13ntd at googlemail.com>, thanks
2010-10-21fix style and typos in messages and commentsAlexandre Ratchov
2010-10-21use MODE_xxx and XRUN_xxx macros everywhere, and zap correspondingAlexandre Ratchov
AMSG_xxx macros, which in turns simplifies the code
2010-05-07remove ``abspos'' counters, from the pre-libsndio era. Since play andAlexandre Ratchov
rec direction use the same clock, there's no need to maintain their absolute position.
2010-05-04make the mixer process data as soon as it's pushed by one of itsAlexandre Ratchov
inputs, i.e. don't way that the output requests it.
2010-05-02Don't systematically fill with silence the mixer output. ThisAlexandre Ratchov
might result in extra samples being written to the device when the mixer is closed.
2010-05-02in the resampling code, handle the case ``diff == 0'', to avoid producingAlexandre Ratchov
the first sample of the next block in advance.
2010-04-24don't increment mixer's ``idle'' counter before truncating theAlexandre Ratchov
amount of samples to commit to ``maxwrite''. Overwise uncommitted samples are accounted as idle, in turn causing the device to be stopped too early, possibly truncating few blocks at the end of streams being drained. subtle bug spotted and analysed by Thomas Pfaff, thanks
2010-04-24rename ibuflist/obuflist -> ins/outs to cut long linesAlexandre Ratchov
from Thomas Pfaff, thanks
2010-04-21adds the necessary bits to join channels (ex stereo->mono) orAlexandre Ratchov
expand channels (ex mono->stereo). It's switched on/off with the ``-j'' option, (default is "on").
2010-04-17Allow the mixer to handle inputs with channel ranges outsideAlexandre Ratchov
the device channel range. This makes the channel mapping code no longer usefuli, so remove it. No behaviour change.
2010-04-06aucat (server):Alexandre Ratchov
- make the ``-m mode'' option per subdevice, allowing subdevices to be play-only or rec-only even if the server is full-duplex - add ``monitoring'' mode (with ``-m mon''). This is a record-only stream from which played streams can be recorded (kind of ``record what you hear''). - allow MIDI devices to be subscribed to the controlling MIDI port of the server, ie what midicat does (with -f option), but using the -q option. - add flow control to the protocol, and serialize clock ticks (sio_onmove() calls) and data chunks. This should fix certain full-duplex programs, broken with ``magic'' block/buffer size combinations. - enable 3 block latency which is the minimum theoretical. Make -z and -b options correspond to device parameters. - make sio_getcap(3) the same for aucat and sun backends, ie return whatever is supported (``everything'' in the aucat case, since everything is actulally supported). aucat (player): - enable ``-m mode'' option to select between monitoring and recording when ``-o file'' is used. - plug MIDI code to non-server codepath. The MIDI control device is specified with the ``-q device'' option, as in server mode. - impliment lseek()'ing within files (controlled through MIDI). Necessary to use aucat with a MIDI sequencer. midicat (thrubox): - rename ``-f'' flag to ``-q'', so it has the same name as in aucat (-f is still working) ok jakemsr@, tweaks from jmc@
2010-04-03backout last change, committed by mistake, sorry...Alexandre Ratchov
2010-04-03doc fixes from jmcAlexandre Ratchov
2010-01-17While resampling, if input samples are available but outputAlexandre Ratchov
is blocked don't start processing input. Similarly don't produce output if input is blocked. This is to ensure that to each output block corresponds exactly one input block. This is necessary for full-duplex clients using block-based i/o and very small buffers.
2010-01-17fix quality degradation when resamplingAlexandre Ratchov
2010-01-15Fix resampling algorithm to always produce integer block sizes.Alexandre Ratchov
2010-01-14Use a more accurate algorithm to calculate clock tick durationAlexandre Ratchov
when resampling is involved. Removes single sample jitter, which could confuse programs expecting fixed block size.
2010-01-12check for bogus clock ticks sent by the device; helps trackingAlexandre Ratchov
bugs in device drivers.
2010-01-11When resuming from suspend, prime play buffers with silence,Alexandre Ratchov
otherwise the client would underrun by more than its own buffer size, which currently is not allowed (causes the client to deadlock). Set the minimum client buffer size to two blocks. Single block buffers don't work properly yet. with help from jakemsr
2010-01-10Add traces to help tracking subtle timing bugs often causingAlexandre Ratchov
underuns and overruns; such bugs are hard to debug with ktrace or a debugger. They are also handy to debug or monitor code using aucat. To enable traces, compile aucat with ``make DEBUG=-DDEBUG'' and use the -d option multiple times. ok jakemsr
2010-01-05Make the way .wav files are handled closer to the way sockets areAlexandre Ratchov
handled, which is conceptually simpler. No behaviour changes.
2009-11-15If two (or more) inputs use channel ranges having no intersection,Alexandre Ratchov
then don't reduce their dynamic range to ``share the volume''.
2009-11-05in rpipe_done (wpipe_done), all buffers must be detachedAlexandre Ratchov
before deleting the writer (reader) otherwise the later could trigger rpipe_done again.
2009-11-03Allow any program using aucat to act as MMC slave and MTC masterAlexandre Ratchov
transparently. Multiple audio applications can be started synchronously from external software/hardware supporting the standard Start/Stop/Relocate messages. The server clock is exposed through MTC, allowing non-audio software/hardware to be synchronized to audio applications.
2009-10-10We don't need independent file reader and writer anymore. So,Alexandre Ratchov
destroy reader when writer terminates and destroy writer when reader terminates. This simplifies a lot the way we drain audio devices and will help simplifying other parts.
2009-10-09Make abuf structure smaller:Alexandre Ratchov
- put aproc-specific parameters into unions since they are never used together - remove constant ``data'' pointer always pointing the end of the abuf structure
2009-10-06prevent aproc structures to be deleted twice. Doesn't change anythingAlexandre Ratchov
for now but will be used in future code.
2009-09-27remove all debug tracesAlexandre Ratchov
2009-07-25fix comments, remove no longer needed declaration, reorder includesAlexandre Ratchov
from Thomas Pfaff
2009-07-25Currently midi capable programs can control midi hardware, butAlexandre Ratchov
cannot cooperate with other programs. The aim of this change is to allow any program to send midi data to other programs as they were midi hardware. For instance, this change should solve the longstanding problem of using a midi sequencer with software synthesizers. More precisely: - new midicat(1) utility (actually hardlink to aucat(1)). it creates software midi thru boxes, allowing programs to send midi messages to other programs as they were midi(4) hardware. - new midi api in libsndio (see mio_open(3)), to access midi(4) devices and midicat(1) sockets in a uniform way. - new device naming scheme <service>:<unit>[.<option>], common to audio and midi. - new sndio(7) manual describing concepts and naming The current audio device naming still works, but people having scripts or configuration files containing device names could read the sndio(7) man page and slowly start updating device names. discussed with jakemsr@ and deraadt@, help form jmc@
2009-01-23spacing + typo fix from Matt Jibson <matt.jibson(at)gmail.com>Alexandre Ratchov
2008-12-29make the code "more correct": add reference counters to aprocAlexandre Ratchov
structures so we can keep a pointer to the device. Beside some simplifications, this allows to easily handle the situation where the audio device desappears. No change in the behaviour.
2008-12-27fix a bug in resampling code, resulting in joined stereo and/orAlexandre Ratchov
high frequency attenuation, intruduced in aproc.c rev 1.27. Hints from Alf Schlichting <a.schlichting(at)lemarit.com>, thanks!
2008-12-27simplify the mixer and the demultiplexer code; no change in theAlexandre Ratchov
behaviour. This also, fixes incorrect constructs that are currently harmless
2008-12-19use simple linear interpolation in the resampling code.Alexandre Ratchov
This partially removes the ``metallic'' noise audible especially when upsampling 8k -> 44.1k.
2008-12-07When resampling, don't require the sample frequency to be an integer.Alexandre Ratchov
This removes the arithmetic constraint between the sample frequency and the block size and all the associated code. Now aucat can work in server mode with any block size. ok jakemsr
2008-11-16make aucat compile without DEBUG defined (still defined by default)Alexandre Ratchov
2008-11-16Make clients inherit the volume parameter when the -v option is used inAlexandre Ratchov
server mode. It gives the maximum volume a client may have. This wastes dynamic range, but allows volume to stay constant when other clients connect or disconnect.
2008-11-10add a per-stream ``soft volume'' knob and the corresponding -v option.Alexandre Ratchov
The code will be useful later for the volume knob in the sndio API.
2008-11-09make aucat(1) stop automatically the audio(1) device if it's idle. ThisAlexandre Ratchov
way, when in server mode, it consumes no CPU if there are no clients. Later, this will allow to start aucat(1) at session or system startup.
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-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-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.