summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod
AgeCommit message (Collapse)Author
2024-06-01sndiod: Don't add/remove server.device entries in dev_{open,close}()Alexandre Ratchov
Fixes server.device entries disappearing when usb devices are unplugged while in use. Found, analysed and tested by Laurie Tratt, thanks!
2024-05-24sndiod: Set the display string of all server.device entriesAlexandre Ratchov
with help from edd@ and armani@
2024-05-24sndiod: Propagate the controls' display string to clients.Alexandre Ratchov
with help from edd@ and armani@
2024-05-24sndiod: Use a 'unsigned char *' for the pointer to the temp sock bufferAlexandre Ratchov
2024-05-24sndiod: Hide "hardware" device's server.device control.Alexandre Ratchov
If sndiod is using another sndiod instance instead of the bare hardware, then it must disable the underlying server.device control to avoid conflicts with its own server.device control.
2024-05-24sndiod: Don't mark as dirty controls that have not been changedAlexandre Ratchov
2024-05-19remove prototypes with no matching function; ok ratchov@Jonathan Gray
2024-05-06sndiod: Ignore server.device settings to a non-working deviceAlexandre Ratchov
2024-05-03sndiod.1: Drop the number component of sndio descriptorsAlexandre Ratchov
2024-05-03sndiod: Fix SIGHUP to reopen the devices in priority orderAlexandre Ratchov
With this commit, SIGHUP makes sndiod discover new devices and if there is a new device with higher priority (greater -F option number) than the current one, sndiod switches to it. If the current device is already the one with the highest priority (i.e. last -F), then SIGHUP does nothing.
2024-04-22sndiod: Use the channel mapping code of aucatAlexandre Ratchov
For now sndiod uses only a subset of the available channel mappings. It gives the same result as the previous one, but having the same in both programs makes code review and testing easier.
2024-04-22sndiod: Use a 24-bit table for index to volume conversion.Alexandre Ratchov
2024-04-22sndiod: Use resampling algorithm from aucatAlexandre Ratchov
sndiod doesn't use partial blocks as aucat, but having the same algorithm makes code review and testing easier.
2024-04-22sndiod: Drop duplicate prototype of dev_new()Alexandre Ratchov
2024-04-22sndiod: Hide forgotten debug printfsAlexandre Ratchov
2024-04-22sndiod: Call ctlslot->ops->sync() after every control updateAlexandre Ratchov
This ensures that the final NULL sioctl_ondesc() call-back call is not lost.
2024-04-22sndiod: Make opt_setdev() return 1 if the device was acceptedAlexandre Ratchov
2024-04-22sndiod: Return the number of controls ctl_del() has deleted.Alexandre Ratchov
2024-04-02sndiod: Migrate clients upon watchdog timeoutAlexandre Ratchov
When -F is used, fixes the difference in behavior between watchdog timer expiry and other errors.
2024-04-02sndiod: Fix confusion between the slot and ctlslot pointersAlexandre Ratchov
Fixes crash when the device is disconnected and the clients are not migrated to another device.
2023-12-09Fix wrong call to slot->ops->exit() causing server to abort.Alexandre Ratchov
ok kn@
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@