Commit Graph

20 Commits

Author SHA1 Message Date
Alexandre Ratchov 436f0dbfff Fix builds with no DEBUG defined. 2019-07-28 11:26:51 +02:00
Alexandre Ratchov f9c0bed6d9 Check return values of syscalls against -1 in OSS code 2019-07-01 17:10:55 +02:00
Alexandre Ratchov 220e7731bc oss: use integer arithmetic to scale volume. 2018-03-02 07:42:53 +01:00
Alexandre Ratchov f1cd80bb72 oss: add support for sio_setvol().
From Tobias Kortkamp <tobik@FreeBSD.org>, thanks.
2018-03-02 07:32:49 +01:00
Tobias Kortkamp 31cfb9b6dc Support rsnd/default for opening the default device 2018-03-02 07:21:41 +01:00
Tobias Kortkamp 6b35921d2b sio_oss.c: Add missing audio_buf_info 2018-02-01 11:33:42 +01:00
Alexandre Ratchov 1024ccde8b Handle par->le, par->msb, par->sig as booleans in sio_oss_setpar().
From Tobias Kortkamp <tobik@FreeBSD.org>. Thanks.
2018-01-15 18:32:02 +01:00
Alexandre Ratchov a81ef2709a Check if the device supports playing/recording.
From Tobias Kortkamp <tobik@FreeBSD.org>. Thanks.
2018-01-15 18:30:21 +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