Lines Matching defs:voice

102 /* Emu10k1 voice mgmt */
365 /* No multiple voice support for now */
916 * Should do some voice(stream) stopping stuff here, that's what will
933 * removed because it will be done in voice shutdown.
1054 * is splaudio necessary here, can the same voice be manipulated by two
1066 chan->voice->sc->sc_type & EMUXKI_AUDIGY ?
1122 emuxki_channel_new(struct emuxki_voice *voice, u_int8_t num)
1130 chan->voice = voice;
1133 chan->voice->sc->channel[num] = chan;
1142 chan->voice->sc->channel[chan->num] = NULL;
1184 /* voice params must be set before calling this */
1200 sc = chan->voice->sc;
1237 struct emuxki_voice *voice;
1242 voice = chan->voice;
1243 sc = voice->sc;
1246 (voice->stereo ? 28 : 30) * (voice->b16 + 1);
1250 emuxki_write(sc, chano, EMU_CHAN_CPF_STEREO, voice->stereo);
1257 (voice->b16 ? 0 : EMU_CHAN_CCCA_8BITSELECT) | start);
1299 struct emuxki_voice *voice;
1304 voice = chan->voice;
1305 sc = voice->sc;
1307 cache_sample = voice->stereo ? 4 : 2;
1308 sample = voice->b16 ? 0x00000000 : 0x80808080;
1309 cache_invalid_size = (voice->stereo ? 28 : 30) * (voice->b16 + 1);
1349 sc = chan->voice->sc;
1367 /* Allocate channels for voice in case of play voice */
1369 emuxki_voice_channel_create(struct emuxki_voice *voice)
1374 channel = voice->sc->channel;
1375 stereo = voice->stereo;
1382 voice->dataloc.chan[1] =
1383 emuxki_channel_new(voice, i + 1);
1384 if (voice->dataloc.chan[1] == NULL)
1387 voice->dataloc.chan[0] = emuxki_channel_new(voice, i);
1388 if (voice->dataloc.chan[0] == NULL) {
1390 emuxki_channel_delete(voice->dataloc.chan[1]);
1391 voice->dataloc.chan[1] = NULL;
1400 /* When calling this function we assume no one can access the voice */
1402 emuxki_voice_channel_destroy(struct emuxki_voice *voice)
1405 emuxki_channel_delete(voice->dataloc.chan[0]);
1406 voice->dataloc.chan[0] = NULL;
1407 if (voice->stereo)
1408 emuxki_channel_delete(voice->dataloc.chan[1]);
1409 voice->dataloc.chan[1] = NULL;
1416 emuxki_recsrc_reserve(struct emuxki_voice *voice, emuxki_recsrc_t source)
1425 if (voice->sc->recsrc[source] == voice)
1427 if (voice->sc->recsrc[source] != NULL)
1429 voice->sc->recsrc[source] = voice;
1433 /* When calling this function we assume the voice is stopped */
1442 emuxki_voice_dataloc_create(struct emuxki_voice *voice)
1446 if (voice->use & EMU_VOICE_USE_PLAY) {
1447 if ((error = emuxki_voice_channel_create(voice)))
1451 emuxki_recsrc_reserve(voice, voice->dataloc.source)))
1458 emuxki_voice_dataloc_destroy(struct emuxki_voice *voice)
1461 if (voice->use & EMU_VOICE_USE_PLAY) {
1462 if (voice->dataloc.chan[0] != NULL)
1463 emuxki_voice_channel_destroy(voice);
1465 if (voice->dataloc.source != EMU_RECSRC_NOTSET) {
1466 emuxki_voice_recsrc_release(voice->sc,
1467 voice->dataloc.source);
1468 voice->dataloc.source = EMU_RECSRC_NOTSET;
1476 struct emuxki_voice *voice;
1480 voice = sc->lvoice;
1483 if (!voice) {
1485 voice = kmem_alloc(sizeof(*voice), KM_SLEEP);
1487 if (!voice)
1489 } else if (voice->use != use) {
1491 emuxki_voice_dataloc_destroy(voice);
1496 voice->sc = sc;
1497 voice->state = !EMU_VOICE_STATE_STARTED;
1498 voice->stereo = EMU_VOICE_STEREO_NOTSET;
1499 voice->b16 = 0;
1500 voice->sample_rate = 0;
1502 voice->dataloc.chan[0] = voice->dataloc.chan[1] = NULL;
1504 voice->dataloc.source = EMU_RECSRC_NOTSET;
1505 voice->buffer = NULL;
1506 voice->blksize = 0;
1507 voice->trigblk = 0;
1508 voice->blkmod = 0;
1509 voice->inth = NULL;
1510 voice->inthparam = NULL;
1511 voice->use = use;
1514 LIST_INSERT_HEAD((&sc->voices), voice, next);
1516 return voice;
1520 emuxki_voice_delete(struct emuxki_voice *voice)
1525 sc = voice->sc;
1526 if (voice->state & EMU_VOICE_STATE_STARTED)
1527 emuxki_voice_halt(voice);
1529 LIST_REMOVE(voice, next);
1531 sc->lvoice = voice;
1543 struct emuxki_voice *voice, uint8_t stereo)
1550 if (! (voice->use & EMU_VOICE_USE_PLAY))
1551 source = voice->dataloc.source;
1553 emuxki_voice_dataloc_destroy(voice);
1554 if (! (voice->use & EMU_VOICE_USE_PLAY))
1555 voice->dataloc.source = source;
1556 voice->stereo = stereo;
1557 error = emuxki_voice_dataloc_create(voice);
1561 if (voice->use & EMU_VOICE_USE_PLAY) {
1571 if (voice->stereo) {
1576 emuxki_channel_set_fxsend(voice->dataloc.chan[0],
1582 emuxki_channel_set_fxsend(voice->dataloc.chan[1],
1590 emuxki_voice_set_srate(struct emuxki_voice *voice, uint32_t srate)
1593 if (voice->use & EMU_VOICE_USE_PLAY) {
1596 voice->sample_rate = srate;
1597 emuxki_channel_set_srate(voice->dataloc.chan[0], srate);
1598 if (voice->stereo)
1599 emuxki_channel_set_srate(voice->dataloc.chan[1],
1604 voice->sample_rate = srate;
1605 if (emuxki_voice_adc_rate(voice) < 0) {
1606 voice->sample_rate = 0;
1615 struct emuxki_voice *voice, uint8_t stereo, uint8_t b16, uint32_t srate)
1619 if (voice->stereo == stereo && voice->b16 == b16 &&
1620 voice->sample_rate == srate)
1624 printf("Setting %s voice params : %s, %u bits, %u Hz\n",
1625 (voice->use & EMU_VOICE_USE_PLAY) ? "play" : "record",
1629 if (voice->stereo != stereo) {
1630 if ((error = emuxki_voice_set_stereo(sc, voice, stereo)))
1633 voice->b16 = b16;
1634 if (voice->sample_rate != srate)
1635 error = emuxki_voice_set_srate(voice, srate);
1639 /* voice audio parms (see just before) must be set prior to this */
1641 emuxki_voice_set_bufparms(struct emuxki_voice *voice, void *ptr,
1652 LIST_FOREACH(mem, &voice->sc->mem, next) {
1656 voice->buffer = mem;
1657 sample_size = (voice->b16 + 1) * (voice->stereo + 1);
1658 voice->trigblk = 0; /* This shouldn't be needed */
1659 voice->blkmod = bufsize / blksize;
1661 voice->blkmod++;
1664 if (voice->use & EMU_VOICE_USE_PLAY) {
1665 voice->blksize = blksize / sample_size;
1666 chan = voice->dataloc.chan;
1671 if (voice->stereo)
1674 voice->timerate = (uint32_t) 48000 *
1675 voice->blksize / voice->sample_rate;
1676 if (voice->timerate < 5)
1679 voice->blksize = blksize;
1690 emuxki_write(voice->sc, 0,
1691 emuxki_recsrc_szreg[voice->dataloc.source], idx);
1692 emuxki_write(voice->sc, 0,
1693 emuxki_recsrc_bufaddrreg[voice->dataloc.source],
1697 voice->timerate = (u_int32_t) 48000 * blksize /
1698 (voice->sample_rate * sample_size);
1699 if (voice->timerate < 5) {
1702 voice->timerate, blksize);
1715 emuxki_voice_commit_parms(struct emuxki_voice *voice)
1717 if (voice->use & EMU_VOICE_USE_PLAY) {
1718 emuxki_channel_commit_parms(voice->dataloc.chan[0]);
1719 if (voice->stereo)
1720 emuxki_channel_commit_parms(voice->dataloc.chan[1]);
1725 emuxki_voice_curaddr(struct emuxki_voice *voice)
1731 if (voice->use & EMU_VOICE_USE_PLAY) {
1733 rv = emuxki_read(voice->sc,
1734 voice->dataloc.chan[0]->num, EMU_CHAN_CCCA_CURRADDR) -
1735 voice->dataloc.chan[0]->loop.start;
1739 switch (voice->dataloc.source) {
1741 idxreg = (voice->sc->sc_type & EMUXKI_AUDIGY) ?
1745 idxreg = (voice->sc->sc_type & EMUXKI_AUDIGY) ?
1757 rv = emuxki_read(voice->sc, 0, EMU_RECIDX(idxreg)
1766 struct emuxki_voice *voice;
1773 LIST_FOREACH(voice, &sc->voices, next) {
1774 if ((voice->state & EMU_VOICE_STATE_STARTED) == 0)
1777 if (voice->timerate < timerate)
1778 timerate = voice->timerate;
1798 emuxki_voice_adc_rate(struct emuxki_voice *voice)
1801 switch(voice->sample_rate) {
1821 if(voice->sc->sc_type & EMUXKI_AUDIGY)
1825 printf("recording sample_rate not supported : %u\n", voice->sample_rate);
1831 if(voice->sc->sc_type & EMUXKI_AUDIGY)
1837 if(voice->sc->sc_type & EMUXKI_AUDIGY)
1844 printf("recording sample_rate not supported : %u\n", voice->sample_rate);
1853 emuxki_voice_start(struct emuxki_voice *voice,
1858 voice->inth = inth;
1859 voice->inthparam = inthparam;
1860 if (voice->use & EMU_VOICE_USE_PLAY) {
1861 voice->trigblk = 1;
1862 emuxki_channel_start(voice->dataloc.chan[0]);
1863 if (voice->stereo)
1864 emuxki_channel_start(voice->dataloc.chan[1]);
1866 voice->trigblk = 1;
1867 switch (voice->dataloc.source) {
1871 if (voice->sc->sc_type & EMUXKI_AUDIGY) {
1873 if (voice->stereo)
1877 if (voice->stereo)
1880 val |= emuxki_voice_adc_rate(voice);
1881 emuxki_write(voice->sc, 0, EMU_ADCCR, 0);
1882 emuxki_write(voice->sc, 0, EMU_ADCCR, val);
1891 voice->dataloc.source);
1895 switch (voice->dataloc.source) {
1902 val |= emuxki_recsrc_intrmasks[voice->dataloc.source];
1910 voice->state |= EMU_VOICE_STATE_STARTED;
1911 emuxki_resched_timer(voice->sc);
1915 emuxki_voice_halt(struct emuxki_voice *voice)
1918 if (voice->use & EMU_VOICE_USE_PLAY) {
1919 emuxki_channel_stop(voice->dataloc.chan[0]);
1920 if (voice->stereo)
1921 emuxki_channel_stop(voice->dataloc.chan[1]);
1923 switch (voice->dataloc.source) {
1925 emuxki_write(voice->sc, 0, EMU_ADCCR, 0);
1934 voice->dataloc.source);
1938 switch (voice->dataloc.source) {
1943 emuxki_write(voice->sc, 0,
1944 emuxki_recsrc_szreg[voice->dataloc.source],
1949 val &= ~emuxki_recsrc_intrmasks[voice->dataloc.source];
1957 voice->state &= ~EMU_VOICE_STATE_STARTED;
1958 emuxki_resched_timer(voice->sc);
1968 struct emuxki_voice *voice;
1979 LIST_FOREACH(voice, &sc->voices, next) {
1980 if ((voice->state &
1984 curblk = emuxki_voice_curaddr(voice) /
1985 voice->blksize;
1987 if (curblk == voice->trigblk) {
1988 voice->inth(voice->inthparam);
1989 voice->trigblk++;
1990 voice->trigblk %= voice->blkmod;
1993 while ((curblk >= voice->trigblk &&
1994 curblk < (voice->trigblk + voice->blkmod / 2)) ||
1995 ((int)voice->trigblk - (int)curblk) >
1996 (voice->blkmod / 2 + 1)) {
1997 voice->inth(voice->inthparam);
1998 voice->trigblk++;
1999 voice->trigblk %= voice->blkmod;
2032 * Multiple voice support would be added as soon as I find a way to
2076 /* No multiple voice support for now */
2153 emuxki_set_vparms(struct emuxki_softc *sc, struct emuxki_voice *voice,
2158 mode = (voice->use & EMU_VOICE_USE_PLAY) ?
2166 return emuxki_voice_set_audioparms(sc, voice, p->channels == 2,
2200 /* No multiple voice support for now */
2214 /* No multiple voice support for now */
2232 /* No multiple voice support for now */
2417 /* No multiple voice support for now */
2418 struct emuxki_voice *voice;
2422 voice = sc->pvoice;
2423 if (voice == NULL)
2425 if ((error = emuxki_voice_set_audioparms(sc, voice, params->channels == 2,
2428 if ((error = emuxki_voice_set_bufparms(voice, start,
2431 emuxki_voice_commit_parms(voice);
2432 emuxki_voice_start(voice, inth, inthparam);
2442 /* No multiple voice support for now */
2443 struct emuxki_voice *voice;
2447 voice = sc->rvoice;
2448 if (voice == NULL)
2450 if ((error = emuxki_voice_set_audioparms(sc, voice,
2454 if ((error = emuxki_voice_set_bufparms(voice, start,
2457 emuxki_voice_start(voice, inth, inthparam);