John Baldwin
fa465e99e0
Rename the loader tunable from hw.sndunit to hw.snd.unit.
...
Submitted by: cg
2001-01-03 02:09:31 +00:00
John Baldwin
d0d4e34743
Add a new API for soundcards that have hardware volume control:
...
- The mixer_hwmute() function can be called when a soundcard receives a
mute request.
- The mixer_hwstep() function can be used to adjust the volume of one or
both channels.
- The 'hw.snd.hwvol_step' sysctl determines the amount that mixer_hwstep()
adjusts the volume by on each call.
- The 'hw.snd.hwvol_mixer' sysctl specifies the mixer device to adjust the
volume on for both functions. The values used correspond to the
SOUNDCARD_MIXER_* constants.
2001-01-03 01:29:47 +00:00
John Baldwin
b3b7ccfe38
Create a new sysctl node 'hw.snd' and move 'hw.sndunit' to
...
'hw.snd.unit'.
Reviewed by: cg
2001-01-03 01:25:26 +00:00
Cameron Grant
6a6ee5bb35
compensate for broken codecs that return 0xffff on unimplemented registers
...
instead of 0.
2000-12-24 03:33:21 +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
41b3c72639
if a channel dies, rejuvenate it on close()
2000-11-07 00:29:24 +00:00
Cameron Grant
4e2e565cbd
add AFMT_8BIT for easier determination of formats
2000-11-06 22:22:52 +00:00
Cameron Grant
d16b567379
implement SNDCTL_DSP_POST
2000-10-27 22:20:45 +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
c0960a5e91
handle AFMT_QUERY right
2000-10-26 01:34:54 +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
33c878f034
only probe mandatory channels on known bad codecs
2000-09-23 22:00:09 +00:00
Cameron Grant
341f16cc60
dynamify- probe codec for supported channels
...
add channel mappings for mixer
2000-09-17 23:51:00 +00:00
Cameron Grant
58359dc594
add 16bit mono/stereo conversion feeder
...
prefer feeder chains of length 1 over length 2
2000-09-09 21:24:03 +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
cd2c103ae0
initial support for multiple ac97 codecs
2000-09-05 21:08:01 +00:00
Cameron Grant
85a6a5dce4
allow a null setdir implementation
2000-09-05 21:00:45 +00:00
Cameron Grant
c9b53085be
be more verbose about failed unload attempts
2000-09-05 20:58:51 +00:00
Cameron Grant
37ab02c0ed
tidy up a little, add a mask for 32bit formats
2000-09-05 20:56:31 +00:00
Peter Wemm
8ac2d635c4
Fix warnings by moving static functions before they are used.
2000-09-03 05:32:09 +00:00
Cameron Grant
f776b5abb8
update for phk's last devfs commit
2000-09-02 23:14:46 +00:00
Cameron Grant
f3dcf66158
add a missing return statement, doh.
2000-09-02 18:55:01 +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
7c438dbe9c
add devfs support. when devfs is enabled, sysctl hw.sndunit is used to set
...
which sound unit the /dev/{dsp,mixer,dspW,audio} links point at. this can
also be set from the loader.
2000-08-29 16:21:33 +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
fa06efc7e6
fix SNDCTL_DSP_GETODELAY
...
PR: kern/20340
Submitted by: Takashi SHIRAI <shirai@nintendo.co.jp>
2000-08-19 18:29:46 +00:00
Cameron Grant
071280d442
MFS: module macro changes
2000-08-09 18:46:48 +00:00
Cameron Grant
1874ec255c
MFS: sync with peter's isadma fixup
2000-08-09 01:22:09 +00:00
Cameron Grant
5fd7b0878e
warn if hwptr goes backwards
2000-08-09 00:42:00 +00:00
Nick Sayer
05a1fdb459
Simplex devices will always report EBUSY on 2nd (and subsequent)
...
opens if the reference count is not decremented on close.
Note that this may result in the reference count being corrupted
on full duplex devices (due to mismatching opens/closes), but the
code doesn't use the reference count for anything on full duplex
devices.
2000-08-02 22:47:44 +00:00
Cameron Grant
1c60ef3f3c
fix a potential local DoS attack
2000-07-30 19:38:26 +00:00
Cameron Grant
e04387c95a
fix a bug where opening /dev/dsp twice resulted in it being busy until reboot
2000-07-30 19:36:13 +00:00
Cameron Grant
d98c7b9a99
make this file suitable for 4-stable as well as 5-current
2000-07-18 21:23:48 +00:00
Seigo Tanimura
fb0ef52838
Finally merge newmidi.
...
(I had been busy for my own research activity until the last weekend)
Supported devices:
SB Midi Port (sbc + midi)
SB OPL3 (sbc + midi)
16550 UART (midi, needs a trick in your hint)
CS461x Midi Port (csa + midi)
OSS-compatible sequencer (seq)
Supported playing software:
playmidi (We definitely need more)
Notes:
/dev/midistat now reports installed midi drivers. /dev/sndstat reports
only pcm drivers. We need the new name(pcmstat?).
EMU8000(SB AWE) does not sound yet but does get probed so that the OPL3
synth on an AWE card works.
TODO:
MSS/PCI bridge drivers
Midi-tty interface to support general serial devices
Modules
2000-07-11 11:49:33 +00:00
Cameron Grant
f314f3dad2
add module metadata. this is a hack, sound drivers will eventually present a
...
bus to which pcm, mixer, etc will attach.
2000-07-03 20:52:27 +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
03cab0581f
make mixer reads return the value written instead of the value set
...
people seem to want this even though it breaks oss spec compliance
2000-06-19 20:31:58 +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
1a50bd2e37
handle duplex properly in the AIOGCAP ioctl - this may (partially?) fix rat
2000-06-07 11:51:30 +00:00
Cameron Grant
20cdda004b
improve recording
2000-06-06 22:30:22 +00:00
Cameron Grant
9c3268206d
don't panic if we try to add a channel we said we wouldn't
2000-06-06 22:24:53 +00:00
Cameron Grant
17dbf67736
if a device has no play or no record channels, set its simplex flag.
2000-06-01 01:32:30 +00:00
Cameron Grant
94e3845ccd
fix the return value of the SOUND_PCM_WRITE_CHANNELS ioctl
...
re-enable old pcm ioctls
2000-05-27 14:40:17 +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
04553e63a5
if we have a codec init routine, fail the attach if init fails
2000-05-26 21:42:50 +00:00
Cameron Grant
35f9e4a1db
handle emulated dma reads
...
don't try to get sample size from snd_dbuf
2000-05-26 21:15:47 +00:00
Yoshihiro Takahashi
7c14268dbd
Supported the mss on PC-98 and Sound Blaster 98.
...
Submitted by: "T.Yamaoka" <taka@windows.squares.net>
2000-05-19 15:41:52 +00:00
Poul-Henning Kamp
9626b608de
Separate the struct bio related stuff out of <sys/buf.h> into
...
<sys/bio.h>.
<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall
not be made a nested include according to bdes teachings on the
subject of nested includes.
Diskdrivers and similar stuff below specfs::strategy() should no
longer need to include <sys/buf.> unless they need caching of data.
Still a few bogus uses of struct buf to track down.
Repocopy by: peter
2000-05-05 09:59:14 +00:00
Cameron Grant
52064e0a88
fix the 100% cpu in xmms issue
2000-05-04 19:06:34 +00:00
Poul-Henning Kamp
eb95c536ad
Remove unneeded #include <sys/kernel.h>
2000-04-29 15:36:14 +00:00
Cameron Grant
a618cffeb8
duh, i forgot to change a bitmask, sorry alexander
...
Submitted by: Alexander Matey <matey@cis.ohio-state.edu>
2000-04-26 23:08:12 +00:00
Cameron Grant
dd1863690a
fix minor numbers for multi-channel devices
...
Submitted by: Alexander Matey <matey@cis.ohio-state.edu>
2000-04-26 20:06:52 +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
Cameron Grant
bd18f33408
allow /dev/dsp to be opened seperately for reading and writing.
2000-04-05 01:13:42 +00:00
Cameron Grant
119a24a450
try increasing 2ndbuffer size to 64k
2000-04-05 00:56:02 +00:00
Cameron Grant
e620d95952
fail in attach if we seem to have no ac97 codec
2000-04-01 22:24:03 +00:00
Cameron Grant
6b4b88f7a2
don't check extended features on codecs known to hang. should fix neomagic
...
problems.
2000-03-24 03:14:35 +00:00
Cameron Grant
39004e693d
update the ac97 layer:
...
* add a callback for initialising the mixer interface
* support ac97 2.1 variable rate audio feature
fix ac97-using drivers for the above
add suspend/resume support for neomagic
2000-03-20 15:30:50 +00:00
Cameron Grant
a0b4946276
add a function to reinitialize the mixer, to be called by drivers on
...
resuming after suspend
2000-03-20 15:21:50 +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
Peter Wemm
5775b1a2b6
Tidy up stray or bogus #if NFOO > 0 and #include "foo.h".
2000-01-29 18:48:30 +00:00
Peter Wemm
96e00123b4
Remove a rather bizzare set of #ifdefs and #defines that all worked out
...
to be a NO-OP.
2000-01-29 18:44:01 +00:00
Cameron Grant
45248baa3c
handle simplex devices right
2000-01-26 20:27:45 +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
03a00905d3
update ac97 layer to use device_printf when printing messages
2000-01-18 17:13:43 +00:00
Cameron Grant
9bc502089a
fix missing \n in sndstat output
2000-01-16 12:52:22 +00:00
Cameron Grant
898cb2af53
make dsp_read() assert that it has a read channel, not a write channel
...
Submitted by: green
2000-01-10 07:05:15 +00:00
Cameron Grant
147d35e8b3
fix the premature termination of playback
2000-01-09 08:32:49 +00:00
Cameron Grant
bf8ca271a3
modify sndstat output
2000-01-09 08:07:46 +00:00
Cameron Grant
833f702348
allow mixer-only devices - ie, devices with no play/rec channels
2000-01-06 04:11:36 +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
Peter Wemm
664a31e496
Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
...
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot). This is consistant with the other
BSD's who made this change quite some time ago. More commits to come.
1999-12-29 04:46:21 +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
1ad869dbc6
allow (broken) apps to use mixer ioctls on dsp devices. eg: vmware
...
Submitted by: "Vladimir N. Silyaev" <vsilyaev@mindspring.com>
1999-12-20 00:56:51 +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
7207eca657
move make_dev operations for audio channels to pcm_addchan(). in theory,
...
with modifications to MAKEDEV this will allow use of multiple output streams
on cards supporting it, eg trident 4dwave.
1999-12-19 15:27:24 +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
0927bf4365
move channel-swapping support to the hardware driver since it knows the card
...
state best
1999-12-12 02:18:58 +00:00
Peter Wemm
c2af6f650c
Update for pnp adjustments regarding NPNP.
...
Also, optimize out a mess of #if's that were duplicating work already
done by config(8). For example, if a file is marked as
"dev/sound/pci/foo.c optional pcm pci" then it's only added if pcm *and*
pci are present, so #if NPCM > 0 and #if NPCI > 0 are totally redundant.
A bit more work is still needed.
Discussed with: cg (a few weeks ago)
1999-12-06 18:26:33 +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
Alfred Perlstein
4d25c041fe
tanimura implemented SNDCTL_DSP_GETODELAY for pcm.
...
Submitted by: tanimura
1999-11-29 23:01:59 +00:00
Cameron Grant
54671c035c
fix panic for large writes in non-blocking mode
1999-11-22 21:16:01 +00:00
Cameron Grant
e479a8af2a
fix for -fno-builtin
...
PR: kern/14278
1999-11-21 17:15:12 +00:00
Cameron Grant
ef9308b1ce
repo-copied to make way for newmidi, this commit updates include paths
1999-11-20 16:50:33 +00:00