summaryrefslogtreecommitdiffstats
path: root/lib/libsndio/sun.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Clean up function naming: use sio_<backend>_ prefix for privateratchov2011-04-081-953/+0
| | | | | audio-related functions and put them in files named sio_<backend>.c No behaviour changes.
* make sio_onvol(3) return a integer exposing whether a volume knobratchov2010-11-061-19/+3
| | | | | is available for the stream. As we're at it, remove macros and functions that are neither used nor documented.
* don't try to get the current stream postion when the device is stopped,ratchov2010-09-171-9/+9
| | | | | and don't generate clock ticks (ie don't invoke the sio_onmove(3) call-back).
* 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-211-2/+1
| | | | 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
* 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!
* 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-241-17/+17
|
* 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-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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!
* 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.
* 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.
* more style improvemets, from Thomas Pfaffratchov2009-07-261-5/+5
|
* sort and space headers as per style(9)ratchov2009-07-261-2/+3
| | | | from Thomas Pfaff
* use const qualifier in libsndio, making it slightly more consistentratchov2009-07-251-5/+5
| | | | | 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-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* cleanup forgotten calls to exit(3)ratchov2009-05-151-10/+17
|
* replace s/sa/sio/, left from when libsa was renamed to libsndioratchov2009-05-151-67/+67
|
* if DEBUG is defined, use a global debug level ratherratchov2009-05-151-58/+41
| | | | than a per-stream debug level. No behaviour change.
* don't use ``hdl->filling'' flag uninitializedratchov2009-02-261-1/+2
| | | | ok deraadt
* 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
* make all private functions staticratchov2009-01-101-29/+29
|
* remove mixer bits from the audio(4) backend of libsndio, it's notratchov2008-12-211-106/+2
| | | | | possible to get them right in the current state of the mixer. discussed with jakemsr
* fix more spelling errors and typos,ratchov2008-12-211-12/+14
| | | | from Thomas Pfaff <tpfaff(at)@tp76.info>, thanks
* stop using stderr in the library, wrap all diagnostic fprintfsratchov2008-12-171-45/+45
| | | | | | so they are visible only when the DEBUG macro is #defined and SIO_DEBUG env. variable is set. requested by many, discussed with jakemsr
* add a writable ``appbufsz'' field to the sa_par structure, containingratchov2008-12-171-4/+5
| | | | | | | | 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
* make both aucat(1) and audio(4) backends use the AUDIODEVICE envratchov2008-11-201-6/+3
| | | | | | variable to determine the socket or the device to use. Allow choosing the when aucat(1) is used too. Noticed and tested by naddy@
* while setting the block size, try smaller blocks half of the retries andratchov2008-11-201-5/+27
| | | | | | larger blocks the other half. That's because shrinking the block size may not be the right direction to go to find a common block size for play and record.
* expose a volume knob in the sndio API: add sio_setvol(3) andratchov2008-11-111-2/+126
| | | | | | | sio_onvol(3) functions. The audio(4) backend tries to use the inputs.dac, outputs.dac, outputs.output and outputs.master controls (in this order). Add a sample file in regress/lib/libsndio/vol/vol.c
* expose the block size in the sndio API by making par->round writableratchov2008-11-071-298/+84
| | | | | | | and thus remove the ugly rate <-> block-size table from sio_setpar(3). Handle the block size negociation in aucat(1), since it has few constrains the code is overally simpler. ok jakemsr@, major crank suggested by deraadt@
* only few (frequency, blocksize) pairs are compatible with both resamplingratchov2008-10-301-66/+240
| | | | | | | | | and block based audio i/o (arithmetic constraints). For now round the frequency to a supported one, (ie 8kHz, 11.025kHz, 12kHz multiple), and get the the block size from a table. fixes problem reported by Robert <robert _at_ openbsd.pap.st> ok jakemsr
* fix missing n in error messageratchov2008-10-281-2/+2
|
* rename libsa to libsndioratchov2008-10-271-0/+858
requested by many, "just go for it" deraadt@