Could sb live owners please test the patch for a while for
any unexpected behaviour or problems.
Yorick.
*** sys/dev/sound/pci/emu10k1.c.orig Tue Dec 21 11:01:14 1999
--- sys/dev/sound/pci/emu10k1.c Tue Dec 25 18:30:39 2001
***************
*** 28,34 ****
--- 28,36 ----
#include <dev/sound/pcm/sound.h>
#include <dev/sound/pcm/ac97.h>
+ #include "mixer_if.h"
#include <gnu/dev/sound/pci/emu10k1.h>
+ #include <gnu/dev/sound/pci/emu10k1tone.h>
#include <pci/pcireg.h>
#include <pci/pcivar.h>
***************
*** 88,93 ****
--- 90,100 ----
device_t dev;
u_int32_t type, rev;
u_int32_t tos_link:1, APS:1;
+ int nextgpr;
+ int mixfout[2],mixrout[2];
+ int mixrvol[2],mixbass[2][5],mixtreb[2][5];
+
+ struct snd_mixer *ac97mixer;
bus_space_tag_t st;
bus_space_handle_t sh;
***************
*** 127,132 ****
--- 134,151 ----
static u_int32_t emu_rd(struct sc_info *, int, int);
static void emu_wr(struct sc_info *, int, u_int32_t, int);
+ /* allocate registers for the DSP */
+ static int emu_allocgpr(struct sc_info *);
+
+ /* mixer */
+ static int emumix_init(struct snd_mixer *m);
+ static int emumix_reinit(struct snd_mixer *m);
+ static int emumix_uninit(struct snd_mixer *m);
+ static int emumix_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right);
+ static u_int32_t emumix_setrecsrc(struct snd_mixer *m, u_int32_t src);
+ kobj_class_t emu_getmixerclass(void);
+ extern struct malloc_type M_MIXER[1];
+
/* -------------------------------------------------------------------- */
static u_int32_t emu_rfmt_ac97[] = {
***************
*** 238,243 ****
--- 257,269 ----
emu_wrptr(sc, 0, MICROCODEBASE + pc, data);
}
+ static int emu_allocgpr(struct sc_info *sc)
+ {
+ if (sc->nextgpr > 0x1ff)
+ device_printf(sc->dev, "Out of GPR registers!\n");
+ return sc->nextgpr++;
+ }
+
/* -------------------------------------------------------------------- */
/* ac97 codec */
/* no locking needed */
***************
*** 1128,1133 ****
--- 1154,1173 ----
for (i = 0; i < 256; i++)
emu_wrptr(sc, 0, FXGPREGBASE + i, 0);
+ /* allocate registers for various functionality */
+ sc->mixfout[0]=(emu_allocgpr(sc));
+ sc->mixfout[1]=(emu_allocgpr(sc));
+ sc->mixrout[0]=(emu_allocgpr(sc));
+ sc->mixrout[1]=(emu_allocgpr(sc));
+ sc->mixrvol[0]=(emu_allocgpr(sc));
+ sc->mixrvol[1]=(emu_allocgpr(sc));
+ for (i = 0; i < 5; i++) {
+ sc->mixbass[0][i]=(emu_allocgpr(sc));
+ sc->mixbass[1][i]=(emu_allocgpr(sc));
+ sc->mixtreb[0][i]=(emu_allocgpr(sc));
+ sc->mixtreb[1][i]=(emu_allocgpr(sc));
+ }
+
/* FX-8010 DSP Registers:
FX Bus
0x000-0x00f : 16 registers
***************
*** 1170,1190 ****
/* Routing - this will be configurable in later version */
/* GPR[0/1] = FX * 4 + SPDIF-in */
! emu_addefxop(sc, 4, 0x100, 0x12, 0, 0x44, &pc);
! emu_addefxop(sc, 4, 0x101, 0x13, 1, 0x44, &pc);
/* GPR[0/1] += APS-input */
! emu_addefxop(sc, 6, 0x100, 0x100, 0x40, sc->APS ? 0x16 : 0x40, &pc);
! emu_addefxop(sc, 6, 0x101, 0x101, 0x40, sc->APS ? 0x17 : 0x40, &pc);
! /* FrontOut (AC97) = GPR[0/1] */
! emu_addefxop(sc, 6, 0x20, 0x40, 0x40, 0x100, &pc);
! emu_addefxop(sc, 6, 0x21, 0x40, 0x41, 0x101, &pc);
/* RearOut = (GPR[0/1] * RearVolume) >> 31 */
! /* RearVolume = GRP[0x10/0x11] */
! emu_addefxop(sc, 0, 0x28, 0x40, 0x110, 0x100, &pc);
! emu_addefxop(sc, 0, 0x29, 0x40, 0x111, 0x101, &pc);
/* TOS out = GPR[0/1] */
! emu_addefxop(sc, 6, 0x22, 0x40, 0x40, 0x100, &pc);
! emu_addefxop(sc, 6, 0x23, 0x40, 0x40, 0x101, &pc);
/* Mute Out2 */
emu_addefxop(sc, 6, 0x24, 0x40, 0x40, 0x40, &pc);
emu_addefxop(sc, 6, 0x25, 0x40, 0x40, 0x40, &pc);
--- 1210,1235 ----
/* Routing - this will be configurable in later version */
/* GPR[0/1] = FX * 4 + SPDIF-in */
! emu_addefxop(sc, 4, sc->mixfout[0], 0x12, 0, 0x44, &pc);
! emu_addefxop(sc, 4, sc->mixfout[1], 0x13, 1, 0x44, &pc);
/* GPR[0/1] += APS-input */
! emu_addefxop(sc, 6, sc->mixfout[0], sc->mixfout[0], 0x40, sc->APS ? 0x16 : 0x40, &pc);
! emu_addefxop(sc, 6, sc->mixfout[1], sc->mixfout[1], 0x41, sc->APS ? 0x17 : 0x40, &pc);
! /* FrontOut (AC97) = GPR[0/1] + tone */
! EFXTONE(sc, sc->mixbass[0], sc->mixtreb[0], sc->mixfout[0], 0x20);
! EFXTONE(sc, sc->mixbass[0], sc->mixtreb[0], sc->mixfout[1], 0x21);
! /* Add the ac97 input for rear output */
! emu_addefxop(sc, 6, sc->mixrout[0], 0x40, sc->mixfout[0], 0x10, &pc);
! emu_addefxop(sc, 6, sc->mixrout[1], 0x40, sc->mixfout[1], 0x11, &pc);
! /* Tone for the rear output */
! EFXTONE(sc, sc->mixbass[1], sc->mixtreb[1], sc->mixrout[0], sc->mixrout[0]);
! EFXTONE(sc, sc->mixbass[1], sc->mixtreb[1], sc->mixrout[1], sc->mixrout[1]);
/* RearOut = (GPR[0/1] * RearVolume) >> 31 */
! emu_addefxop(sc, 0, 0x28, 0x40, sc->mixrvol[0], sc->mixrout[0], &pc);
! emu_addefxop(sc, 0, 0x29, 0x40, sc->mixrvol[1], sc->mixrout[1], &pc);
/* TOS out = GPR[0/1] */
! emu_addefxop(sc, 6, 0x22, 0x40, 0x40, sc->mixfout[0], &pc);
! emu_addefxop(sc, 6, 0x23, 0x40, 0x40, sc->mixfout[1], &pc);
/* Mute Out2 */
emu_addefxop(sc, 6, 0x24, 0x40, 0x40, 0x40, &pc);
emu_addefxop(sc, 6, 0x25, 0x40, 0x40, 0x40, &pc);
***************
*** 1291,1296 ****
--- 1336,1342 ----
emu_wrptr(sc, 0, SPCS1, spcs);
emu_wrptr(sc, 0, SPCS2, spcs);
+ sc->nextgpr=FXGPREGBASE;
emu_initefx(sc);
SLIST_INIT(&sc->mem.blocks);
***************
*** 1472,1478 ****
codec = AC97_CREATE(dev, sc, emu_ac97);
if (codec == NULL) goto bad;
! if (mixer_init(dev, ac97_getmixerclass(), codec) == -1) goto bad;
sc->irqid = 0;
sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irqid,
--- 1518,1531 ----
codec = AC97_CREATE(dev, sc, emu_ac97);
if (codec == NULL) goto bad;
!
! /* unsure how to do this nicely,
! copy the code from mixer.c to access the ac97 mixer */
! sc->ac97mixer = (struct snd_mixer *)kobj_create(ac97_getmixerclass(), M_MIXER, M_WAITOK | M_ZERO);
! if (sc->ac97mixer == NULL) goto bad;
! mix_setdevinfo(sc->ac97mixer, codec);
!
! if (mixer_init(dev, emu_getmixerclass(), sc) == -1) goto bad;
sc->irqid = 0;
sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irqid,
***************
*** 1497,1502 ****
--- 1550,1556 ----
return 0;
bad:
+ if (sc->ac97mixer) kobj_delete((kobj_t)sc->ac97mixer, M_MIXER);
if (codec) ac97_destroy(codec);
if (sc->reg) bus_release_resource(dev, sc->regtype, sc->regid, sc->reg);
if (sc->ih) bus_teardown_intr(dev, sc->irq, sc->ih);
***************
*** 1597,1600 ****
--- 1651,1751 ----
static devclass_t emujoy_devclass;
DRIVER_MODULE(emujoy, pci, emujoy_driver, emujoy_devclass, 0, 0);
+
+
+ static int
+ emumix_init(struct snd_mixer *m)
+ {
+ struct sc_info *sc = mix_getdevinfo(m);
+ u_int32_t devs;
+ int r;
+
+ r = MIXER_INIT(sc->ac97mixer);
+ if (r) return r;
+
+ devs = mix_getdevs(sc->ac97mixer);
+ mix_setdevs(m, devs | SOUND_MASK_ALTPCM | SOUND_MASK_BASS | SOUND_MASK_TREBLE);
+ devs = mix_getrecdevs(sc->ac97mixer);
+ mix_setrecdevs(m, devs);
+ return 0;
+ }
+
+ static int
+ emumix_reinit(struct snd_mixer *m)
+ {
+ struct sc_info *sc = mix_getdevinfo(m);
+ return MIXER_REINIT(sc->ac97mixer);
+ }
+
+ static int
+ emumix_uninit(struct snd_mixer *m)
+ {
+ struct sc_info *sc = mix_getdevinfo(m);
+ MIXER_UNINIT(sc->ac97mixer);
+ kobj_delete((kobj_t)sc->ac97mixer, M_MIXER);
+ return 0;
+ }
+
+ static int
+ emumix_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
+ {
+ struct sc_info *sc = mix_getdevinfo(m);
+ unsigned efx_l, efx_r, *tone_f, *tone_r;
+ int i;
+
+ if (sc == NULL)
+ return -1;
+
+ /* use ALTPCM until someone suggests something better */
+ if (dev == SOUND_MIXER_ALTPCM) {
+ efx_l = ((((unsigned)1 << 31) - 1) / 100) * left;
+ efx_r = ((((unsigned)1 << 31) - 1) / 100) * right;
+ emu_wrptr(sc, 0, sc->mixrvol[0], efx_l);
+ emu_wrptr(sc, 0, sc->mixrvol[1], efx_r);
+ return 0;
+ }
+ if (dev == SOUND_MIXER_BASS) {
+ tone_f = emu_tone_get_bass(left);
+ tone_r = emu_tone_get_bass(right);
+ for(i = 0; i < 5; i++) {
+ emu_wrptr(sc, 0, sc->mixbass[0][i], tone_f[i]);
+ emu_wrptr(sc, 0, sc->mixbass[1][i], tone_r[i]);
+ }
+ return 0;
+ }
+ if (dev == SOUND_MIXER_TREBLE) {
+ tone_f = emu_tone_get_treble(left);
+ tone_r = emu_tone_get_treble(right);
+ for(i = 0; i < 5; i++) {
+ emu_wrptr(sc, 0, sc->mixtreb[0][i], tone_f[i]);
+ emu_wrptr(sc, 0, sc->mixtreb[1][i], tone_r[i]);
+ }
+ return 0;
+ }
+
+ return MIXER_SET(sc->ac97mixer,dev,left,right);
+ }
+
+ static u_int32_t
+ emumix_setrecsrc(struct snd_mixer *m, u_int32_t src)
+ {
+ struct sc_info *sc = mix_getdevinfo(m);
+ return MIXER_SETRECSRC(sc->ac97mixer,src);
+ }
+
+ static kobj_method_t emumix_methods[] = {
+ KOBJMETHOD(mixer_init, emumix_init),
+ KOBJMETHOD(mixer_reinit, emumix_reinit),
+ KOBJMETHOD(mixer_uninit, emumix_uninit),
+ KOBJMETHOD(mixer_set, emumix_set),
+ KOBJMETHOD(mixer_setrecsrc, emumix_setrecsrc),
+ { 0, 0 }
+ };
+ MIXER_DECLARE(emumix);
+
+ kobj_class_t
+ emu_getmixerclass(void)
+ {
+ return &emumix_class;
+ }
diff -crN /home/yorick/FreeBSD/ctm/src/sys/dev/sound/pcm/mixer.c sys/dev/sound/pcm/mixer.c
*** /home/yorick/FreeBSD/ctm/src/sys/dev/sound/pcm/mixer.c Sat Aug 4 13:27:18 2001
--- sys/dev/sound/pcm/mixer.c Fri Dec 21 21:00:05 2001
***************
*** 192,197 ****
--- 192,203 ----
return m->devinfo;
}
+ void
+ mix_setdevinfo(struct snd_mixer *m, void *d)
+ {
+ m->devinfo = d;
+ }
+
int
mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
{
diff -crN /home/yorick/FreeBSD/ctm/src/sys/dev/sound/pcm/mixer.h sys/dev/sound/pcm/mixer.h
*** /home/yorick/FreeBSD/ctm/src/sys/dev/sound/pcm/mixer.h Wed Aug 1 23:32:26 2001
--- sys/dev/sound/pcm/mixer.h Fri Dec 21 21:01:01 2001
***************
*** 40,45 ****
--- 40,46 ----
u_int32_t mix_getdevs(struct snd_mixer *m);
u_int32_t mix_getrecdevs(struct snd_mixer *m);
void *mix_getdevinfo(struct snd_mixer *m);
+ void mix_setdevinfo(struct snd_mixer *m, void *d);
/*
* this is a kludge to allow hiding of the struct snd_mixer definition
diff -crN /home/yorick/FreeBSD/ctm/src/sys/gnu/dev/sound/pci/emu10k1tone.h sys/gnu/dev/sound/pci/emu10k1tone.h
*** /home/yorick/FreeBSD/ctm/src/sys/gnu/dev/sound/pci/emu10k1tone.h Thu Jan 1 00:00:00 1970
--- sys/gnu/dev/sound/pci/emu10k1tone.h Tue Dec 25 18:27:51 2001
***************
*** 0 ****
--- 1,242 ----
+ /* emu10k1tone.c derived from tone.asm
+ from the opensource live driver at opensource.creative.com
+ The original file is included as a comment below. */
+ /* portions taken from mixer.c
+ from the opensource live driver at opensource.creative.com */
+
+ static const unsigned emu_tone_bass_table[41][5] = {
+ { 0x3e4f844f, 0x84ed4cc3, 0x3cc69927, 0x7b03553a, 0xc4da8486 },
+ { 0x3e69a17a, 0x84c280fb, 0x3cd77cd4, 0x7b2f2a6f, 0xc4b08d1d },
+ { 0x3e82ff42, 0x849991d5, 0x3ce7466b, 0x7b5917c6, 0xc48863ee },
+ { 0x3e9bab3c, 0x847267f0, 0x3cf5ffe8, 0x7b813560, 0xc461f22c },
+ { 0x3eb3b275, 0x844ced29, 0x3d03b295, 0x7ba79a1c, 0xc43d223b },
+ { 0x3ecb2174, 0x84290c8b, 0x3d106714, 0x7bcc5ba3, 0xc419dfa5 },
+ { 0x3ee2044b, 0x8406b244, 0x3d1c2561, 0x7bef8e77, 0xc3f8170f },
+ { 0x3ef86698, 0x83e5cb96, 0x3d26f4d8, 0x7c114600, 0xc3d7b625 },
+ { 0x3f0e5390, 0x83c646c9, 0x3d30dc39, 0x7c319498, 0xc3b8ab97 },
+ { 0x3f23d60b, 0x83a81321, 0x3d39e1af, 0x7c508b9c, 0xc39ae704 },
+ { 0x3f38f884, 0x838b20d2, 0x3d420ad2, 0x7c6e3b75, 0xc37e58f1 },
+ { 0x3f4dc52c, 0x836f60ef, 0x3d495cab, 0x7c8ab3a6, 0xc362f2be },
+ { 0x3f6245e8, 0x8354c565, 0x3d4fdbb8, 0x7ca602d6, 0xc348a69b },
+ { 0x3f76845f, 0x833b40ec, 0x3d558bf0, 0x7cc036df, 0xc32f677c },
+ { 0x3f8a8a03, 0x8322c6fb, 0x3d5a70c4, 0x7cd95cd7, 0xc317290b },
+ { 0x3f9e6014, 0x830b4bc3, 0x3d5e8d25, 0x7cf1811a, 0xc2ffdfa5 },
+ { 0x3fb20fae, 0x82f4c420, 0x3d61e37f, 0x7d08af56, 0xc2e9804a },
+ { 0x3fc5a1cc, 0x82df2592, 0x3d6475c3, 0x7d1ef294, 0xc2d40096 },
+ { 0x3fd91f55, 0x82ca6632, 0x3d664564, 0x7d345541, 0xc2bf56b9 },
+ { 0x3fec9120, 0x82b67cac, 0x3d675356, 0x7d48e138, 0xc2ab796e },
+ { 0x40000000, 0x82a36037, 0x3d67a012, 0x7d5c9fc9, 0xc2985fee },
+ { 0x401374c7, 0x8291088a, 0x3d672b93, 0x7d6f99c3, 0xc28601f2 },
+ { 0x4026f857, 0x827f6dd7, 0x3d65f559, 0x7d81d77c, 0xc27457a3 },
+ { 0x403a939f, 0x826e88c5, 0x3d63fc63, 0x7d9360d4, 0xc2635996 },
+ { 0x404e4faf, 0x825e5266, 0x3d613f32, 0x7da43d42, 0xc25300c6 },
+ { 0x406235ba, 0x824ec434, 0x3d5dbbc3, 0x7db473d7, 0xc243468e },
+ { 0x40764f1f, 0x823fd80c, 0x3d596f8f, 0x7dc40b44, 0xc23424a2 },
+ { 0x408aa576, 0x82318824, 0x3d545787, 0x7dd309e2, 0xc2259509 },
+ { 0x409f4296, 0x8223cf0b, 0x3d4e7012, 0x7de175b5, 0xc2179218 },
+ { 0x40b430a0, 0x8216a7a1, 0x3d47b505, 0x7def5475, 0xc20a1670 },
+ { 0x40c97a0a, 0x820a0d12, 0x3d4021a1, 0x7dfcab8d, 0xc1fd1cf5 },
+ { 0x40df29a6, 0x81fdfad6, 0x3d37b08d, 0x7e098028, 0xc1f0a0ca },
+ { 0x40f54ab1, 0x81f26ca9, 0x3d2e5bd1, 0x7e15d72b, 0xc1e49d52 },
+ { 0x410be8da, 0x81e75e89, 0x3d241cce, 0x7e21b544, 0xc1d90e24 },
+ { 0x41231051, 0x81dcccb3, 0x3d18ec37, 0x7e2d1ee6, 0xc1cdef10 },
+ { 0x413acdd0, 0x81d2b39e, 0x3d0cc20a, 0x7e38184e, 0xc1c33c13 },
+ { 0x41532ea7, 0x81c90ffb, 0x3cff9585, 0x7e42a58b, 0xc1b8f15a },
+ { 0x416c40cd, 0x81bfdeb2, 0x3cf15d21, 0x7e4cca7c, 0xc1af0b3f },
+ { 0x418612ea, 0x81b71cdc, 0x3ce20e85, 0x7e568ad3, 0xc1a58640 },
+ { 0x41a0b465, 0x81aec7c5, 0x3cd19e7c, 0x7e5fea1e, 0xc19c5f03 },
+ { 0x41bc3573, 0x81a6dcea, 0x3cc000e9, 0x7e68ebc2, 0xc1939250 }
+ };
+
+ static const unsigned emu_tone_treble_table[41][5] = {
+ { 0x0125cba9, 0xfed5debd, 0x00599b6c, 0x0d2506da, 0xfa85b354 },
+ { 0x0142f67e, 0xfeb03163, 0x0066cd0f, 0x0d14c69d, 0xfa914473 },
+ { 0x016328bd, 0xfe860158, 0x0075b7f2, 0x0d03eb27, 0xfa9d32d2 },
+ { 0x0186b438, 0xfe56c982, 0x00869234, 0x0cf27048, 0xfaa97fca },
+ { 0x01adf358, 0xfe21f5fe, 0x00999842, 0x0ce051c2, 0xfab62ca5 },
+ { 0x01d949fa, 0xfde6e287, 0x00af0d8d, 0x0ccd8b4a, 0xfac33aa7 },
+ { 0x02092669, 0xfda4d8bf, 0x00c73d4c, 0x0cba1884, 0xfad0ab07 },
+ { 0x023e0268, 0xfd5b0e4a, 0x00e27b54, 0x0ca5f509, 0xfade7ef2 },
+ { 0x0278645c, 0xfd08a2b0, 0x01012509, 0x0c911c63, 0xfaecb788 },
+ { 0x02b8e091, 0xfcac9d1a, 0x0123a262, 0x0c7b8a14, 0xfafb55df },
+ { 0x03001a9a, 0xfc45e9ce, 0x014a6709, 0x0c65398f, 0xfb0a5aff },
+ { 0x034ec6d7, 0xfbd3576b, 0x0175f397, 0x0c4e2643, 0xfb19c7e4 },
+ { 0x03a5ac15, 0xfb5393ee, 0x01a6d6ed, 0x0c364b94, 0xfb299d7c },
+ { 0x0405a562, 0xfac52968, 0x01ddafae, 0x0c1da4e2, 0xfb39dca5 },
+ { 0x046fa3fe, 0xfa267a66, 0x021b2ddd, 0x0c042d8d, 0xfb4a8631 },
+ { 0x04e4b17f, 0xf975be0f, 0x0260149f, 0x0be9e0f2, 0xfb5b9ae0 },
+ { 0x0565f220, 0xf8b0fbe5, 0x02ad3c29, 0x0bceba73, 0xfb6d1b60 },
+ { 0x05f4a745, 0xf7d60722, 0x030393d4, 0x0bb2b578, 0xfb7f084d },
+ { 0x06923236, 0xf6e279bd, 0x03642465, 0x0b95cd75, 0xfb916233 },
+ { 0x07401713, 0xf5d3aef9, 0x03d01283, 0x0b77fded, 0xfba42984 },
+ { 0x08000000, 0xf4a6bd88, 0x0448a161, 0x0b594278, 0xfbb75e9f },
+ { 0x08d3c097, 0xf3587131, 0x04cf35a4, 0x0b3996c9, 0xfbcb01cb },
+ { 0x09bd59a2, 0xf1e543f9, 0x05655880, 0x0b18f6b2, 0xfbdf1333 },
+ { 0x0abefd0f, 0xf04956ca, 0x060cbb12, 0x0af75e2c, 0xfbf392e8 },
+ { 0x0bdb123e, 0xee806984, 0x06c739fe, 0x0ad4c962, 0xfc0880dd },
+ { 0x0d143a94, 0xec85d287, 0x0796e150, 0x0ab134b0, 0xfc1ddce5 },
+ { 0x0e6d5664, 0xea547598, 0x087df0a0, 0x0a8c9cb6, 0xfc33a6ad },
+ { 0x0fe98a2a, 0xe7e6ba35, 0x097edf83, 0x0a66fe5b, 0xfc49ddc2 },
+ { 0x118c4421, 0xe536813a, 0x0a9c6248, 0x0a4056d7, 0xfc608185 },
+ { 0x1359422e, 0xe23d19eb, 0x0bd96efb, 0x0a18a3bf, 0xfc77912c },
+ { 0x1554982b, 0xdef33645, 0x0d3942bd, 0x09efe312, 0xfc8f0bc1 },
+ { 0x1782b68a, 0xdb50deb1, 0x0ebf676d, 0x09c6133f, 0xfca6f019 },
+ { 0x19e8715d, 0xd74d64fd, 0x106fb999, 0x099b3337, 0xfcbf3cd6 },
+ { 0x1c8b07b8, 0xd2df56ab, 0x124e6ec8, 0x096f4274, 0xfcd7f060 },
+ { 0x1f702b6d, 0xcdfc6e92, 0x14601c10, 0x0942410b, 0xfcf108e5 },
+ { 0x229e0933, 0xc89985cd, 0x16a9bcfa, 0x09142fb5, 0xfd0a8451 },
+ { 0x261b5118, 0xc2aa8409, 0x1930bab6, 0x08e50fdc, 0xfd24604d },
+ { 0x29ef3f5d, 0xbc224f28, 0x1bfaf396, 0x08b4e3aa, 0xfd3e9a3b },
+ { 0x2e21a59b, 0xb4f2ba46, 0x1f0ec2d6, 0x0883ae15, 0xfd592f33 },
+ { 0x32baf44b, 0xad0c7429, 0x227308a3, 0x085172eb, 0xfd741bfd },
+ { 0x37c4448b, 0xa45ef51d, 0x262f3267, 0x081e36dc, 0xfd8f5d14 }
+ };
+
+
+ static const unsigned *emu_tone_get_bass(int l)
+ {
+ l = (l * 40 + 50) / 100;
+ return emu_tone_bass_table[l];
+ }
+
+ static const unsigned *emu_tone_get_treble(int l)
+ {
+ l = (l * 40 + 50) / 100;
+ return emu_tone_treble_table[l];
+ }
+
+ static int emu_tone_bss_d0;
+ static int emu_tone_bss_d1;
+ static int emu_tone_bss_d2;
+ static int emu_tone_bss_d3;
+ static int emu_tone_tbl_d0;
+ static int emu_tone_tbl_d1;
+ static int emu_tone_tbl_d2;
+ static int emu_tone_tbl_d3;
+ static int emu_tone_tmp=0;
+
+ #define EFXTONE(sc, bass, treble, source, target) \
+ if (emu_tone_tmp == 0) emu_tone_tmp=emu_allocgpr(sc); \
+ emu_tone_bss_d0=emu_allocgpr(sc); \
+ emu_tone_bss_d1=emu_allocgpr(sc); \
+ emu_tone_bss_d2=emu_allocgpr(sc); \
+ emu_tone_bss_d3=emu_allocgpr(sc); \
+ emu_tone_tbl_d0=emu_allocgpr(sc); \
+ emu_tone_tbl_d1=emu_allocgpr(sc); \
+ emu_tone_tbl_d2=emu_allocgpr(sc); \
+ emu_tone_tbl_d3=emu_allocgpr(sc); \
+ emu_addefxop(sc, 0, emu_tone_tmp, 0x40, 0x4c, source, &pc); \
+ emu_addefxop(sc, 0, 0x40, 0x40, emu_tone_tmp, bass[0], &pc); \
+ emu_addefxop(sc, 7, emu_tone_bss_d1, emu_tone_bss_d0, emu_tone_bss_d1, bass[2], &pc); \
+ emu_addefxop(sc, 7, emu_tone_bss_d0, emu_tone_tmp, emu_tone_bss_d0, bass[1], &pc); \
+ emu_addefxop(sc, 7, emu_tone_bss_d3, emu_tone_bss_d2, emu_tone_bss_d3, bass[4], &pc); \
+ emu_addefxop(sc, 0, emu_tone_bss_d2, 0x56, emu_tone_bss_d2, bass[3], &pc); \
+ emu_addefxop(sc, 6, emu_tone_bss_d2, emu_tone_bss_d2, emu_tone_bss_d2, 0x40, &pc); \
+ emu_addefxop(sc, 0, 0x40, 0x40, emu_tone_bss_d2, treble[0], &pc); \
+ emu_addefxop(sc, 7, emu_tone_tbl_d1, emu_tone_tbl_d0, emu_tone_tbl_d1, treble[2], &pc); \
+ emu_addefxop(sc, 7, emu_tone_tbl_d0, emu_tone_bss_d2, emu_tone_tbl_d0, treble[1], &pc); \
+ emu_addefxop(sc, 7, emu_tone_tbl_d3, emu_tone_tbl_d2, emu_tone_tbl_d3, treble[4], &pc); \
+ emu_addefxop(sc, 0, emu_tone_tbl_d2, 0x56, emu_tone_tbl_d2, treble[3], &pc); \
+ emu_addefxop(sc, 4, emu_tone_tbl_d2, 0x40, emu_tone_tbl_d2, 0x46, &pc); \
+ emu_addefxop(sc, 0, target, emu_tone_tbl_d2, 0x40, 0x40, &pc);
+
+
+ /* From mixer.c */
+ /*
+ **********************************************************************
+ * mixer.c - /dev/mixer interface for emu10k1 driver
+ * Copyright 1999, 2000 Creative Labs, Inc.
+ *
+ **********************************************************************
+ *
+ * Date Author Summary of changes
+ * ---- ------ ------------------
+ * October 20, 1999 Bertrand Lee base code release
+ * November 2, 1999 Alan Cox cleaned up stuff
+ *
+ **********************************************************************
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
+ * USA.
+ *
+ **********************************************************************
+ */
+
+ /* From tone.asm */
+ /*
+ ;;; Bass and Treble Effect
+ ;;; By: Daniel Bertrand
+ ;;; Date: August 14th,2001
+ ;;; License: GPL v2
+ ;;;
+ name "Tone Control"
+ include "emu_constants.inc"
+
+ ;;; a and b coefs for bass:
+ bass control $3e4f844f, #-1, #1
+ bass_1 control $84ed4cc3, #-1, #1
+ bass_2 control $3cc69927, #-1, #1
+ bass_3 control $7b03553a, #-1, #1
+ bass_4 control $c4da8486, #-1, #1
+
+ ;;; a and b coef for treble:
+ treble control $0125cba9, #-1, #1
+ treble_1 control $fed5debd, #-1, #1
+ treble_2 control $00599b6c, #-1, #1
+ treble_3 control $0d2506da, #-1, #1
+ treble_4 control $fa85b354, #-1, #1
+
+ in IO
+ out equ in
+
+ tbl_d0 static 0
+ tbl_d1 static 0
+ tbl_d2 static 0
+ tbl_d3 static 0
+
+ bss_d0 static 0
+ bss_d1 static 0
+ bss_d2 static 0
+ bss_d3 static 0
+
+ tmp dynamic
+ ;; bass:
+
+ fracmult tmp,$04c, in
+
+ fracmult $0040, tmp, bass
+ macmv bss_d1, bss_d0, bss_d1, bass_2
+ macmv bss_d0, tmp , bss_d0, bass_1
+ macmv bss_d3, bss_d2, bss_d3, bass_4
+ macs bss_d2, $56, bss_d2, bass_3
+ acc3 bss_d2, bss_d2, bss_d2, $40
+
+ ;; treble:
+
+ fracmult $40, bss_d2, treble
+ macmv tbl_d1, tbl_d0, tbl_d1, treble_2
+ macmv tbl_d0, bss_d2, tbl_d0, treble_1
+ macmv tbl_d3, tbl_d2, tbl_d3, treble_4
+ macs tbl_d2, $56, tbl_d2, treble_3
+ macints tbl_d2, $40, tbl_d2, $46
+
+ ;;; 2x gain at output, may cause a bit of distortion at higher levels:
+ ; acc3 out, tbl_d2, tbl_d2, $40
+
+ ;;; more correct.
+ move out, tbl_d2
+
+ end
+ */
To Unsubscribe: send mail to majo...@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message