summaryrefslogtreecommitdiff
path: root/lib/libsndio/aucat.c
AgeCommit message (Collapse)Author
2016-01-09Make code fit in 80 columns, remove trailing spaces & tabs.Alexandre Ratchov
2015-12-23remove NULL-checks before free()mmcc
2015-11-22Don't remove the type component from the device string before passingAlexandre Ratchov
it to the *_open() functions. It's more flexible this way. No behaviour change.
2015-10-05Fix missing checks for truncation of long file names. Rather thanAlexandre Ratchov
checking for truncation every time we touch the string, simply allocate a memory chunk large enough to store the full path.
2015-10-02use macros for cookie path and temp file template insteadAlexandre Ratchov
of hardcoded strings. no object change.
2015-10-02As the socket path is known, use its size rather that PATH_MAX.Alexandre Ratchov
2015-10-02use macros instead of hard-coded strings for unix sockets pathsAlexandre Ratchov
2015-10-01Remove support for the AUCAT_COOKIE environment variable.Alexandre Ratchov
2015-05-05add missing braces in _aucat_wmsg()Jonathan Gray
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@
2014-09-07Use SOCK_CLOEXEC (instead of later using fcntl(F_SETFD)) when creating socketsPhilip Guenther
for talking to aucat/sndiod ok ratchov@
2013-12-20Be less verbose when SNDIO_DEBUG=1 is set.Alexandre Ratchov
2013-11-18add missing prototypesAlexandre Ratchov
2013-11-13Prefix by '_' symbols that are not part of the API.Alexandre Ratchov
ok deraadt, guenther
2013-11-12internalize some functions so that they do not need prototypesTheo de Raadt
ok ratchov
2013-03-13in debug mode, log successful connections, from Jan StaryAlexandre Ratchov
2012-11-23Remplace aucat server by a new sndiod daemon aimed to be simplerAlexandre Ratchov
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@
2012-11-02Use dedicated messages for flow control instead of abusing clock tickAlexandre Ratchov
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.
2012-04-11Use "unsigned int" rather than "unsigned". No object change.Alexandre Ratchov
suggested by deraadt@
2011-11-15Add a "device number" component in sndio(7) device names, allowing aAlexandre Ratchov
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.
2011-10-22Don't attempt to send data not available for sending yet. AnalysedAlexandre Ratchov
and fixed by Remco <remco at d-compu.dyndns.org>, thanks!
2011-10-17Remove midicat since aucat can now be used instead of midicatAlexandre Ratchov
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
2011-10-05restart connect(2) if it returns EINTRAlexandre Ratchov
2011-05-03determine the default device in backend code instead of the commonAlexandre Ratchov
code. This is simpler as long as not all backends use the same default.
2011-05-02Add missing byter order conversions in message headers. Fixes the caseAlexandre Ratchov
when the server and the client are not of the same endianness. Found by naddy.
2011-05-02set the TCP_NODELAY option for TCP connectionsAlexandre Ratchov
2011-04-28Implement a new authentication method allowing aucat and midicat toAlexandre Ratchov
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
2011-04-18slightly cleanup by separating socket-specific code fromAlexandre Ratchov
protocol specific code. No behaviour change
2011-04-16Make aucat audio and midi backends share the same code to communicateAlexandre Ratchov
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.
2011-04-08Clean up function naming: use sio_<backend>_ prefix for privateAlexandre Ratchov
audio-related functions and put them in files named sio_<backend>.c No behaviour changes.
2010-10-21use MODE_xxx and XRUN_xxx macros everywhere, and zap correspondingAlexandre Ratchov
AMSG_xxx macros, which in turns simplifies the code
2010-06-05don't prime server buffers, because it's ugly and conceptuallyAlexandre Ratchov
complicated. Instead, request clients to provide enough samples and start with buffers full.
2010-06-05don't send clock ticks while buffers are being primedAlexandre Ratchov
2010-06-05Don't send the initial position as a clock tick with a negative delta.Alexandre Ratchov
Add a new ``initial position'' message which is simpler. No bahaviour change, except effects of the protocol version crank.
2010-05-25complete any pending message when the device is stoppedAlexandre Ratchov
2010-04-24remove trailing spaces, from Alexandr Shadchin, thanksAlexandre Ratchov
2010-04-22Allow multiple users to share the same aucat server. If aucat isAlexandre Ratchov
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
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-01-20back out last commit. breaks half-duplex playback with poll().Jacob Meuser
ok ratchov
2010-01-15Keep in memory whether the socket is writable. This way sio_revents()Alexandre Ratchov
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.
2009-10-26reader state cannot be IDLE, terminate the stream if so ratherAlexandre Ratchov
entering a busy loop
2009-10-24Flow control blocks the client in sio_write(3). Split the dataAlexandre Ratchov
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.
2009-10-22When starting playback, the client tries to write ``bufsz'' framesAlexandre Ratchov
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.
2009-10-17Add version number to aucat protocol. It's not used yet,Alexandre Ratchov
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
2009-08-28don't consider calling sio_close() without calling sio_stop() firstAlexandre Ratchov
as a programming error. At any stage the program should be alble to cleanly free resources and close the device.
2009-08-28when using aucat backend, wait for the server to drop the connectionAlexandre Ratchov
on sio_close()
2009-08-28add a new AMSG_BYE, sent by the client to requst the server toAlexandre Ratchov
free resources and drop the connection. This allows the client to ensuire that at any time it's using only one connection, thus only one MIDI control channel.
2009-08-26handle incoming AMSG_SETVOL messages, allows the client to be notifiedAlexandre Ratchov
of volume changes
2009-07-26sort and space headers as per style(9)Alexandre Ratchov
from Thomas Pfaff
2009-07-25use const qualifier in libsndio, making it slightly more consistentAlexandre Ratchov
with open(2) and write(2) syscalls. from Thomas Pfaff, jakemsr is fine with it
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@