Commit Graph

57 Commits

Author SHA1 Message Date
Cameron Grant
49c5e6e20a lock sound device when adding/removing channels
implement setblocksize for vchans
don't panic when doing certain ioctls or aborting on a vchan
xmms now works with vchans
2001-06-07 20:06:22 +00:00
Cameron Grant
285648f9d2 beginnings of virtual playback channel support
instead of using two malloced arrays for storing channel lists, use an
slist.  convert the sndstat device to use sbufs and optionally provide more
detail about channel state.

vchans are software mixed playback channels.  they are not enabled by this
commit.  they use the feeder infrastructure to emulate normal playback
channels in a manner transparent to applications, whilst providing as many
channels are desired, especially suitable for devices with only one hardware
playback channel.  in the future they will provide additional features.

those wishing to test this functionality will need to add vchan.c to
sys/conf/files and use 'sysctl -w hw.snd.pcm0.vchans' to enable it.

blocksize and auto-rate selection are not yet supported.
2001-05-27 17:22:00 +00:00
Cameron Grant
cd94939222 don't unlock the channel in chn_read, msleep will do it for us.
PR:		kern/26430
2001-04-29 02:31:02 +00:00
Cameron Grant
66a3addbf2 minor tweaks in speed and format setting routines.
don't stop exploring the feeders if a feeder fails to initialise.
2001-04-08 20:20:52 +00:00
Cameron Grant
26799605fc fix whitespace bogons 2001-03-25 21:43:24 +00:00
Cameron Grant
66ef8af5b0 mega-commit.
this introduces a new buffering mechanism which results in dramatic
simplification of the channel manager.

as several structures have changed, we take the opportunity to move their
definitions into the source files where they are used, make them private and
de-typedef them.

the sound drivers are updated to use snd_setup_intr instead of
bus_setup_intr, and to comply with the de-typedefed structures.

the ac97, mixer and channel layers have been updated with finegrained
locking, as have some drivers- not all though.  the rest will follow soon.
2001-03-24 23:10:29 +00:00
Cameron Grant
7ec3c4620e make attempts to set unsupported speeds or formats non-sticky. this should
fix problems with apps that probe for a variety of settings.

Submitted by:	Orion Hodson <O.Hodson@cs.ucl.ac.uk>
2001-02-13 21:57:34 +00:00
Cameron Grant
d55a14469f back out rev 1.49, looks like i committed it from the wrong tree.
include the changes 1.49 was supposed to have.

Noticed by:	peter
2001-02-07 20:45:40 +00:00
Cameron Grant
9d7227e565 conditionalize "hwptr went backwards" messages
modify default buffer size heuristic to not max out at 4k.  mpg123 should now
behave better under load.
2001-02-07 06:48:28 +00:00
Cameron Grant
6e64c174bd prevent excessively small buffer sizes resulting in hundreds of irqs per
second
2001-01-24 01:15:50 +00:00
Cameron Grant
f4084c4526 fix a panic if the requested blocksize was greater than the data rate,
resulting in a divide by 0.
2000-12-23 06:09:43 +00:00
Cameron Grant
b4f8389d56 fix a typo 2000-12-23 05:16:39 +00:00
Cameron Grant
350a5fafb1 update code dealing with snd_dbuf objects to do so using a functional interface
modify chn_setblocksize() to pick a default soft-blocksize appropriate to the
sample rate and format in use.  it will aim for a power of two size small
enough to generate block sizes of at most 20ms.  it will also set the
hard-blocksize taking into account rate/format conversions in use.

update drivers to implement setblocksize  correctly:
updated, tested: 	sb16, emu10k1, maestro, solo
updated, untested: 	ad1816, ess, mss, sb8, csa
not updated: 		ds1, es137x, fm801, neomagic, t4dwave, via82c686

i lack hardware to test: ad1816, csa, fm801, neomagic
others will be updated/tested in the next few days.
2000-12-23 03:16:13 +00:00
Cameron Grant
0f55ac6c1a kobjify.
this gives us several benefits, including:

* easier extensibility- new optional methods can be added to
  ac97/mixer/channel classes without having to fixup every driver.

* forward compatibility for drivers, provided no new mandatory methods are
  added.
2000-12-18 01:36:41 +00:00
Cameron Grant
612276f48c do not blindly assume 8khz is supported on open(). try for 8khz but respect
minspeed/maxspeed specified by the hw driver.

Submitted by:	Andrew Gordon <arg@arg1.demon.co.uk>
2000-11-18 03:43:04 +00:00
Cameron Grant
d19811446d slight mods to isa dma and channel flushing code 2000-11-07 00:32:35 +00:00
Cameron Grant
9ec437a334 add reinit functions to mixers
unstaticize chn_start()
add reset/resetdone functions to channels
2000-10-26 20:46:58 +00:00
Cameron Grant
c9c6ba09e4 prepare for adding a rate conversion feeder.
move format conversion feeders to feeder_fmt.c - no pertinent history so no
repo-copy.
2000-09-23 22:11:32 +00:00
Cameron Grant
306f91b60b detach support
remove un-needed setdir functions
add bus_teardown_intr calls where necessary
destroy our dma tags where necessary
destroy ac97 before releasing resources
2000-09-09 19:21:04 +00:00
Cameron Grant
85a6a5dce4 allow a null setdir implementation 2000-09-05 21:00:45 +00:00
Cameron Grant
33dbf14a17 change mixer api slightly
change channel interface - kobj implementation coming soonish
make pcm_makelinks not panic if modular
add pcm_unregister()

these changes support newpcm kld unloading, but this is only implemented
by ds1.c
2000-09-01 20:09:24 +00:00
Cameron Grant
c07a337569 make the test for hwptr going backwards more picky- now it only triggers if
15/16 of the buffer is skipped or we go backwards by < 1/16 of buffer size.
2000-08-29 16:32:26 +00:00
Cameron Grant
513693be6c rework feeder sytem to allow feeders in klds
modify driver capability reporting format to list every audio format
seperately- required for above and because we could not previously indicate
that mono was unsupported.

there should be no functional impact.
2000-08-20 22:18:56 +00:00
Cameron Grant
5fd7b0878e warn if hwptr goes backwards 2000-08-09 00:42:00 +00:00
Cameron Grant
1c60ef3f3c fix a potential local DoS attack 2000-07-30 19:38:26 +00:00
Cameron Grant
946e608646 add record channel irq timeouts too 2000-06-20 23:42:08 +00:00
Cameron Grant
e4d5b2502d fix a bug where opening for write would not fail if channel allocation failed
when playing, if we stall for 1s with no data advancing, abort and mark the
channel dead - fail all future operations
2000-06-20 23:27:12 +00:00
Cameron Grant
fa5e422d98 replace a line erroneously removed in 1.28, should fix xmms
make buf_clear handle unaligned lengths
2000-06-17 19:29:40 +00:00
Cameron Grant
20a874f116 handle closing differently - should fix the end-of-sample cutoff bug 2000-06-13 23:18:43 +00:00
Cameron Grant
20cdda004b improve recording 2000-06-06 22:30:22 +00:00
Cameron Grant
d28089a10d move various fields from pcm_channel to snd_dbuf
improve chn_read code- don't stop/restart on overrun, just dump data

more error checking on ioctls
2000-05-26 21:55:13 +00:00
Cameron Grant
52064e0a88 fix the 100% cpu in xmms issue 2000-05-04 19:06:34 +00:00
Cameron Grant
a0e22dd8db implement settrigger according to spec
fixes for non-blocking mode
2000-04-23 18:09:18 +00:00
Cameron Grant
8ae4c159aa more mmap fixes 2000-04-17 17:06:47 +00:00
Cameron Grant
603ddb6d5d make mmap sort-of work. there seem to be interactions with certain hw
drivers, so still work in progress.

do various mmap-related ioctls right.

improve blocksize control.

bits of cleanup.
2000-04-15 05:04:12 +00:00
Cameron Grant
7c7f2a4a81 make poll() dtrt, previously when playing it would trigger if there was less
than 1 byte ready to play instead of room for at least 1 byte to be written.
similarly for recording.
2000-04-05 05:54:02 +00:00
Nick Hibma
efb572af98 Spelling mistake 2000-03-15 22:11:00 +00:00
Poul-Henning Kamp
d8b47cbb70 Stop isadma from abusing the B_READ, B_RAW and B_WRITE flags.
Define ISADMA_{READ,WRITE,RAW} macros with the same numeric
values as the B_{READ,WRITE,RAW} and use them instead throughout.
2000-03-13 10:19:32 +00:00
Cameron Grant
f2410ff244 kludge to fix the end-of-sample repeating bug. i don't know why it happens;
none of my hw does it, but this should fix it for now.

Tested by:	wpaul
2000-01-18 18:59:03 +00:00
Cameron Grant
147d35e8b3 fix the premature termination of playback 2000-01-09 08:32:49 +00:00
Cameron Grant
bbb5bf3d69 don't panic if channel init fails, report and fail gracefully 2000-01-05 20:44:41 +00:00
Cameron Grant
2abc85f0c0 argh, forgot the bus_dma_tag_creates.
also, panic if channel init fails instead of derefing null.
2000-01-05 04:01:34 +00:00
Cameron Grant
a0b57fb738 - latest 2ndbuffer patch
- make chn_setdir work for rec on isa cards
- note: es1371 does not irq in smp

Submitted by:	tanimura
1999-12-29 03:46:54 +00:00
Cameron Grant
9035ec00a0 minor cleanup
Parts Submitted by:	Ville-Pertti Keinonen <will@ztango.com>
1999-12-21 08:43:28 +00:00
Cameron Grant
a451ce1dad minor cosmetics 1999-12-20 14:57:46 +00:00
Cameron Grant
529863cb71 stop playing if we underrun; if there is more data to come, the next write
will restart
1999-12-19 22:32:55 +00:00
Cameron Grant
f4a31ab806 fix the buffer repetition on ^c problem 1999-12-18 22:24:50 +00:00
Cameron Grant
5f070b6772 more dma underrun fixes, using a per-channel 2nd buffer
Submitted by:	tanimura
1999-12-13 03:29:09 +00:00
Cameron Grant
0e25481f93 fix dma underrun issues
mutate some panics to kasserts
add more spl protection

PR:		kern/14990
Partially Submitted by:	Vladimir N.Silyaev <vns@delta.odessa.ua>
Reviewed by:	dfr
1999-12-05 19:09:13 +00:00
Cameron Grant
54671c035c fix panic for large writes in non-blocking mode 1999-11-22 21:16:01 +00:00