summaryrefslogtreecommitdiff
path: root/lib/libsndio
AgeCommit message (Collapse)Author
2010-11-06tweak previous;Jason McIntyre
2010-11-06make sio_onvol(3) return a integer exposing whether a volume knobAlexandre Ratchov
is available for the stream. As we're at it, remove macros and functions that are neither used nor documented.
2010-10-23add forgotten ``static''Alexandre Ratchov
2010-10-21use MODE_xxx and XRUN_xxx macros everywhere, and zap correspondingAlexandre Ratchov
AMSG_xxx macros, which in turns simplifies the code
2010-09-17don't try to get the current stream postion when the device is stopped,Alexandre Ratchov
and don't generate clock ticks (ie don't invoke the sio_onmove(3) call-back).
2010-08-20polish the code: remove few unused #includes, add missing ones,Alexandre Ratchov
fix NULL vs 0, etc. No behaviour change.
2010-08-06If audio interrupts are missed (as this happens on some MP systemsAlexandre Ratchov
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@
2010-07-21remove unnecessary ``return 0'' statements,Alexandre Ratchov
from Remco <remco at d-compu.dyndns.org>, thanks!
2010-07-15add two new members to structs audio_encoding and audio_prinfo.Jacob Meuser
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
2010-07-06Handle all streams the same way because there's no actualAlexandre Ratchov
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
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-05-25drop samples or insert silence in sun_revents(). Otherwise, inAlexandre Ratchov
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.
2010-05-09if the sample rate the hardware will use is different than theJacob Meuser
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@
2010-04-29in sun_start(), don't pause the device in play mode, since it'sAlexandre Ratchov
already paused (by either sio_open or sio_stop) from Alexandr Shadchin, thanks!
2010-04-26once sio_start() has been called, stream parameters cannot beJacob Meuser
changed until after sio_stop() is called ok ratchov@, jmc@
2010-04-25If setting close-on-exec flag fails (can this happen?), the wrongAlexandre Ratchov
descriptor is closed. Fix from Alexandr Shadchin, together with various simplifications.
2010-04-25Fix the way sio_getcap() probes rates of audio(4) devices.Alexandre Ratchov
From Alexandr Shadchin <alexandr.shadchin at gmail.com> Good catch!
2010-04-25when probing for a encoding/channels/rate combination, ensure thatAlexandre Ratchov
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.
2010-04-24when probing an encoding of a audio(4) device, don't forget toAlexandre Ratchov
set record precision.
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-11audio(4) doesn't require to be started explicitely, so the device isAlexandre Ratchov
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
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-02-10Fix sio_getcap() for audio(4) devices exposing encodingsAlexandre Ratchov
with precision other than 8, 16 or 32 bits. Found by Jan Stary <hans at stare.cz>, thanks!
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-12-30explain what sio_close() drains play buffers as if sio_close() wasAlexandre Ratchov
called. Since sio_onmove() callback doesn't return negative deltas anymore, slightly simplify related paragraphs. siggested by espie@, ok jakemsr@
2009-12-02we don't expose overruns/underruns as negative positions anymore,Alexandre Ratchov
don't call the sio_onmove() call-back with negative argument.
2009-11-03in block size calculations, use SIO_BPS(precision) instead ofAlexandre Ratchov
precision / 8. Fixes sio_setpar() requesting smaller block sizes on 24-bit devices.
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-22set protocol version number for midi too. Fixes aucat refusingAlexandre Ratchov
control connections.
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-10-10when setting parameters of sun devices, check that selected encodingAlexandre Ratchov
is actually linear
2009-10-10at initialization of sun devices, use sio_setpar(3) instead ofAlexandre Ratchov
AUDIO_SETINFO() to set the initial parameters, since AUDIO_SETINFO() can fail.
2009-10-10since AUDIO_INITINFO() may set parameters to whatever is supportedAlexandre Ratchov
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.
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-08-21make aucat(1) expose a MIDI device to control server behaviour inAlexandre Ratchov
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.
2009-08-01honor non-blocking flag in mio_open_rmidi(), fixes programsAlexandre Ratchov
eating 100% CPU while trying to use blocking i/o. ok jakemsr
2009-07-27don't use ``return'' in sio_close() and mio_close()Alexandre Ratchov
2009-07-26more style improvemets, from Thomas PfaffAlexandre Ratchov
2009-07-26use ``sizeof(string) - 1'' rather than ``strlen(string)'' on staticAlexandre Ratchov
strings. suggested by Thomas Pfaff
2009-07-26remove the (bogus) special case when mio_open() is called withAlexandre Ratchov
a midi device name starting with a separator