summaryrefslogtreecommitdiffstats
path: root/lib/libsndio (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* polish the code: remove few unused #includes, add missing ones,ratchov2010-08-201-2/+5
| | | | fix NULL vs 0, etc. No behaviour change.
* If audio interrupts are missed (as this happens on some MP systemsratchov2010-08-061-18/+22
| | | | | | | | | | | | | | | now), play and record directons may be out of sync, and since the play direction is used as clock source, we may end up with data ariving _before_ the time it was recorded. This breaks the sndio ``device model'' and most full-duplex apps relying on it, starting with aucat in its default mode. Workaround this by using the direction that's ahead as clock source, ensuring that recorded data never arrives before the clock tick it was recorded. This prevents apps from crashing but won't fix stuttering caused by missed interrupts. ok deraadt@
* remove unnecessary ``return 0'' statements,ratchov2010-07-213-6/+3
| | | | from Remco <remco at d-compu.dyndns.org>, thanks!
* add two new members to structs audio_encoding and audio_prinfo.jakemsr2010-07-151-7/+7
| | | | | | | | | | for both structs, the new members are 'bps' and 'msb', which describe the number of bytes per sample and data alignment in the sample, respectively. drivers must properly set these fields in the 'query_encoding', 'set_parameters' and 'get_default_params' hardware interface methods. discussed with ratchov, deraadt
* Handle all streams the same way because there's no actualratchov2010-07-061-4/+18
| | | | | | | | | | | | difference between audio files and client connections. Clean up the way command line options are handled and clarify this in the manual page: stream parameters (-Ccehjmrtvx) must precede stream definitions (-ios) and per-device parameters (-abz) and stream definitions (-ios) must precede device definitions (-f). Since there's no ``server'' and ``non-server'' modes anymore, make the -l option just detach the process. ok and help from jakemsr and jmc
* 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
|
* drop samples or insert silence in sun_revents(). Otherwise, inratchov2010-05-251-18/+54
| | | | | | | full-duplex, we may detect a xrun in the play direction and discard the clock tick, this would cause sio_revents() to return POLLIN without the clock being advanced, causing apps relying on the clock for flow control to enter a busy loop.
* if the sample rate the hardware will use is different than thejakemsr2010-05-091-4/+20
| | | | | | | | requested sample rate, scale the block/buffer sizes so the block/ buffer sizes the hardware will use are the same amount of *time* as the requested block/buffer sizes. ok ratchov@
* in sun_start(), don't pause the device in play mode, since it'sratchov2010-04-291-11/+1
| | | | | already paused (by either sio_open or sio_stop) from Alexandr Shadchin, thanks!
* once sio_start() has been called, stream parameters cannot bejakemsr2010-04-261-2/+9
| | | | | | changed until after sio_stop() is called ok ratchov@, jmc@
* If setting close-on-exec flag fails (can this happen?), the wrongratchov2010-04-251-12/+8
| | | | | descriptor is closed. Fix from Alexandr Shadchin, together with various simplifications.
* Fix the way sio_getcap() probes rates of audio(4) devices.ratchov2010-04-251-11/+16
| | | | | From Alexandr Shadchin <alexandr.shadchin at gmail.com> Good catch!
* when probing for a encoding/channels/rate combination, ensure thatratchov2010-04-251-19/+15
| | | | | | | play parameters are set only if playback is enabled, and record parameters are set only if recording is enabled. Fixes sun_getcap() on devices whose play and record parameters are not independent.
* when probing an encoding of a audio(4) device, don't forget toratchov2010-04-241-1/+2
| | | | set record precision.
* remove trailing spaces, from Alexandr Shadchin, thanksratchov2010-04-246-42/+42
|
* Allow multiple users to share the same aucat server. If aucat isratchov2010-04-222-5/+23
| | | | | | | | | | | 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
* audio(4) doesn't require to be started explicitely, so the device isratchov2010-04-111-1/+18
| | | | | | | | started immediately after it's opened in record only mode. Pause it in sio_open() and sio_stop(), since libsndio requires an explicit call to sio_start(). discussed with jakemsr
* aucat (server):ratchov2010-04-064-73/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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@
* Fix sio_getcap() for audio(4) devices exposing encodingsratchov2010-02-101-3/+3
| | | | | with precision other than 8, 16 or 32 bits. Found by Jan Stary <hans at stare.cz>, thanks!
* 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.
* explain what sio_close() drains play buffers as if sio_close() wasratchov2009-12-301-16/+16
| | | | | | | called. Since sio_onmove() callback doesn't return negative deltas anymore, slightly simplify related paragraphs. siggested by espie@, ok jakemsr@
* we don't expose overruns/underruns as negative positions anymore,ratchov2009-12-021-3/+3
| | | | don't call the sio_onmove() call-back with negative argument.
* in block size calculations, use SIO_BPS(precision) instead ofratchov2009-11-031-3/+3
| | | | | precision / 8. Fixes sio_setpar() requesting smaller block sizes on 24-bit devices.
* 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.
* set protocol version number for midi too. Fixes aucat refusingratchov2009-10-221-1/+2
| | | | control connections.
* 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
* when setting parameters of sun devices, check that selected encodingratchov2009-10-101-4/+23
| | | | is actually linear
* at initialization of sun devices, use sio_setpar(3) instead ofratchov2009-10-101-11/+10
| | | | | AUDIO_SETINFO() to set the initial parameters, since AUDIO_SETINFO() can fail.
* since AUDIO_INITINFO() may set parameters to whatever is supportedratchov2009-10-101-24/+59
| | | | | | | | by the device, we may end up with different recording and playback parameters, which will break almost all full duplex apps on such devices. For instance, this should fix full-duplex apps not working on devices that can record at any sample rate but can play at 48kHz only.
* don't consider calling sio_close() without calling sio_stop() firstratchov2009-08-282-6/+4
| | | | | 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-282-2/+12
| | | | | | 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
* make aucat(1) expose a MIDI device to control server behaviour inratchov2009-08-214-20/+50
| | | | | | realtime. For now only the playback volume of individual streams can be changed/monitored. To each stream is assigned a MIDI channel; the volume is changed/monitored using the standard controller number 7.
* honor non-blocking flag in mio_open_rmidi(), fixes programsratchov2009-08-011-3/+4
| | | | | eating 100% CPU while trying to use blocking i/o. ok jakemsr
* don't use ``return'' in sio_close() and mio_close()ratchov2009-07-272-4/+4
|
* more style improvemets, from Thomas Pfaffratchov2009-07-262-8/+8
|
* use ``sizeof(string) - 1'' rather than ``strlen(string)'' on staticratchov2009-07-263-8/+8
| | | | strings. suggested by Thomas Pfaff
* remove the (bogus) special case when mio_open() is called withratchov2009-07-261-16/+1
| | | | a midi device name starting with a separator
* rephrase description of (MIO_IN | MIO_OUT) moderatchov2009-07-261-4/+5
| | | | from Thomas Pfaff, ok jmc@
* Make ``static'' few functions that are prototyped as static but are notratchov2009-07-262-4/+4
| | | | | defined as such from Thomas Pfaff
* sort and space headers as per style(9)ratchov2009-07-266-13/+21
| | | | from Thomas Pfaff
* use const qualifier in libsndio, making it slightly more consistentratchov2009-07-2510-38/+38
| | | | | with open(2) and write(2) syscalls. from Thomas Pfaff, jakemsr is fine with it
* add sndio.7, forgotten in last commitratchov2009-07-251-0/+168
| | | | spotted by jasper@