summaryrefslogtreecommitdiff
path: root/lib/libsndio/aucat.c
AgeCommit message (Collapse)Author
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@
2009-05-16don't set mode in sio_setpar(), already done at initializationAlexandre Ratchov
2009-05-16add a new ``hello'' message to aucat protocol useful to work onAlexandre Ratchov
future aucat extentions. No functional changes.
2009-05-16fix style to make future diffs contain functional changes onlyAlexandre Ratchov
2009-05-16in aucat_getpar() and aucat_getcap(), initialize the message to sendAlexandre Ratchov
with AMSG_INIT(), rather than the reply we expect.
2009-05-15replace s/sa/sio/, left from when libsa was renamed to libsndioAlexandre Ratchov
2009-05-15if DEBUG is defined, use a global debug level ratherAlexandre Ratchov
than a per-stream debug level. No behaviour change.
2009-02-25after the STOP message is sent, move the receiver to the RMSG stateAlexandre Ratchov
only if it's in the IDLE state, otherwise in some rare cases a data chunk may be interpreted as a message, causing the connection to be dropped. ok deraadt
2009-02-18in aucat_stop(), after the STOP message was send, put the receiverAlexandre Ratchov
in ``waiting state'', otherwise the ACK message will be skipped, and the other functions not expecting ACKs might be confused by the ACK.
2009-02-04Programs have no direct access do the device file descriptor. So, ifAlexandre Ratchov
the programs calls execvp(2), the new image can't use the device, which stays open, so other programs get EBUSY. Set the close-on-exec flag to avoid this. ok jakemsr
2009-02-03in server mode, create /tmp/aucat-userid/ directory withAlexandre Ratchov
permissions 0700, and create sockets in it. This prevents one local user to eavesdrop or disturb audio programs of other users. if you're using the ``-s socket'' option with an absolute path as argument, please update it to use a socket name. requested by many, bits from jakemsr and otto ok jakemsr
2009-01-10make all private functions staticAlexandre Ratchov
2008-12-27when polling aucat(1) socket, don't set the POLLIN bit if weAlexandre Ratchov
don't expect messages. Avoids busy loops in programs calling poll(2) on a stopped device.
2008-12-27when using the aucat(1) backend, don't mask the POLLHUP bitAlexandre Ratchov
even if the device is not started yet. This way, if the server is killed programs can notice it.
2008-12-21fix more spelling errors and typos,Alexandre Ratchov
from Thomas Pfaff <tpfaff(at)@tp76.info>, thanks