summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod
AgeCommit message (Collapse)Author
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.
2020-06-18Don't try to open device that's already openAlexandre Ratchov
Save the current alternate device index and skip it in dev_reopen(). Handling alternate device indices this way will ease future development as well.
2020-06-12On error, drop clients and close the device only if it's still openAlexandre Ratchov
Fixes crashes when USB devices are disconnected, caused by an attempt to close the already closed device: it was closed once when its ref counter drops to zero (after the last client is disconnected) and once with an explicit call to dev_close() on the error code-path.
2020-04-26Bypass authentication and create no session for rootAlexandre Ratchov
ok deraadt
2020-04-25If no -f options are used, expose first 4 audio(4) devices to clientsAlexandre Ratchov
2020-04-25Get a reference to the device when "snd/N" MIDI ports are openedAlexandre Ratchov
As the master output level control is not in software any longer the device needs to opened for adjustments to work.
2020-04-24Make sure devices are properly closed in case of an error.Alexandre Ratchov
Fixes possible crashes if the contol device fails, while the audio device continues to work.
2020-04-16If available, use hardware "output.level" for volume control.Alexandre Ratchov
With this change, there's a single outputs.level control: either the hardware one or software one. Consequently, there can't be control name clashes and there's no need to move hardware's top-level controls into the "hw/" group.
2020-04-16Hide controls of unused slots from "mixer" clients.Alexandre Ratchov
2020-04-15When device is (re-)opened, call dev_ctlsync() if there's no control deviceAlexandre Ratchov
In the dev_reopen() case the controls of the old device are removed, but if the new device has no controls, we still need to call dev_ctlsync() so that clients are notified about the removal of the old controls.
2020-04-15Don't forget to notify clients when a control is removedAlexandre Ratchov
2020-04-15Properly log CTL_NONE controlsAlexandre Ratchov
2020-04-01If no -q options are used, expose first 8 midi(4) devices to sndiod clientsAlexandre Ratchov
2020-03-31Don't send "control changed" messages when hardware controls are set.Alexandre Ratchov
This sends twice the "control changed" messages because a second message will be sent upon the notification from the hardware.
2020-03-08Don't forget to notify clients when controls list is ready.Alexandre Ratchov
This is needed because when devices are swapped, clients need to know when to rebuild their user interface.
2020-02-26Add API to control audio device parameters exposed by sndiod.Alexandre Ratchov
The API exposes controls of modern audio hardware and sndiod software volume knobs in a uniform way. Hardware knobs are exposed through sndiod. Multiple programs may use the controls at the same time without the need to continuously scan the controls. For now sndiod exposes only its own controls and the master output and input volumes of the underlying hardware (if any), i.e. those typically exposed by acpi volume keys. ok deraadt
2020-01-23Remove unused sys/signal.h include.Alexandre Ratchov
2020-01-23When opening a device, loop over the alternate devices list in theAlexandre Ratchov
worker process instead of the helper process. It is simpler this way and allows the worker to properly log which device is being used.
2020-01-23Accept MIDI clients that don't reset status during sysex messages.Alexandre Ratchov
The MIDI protocol requires the status byte to be resent after common messages, including system exclusive messages. But, some MIDI clients forget to resend it; we workaround this restoring the status byte after sysex messages.
2020-01-10Unbreak channel duplication (aka -j option).Alexandre Ratchov
Fix from Peter Piwowarski <peterjpiwowarski at gmail.com> with few tweaks from me. Thanks.
2019-11-27Initialize nfds fields of new file structures.Alexandre Ratchov
Fixes a possible crash when a new file structure is added in the time-out processing code-path.
2019-09-21tweak previous;Jason McIntyre
2019-09-21Fix missing word in -F and -Q descriptions.Alexandre Ratchov
2019-09-21Lower the default audio block size from 20ms to 10ms.Alexandre Ratchov
Then new default block size is supported by virtually all devices which allows switching between devices without further configuration. The buffer size remains the same, so this change won't affect audio stability. ok mpi@
2019-09-21Allow switching between devices without disconnecting clients.Alexandre Ratchov
The new -F option allows alternate device to be specified. If the device is disconnected, the one given with the last -f or -F options will be used instead. Similarly, the new -Q option allows an alternate MIDI port to be specified. ok mpi@
2019-09-19Don't attempt to join/expand nonexistent channels.Alexandre Ratchov
If the (hardware) device has fewer channels than the exposed sub-device, then join/expand only to channels that exist on the device.
2019-09-19Move device slot convertions setup in its own routine.Alexandre Ratchov
No behabior change.
2019-09-19Move device buffer allocation to its own routines.Alexandre Ratchov
This makes the code more readable and the routine available for other uses. No behavior change.
2019-08-29Split dev_close() routine in two parts.Alexandre Ratchov
The first part disconnects clients, the other closes the device and frees audio buffers. No behavior change.
2019-08-29Split dev_open() in two parts.Alexandre Ratchov
The first part resets audio parameters to the prefered ones, the second part opens the device and allocates the audio buffers. No behavior change.
2019-08-29Make debug printf in port_open() look as othersAlexandre Ratchov
2019-08-29Fix wrong comment about MIDI port hold flagAlexandre Ratchov
2019-08-29Move code de disconnect all MIDI clients to its own routine.Alexandre Ratchov
This makes the routine reusable, no behavior change.
2019-08-29Move code de disconnect all audio clients to its own routine.Alexandre Ratchov
This makes the routine reusable, no behavior change.
2019-08-29Uniformize device-specific debug printfsAlexandre Ratchov
2019-07-2816 channels is not enough to handle all common uaudio(4) devices, soAlexandre Ratchov
crank the maximum channels number to 64.
2019-07-12Add affinity between the program and its mixer control.Alexandre Ratchov
Currently, if there are two instances of the same program, sndiod will allocate one volume control to each. If both programs disconnect and reconnect, the information of which control is assigned to which program is lost. This makes difficult to run two instances of a player and crossfade between each other with a MIDI controller. To address this, the program chooses a 32-bit "id" (for now the process pid) and sends it to the server. The server records the id in the client's slot structure. When the server accepts a new connection, it uses the id to identify the slot the client used during the previous connection; if it was not recycled yet, it's assigned to the program.
2019-07-10Remove few level 3 debug printfs related to slot allocation.Alexandre Ratchov
2019-07-10Replace the "umap" bitmap by a simple table of slot pointers.Alexandre Ratchov
Makes the code simpler at virtually no cost since we need 8 entries only. No behavior change.
2019-07-10Swap "if" and "else" code blocks in slot_new() to improve readability.Alexandre Ratchov
No behavior change.
2019-07-10Slot name can't be empty. So, no need to check if it is empty.Alexandre Ratchov
2019-07-10Use NULL instead of 0 where a pointer is expected.Alexandre Ratchov
2019-07-05Fix spacing and comments, no code change.Alexandre Ratchov
2019-06-29Check if syscalls return -1 instead of any negative or non-zero value.Alexandre Ratchov
ok deraadt
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-06-16Ignore the frame cents component in MMC relocate message.Alexandre Ratchov
As MTC requires new position to be transmitted with one frame precision and then to advance in quarter-frame steps, its not necessary to pollute out mtc position pointer with a frame cents information, care about rounding errors and so on.
2019-06-16Say in comment why we use 1/2400 second as MTC time unit.Alexandre Ratchov