summaryrefslogtreecommitdiffstats
path: root/lib/libsndio/aucat.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add affinity between the program and its mixer control.ratchov2019-07-121-1/+2
| | | | | | | | | | | | | | | 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.
* Check if syscalls return -1 instead of any negative value.ratchov2019-06-291-22/+22
| | | | "Looks right" deraadt
* mkstemp() returns -1 on failurederaadt2019-06-281-2/+2
|
* Wait until server disconnects before closing the socket. Otherwise,ratchov2019-03-281-4/+17
| | | | last bytes sent may be lost by the server.
* call _sndio_parsenum() instead of duplicating the code in parsedev(); ok ratchov@miko2018-09-261-24/+3
|
* Move libsndio session cookie in its own $HOME/.sndio/ directory toratchov2018-07-281-2/+12
| | | | | | make libsndio easier to use with unveil(2). "make sense" deraadt
* Make code fit in 80 columns, remove trailing spaces & tabs.ratchov2016-01-091-3/+3
|
* remove NULL-checks before free()mmcc2015-12-231-5/+3
|
* Don't remove the type component from the device string before passingratchov2015-11-221-7/+16
| | | | | it to the *_open() functions. It's more flexible this way. No behaviour change.
* Fix missing checks for truncation of long file names. Rather thanratchov2015-10-051-14/+28
| | | | | checking for truncation every time we touch the string, simply allocate a memory chunk large enough to store the full path.
* use macros for cookie path and temp file template insteadratchov2015-10-021-3/+5
| | | | of hardcoded strings. no object change.
* As the socket path is known, use its size rather that PATH_MAX.ratchov2015-10-021-3/+3
|
* use macros instead of hard-coded strings for unix sockets pathsratchov2015-10-021-3/+3
|
* Remove support for the AUCAT_COOKIE environment variable.ratchov2015-10-011-11/+7
|
* add missing braces in _aucat_wmsg()jsg2015-05-051-2/+3
| | | | | | | | As ratchov@ notes: "all _aucat_wmsg() callers set hdl->wtodo, so your diff can't break things that used to work by accident." ok ratchov@
* Use SOCK_CLOEXEC (instead of later using fcntl(F_SETFD)) when creating socketsguenther2014-09-071-7/+4
| | | | | | for talking to aucat/sndiod ok ratchov@
* Be less verbose when SNDIO_DEBUG=1 is set.ratchov2013-12-201-3/+3
|
* add missing prototypesratchov2013-11-181-1/+2
|
* Prefix by '_' symbols that are not part of the API.ratchov2013-11-131-31/+30
| | | | ok deraadt, guenther
* internalize some functions so that they do not need prototypesderaadt2013-11-121-4/+4
| | | | ok ratchov
* in debug mode, log successful connections, from Jan Staryratchov2013-03-131-1/+2
|
* Remplace aucat server by a new sndiod daemon aimed to be simplerratchov2012-11-231-3/+2
| | | | | | | | | | | | smaller and faster than aucat. It's a drop in replacement with the following exceptions that don't affect the default setup: - The sample rate and the encoding are a per-device parameters thus -r and -e options must precede the corresponding -f option - MIDI thru boxes are dynamically created and no -M option is required anymore, so -M was removed. - MIDI ports are exposed with a new ``midi/N'' name, rather than abusing MIDI thru boxes. with help from armani@, ok deraadt@
* Use dedicated messages for flow control instead of abusing clock tickratchov2012-11-021-1/+2
| | | | | | messages and enable flow control for MIDI. Since this requires protocol version bump, both sndiod and libsndio must be kept up to date to work together.
* Use "unsigned int" rather than "unsigned". No object change.ratchov2012-04-111-9/+11
| | | | suggested by deraadt@
* Add a "device number" component in sndio(7) device names, allowing aratchov2011-11-151-45/+88
| | | | | | | | | | | | | | | | single aucat instance to handle all audio and MIDI services. Since this partially breaks compatibility, this is a opportunitiy to fix few other design mistakes (eg ':' being used by inet6, type name vs api name confusion, etc..). This leads to the following names: type[@hostname][,unit]/devnum[.option] The device number is the minor device number for direct hardware access (ie the 'N' in /dev/audioN). For aucat, this is the occurence number of the -f (or -M) option. There's a compatibility hook to keep old names working if only one aucat server is running.
* Don't attempt to send data not available for sending yet. Analysedratchov2011-10-221-7/+9
| | | | and fixed by Remco <remco at d-compu.dyndns.org>, thanks!
* Remove midicat since aucat can now be used instead of midicatratchov2011-10-171-15/+9
| | | | | | | | | with almost the same syntax (roughly an extra -M option). Thru boxes are created with aucat, and corresponding MIDI port names have the "aucat" prefix instead of "midithru". The old device name will still work some time for backward compatibility. ok deraadt
* restart connect(2) if it returns EINTRratchov2011-10-051-1/+4
|
* determine the default device in backend code instead of the commonratchov2011-05-031-1/+3
| | | | | code. This is simpler as long as not all backends use the same default.
* Add missing byter order conversions in message headers. Fixes the caseratchov2011-05-021-12/+12
| | | | | when the server and the client are not of the same endianness. Found by naddy.
* set the TCP_NODELAY option for TCP connectionsratchov2011-05-021-2/+9
|
* Implement a new authentication method allowing aucat and midicat toratchov2011-04-281-4/+164
| | | | | | | | | | | | | | | | | | | work over TCP, for instance, to expose the sound card of one machine with other machines of the network. The first client generates a 128-bit random number (aka the session cookie), saves it in $HOME/.aucat_cookie and sends it to the server. Successive clients load the cookie from $HOME/.aucat_cookie and send it to the server but the server accepts only clients whose cookie matches the session cookie. When all clients are gone, the session is over, and another cookie could start a new session, and so on. TCP is enabled on the server with the new -L option, and on the client side hostnames are specified with a new optional component in the device name. hints from damien, dlg and deraadt, tweaks from jmc
* slightly cleanup by separating socket-specific code fromratchov2011-04-181-29/+38
| | | | protocol specific code. No behaviour change
* Make aucat audio and midi backends share the same code to communicateratchov2011-04-161-0/+330
| | | | | | with the server. As we're at it use the same protocol for midi and audio. Now, both audio and midi code use the same SNDIO_DEBUG environment variable to turn on/off DPRINTF's.
* Clean up function naming: use sio_<backend>_ prefix for privateratchov2011-04-081-746/+0
| | | | | audio-related functions and put them in files named sio_<backend>.c No behaviour changes.
* use MODE_xxx and XRUN_xxx macros everywhere, and zap correspondingratchov2010-10-211-6/+2
| | | | AMSG_xxx macros, which in turns simplifies the code
* don't prime server buffers, because it's ugly and conceptuallyratchov2010-06-051-4/+6
| | | | | complicated. Instead, request clients to provide enough samples and start with buffers full.
* don't send clock ticks while buffers are being primedratchov2010-06-051-5/+8
|
* Don't send the initial position as a clock tick with a negative delta.ratchov2010-06-051-9/+12
| | | | | Add a new ``initial position'' message which is simpler. No bahaviour change, except effects of the protocol version crank.
* complete any pending message when the device is stoppedratchov2010-05-251-11/+16
|
* remove trailing spaces, from Alexandr Shadchin, thanksratchov2010-04-241-5/+5
|
* Allow multiple users to share the same aucat server. If aucat isratchov2010-04-221-2/+11
| | | | | | | | | | | run by root, it binds a shared address to the socket, cranks the process priority and drops privileges. sio_open(3) will try to connect to the private socket first (if any), then to the shared socket. Only one user may have connections to aucat at a given time. based on discussions with henning, pyr and others ok jacek, deraadt
* aucat (server):ratchov2010-04-061-23/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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@
* back out last commit. breaks half-duplex playback with poll().jakemsr2010-01-201-14/+7
| | | | ok ratchov
* Keep in memory whether the socket is writable. This way sio_revents()ratchov2010-01-151-7/+14
| | | | | | | | can return POLLOUT (if requested), even the handle was not writable when sio_pollfd() was called but become writable somewhere in the code path of sio_revents(). This should improve stability of programs using very small buffers.
* reader state cannot be IDLE, terminate the stream if so ratherratchov2009-10-261-3/+4
| | | | entering a busy loop
* Flow control blocks the client in sio_write(3). Split the dataratchov2009-10-241-3/+7
| | | | | | | | stream in a way that the pause never occurs in the middle of data chunks. Beside being more natural, this allows the client to send non-data messages during the pause (set the volume, stop playback...), rather than delaying them until the end of the pause. It's about few milliseconds only.
* When starting playback, the client tries to write ``bufsz'' framesratchov2009-10-221-4/+19
| | | | | | | | | | instead of ``appbufsz'', which violates the flow control mechanism. Fix this longstanding bug by enabling negative values in AMSG_MOVE messages, this way the client is notified when its stream is attached to the mixer, and can update its max transfer limit. Since this fix changes the AMSG_MOVE message format, we crank the protocol version, and thus remove code specific to the old protocol.
* Add version number to aucat protocol. It's not used yet,ratchov2009-10-171-1/+2
| | | | | | | but later, it will permit aucat to reject connections from clients statically linked to a unsupported version of libsndio. idea from kittenis, otto and sthen
* don't consider calling sio_close() without calling sio_stop() firstratchov2009-08-281-1/+3
| | | | | as a programming error. At any stage the program should be alble to cleanly free resources and close the device.