summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod
AgeCommit message (Collapse)Author
2022-12-26spelling fixes; from paul tagliamonteJason McIntyre
amendments to his diff are noted on tech
2022-04-29Wait until the buffer is drained before closing the deviceAlexandre Ratchov
Fixes last few samples not being played when very large buffers are used.
2022-04-29Add sio_flush(3) function to stop playback immediatelyAlexandre Ratchov
The new sio_flush(3) functions works the same way as sio_stop(3), except that it doesn't wait for play buffer to be drained. Instead, it discards its contents and returns immediately.
2022-03-15Fix crash caused by confusion between requested device and last used oneAlexandre Ratchov
Found by and ok semarie@
2022-03-07Switch internal sample representation to 24-bit fixed-point.Alexandre Ratchov
The default device precision doesn't change (yet), i.e. we still request the usual 16-bit mode, when available. Hardware supporting 24-bit samples only gets end-to-end 24-bit processing by default. ok kettenis
2022-02-18Avoid gendered language in man pages when not referring to a specificJonathan Gray
person. Rewrite or use singular they. ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and others I'm likely missing on an earlier version. feedback tj@, feedback and ok jmc@
2021-12-25Move example about USB devices from -F description to hot plugging sectionAlexandre Ratchov
ok kn
2021-12-25Add section to explain how to handle device hot pluggingAlexandre Ratchov
mostly from kn@, tweaks from me
2021-12-18tighten the decription of -F; from richard ulmerJason McIntyre
ok ratchov
2021-11-01Remove unused struct nameAlexandre Ratchov
2021-11-01Stop binding audio devices exposed by sndiod to physical devicesAlexandre Ratchov
This a shift towards a new model: clients connect to logical devices (created with -s option) then the server routes data to/from the underlying physical device (registered with -f option). The binding may be changed at run-time with the server.device control exposed by sndioctl(1). As audio devices exposed by sndiod(8) are not bound to fixed physical devices anymore, the physical audio device number component of sndio(7) descriptors was removed. fixes, help from and ok denis, edd
2021-07-16Update the default block size in the manual, in sndiod.c r1.37 it wasStuart Henderson
reduced to 480 frames. ok ratchov@
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2021-07-05Fix off-by-one array access when 64 channel stream is resampledAlexandre Ratchov
2021-05-25Drop assembly for 24-bit fixed-point operationsAlexandre Ratchov
Now i386 compiler is smart enough to generate a single imul instruction per fixed-point multiplication. This change also allows 24-bit precision to be used on all archs (if -DADATA_BITS=24 is used). Tested on arm64 by Doug Moss <dougmoss710 at yahoo.com>, thanks Suggested and ok naddy@
2021-05-03If mode is not allowed in struct opt, then just play/record silenceAlexandre Ratchov
This is similar to what we already do when device is opened and its mode doesn't match requested mode. Besides adding consistency, this change would allow client's opt structure to be changed dynamically.
2021-04-28sndiod: Attach client at the same position, regardless the device modeAlexandre Ratchov
This is necessary to make rec-only devices properly work in full-duplex. Fixes full-duplex clients stuck on rec-only device.
2021-04-28sndiod: Allocate (free) conversion buffers in slot_attach (slot_detach)Alexandre Ratchov
Besides being better coding style, this allows a client to be detached and then attached to a device with different parameters.
2021-03-10sndiod: When a slot structure is recycled allocate new controlAlexandre Ratchov
Trying to rename the program level control is not needed anymore. When a slot is given to another program, the new ctl_{new,del}() functions can be used to delete the control of the old program and create a new one for the new program. Cleaner, simpler.
2021-03-10sndiod: Style tweak: swap if/else code blocks in slot_new()Alexandre Ratchov
2021-03-08sndiod: Use chronological order for {dev,port}_listAlexandre Ratchov
This simplifies the logic of the initialization code, makes debug printfs nicer and could slightly ease futur development. No behavior change.
2021-03-08sndiod: Initialize dev->master_enabled earlierAlexandre Ratchov
This is better style as since recently dev->master_enabled is used by the ctlslot_xxx family functions which -- in the future -- could be called with the device closed. No behavior change.
2021-03-08sndiod: Style tweak: uniformize pattern to access ctlslot_arrayAlexandre Ratchov
2021-03-03sndiod: Move MTC/MMC state to its own global structureAlexandre Ratchov
2021-03-03sndiod: Move MIDI control endpoint to opt structureAlexandre Ratchov
No behavior change.
2021-03-03sndiod: Move controls out of the device structureAlexandre Ratchov
Moving to a global server-wide controls list is necessary to expose controls that are not associated to a particular device (ex. a device selector). The current hack to use the device-side sioctl_desc->addr variable as client-side key can't work anymore. So, we use a unique dynamically allocated ctl->addr key; this is much cleaner. A new "scope" enum (with two "void *" arguments) is used to determine what the control does control. This adds flexibility and allows to easily add new control types that are not associated to devices. No behavior change.
2021-03-02sndiod: Allow alternative devices to support different modes.Edd Barrett
Currently sndiod does not allow you to use alternative devices (-F devices) which support only a subset of the modes of the main (-f) device. For example, if you do `sndiod -f rsnd/0 -F rsnd/1` and: - rsnd/0 is full-duplex (rec + play). - rsnd/1 is play-only. Then you will be unable to use rsnd/1 as sndiod deems it incompatible and refuses to use it (similarly if rsnd/1 is record-only). This is annoying. It means if you want to use a record-only or play-only device, you will either have to kill sndiod and restart it specifying only that device (`sndiod -f rsnd/1` for the above example), or failing that, downgrade the functionality of the main device (`-m play`). This diff (a joint effort between ratchov@ and myself) makes mixing devices with different modes possible. It does this by making both recording and playing available for all devices, even if the underlying hardware doesn't support both modes. For example, if I try to record from a play-only device, then recording will succeed, but the captured PCM data will be pure silence. Similarly, if I try to play to a record-only device, then the audio stream will disappear into the ether. This is mostly a no-op for sndiod in the default configuration (except that play-only devices now accept recording clients). If you use alternative devices (-F), then it's possible for a record-only device to be found first, which may be confusing if you just want to hear sound. We can only assume that if you deviate from defaults, then you know what you are doing. With guidance from, and OK ratchov@, thanks!
2021-02-05disable autovol by default and set default volume to 127Joshua Stein
The previous behavior of automatically decreasing playback volume when new programs start playing can be achieved with '-w on'. ok ratchov, patrick
2021-02-02Fix use-after-free in dev_abort()Alexandre Ratchov
Fixes crash that can occur when an usb device is unplugged, found by edd@
2021-02-01some article fixes; from eddie youseph and grepJason McIntyre
2021-01-29Make audio clients use struct opt to reach the deviceAlexandre Ratchov
No behavior change. This decreases the number of explicit references to the dev structure
2021-01-29Make control clients use struct opt to reach the deviceAlexandre Ratchov
No behavior change. This decreases the number of explicit references to the dev structure.
2021-01-29Rename ctlslot->mask to ctlslot->self to match the rest of the codeAlexandre Ratchov
No binary change.
2021-01-29Order opt_list in opt_new() call order, limit items to OPT_NMAXAlexandre Ratchov
No behavior change, except for improved debug printfs.
2021-01-29Move the options list out of the device structureAlexandre Ratchov
No behavior change. Later this will ease applying the configuration of one device to another by "just" swapping pointers.
2021-01-29Move the control client state out of the device structureAlexandre Ratchov
No behavior change. Later this will ease changing the controlled device by "just" swapping pointers.
2021-01-29Move the audio clients state out of the device structureAlexandre Ratchov
No behavior change. Later this will ease moving clients from one device to another by "just" swapping pointers.
2021-01-28When an audio device is disconnected, drop MIDI clients controlling itAlexandre Ratchov
2021-01-28Dont attempt to drain disconnected clientsAlexandre Ratchov
Clients are always drained before they disconnect, so this change affects programs that die unexpectedly or loose thier network connection. Besides the bad style, this change fixes a theoretical bug when the disconnected client slot could be recycled and given to another client while it's being drained
2021-01-28In slot_xxx(), store dev pointer in local variableAlexandre Ratchov
This removes many redundant dereferences to obtain the dev pointer from the slot stucture and makes the source slightly more readable. No behavior change.
2021-01-28Use everywhere the same pattern to handle fractional clock ticksAlexandre Ratchov
No behavior change; this change is only to make the maths easier to proofread
2021-01-28Make slot_{attach,detach}() the opposite of each otherAlexandre Ratchov
No bahavior change. Now, slot_attach() moves slot's clock forward and puts the slot on device list; slot_detach() does the opposite: remove from device list and move clock backwards. This will allow to detach a client and attach it later in exactly the same state.
2021-01-28Drop unused dev_nctl() function and few unused prototypesAlexandre Ratchov
2021-01-12const-ify lookup tables; ok ratchov@Christian Weisgerber
2021-01-11Use a 8-th order FIR low-pass filter for resamplingAlexandre Ratchov
At the expence of slightly more CPU cycles, it almost removes aliasing noise in most practical use-cases.
2020-12-10Check sample signedness when setting up format conversions.Alexandre Ratchov
Fixes confusion between s16 and u16 found in aucat by James Cook.
2020-07-19Don't add server.device knob if there's only one audio deviceAlexandre Ratchov
2020-07-19Fix initial alternate device numberAlexandre Ratchov
The initial alternate device number was set to 1 (instead of -1), causing device number 1 to be skipped the first time sndiod is used.
2020-06-28Allow switching between alternate devices (-F option) with sndioctl(1)Alexandre Ratchov
2020-06-28Add a new SIOCTL_SEL control type to select one of a predefined set ofAlexandre Ratchov
mutually exclusive values. It's the same as SIOCTL_LIST except that exactly one list element may be selected.