Commit Graph

351 Commits

Author SHA1 Message Date
Alexandre Ratchov a25bc8355a In OSS/FreeBSD sio_setpar(), validate the encoding, ensuring we
never end-up with an unknown one.
2017-02-14 14:20:17 +01:00
Alexandre Ratchov a88873c661 Make sio_getpar() on OSS/FreeBSD return the device block size/count
instead of saved ones. Fixes busy loops caused by poll(2) returning
POLLOUT after the program has filled its play buffer.
2017-02-14 14:20:03 +01:00
Alexandre Ratchov 89f3ea0426 Tweak spacing of sio_oss.c to look more like other files. 2017-02-14 14:19:33 +01:00
Alexandre Ratchov 02c2d1521c Add support for OSS/FreeBSD. From Tobias Kortkamp <t@tobik.me>. 2017-02-14 14:19:25 +01:00
Alexandre Ratchov 2606d3f24e Add support for FreeBSD raw usb-midi devices. Bits from Tobias
Kortkamp <t@tobik.me> plus configure script tweaks.
2016-11-06 12:21:59 +01:00
Alexandre Ratchov 9cb5193ca7 sio_oss.c: In full duplex-mode, don't require play and rec
buffer sizes to be the same. Only the block sizes need to be the
same.
2016-11-05 07:21:28 +01:00
Alexandre Ratchov 8c95537698 sio_oss.c: Disallow tiny fragment sizes, as they may overload
the system. And as sndiod runs with increased priority, it would
consume all the cpu and could in turn hang the system.
2016-11-05 07:14:46 +01:00
Alexandre Ratchov c25d86c7db sio_oss.c: if the requrested block size is a power of two
make the oss block size calculation return the requested value.
2016-11-05 07:11:08 +01:00
Alexandre Ratchov 4f56ff6181 In sio_oss_revents() use the fifo_samples counter returned
by SNDCTL_DSP_CURRENT_{I,O}PTR to determine the device current
position. Besides being simpler than using the absolute position,
this fixes hangs in record-only mode.
2016-11-05 07:02:39 +01:00
Alexandre Ratchov c5daeee294 On OSS/FreeBSD, set poll(2) threshold to 1 byte, so that it returs
POLLIN/POLLOUT whenever read/write can be called without blocking. By
default OSS use 1 block of threshold.
2016-11-04 19:12:07 +01:00
Alexandre Ratchov 2b58ec0677 Remove forgotten debug printf in sio_oss.c 2016-11-04 14:14:52 +01:00
Alexandre Ratchov db20298468 Use the SNDCTL_DSP_SETTRIGGER interface to start/stop the device, this
allows the "onmove" callback to be called whenever the DMA actually
starts (and not on the first write). This also removes the need for
sio_osee_setpar() call every time the device is stopped.
2016-11-04 14:09:42 +01:00
Alexandre Ratchov 9be2c65600 Allow programs using OSS/FreeBSD backend to select the buffer size.
According to kernel sources, SNDCTL_DSP_POLICY ioctl doesn't seem to
always set play and rec buffer sizes to the same value.  That's why we
use the SNDCTL_DSP_SETFRAGMENT ioctl instead.
2016-11-04 11:03:41 +01:00
Alexandre Ratchov a282420a49 In OSS/FreeBSD sio_setpar(), validate the encoding, ensuring we
never end-up with an unknown one.
2016-11-04 09:18:04 +01:00
Alexandre Ratchov 4d6d7700a4 Make sio_getpar() on OSS/FreeBSD return the device block size/count
instead of saved ones. Fixes busy loops caused by poll(2) returning
POLLOUT after the program has filled its play buffer.
2016-11-04 08:05:47 +01:00
Alexandre Ratchov e867d773fa Tweak spacing of sio_oss.c to look more like other files. 2016-11-03 08:09:11 +01:00
Alexandre Ratchov d396d690d1 Add support for OSS/FreeBSD. From Tobias Kortkamp <t@tobik.me>. 2016-11-03 08:04:47 +01:00
Alexandre Ratchov 20a7e3c46e switch back into using a single "filling" flag to determine
whether playback is started
2016-05-16 07:53:05 +02:00
Alexandre Ratchov 7c24b48b99 switch back into using a single "filling" flag to determine
whether playback is started
2016-05-16 07:52:45 +02:00
Alexandre Ratchov 50e5b13815 rename namespace -> group (it's c++ keyword) 2016-05-15 14:45:32 +02:00
Alexandre Ratchov a3dbdeb179 s/mute/level/, from armani@ 2016-03-16 07:57:46 +01:00
Alexandre Ratchov e989416be8 switch to new obsd audio api 2016-03-16 07:48:27 +01:00
Alexandre Ratchov 85c75911dc switch to new obsd audio api 2016-03-16 07:48:13 +01:00
Alexandre Ratchov 91ad4627a7 remove commented code 2016-01-29 08:23:24 +01:00
Alexandre Ratchov 030bfe1dcb fix controls with no unit nomber (used to appear as 65536) 2016-01-28 19:27:46 +01:00
Alexandre Ratchov 5a63dff869 intruduce namespaces 2016-01-28 19:17:11 +01:00
Alexandre Ratchov 91689ee702 Don't fail if mute control remain unchanged. 2016-01-28 19:06:32 +01:00
Alexandre Ratchov 318845ea8c fix onctl() feedback addr 2016-01-26 10:30:12 +01:00
Alexandre Ratchov f08810f595 don't fail if ctl is set to the same value 2016-01-26 10:25:58 +01:00
Alexandre Ratchov 5dc67b663e merge head 2016-01-26 10:23:38 +01:00
Alexandre Ratchov b5a1760af3 unexpand tabs 2016-01-09 09:23:56 +01:00
Alexandre Ratchov cbaa92d4d8 better debug mesg 2016-01-09 09:20:46 +01:00
Alexandre Ratchov 99cfc04004 fit code in 80 columns, remove traing spaces 2016-01-08 21:51:12 +01:00
Alexandre Ratchov aa4fc43964 move sndiod manual to sec 8 2016-01-07 17:48:47 +01:00
Alexandre Ratchov 37cdacd0aa crank major (openbsd specific changes) 2015-12-30 12:54:40 +01:00
Alexandre Ratchov 7530bbf6d2 Pass full device name to audio/midi backends. 2015-12-09 11:13:11 +01:00
Alexandre Ratchov 7b062cf12f merge from head 2015-10-30 16:17:56 +01:00
Alexandre Ratchov 8bb88f248f if no -f or -q are used, attach rsnd/[0-3] and rmidi/[0-7] 2015-10-20 15:25:54 +02:00
Alexandre Ratchov bbfde03621 please gcc 2015-10-20 09:15:09 +02:00
Alexandre Ratchov 353176f99a merge PATH_MAX changes from HEAD 2015-10-02 14:40:00 +02:00
Alexandre Ratchov 5d431d3616 Replace hard-coded strings with macros, replace PATH_MAX with actual
string length, validate audio and midi device numbers
2015-10-02 14:28:17 +02:00
Alexandre Ratchov 2d90528559 merges from -head 2015-10-01 08:56:06 +02:00
Alexandre Ratchov 6ddedf6c9f remove unused AUCAT_COOKIE environment variable 2015-10-01 08:50:13 +02:00
Alexandre Ratchov 7062d226ac remove useless quoting and fix typos, from schwarze@ 2015-10-01 08:49:47 +02:00
Alexandre Ratchov ba4929bdb9 Terminate mixer description dump with a MIXSYNC message. Fix
server-side "desc" temporary buffer size.
2015-09-05 16:10:03 +02:00
Alexandre Ratchov 84e30dd7a9 use fixed size buffer for mixer description 2015-09-05 14:34:20 +02:00
Alexandre Ratchov 043bb0950a remove labels, use the stream name instead. Disallow digits in
stream names and use the "unit" integer instead.
2015-09-04 17:08:12 +02:00
Alexandre Ratchov a162cfd9e6 remove mixer api files 2015-08-28 09:03:49 +02:00
Alexandre Ratchov e8007feb00 move the mixer api to a dedicated "mixer" branch 2015-08-28 08:57:47 +02:00
Alexandre Ratchov 9ff8e621d0 typos in comments and strings 2015-08-26 10:27:22 +02:00
Alexandre Ratchov dbebd9982f Fix typos, from Peter Piwowarski <peterjpiwowarski at gmail.com> 2015-08-13 17:37:45 +02:00
Alexandre Ratchov 29516de2c3 Use "Ev" macro for AUCAT_COOKIE environment variable. From Michael
Reed <m.reed at mykolab.com>. Thanks.
2015-08-01 12:31:36 +02:00
Alexandre Ratchov 5edf525314 switch to now AUDIO_GETPOS interface 2015-07-31 17:35:54 +02:00
Alexandre Ratchov f4aff492a8 use single .so.min.maj link for .so 2015-07-15 10:37:46 +02:00
Alexandre Ratchov 07ee111086 readd soname with major, needed on linux 2015-07-09 17:13:01 +02:00
Alexandre Ratchov 72e727b865 drop soname 2015-07-08 17:59:05 +02:00
Alexandre Ratchov 8468b9f0a0 rename grp->func 2015-06-04 06:12:38 +02:00
Alexandre Ratchov 33ad1a504d fix missing brace mistake, from jsg@ 2015-05-05 14:45:55 +02:00
Alexandre Ratchov b3a8f99047 make the label use chan1 as parameter 2015-03-12 08:20:23 +01:00
Alexandre Ratchov 0c4e64484d append _in _out to mic/spkr/hp/... only 2015-03-06 10:39:51 +01:00
Alexandre Ratchov 99ca91c6b3 suffix stream names with -in, -out, -rec 2015-03-06 08:53:40 +01:00
Alexandre Ratchov 905c319315 use strings rather than channel numbers 2015-03-05 10:12:34 +01:00
Alexandre Ratchov 4717cf976d include limits.h and unbreak build 2015-02-25 08:37:50 +01:00
Alexandre Ratchov 52e645e422 handle EINTR when reading /dev/urandom 2015-02-16 18:56:30 +01:00
Alexandre Ratchov 98027ba688 use SOCK_CLOEXEC 2015-02-16 11:52:36 +01:00
Alexandre Ratchov d27e0e138f don't force poll to sleep at block boundaries 2015-01-19 18:22:42 +01:00
Alexandre Ratchov b989e17c05 don't use openbsd-specific SOCK_CLOEXEC 2015-01-18 00:16:36 +01:00
Alexandre Ratchov debf3b302c stop using param.h, from deraadt@ 2015-01-18 00:09:04 +01:00
Alexandre Ratchov 26400ac4de set default xrun mode 2015-01-17 21:08:11 +01:00
Alexandre Ratchov e36de0d10b fix bsd-compat related warnings on linux 2014-12-29 12:55:43 +01:00
Alexandre Ratchov 7834cb2a56 drop support for ":" in device names 2014-11-18 10:31:18 +01:00
Alexandre Ratchov 6c83586b81 remove todo list (already done) 2014-11-18 10:26:45 +01:00
Alexandre Ratchov b20e28a66e merge from openbsd: typos, use of O_CLOEXEC, _sndio_debug fix 2014-08-19 16:05:29 +02:00
Alexandre Ratchov da8108f09a add initial support for audio mixers, disabled by default
ok armani@
2014-07-16 12:05:01 +02:00
Alexandre Ratchov dfa5df2eb5 add -I. to build with sndio.h in current dir 2014-05-13 09:38:00 +02:00
Alexandre Ratchov 0e0511c762 for alsa, POLL{IN,OUT} events mean that a block can be read or
written (not a byte as unix files expect). Use "tickets" counters that
are reset to hdl->par.round on each POLL{IN,OUT} event. Limit read()
and write() to one block to ensure poll is always called at block
boundaries.
2014-05-05 19:25:15 +02:00
Alexandre Ratchov 4709dcb282 simplify switch/case 2014-03-10 11:20:45 +01:00
Alexandre Ratchov e9feeda8a2 nicer debug traces 2014-03-06 16:59:57 +01:00
Alexandre Ratchov 15739f2718 add "sndio" keyword to please "man -k" 2014-03-05 21:17:42 +01:00
Alexandre Ratchov cbecd3ea8d Fix confusion between processed samples by the hardware (as reported
by GET{I,O}OFFS) and samples played as reported by GETINFO(). Fixes
incorrect delta propagated after xruns.
2014-03-04 23:24:52 +01:00
Alexandre Ratchov d06df743db Refresh current position before reading/writing data, to keep the
current position always consistent with read & write pointers.
2014-02-21 10:58:43 +01:00
Alexandre Ratchov c9d4272377 Don't wait for POLLIN or POLLOUT to be set to refresh ring pointers,
as they may not be set in certain cases
2014-02-21 10:55:30 +01:00
Alexandre Ratchov d02745522d backout latest 2014-02-15 21:56:05 +01:00
Alexandre Ratchov 3fe3b27ace return actual rchan, rather requested one 2014-02-14 20:59:38 +01:00
Alexandre Ratchov 6cbde939dd ensure that rpos <= cpos <= wpos 2014-02-14 15:15:13 +01:00
Alexandre Ratchov e8fc261612 use save parameters instead of calling getpar() 2014-02-13 16:41:51 +01:00
Alexandre Ratchov 1161add0e8 use save parameters instead of calling getpar() 2014-02-13 16:39:42 +01:00
Alexandre Ratchov 7fbbfab94a remove unused 2014-02-13 16:36:56 +01:00
Alexandre Ratchov 05c5ae3c6a handle xrun if xfers are not frame-aligned 2014-02-13 15:11:33 +01:00
Alexandre Ratchov 9fc928011a set rbpf/wbpf to 1 if not used to avoid SIGFPE 2014-02-13 15:10:56 +01:00
Alexandre Ratchov 262541f176 remove unused 2014-02-13 13:05:37 +01:00
Alexandre Ratchov 7a9ad77510 use relative read/write positions for debug printfs 2014-02-13 13:04:02 +01:00
Alexandre Ratchov 002a501b9f cleanup tags, from schwarze@ 2014-01-27 13:16:23 +01:00
Alexandre Ratchov a49e6f5991 clarify sio_stop() and friends 2013-12-27 13:20:04 +01:00
Alexandre Ratchov f4f0b9e7b7 - replace "audio stream" by "audio device", as sndio is a device
abstraction
- remove useless statements.
2013-12-22 02:22:00 +01:00
Alexandre Ratchov dd2c5a2816 set rec params before play params 2013-12-11 13:35:28 +01:00
Alexandre Ratchov 496c443bca log errors only if SNDIO_DEBUG=1 2013-12-10 20:23:11 +01:00
Alexandre Ratchov b22be8340a log only errors if SNDIO_DEBUG=1 2013-12-10 20:14:48 +01:00
Alexandre Ratchov e8221ec396 handle partial samples in alsa 2013-12-10 08:43:45 +01:00
Alexandre Ratchov 90db576827 implement getcaps for alsa 2013-11-28 18:47:07 +01:00
Alexandre Ratchov 305695dee8 bump major 2013-11-26 19:45:01 +01:00
Alexandre Ratchov c0b2a1da07 drop comment 2013-11-22 12:09:43 +01:00
Alexandre Ratchov b1c417ab04 add prototypes 2013-11-18 17:50:04 +01:00
Alexandre Ratchov def3c30515 forgotten s/sndio_debug/_sndio_debug, from Christian Neukirchen,
thanks!
2013-11-15 08:35:11 +01:00
Alexandre Ratchov f4e64d573c spacing 2013-11-14 19:34:11 +01:00
Alexandre Ratchov abfcc198af sync to openbsd 2013-11-14 14:07:20 +01:00
Alexandre Ratchov 3254773ea9 remove only files we generate 2013-11-12 09:51:47 +01:00
Alexandre Ratchov 686dd7065e cleanup namespace 2013-11-12 09:49:28 +01:00
Alexandre Ratchov 73396a2106 crank major, as openbsd did 2013-08-27 08:08:59 +02:00
Alexandre Ratchov 5419334f1e align comments 2013-08-09 13:08:06 +02:00
Alexandre Ratchov 2bbe227870 use .In for includes, remove FILES sections 2013-08-09 12:08:34 +02:00
Alexandre Ratchov 6c33ab75ef fix play vs rec parameters confision 2013-06-03 16:15:56 +02:00
Alexandre Ratchov 6be37c42ee style 2013-06-03 15:48:01 +02:00
Alexandre Ratchov 9ba5076846 drop forgotten debug printf 2013-06-03 13:53:37 +02:00
Alexandre Ratchov bd681ab72d handle poll revents before state changes may occur 2013-06-03 12:55:22 +02:00
Alexandre Ratchov 83cf9a6eb7 fix & reorganize few traces 2013-05-14 11:45:19 +02:00
Alexandre Ratchov 05834decf0 less traces 2013-05-14 11:42:32 +02:00
Alexandre Ratchov bd09b46d73 fix samples vs bytes confusion in xrun code-path 2013-05-09 18:03:40 +02:00
Alexandre Ratchov aea7519d93 tabify 2013-04-15 10:42:51 +02:00
Alexandre Ratchov b5f32675fc explain what "default" means in sndio.7 2013-04-12 16:24:59 +02:00
Alexandre Ratchov 8748c853c2 move wsil/rdrop code in sio.c 2013-04-12 16:14:53 +02:00
Alexandre Ratchov 92bec779c0 better debug traces 2013-04-04 16:07:14 +02:00
Alexandre Ratchov 53f43d4df8 typo in comment 2013-04-04 16:01:44 +02:00
Alexandre Ratchov 8e377687b9 fix premature onmove() call-backs 2013-03-19 19:43:49 +01:00
Alexandre Ratchov ca804a9ffe log successful connections if debug enabled 2013-03-04 08:59:49 +01:00
Alexandre Ratchov 07bb2c0c95 subdevice -> sub-device 2013-01-06 19:14:55 +01:00
Alexandre Ratchov 2d63cee93c factor hw parameters setup 2012-11-13 15:08:28 +01:00
Alexandre Ratchov e77cefa34a pick a know format, if the requested one is not supported 2012-11-12 19:41:46 +01:00
Alexandre Ratchov 589cf9599a dont put xrun counters under #ifdef DEBUG 2012-11-08 20:07:51 +01:00
Alexandre Ratchov 2d4a336e1d rework xrun recovery code 2012-11-08 16:58:46 +01:00
Alexandre Ratchov a3a868da74 prime buffers with silence; make flow control start with zero
maxwrite
2012-11-07 08:48:35 +01:00
Alexandre Ratchov d6cb8d427d add bits for midi/N style port names 2012-11-06 20:52:40 +01:00
Alexandre Ratchov 718a891d31 fix clock ticks arithmetics 2012-10-30 08:19:25 +01:00
Alexandre Ratchov 26bf90b89d use gnu autoconf style HAVE_XXX macros 2012-10-29 18:08:36 +01:00
Alexandre Ratchov a26dd8e520 remove wrong comment about wrong code 2012-10-27 15:02:44 +02:00
Alexandre Ratchov fcc55272a8 hide alsa defs if USA_ALSA is not defined 2012-10-27 14:11:23 +02:00
Alexandre Ratchov 5681bf83e2 backout debug traces additions 2012-10-27 10:53:27 +02:00
Alexandre Ratchov 4b0c3775f1 crank SIO_MAXNFDS 2012-10-26 18:53:30 +02:00
Alexandre Ratchov 1c240e397d snd_pcm_poll_descriptors_count is not reliable use SIO_MAXNFDS 2012-10-26 18:50:09 +02:00
Alexandre Ratchov 1e60e2e649 add mio_alsa 2012-10-26 18:11:15 +02:00
Alexandre Ratchov f7a1b42dce user netinet/inet.h rather than arpa/inet.h 2012-10-26 16:58:55 +02:00
Alexandre Ratchov e750088847 fix bufsz arithmetic 2012-10-26 15:29:12 +02:00
Alexandre Ratchov 532c615895 use snd_pcm_poll_descriptors_count at initialisation 2012-10-26 15:01:04 +02:00
Alexandre Ratchov 80a52c9600 add alsa rawmidi support 2012-10-26 14:30:48 +02:00
Alexandre Ratchov 9f6bcbbc0e rmidi is not blocking as well 2012-10-26 10:55:57 +02:00
Alexandre Ratchov ea0d66a62d add explicit flow control in the protocol and use it for both midi and audio 2012-10-24 12:45:13 +02:00
Alexandre Ratchov 3a6bc9af60 rearrange debug traces 2012-10-24 10:31:19 +02:00
Alexandre Ratchov 8ca941be6f handle both EPIPE and ESTRPIPE 2012-10-17 22:43:01 +02:00
Alexandre Ratchov aecccdb36f use int for nfds 2012-10-06 12:25:25 +02:00
Alexandre Ratchov bde184cd77 save fifo pointers for debug purposes 2012-10-05 21:27:11 +02:00