summaryrefslogtreecommitdiffstats
path: root/lib/libsndio/aucat.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* when using aucat backend, wait for the server to drop the connectionratchov2009-08-281-2/+7
| | | | on sio_close()
* add a new AMSG_BYE, sent by the client to requst the server toratchov2009-08-281-1/+7
| | | | | | 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.
* handle incoming AMSG_SETVOL messages, allows the client to be notifiedratchov2009-08-261-1/+7
| | | | of volume changes
* sort and space headers as per style(9)ratchov2009-07-261-2/+4
| | | | from Thomas Pfaff
* use const qualifier in libsndio, making it slightly more consistentratchov2009-07-251-4/+4
| | | | | with open(2) and write(2) syscalls. from Thomas Pfaff, jakemsr is fine with it
* Currently midi capable programs can control midi hardware, butratchov2009-07-251-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* don't set mode in sio_setpar(), already done at initializationratchov2009-05-161-2/+1
|
* add a new ``hello'' message to aucat protocol useful to work onratchov2009-05-161-5/+25
| | | | future aucat extentions. No functional changes.
* fix style to make future diffs contain functional changes onlyratchov2009-05-161-58/+58
|
* in aucat_getpar() and aucat_getcap(), initialize the message to sendratchov2009-05-161-3/+3
| | | | with AMSG_INIT(), rather than the reply we expect.
* replace s/sa/sio/, left from when libsa was renamed to libsndioratchov2009-05-151-27/+27
|
* if DEBUG is defined, use a global debug level ratherratchov2009-05-151-17/+17
| | | | than a per-stream debug level. No behaviour change.
* after the STOP message is sent, move the receiver to the RMSG stateratchov2009-02-251-3/+5
| | | | | | | 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
* in aucat_stop(), after the STOP message was send, put the receiverratchov2009-02-181-1/+3
| | | | | | in ``waiting state'', otherwise the ACK message will be skipped, and the other functions not expecting ACKs might be confused by the ACK.
* Programs have no direct access do the device file descriptor. So, ifratchov2009-02-041-1/+5
| | | | | | | | 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
* in server mode, create /tmp/aucat-userid/ directory withratchov2009-02-031-3/+9
| | | | | | | | | | | | 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
* make all private functions staticratchov2009-01-101-31/+31
|
* when polling aucat(1) socket, don't set the POLLIN bit if weratchov2008-12-271-2/+2
| | | | | don't expect messages. Avoids busy loops in programs calling poll(2) on a stopped device.
* when using the aucat(1) backend, don't mask the POLLHUP bitratchov2008-12-271-2/+2
| | | | | even if the device is not started yet. This way, if the server is killed programs can notice it.
* fix more spelling errors and typos,ratchov2008-12-211-4/+4
| | | | from Thomas Pfaff <tpfaff(at)@tp76.info>, thanks
* stop using stderr in the library, wrap all diagnostic fprintfsratchov2008-12-171-16/+16
| | | | | | so they are visible only when the DEBUG macro is #defined and SIO_DEBUG env. variable is set. requested by many, discussed with jakemsr
* fix spell errors, from Thomas Pfaff <tpfaff(at)tp76.info>, thanks!ratchov2008-12-171-3/+3
|
* add a writable ``appbufsz'' field to the sa_par structure, containingratchov2008-12-171-2/+3
| | | | | | | | the program-part of the buffer size, ie the part that is subject to underruns. Useful for apps like cdio(1) that don't have their own rings, or to apps that have a minimum ring size constraint. Setting the ``bufsz'' parameter becomes deprecated. ok jakemsr