Commit Graph

10 Commits

Author SHA1 Message Date
Ed Schouten
d745c852be Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
Rui Paulo
577fedb6b1 Fix a brain-o: wrong case statement semantics.
Found with:	clang
2010-10-13 14:39:54 +00:00
Joel Dahl
b40d342195 Start copyright notices with /*- 2010-03-29 20:27:17 +00:00
Ariff Abdullah
90da2b2859 Sound Mega-commit. Expect further cleanup until code freeze.
For a slightly thorough explaination, please refer to
	[1] http://people.freebsd.org/~ariff/SOUND_4.TXT.html .

Summary of changes includes:

1 Volume Per-Channel (vpc).  Provides private / standalone volume control
  unique per-stream pcm channel without touching master volume / pcm.
  Applications can directly use SNDCTL_DSP_[GET|SET][PLAY|REC]VOL, or for
  backwards compatibility, SOUND_MIXER_PCM through the opened dsp device
  instead of /dev/mixer.  Special "bypass" mode is enabled through
  /dev/mixer which will automatically detect if the adjustment is made
  through /dev/mixer and forward its request to this private volume
  controller.  Changes to this volume object will not interfere with
  other channels.

  Requirements:
    - SNDCTL_DSP_[GET|SET][PLAY|REC]_VOL are newer ioctls (OSSv4) which
      require specific application modifications (preferred).
    - No modifications required for using bypass mode, so applications
      like mplayer or xmms should work out of the box.

  Kernel hints:
    - hint.pcm.%d.vpc (0 = disable vpc).

  Kernel sysctls:
    - hw.snd.vpc_mixer_bypass (default: 1).  Enable or disable /dev/mixer
      bypass mode.
    - hw.snd.vpc_autoreset (default: 1).  By default, closing/opening
      /dev/dsp will reset the volume back to 0 db gain/attenuation.
      Setting this to 0 will preserve its settings across device
      closing/opening.
    - hw.snd.vpc_reset (default: 0).  Panic/reset button to reset all
      volume settings back to 0 db.
    - hw.snd.vpc_0db (default: 45).  0 db relative to linear mixer value.

2 High quality fixed-point Bandlimited SINC sampling rate converter,
  based on Julius O'Smith's Digital Audio Resampling -
  http://ccrma.stanford.edu/~jos/resample/.  It includes a filter design
  script written in awk (the clumsiest joke I've ever written)
    - 100% 32bit fixed-point, 64bit accumulator.
    - Possibly among the fastest (if not fastest) of its kind.
    - Resampling quality is tunable, either runtime or during kernel
      compilation (FEEDER_RATE_PRESETS).
    - Quality can be further customized during kernel compilation by
      defining FEEDER_RATE_PRESETS in /etc/make.conf.

  Kernel sysctls:
    - hw.snd.feeder_rate_quality.
      0 - Zero-order Hold (ZOH).  Fastest, bad quality.
      1 - Linear Interpolation (LINEAR).  Slightly slower than ZOH,
          better quality but still does not eliminate aliasing.
      2 - (and above) - Sinc Interpolation(SINC).  Best quality.  SINC
          quality always start from 2 and above.

  Rough quality comparisons:
    - http://people.freebsd.org/~ariff/z_comparison/

3 Bit-perfect mode.  Bypasses all feeder/dsp effects.  Pure sound will be
  directly fed into the hardware.

4 Parametric (compile time) Software Equalizer (Bass/Treble mixer). Can
  be customized by defining FEEDER_EQ_PRESETS in /etc/make.conf.

5 Transparent/Adaptive Virtual Channel. Now you don't have to disable
  vchans in order to make digital format pass through.  It also makes
  vchans more dynamic by choosing a better format/rate among all the
  concurrent streams, which means that dev.pcm.X.play.vchanformat/rate
  becomes sort of optional.

6 Exclusive Stream, with special open() mode O_EXCL.  This will "mute"
  other concurrent vchan streams and only allow a single channel with
  O_EXCL set to keep producing sound.

Other Changes:
    * most feeder_* stuffs are compilable in userland. Let's not
      speculate whether we should go all out for it (save that for
      FreeBSD 16.0-RELEASE).
    * kobj signature fixups, thanks to Andriy Gapon <avg@freebsd.org>
    * pull out channel mixing logic out of vchan.c and create its own
      feeder_mixer for world justice.
    * various refactoring here and there, for good or bad.
    * activation of few more OSSv4 ioctls() (see [1] above).
    * opt_snd.h for possible compile time configuration:
      (mostly for debugging purposes, don't try these at home)
        SND_DEBUG
        SND_DIAGNOSTIC
        SND_FEEDER_MULTIFORMAT
        SND_FEEDER_FULL_MULTIFORMAT
        SND_FEEDER_RATE_HP
        SND_PCM_64
        SND_OLDSTEREO

Manual page updates are on the way.

Tested by:	joel, Olivier SMEDTS <olivier at gid0 d org>, too many
          	unsung / unnamed heroes.
2009-06-07 19:12:08 +00:00
Alexander Leidinger
3141a8dcd1 All open fixes and improvements from Konstantin for which users had to
use patches so far:
 + Envy24:
   - fix: broken init data for M Audio Delta DiO 2496
   - add: support for M Audio Delta 44
   - add: support for M Audio Delta 1010LT
     Tested by:	Dominique Goncalves, dominique.goncalves at gmail.com
   - add: support for Terratec EWX 2496
     Tested by:	Stefan Sperling, stsp at stsp.name
   - add: support for M Audio Delta 66
     Tested by:	Richard Bown, richard.bown at blueyonder.co.uk
   - add: support for M Audio Delta 1010
     Tested by:	Andrew Reilly, areilly at bigpond.net.au
 + Envy24HT:
   - add: support for Terrasoniq TS22PCI
   - fix: M-Audio Revolution 5.1 sound volume is very low
     Reported by:	Oliver Hartmann, ohartman at zedat.fu-berlin.de
                 	Andrey Slusar, anrays at gmail.com
     Tested by:		Andrey Slusar, anrays at gmail.com
               		Rusu Silviu, arol.the at gmail.com
   - fix: M-Audio Revolution 7.1 sound is distorted and very quiet
     Reported by:	Olev Hannula, hannula at gmail.com
     Tested by:		Olev Hannula, hannula at gmail.com
               		Stanislav Belansky, stanislav at icmail.ru
   - fix: Terratec PHASE 22 codec is power-off due to wrong init data
     Reported by:	Philipp Ost, pj at smo.de
     Tested by:		Philipp Ost, pj at smo.de
 + SpicDS:
   - fix: AK4381 produce hiss sound on 192kHz sample rate
   - fix: stupid bug with volume control for AK4396

Submitted by:	 	Konstantin Dimitrov <kosio.dimitrov@gmail.com>
2009-02-11 10:29:45 +00:00
Joel Dahl
ccb43d8d2c Bring in a bunch of bug fixes and some code to support more chipsets.
Neither me nor Ariff have access to any of this hardware, so all tests
have been made by Konstantin and Artem.  Commit message mostly written
by Konstantin.

envy24:
- Add test code to support rear line-in input on 'Terratec DMX 6fire'
  audio card.  This code is also intended to be used in the future for
  support of cards, that have I2C-to-GPIO expanders wired between the
  control line of the audio codec and the Envy24, however such cards
  are too complex and i can't add that support without hardware sample
  of such board, i've already tried and failed.

envy24ht:
- Add support for 'AudioTrak Prodigy HD2'.
- Add support for 'AudioTrak Prodigy 7.1 XT'.
- Add support for 'ESI Juli@' (Works ok, DAC volume is hard-coded for
  the time being, so 'mixer vol ...' doesn't work, only 'mixer pcm
  ...' works). [1]
- Fix bug in the init data for M-Audio Revolution 5.1, that
  results in distorted sound.
- Add software volume control (now 'mixer pcm' works, thanks to Ariff).
- Add support for more samples rates - 176.4kHz and 192kHz.
- Fix problem with the 192kHz samples rate playback when 24.576MHz
  crystal is used on the board instead of 49.152MHz crystal.

spicds:
- Add support for Asahi Kasei flagship DAC - AK4396 (used in AudioTrak
  Prodigy HD2).

Submitted by:	Konstantin Dimitrov <kosio.dimitrov@gmail.com>
Tested by:	Artem Antonov [1]
Reviewed by:	ariff
2007-05-27 19:58:39 +00:00
Ariff Abdullah
d82080b4cd Fix compilation for statically linked snd_envy24{ht}/spicds. Use explicit
struct mtx rather than void pointer.

PR:	kern/109147
2007-02-14 15:23:44 +00:00
Alexander Leidinger
f198ead2a5 After repo copy from ak452x.[ch]: SPIcds is the I2S SPI audio codec code
used by the Envy* drivers.

Submitted by:	"Konstantin Dimitrov" <kosio.dimitrov@gmail.com>
2006-09-30 16:53:40 +00:00
Alexander Leidinger
ce356b7017 - fix compatibility with newer versions of FreeBSD
- fix all warnings during compilation
- fix obvious bugs
- add support for more cards

Now supported:
 - M-Audio Delta Dio 2496
 - M-Audio Audiophile 2496
 - Terratec DMX 6fire

Known bugs (detected by Nokolas and Stefan):
 - $ kldunload snd_ak452x.ko
   Warning: memory type ak452x leaked memory on destroy (1 allocations,
   64 bytes leaked).
 - No sound in KDE: Everything works fine at the console but when I load KDE
   (3.5.3) the sound stutters and plays at less then 1/2 speed.
 - 'mixer: WRITE_MIXER: Device not configured' The message repeats x
   times at system startup, x = whatever hw.snd.maxautovchans is set to.
   (this is because only vol, pcm and line are supported, but the driver
   shows more than those mixer devices and setting those additional mixers
   results in this error message)
 - vchans don't work
 - 24 bit playback not supported (only 16/32 bit)
 - after kld(un)loading some times, the card fails to be probed until reboot

Datasheets are available from:
	http://www.nbritton.org/uploads/envy24/
	http://www.asahi-kasei.co.jp/akm/en/product/ak4528/ak4528_f01e.pdf
	http://www.asahi-kasei.co.jp/akm/en/product/ak4528/ekd4528-01.pdf
	http://www.asahi-kasei.co.jp/akm/en/product/ak4524/ak4524_f03e.pdf
	http://www.asahi-kasei.co.jp/akm/en/product/ak4524/ekd4524.pdf
	http://www.wolfson.co.uk/uploads/documents/en/WM8728.pdf
	http://www.richtech.co.kr/down/richtek/RT9131.pdf
	http://xkodi.svobodno.com/xkodi/space71.html
	http://people.freebsd.org/~lofi/envy24.pdf
	http://people.freebsd.org/~lofi/4524.pdf

Submitted by:	Konstantin Dimitrov <kosio.dimitrov@gmail.com>
Tested by:	Nikolas Britton <nikolas.britton@gmail.com>
		Stefan Ehmann <shoesoft@gmx.net>
2006-06-17 15:11:36 +00:00
Alexander Leidinger
12ab72d345 dd the envy24 driver as is to the tree. It's not connected to the build
yet. More commits to follow.

I got no response from the author, but since the driver is BSD licensed
I don't think he will complain. :-)

I got it from http://people.freebsd.org/~lofi/envy24.tar.gz

Written by:	Katsurajima Naoto <raven@katsurajima.seya.yokohama.jp>
2006-06-17 14:36:44 +00:00