voice
opm_set_voice(int channel, struct opm_voice *voice)
memcpy(&opm0->sc_vdata[channel], voice, sizeof(struct opm_voice));
opm_set_voice_sub(0x40 + channel, &voice->m1);
opm_set_voice_sub(0x48 + channel, &voice->m2);
opm_set_voice_sub(0x50 + channel, &voice->c1);
opm_set_voice_sub(0x58 + channel, &voice->c2);
writeopm(0x20 + channel, 0xc0 | (voice->fb & 0x7) << 3 |
(voice->con & 0x7));
memcpy(&voice, &bell_voice, sizeof(bell_voice));
if (read(fd, &voice, sizeof(voice)) != sizeof(voice))
if (ioctl(fd, BELLIOCSVOICE, &voice))
static struct opm_voice voice;
opl_set_op_reg(struct opl_softc *sc, int base, int voice, int op, u_char value)
struct opl_voice *v = &sc->voices[voice];
opl_set_ch_reg(struct opl_softc *sc, int base, int voice, u_char value)
struct opl_voice *v = &sc->voices[voice];
uint_fast16_t voice, midipitch_t mp, int16_t level_cB)
oplsyn_setv(ms, voice, mp, level_cB,
oplsyn_repitchv(midisyn *ms, uint_fast16_t voice, midipitch_t mp)
oplsyn_setv(ms, voice, mp, 0, OPLACT_PITCH);
oplsyn_relevelv(midisyn *ms, uint_fast16_t voice, int16_t level_cB)
oplsyn_setv(ms, voice, 0, level_cB, OPLACT_LEVEL);
uint_fast16_t voice, midipitch_t mp, int16_t level_cB, int act)
DPRINTFN(3, ("%s: %p %d %u %d\n", __func__, sc, voice,
if (voice >= sc->syn.nvoice) {
printf("%s: bad voice %d\n", __func__, voice);
v = &sc->voices[voice];
opl_set_op_reg(sc, OPL_KSL_LEVEL, voice, 0, 0xff);
opl_set_op_reg(sc, OPL_KSL_LEVEL, voice, 1, 0xff);
opl_set_ch_reg(sc, OPL_KEYON_BLOCK, voice, 0);
chan = MS_GETCHAN(&ms->voices[voice]);
opl_load_patch(sc, voice);
opl_set_ch_reg(sc, OPL_FEEDBACK_CONNECTION, voice, fbc);
opl_set_op_reg(sc, OPL_KSL_LEVEL, voice, 0, r40m);
opl_set_op_reg(sc, OPL_KSL_LEVEL, voice, 1, r40c);
opl_set_op_reg(sc, OPL_AM_VIB, voice, 0, r20m);
opl_set_op_reg(sc, OPL_AM_VIB, voice, 1, r20c);
opl_set_ch_reg(sc, OPL_FNUM_LOW, voice, rA0);
opl_set_ch_reg(sc, OPL_KEYON_BLOCK, voice, rB0);
oplsyn_releasev(midisyn *ms, uint_fast16_t voice, uint_fast8_t vel)
DPRINTFN(1, ("%s: %p %d\n", __func__, sc, voice));
if (voice >= sc->syn.nvoice) {
printf("oplsyn_noteoff: bad voice %d\n", voice);
v = &sc->voices[voice];
opl_set_ch_reg(sc, 0xB0, voice, v->rB0 & ~OPL_KEYON_BIT);
int voice = CHAN_TO_VOICE(vidx);
chip, voice, octave, count, OCTAVE_OFFSET(voice),
OCTAVE_SHIFT(voice)));
CMS_WRITE(sc, chip, CMS_IREG_FREQ0 + voice, count);
reg = CMS_READ(sc, chip, CMS_IREG_OCTAVE_1_0 + OCTAVE_OFFSET(voice));
reg &= ~(0x0f<<OCTAVE_SHIFT(voice));
reg |= ((octave&0x7)<<OCTAVE_SHIFT(voice));
CMS_WRITE(sc, chip, CMS_IREG_OCTAVE_1_0 + OCTAVE_OFFSET(voice), reg);
CMS_WRITE(sc, chip, CMS_IREG_VOL0 + voice, ((vol<<4)|vol));
reg |= (1<<voice);
int voice = CHAN_TO_VOICE(vidx);
reg &= ~(1<<voice);
#define OCTAVE_OFFSET(voice) ((voice)>>1)
#define OCTAVE_SHIFT(voice) (((voice)&1)<<2)
int ignore, voice, rval;
voice = intr & GUSMASK_WIRQ_VOICEMASK;
if ((1 << voice) & ignore)
ignore |= 1 << voice;
if (voice != GUS_VOICE_LEFT) {
device_xname(sc->sc_dev), voice));
gus_stop_voice(sc, voice, 0);
gus_stop_voice(sc, voice, 1);
if (gus_continue_playing(sc, voice)) {
gus_continue_playing(struct gus_softc *sc, int voice)
sc->sc_voc[voice].voccntl & ~(GUSMASK_VOICE_IRQ));
gus_set_endaddr(sc, voice, GUS_MEM_OFFSET +
sc->sc_voc[voice].voccntl &= ~GUSMASK_LOOP_ENABLE;
sc->sc_voc[voice].volcntl &= ~GUSMASK_VOICE_ROLL;
sc->sc_voc[voice].voccntl |= GUSMASK_LOOP_ENABLE;
sc->sc_voc[voice].volcntl &= ~GUSMASK_VOICE_ROLL;
sc->sc_voc[voice].voccntl &= ~GUSMASK_LOOP_ENABLE;
sc->sc_voc[voice].volcntl |= GUSMASK_VOICE_ROLL;
playstats[playcntr].curaddr = gus_get_curaddr(sc, voice);
playstats[playcntr].voccntl = sc->sc_voc[voice].voccntl;
playstats[playcntr].volcntl = sc->sc_voc[voice].volcntl;
playstats[playcntr].endaddr = sc->sc_voc[voice].end_addr;
bus_space_write_1(iot, ioh2, GUS_DATA_HIGH, sc->sc_voc[voice].voccntl);
bus_space_write_1(iot, ioh2, GUS_DATA_HIGH, sc->sc_voc[voice].volcntl);
gus_start_voice(struct gus_softc *sc, int voice, int intrs)
start = sc->sc_voc[voice].start_addr;
current = sc->sc_voc[voice].current_addr;
end = sc->sc_voc[voice].end_addr;
if (sc->sc_voc[voice].voccntl & GUSMASK_DATA_SIZE16) {
bus_space_write_1(iot, ioh2, GUS_VOICE_SELECT, (unsigned char) voice);
sc->sc_voc[voice].voccntl |= GUSMASK_VOICE_IRQ;
sc->sc_voc[voice].voccntl &= ~GUSMASK_VOICE_IRQ;
sc->sc_voc[voice].voccntl &= ~(GUSMASK_VOICE_STOPPED |
sc->sc_voc[voice].current_volume >> 4);
bus_space_write_1(iot, ioh2, GUS_DATA_HIGH, sc->sc_voc[voice].voccntl);
bus_space_write_1(iot, ioh2, GUS_DATA_HIGH, sc->sc_voc[voice].voccntl);
gus_stop_voice(struct gus_softc *sc, int voice, int intrs_too)
sc->sc_voc[voice].voccntl |= GUSMASK_VOICE_STOPPED |
sc->sc_voc[voice].voccntl &= ~(GUSMASK_VOICE_IRQ);
bus_space_write_1(iot, ioh2, GUS_VOICE_SELECT, (unsigned char) voice);
bus_space_write_1(iot, ioh2, GUS_DATA_HIGH, sc->sc_voc[voice].voccntl);
bus_space_write_1(iot, ioh2, GUS_DATA_HIGH, sc->sc_voc[voice].voccntl);
gus_set_volume(struct gus_softc *sc, int voice, int volume)
sc->sc_voc[voice].current_volume = gusvol;
bus_space_write_1(iot, ioh2, GUS_VOICE_SELECT, (unsigned char) voice);
gus_set_samprate(struct gus_softc *sc, int voice, int freq)
bus_space_write_1(iot, ioh2, GUS_VOICE_SELECT, (unsigned char) voice);
sc->sc_voc[voice].rate = freq;
gus_set_endaddr(struct gus_softc *sc, int voice, u_long addr)
sc->sc_voc[voice].end_addr = addr;
if (sc->sc_voc[voice].voccntl & GUSMASK_DATA_SIZE16)
gus_set_curaddr(struct gus_softc *sc, int voice, u_long addr)
sc->sc_voc[voice].current_addr = addr;
if (sc->sc_voc[voice].voccntl & GUSMASK_DATA_SIZE16)
bus_space_write_1(iot, ioh2, GUS_VOICE_SELECT, (unsigned char) voice);
gus_get_curaddr(struct gus_softc *sc, int voice)
bus_space_write_1(iot, ioh2, GUS_VOICE_SELECT, (unsigned char) voice);
if (sc->sc_voc[voice].voccntl & GUSMASK_DATA_SIZE16)
voice, addr, sc->sc_voc[voice].end_addr));
uint_fast16_t voice, midipitch_t mp, int16_t level)
midi_pcppi_off(midisyn *ms, uint_fast16_t voice, uint_fast8_t vel)
midi_pcppi_repitchv(midisyn *ms, uint_fast16_t voice, midipitch_t newpitch)
midi_pcppi_on(ms, voice, newpitch, 64);
ms->voices = kmem_zalloc(ms->nvoice * sizeof(struct voice),
midisyn_freevoice(midisyn *ms, int voice)
ms->voices[voice].inuse = 0;
midisyn_attackv_vel(midisyn *ms, uint_fast16_t voice, midipitch_t mp,
ms->voices[voice].velcB = midisyn_vol2cB((uint_fast16_t)vel << 7);
ms->mets->attackv(ms, voice, mp, level_cB + ms->voices[voice].velcB);
int voice = 0; /* initialize to keep gcc quiet */
voice = midisyn_findvoice(ms, chan, buf[1]);
if (voice >= 0) {
fs->releasev(ms, voice, buf[2]);
midisyn_freevoice(ms, voice);
voice = fs->allocv(ms, chan, buf[1]);
ms->voices[voice].velcB = 0; /* assume driver handles vel */
fs->attackv_vel(ms, voice,
struct voice *vp, *_end_##vp; \
struct voice *voices;
sc->voice[i].parent = sc->sc_dev;
sc->voice[i].index = i;
audio_attach_mi(&esa_hw_if, &sc->voice[i], sc->sc_dev);
vc = &sc->voice[i];
vc = &sc->voice[i];
struct esa_voice voice[ESA_NUM_VOICES];
dev = b->voice.device;
b->voice.channel > 15 ||
b->voice.key >= SEQ_NOTE_MAX)
switch(b->voice.op) {
error = midiseq_noteon(md, b->voice.channel, b->voice.key, b);
error = midiseq_noteoff(md, b->voice.channel, b->voice.key, b);
b->voice.channel, b->voice.key, b);
b->voice.op));
uint32_t voice;
uint16_t voice; /* voice setting */
struct { _VOICE_HDR; } voice;
switch ( e.voice.op ) {
LOG("unknown common op: %x", e.voice.op);
if (filter_devchan(e.voice.device, e.voice.channel))
switch (e.voice.op) {
LOG("unknown voice op: %x", e.voice.op);
printf("\tvoice: [0x%4.4x]\n", voice);
switch ((voice & 0x0300) >> 8) {
(voice & 0x0020 ? 16 : 8),
(voice & 0x001c) >> 2); break;
switch ((voice & 0x00c0) >> 6) {
switch (voice & 0x0003) {
static uint32_t voice;
{ "voice", P_HEX, &opt_voice, &voice },
val = htole16(voice & 0x03ff);
voice = (buf[1] << 8) | buf[0];