* Redo the way the way the MIDI driver attaches to audio devices.

* Improve the midisyn layer a little.
* Add a driver for the Yamaha OPL[23] FM synths.
  The opl driver is not finished yet; it sounds pretty awful.

For some strange reason I cannot get any FM sound from my SB64 cards,
but a regular SB16 works fine.
This commit is contained in:
augustss 1998-08-17 21:16:09 +00:00
parent 0809175887
commit cd09067eb4
37 changed files with 1731 additions and 128 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aucc.c,v 1.22 1998/01/12 10:39:10 thorpej Exp $ */
/* $NetBSD: aucc.c,v 1.23 1998/08/17 21:16:09 augustss Exp $ */
/*
* Copyright (c) 1997 Stephan Thesing
@ -246,7 +246,7 @@ auccattach(parent, self, args)
return;
}
audio_attach_mi(&sa_hw_if, 0, sc, &sc->sc_dev);
audio_attach_mi(&sa_hw_if, sc, &sc->sc_dev);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lmcaudio.c,v 1.19 1998/07/08 00:15:59 mark Exp $ */
/* $NetBSD: lmcaudio.c,v 1.20 1998/08/17 21:16:10 augustss Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
@ -278,7 +278,7 @@ lmcaudio_attach(parent, self, aux)
lmcaudio_beep_generate();
audio_attach_mi(&lmcaudio_hw_if, 0, sc, &sc->device);
audio_attach_mi(&lmcaudio_hw_if, sc, &sc->device);
}
int nauzero = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcaudio.c,v 1.24 1998/07/07 03:05:17 mark Exp $ */
/* $NetBSD: vidcaudio.c,v 1.25 1998/08/17 21:16:10 augustss Exp $ */
/*
* Copyright (c) 1995 Melvin Tang-Richardson
@ -279,7 +279,7 @@ vidcaudio_attach(parent, self, aux)
vidcaudio_dma_program(ag.silence, ag.silence+NBPG-16,
vidcaudio_dummy_routine, NULL);
audio_attach_mi(&vidcaudio_hw_if, 0, sc, &sc->device);
audio_attach_mi(&vidcaudio_hw_if, sc, &sc->device);
#ifdef DEBUG
printf(" UNDER DEVELOPMENT (nuts)\n");

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.175 1998/08/13 17:47:56 rvb Exp $
# $NetBSD: GENERIC,v 1.176 1998/08/17 21:16:10 augustss Exp $
#
# GENERIC -- everything that's currently supported
#
@ -456,12 +456,16 @@ sp0 at pss0 port 0x530 irq 10 drq 0 # sound port driver
sb0 at isa? port 0x220 irq 5 drq 1 drq2 5 # SoundBlaster
wss0 at isa? port 0x530 irq 10 drq 0 drq2 1 # Windows Sound System
# OPL[23] FM syntheziers
opl* at sb?
# USB Audio devices
#uaudio* at uhub? port ?
# Audio support
audio* at aria?
audio* at eap?
audio* at ess?
audio* at gus?
audio* at guspnp?
audio* at pas?
@ -470,11 +474,11 @@ audio* at sp?
#audio* at uaudio?
audio* at wss?
audio* at ym?
audio* at ess?
# MIDI support
midi* at pcppi? # MIDI interface to the PC speaker
midi* at sb? # SB MPU401 port
midi* at opl? # OPL FM synth
# The spkr driver provides a simple tone interface to the built in speaker.
#spkr0 at pcppi? # PC speaker

View File

@ -1,4 +1,4 @@
/* $NetBSD: am7930_sparc.c,v 1.39 1998/06/24 11:09:24 jonathan Exp $ */
/* $NetBSD: am7930_sparc.c,v 1.40 1998/08/17 21:16:10 augustss Exp $ */
/*
* Copyright (c) 1995 Rolf Grossmann
@ -251,7 +251,7 @@ am7930_sparc_attach(sc, pri)
evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
audio_attach_mi(&sa_hw_if, 0, sc, &sc->sc_dev);
audio_attach_mi(&sa_hw_if, sc, &sc->sc_dev);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: amd7930.c,v 1.38 1998/05/07 21:13:23 kleink Exp $ */
/* $NetBSD: amd7930.c,v 1.39 1998/08/17 21:16:10 augustss Exp $ */
/*
* Copyright (c) 1995 Rolf Grossmann
@ -370,7 +370,7 @@ amd7930attach(sc, pri)
evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
audio_attach_mi(&sa_hw_if, 0, sc, &sc->sc_dev);
audio_attach_mi(&sa_hw_if, sc, &sc->sc_dev);
}
static void

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.233 1998/08/14 03:27:51 mark Exp $
# $NetBSD: files,v 1.234 1998/08/17 21:16:11 augustss Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@ -271,6 +271,11 @@ define i2c_eeprom
device esh: hippi, ifnet
file dev/ic/rrunner.c esh
# OPL2/OPL3 FM synth driver
device opl: midibus
file dev/ic/opl.c opl
file dev/ic/oplinstrs.c opl
# XXX THE FOLLOWING BLOCK SHOULD BE UNCOMMENTED, BUT CANNOT
# XXX BECAUSE NOT ALL PORTS USE THE MI wdc DRIVER YET.
#

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio.c,v 1.98 1998/08/10 01:17:33 mycroft Exp $ */
/* $NetBSD: audio.c,v 1.99 1998/08/17 21:16:11 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -142,8 +142,6 @@ static __inline void audio_pint_silence __P((struct audio_softc *, struct audio_
int audio_alloc_ring __P((struct audio_softc *, struct audio_ringbuffer *, int));
void audio_free_ring __P((struct audio_softc *, struct audio_ringbuffer *));
int audioprint __P((void *, const char *));
int audioprobe __P((struct device *, struct cfdata *, void *));
void audioattach __P((struct device *, struct device *, void *));
@ -378,26 +376,23 @@ au_check_ports(sc, ports, mi, cls, name, mname, tbl)
* probed/attached to the hardware driver.
*/
void
audio_attach_mi(ahwp, mhwp, hdlp, dev)
audio_attach_mi(ahwp, hdlp, dev)
struct audio_hw_if *ahwp;
struct midi_hw_if *mhwp;
void *hdlp;
struct device *dev;
{
struct audio_attach_args arg;
if (ahwp != NULL) {
arg.type = AUDIODEV_TYPE_AUDIO;
arg.hwif = ahwp;
arg.hdl = hdlp;
(void)config_found(dev, &arg, audioprint);
}
if (mhwp != NULL) {
arg.type = AUDIODEV_TYPE_MIDI;
arg.hwif = mhwp;
arg.hdl = hdlp;
(void)config_found(dev, &arg, audioprint);
#ifdef DIAGNOSTIC
if (ahwp == NULL) {
printf("audio_attach_mi: NULL\n");
return;
}
#endif
arg.type = AUDIODEV_TYPE_AUDIO;
arg.hwif = ahwp;
arg.hdl = hdlp;
(void)config_found(dev, &arg, audioprint);
}
int
@ -416,6 +411,12 @@ audioprint(aux, pnp)
case AUDIODEV_TYPE_MIDI:
type = "midi";
break;
case AUDIODEV_TYPE_OPL:
type = "opl";
break;
case AUDIODEV_TYPE_MPU:
type = "mpu";
break;
default:
panic("audioprint: unknown type %d", arg->type);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio_if.h,v 1.29 1998/08/12 18:11:53 augustss Exp $ */
/* $NetBSD: audio_if.h,v 1.30 1998/08/17 21:16:11 augustss Exp $ */
/*
* Copyright (c) 1994 Havard Eidnes.
@ -34,6 +34,9 @@
*
*/
#ifndef _SYS_DEV_AUDIO_IF_H_
#define _SYS_DEV_AUDIO_IF_H_
/*
* Generic interface to hardware driver.
*/
@ -121,24 +124,6 @@ struct audio_hw_if {
void (*)(void *), void *, struct audio_params *));
};
struct midi_info {
char *name; /* Name of MIDI hardware */
int props;
};
#define MIDI_PROP_OUT_INTR 1
#define MIDI_PROP_CAN_INPUT 2
struct midi_hw_if {
int (*open)__P((void *, int, /* open hardware */
void (*)__P((void *, int)), /* input callback */
void (*)__P((void *)), /* output callback */
void *));
void (*close)__P((void *)); /* close hardware */
int (*output)__P((void *, int)); /* output a byte */
void (*getinfo)__P((void *, struct midi_info *));
int (*ioctl)__P((void *, u_long, caddr_t, int, struct proc *));
};
struct audio_attach_args {
int type;
void *hwif; /* either audio_hw_if * or midi_hw_if * */
@ -146,9 +131,12 @@ struct audio_attach_args {
};
#define AUDIODEV_TYPE_AUDIO 0
#define AUDIODEV_TYPE_MIDI 1
#define AUDIODEV_TYPE_OPL 2
#define AUDIODEV_TYPE_MPU 3
/* Attach the MI driver(s) to the MD driver. */
extern void audio_attach_mi __P((struct audio_hw_if *, struct midi_hw_if *, void *, struct device *));
void audio_attach_mi __P((struct audio_hw_if *, void *, struct device *));
int audioprint __P((void *, const char *));
/* Device identity flags */
#define SOUND_DEVICE 0
@ -168,3 +156,6 @@ extern void audio_attach_mi __P((struct audio_hw_if *, struct midi_hw_if *, void
#define splaudio splbio /* XXX */
#define IPL_AUDIO IPL_BIO /* XXX */
#endif
#endif /* _SYS_DEV_AUDIO_IF_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: interwave.c,v 1.7 1998/06/10 10:24:13 bouyer Exp $ */
/* $NetBSD: interwave.c,v 1.8 1998/08/17 21:16:12 augustss Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -214,7 +214,7 @@ iwattach(sc)
iw_set_format(sc, AUDIO_ENCODING_ULAW, 1);
printf("%s: interwave version %s\n",
sc->sc_dev.dv_xname, iw_device.version);
audio_attach_mi(sc->iw_hw_if, 0, sc, &sc->sc_dev);
audio_attach_mi(sc->iw_hw_if, sc, &sc->sc_dev);
}
int

577
sys/dev/ic/opl.c Normal file
View File

@ -0,0 +1,577 @@
/* $NetBSD: opl.c,v 1.1 1998/08/17 21:16:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Author: Lennart Augustsson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* The OPL3 (YMF262) manual can be found at
* ftp://ftp.yamahayst.com/pub/Fax_Back_Doc/Sound/YMF262.PDF
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
#include <sys/device.h>
#include <sys/select.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <sys/audioio.h>
#include <sys/midiio.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/midivar.h>
#include <dev/midisynvar.h>
#include <dev/ic/oplreg.h>
#include <dev/ic/oplvar.h>
#ifdef AUDIO_DEBUG
#define DPRINTF(x) if (opldebug) printf x
#define DPRINTFN(n,x) if (opldebug >= (n)) printf x
int opldebug = 3;
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
#endif
struct real_voice {
u_int8_t voice_num;
u_int8_t voice_mode; /* 0=unavailable, 2=2 OP, 4=4 OP */
u_int8_t iooffs; /* I/O port (left or right side) */
u_int8_t op[4]; /* Operator offsets */
};
struct opl_voice voicetab[] = {
/* No I/O offs OP1 OP2 OP3 OP4 */
/* --------------------------------------------------- */
{ 0, OPL_LO, {0x00, 0x03, 0x08, 0x0b}},
{ 1, OPL_LO, {0x01, 0x04, 0x09, 0x0c}},
{ 2, OPL_LO, {0x02, 0x05, 0x0a, 0x0d}},
{ 3, OPL_LO, {0x08, 0x0b, 0x00, 0x00}},
{ 4, OPL_LO, {0x09, 0x0c, 0x00, 0x00}},
{ 5, OPL_LO, {0x0a, 0x0d, 0x00, 0x00}},
{ 6, OPL_LO, {0x10, 0x13, 0x00, 0x00}},
{ 7, OPL_LO, {0x11, 0x14, 0x00, 0x00}},
{ 8, OPL_LO, {0x12, 0x15, 0x00, 0x00}},
{ 0, OPL_HI, {0x00, 0x03, 0x08, 0x0b}},
{ 1, OPL_HI, {0x01, 0x04, 0x09, 0x0c}},
{ 2, OPL_HI, {0x02, 0x05, 0x0a, 0x0d}},
{ 3, OPL_HI, {0x08, 0x0b, 0x00, 0x00}},
{ 4, OPL_HI, {0x09, 0x0c, 0x00, 0x00}},
{ 5, OPL_HI, {0x0a, 0x0d, 0x00, 0x00}},
{ 6, OPL_HI, {0x10, 0x13, 0x00, 0x00}},
{ 7, OPL_HI, {0x11, 0x14, 0x00, 0x00}},
{ 8, OPL_HI, {0x12, 0x15, 0x00, 0x00}}
};
static void opl_command(struct opl_softc *, int, int, int);
void opl_reset(struct opl_softc *);
void opl_freq_to_fnum (int freq, int *block, int *fnum);
int oplsyn_open __P((midisyn *ms, int));
void oplsyn_close __P((midisyn *));
void oplsyn_reset __P((void *));
void oplsyn_noteon __P((midisyn *, u_int32_t, u_int32_t, u_int32_t));
void oplsyn_noteoff __P((midisyn *, u_int32_t, u_int32_t, u_int32_t));
void oplsyn_keypressure __P((midisyn *, u_int32_t, u_int32_t, u_int32_t));
void oplsyn_ctlchange __P((midisyn *, u_int32_t, u_int32_t, u_int32_t));
void oplsyn_pitchbend __P((midisyn *, u_int32_t, u_int32_t, u_int32_t));
void oplsyn_loadpatch __P((midisyn *, struct sysex_info *, struct uio *));
void opl_set_op_reg __P((struct opl_softc *, int, int, int, u_char));
void opl_set_ch_reg __P((struct opl_softc *, int, int, u_char));
void opl_load_patch __P((struct opl_softc *, int));
u_int32_t opl_get_block_fnum __P((int freq));
int opl_calc_vol __P((int regbyte, int volume, int main_vol));
struct midisyn_methods opl3_midi = {
oplsyn_open,
oplsyn_close,
0,
0,
oplsyn_noteon,
oplsyn_noteoff,
oplsyn_keypressure,
oplsyn_ctlchange,
0,
0,
oplsyn_pitchbend,
0
};
void
opl_attach(sc)
struct opl_softc *sc;
{
int i;
if (!opl_find(sc)) {
printf("\nopl: find failed\n");
return;
}
sc->syn.mets = &opl3_midi;
sprintf(sc->syn.name, "Yamaha OPL%d", sc->model);
sc->syn.data = sc;
sc->syn.nvoice = sc->model == OPL_2 ? OPL2_NVOICE : OPL3_NVOICE;
sc->syn.flags = MS_DOALLOC | MS_FREQXLATE;
midisyn_attach(&sc->sc_mididev, &sc->syn);
/* Set up voice table */
for (i = 0; i < OPL3_NVOICE; i++)
sc->voices[i] = voicetab[i];
opl_reset(sc);
printf(": model OPL%d\n", sc->model);
midi_attach_mi(&midisyn_hw_if, &sc->syn, &sc->sc_mididev.dev);
}
static void
opl_command(sc, offs, addr, data)
struct opl_softc *sc;
int offs;
int addr, data;
{
DPRINTFN(4, ("opl_command: sc=%p, offs=%d addr=0x%02x data=0x%02x\n",
sc, offs, addr, data));
offs += sc->offs;
bus_space_write_1(sc->iot, sc->ioh, OPL_ADDR+offs, addr);
if (sc->model == OPL_2) {
delay(10);
} else {
/* wait a little */
bus_space_read_1(sc->iot, sc->ioh, OPL_STATUS+offs);
bus_space_read_1(sc->iot, sc->ioh, OPL_STATUS+offs);
}
bus_space_write_1(sc->iot, sc->ioh, OPL_DATA+offs, data);
if (sc->model == OPL_2) {
delay(30);
} else {
/* wait a little */
bus_space_read_1(sc->iot, sc->ioh, OPL_STATUS+offs);
bus_space_read_1(sc->iot, sc->ioh, OPL_STATUS+offs);
}
}
int
opl_find(sc)
struct opl_softc *sc;
{
u_int8_t status1, status2;
sc->model = OPL_2; /* worst case assumtion */
/* Reset timers 1 and 2 */
opl_command(sc, OPL_LO, OPL_TIMER_CONTROL,
OPL_TIMER1_MASK | OPL_TIMER2_MASK);
/* Reset the IRQ of the FM chip */
opl_command(sc, OPL_LO, OPL_TIMER_CONTROL, OPL_IRQ_RESET);
/* get status bits */
status1 = bus_space_read_1(sc->iot,sc->ioh,OPL_STATUS+OPL_LO+sc->offs);
opl_command(sc, OPL_LO, OPL_TIMER1, -2); /* wait 2 ticks */
opl_command(sc, OPL_LO, OPL_TIMER_CONTROL, /* start timer1 */
OPL_TIMER1_START | OPL_TIMER2_MASK);
delay(1000); /* wait for timer to expire */
/* get status bits again */
status2 = bus_space_read_1(sc->iot,sc->ioh,OPL_STATUS+OPL_LO+sc->offs);
opl_command(sc, OPL_LO, OPL_TIMER_CONTROL,
OPL_TIMER1_MASK | OPL_TIMER2_MASK);
opl_command(sc, OPL_LO, OPL_TIMER_CONTROL, OPL_IRQ_RESET);
DPRINTFN(4,("opl_find: %02x %02x\n", status1, status2));
if ((status1 & OPL_STATUS_MASK) != 0 ||
(status2 & OPL_STATUS_MASK) != (OPL_STATUS_IRQ | OPL_STATUS_FT1))
return (0);
switch(status1) {
case 0x00:
case 0x0f:
sc->model = OPL_3;
break;
case 0x06:
sc->model = OPL_2;
break;
default:
return 0;
}
DPRINTFN(4,("opl_find: OPL%d at 0x%x detected\n",
sc->model, (int)sc->ioh));
return (1);
}
void
opl_set_op_reg(sc, base, voice, op, value)
struct opl_softc *sc;
int base;
int voice;
int op;
u_char value;
{
struct opl_voice *v = &sc->voices[voice];
opl_command(sc, v->iooffs, base + v->op[op], value);
}
void
opl_set_ch_reg(sc, base, voice, value)
struct opl_softc *sc;
int base;
int voice;
u_char value;
{
struct opl_voice *v = &sc->voices[voice];
opl_command(sc, v->iooffs, base + v->voiceno, value);
}
void
opl_load_patch(sc, v)
struct opl_softc *sc;
int v;
{
struct opl_operators *p = sc->voices[v].patch;
opl_set_op_reg(sc, OPL_AM_VIB, v, 0, p->ops[OO_CHARS+0]);
opl_set_op_reg(sc, OPL_AM_VIB, v, 1, p->ops[OO_CHARS+1]);
opl_set_op_reg(sc, OPL_KSL_LEVEL, v, 0, p->ops[OO_KSL_LEV+0]);
opl_set_op_reg(sc, OPL_KSL_LEVEL, v, 1, p->ops[OO_KSL_LEV+1]);
opl_set_op_reg(sc, OPL_ATTACK_DECAY, v, 0, p->ops[OO_ATT_DEC+0]);
opl_set_op_reg(sc, OPL_ATTACK_DECAY, v, 1, p->ops[OO_ATT_DEC+1]);
opl_set_op_reg(sc, OPL_SUSTAIN_RELEASE, v, 0, p->ops[OO_SUS_REL+0]);
opl_set_op_reg(sc, OPL_SUSTAIN_RELEASE, v, 1, p->ops[OO_SUS_REL+1]);
opl_set_op_reg(sc, OPL_WAVE_SELECT, v, 0, p->ops[OO_WAV_SEL+0]);
opl_set_op_reg(sc, OPL_WAVE_SELECT, v, 1, p->ops[OO_WAV_SEL+1]);
opl_set_ch_reg(sc, OPL_FEEDBACK_CONNECTION, v, p->ops[OO_FB_CONN]);
}
#define OPL_FNUM_FAIL 0xffff
u_int32_t
opl_get_block_fnum(freq)
int freq;
{
u_int32_t f_num = freq / 3125;
u_int32_t block = 0;
while (f_num > 0x3FF && block < 8) {
block++;
f_num >>= 1;
}
if (block > 7)
return (OPL_FNUM_FAIL);
else
return ((block << 10) | f_num);
}
void
opl_reset(sc)
struct opl_softc *sc;
{
int i;
for (i = 1; i <= OPL_MAXREG; i++)
opl_command(sc, OPL_LO, OPL_KEYON_BLOCK + i, 0);
opl_command(sc, OPL_LO, OPL_TEST, OPL_ENABLE_WAVE_SELECT);
opl_command(sc, OPL_LO, OPL_PERCUSSION, 0);
sc->volume = 64;
}
int
oplsyn_open(ms, flags)
midisyn *ms;
int flags;
{
DPRINTFN(2, ("oplsyn_open: %d\n", flags));
opl_reset(ms->data);
return (0);
}
void
oplsyn_close(ms)
midisyn *ms;
{
struct opl_softc *sc = ms->data;
int v;
DPRINTFN(2, ("oplsyn_close:\n"));
/*opl_reset(ms->data);*/
for (v = 0; v < sc->syn.nvoice ; v++)
oplsyn_noteoff(ms, v, 0, 0);
}
#if 0
void
oplsyn_getinfo(addr, sd)
void *addr;
struct synth_dev *sd;
{
struct opl_softc *sc = addr;
sd->name = sc->model == OPL_2 ? "Yamaha OPL2" : "Yamaha OPL3";
sd->type = SYNTH_TYPE_FM;
sd->subtype = sc->model == OPL_2 ? SYNTH_SUB_FM_TYPE_ADLIB
: SYNTH_SUB_FM_TYPE_OPL3;
sd->capabilities = 0;
}
#endif
void
oplsyn_reset(addr)
void *addr;
{
struct opl_softc *sc = addr;
DPRINTFN(3, ("oplsyn_reset:\n"));
opl_reset(sc);
}
int8_t opl_volume_table[128] =
{-64, -48, -40, -35, -32, -29, -27, -26,
-24, -23, -21, -20, -19, -18, -18, -17,
-16, -15, -15, -14, -13, -13, -12, -12,
-11, -11, -10, -10, -10, -9, -9, -8,
-8, -8, -7, -7, -7, -6, -6, -6,
-5, -5, -5, -5, -4, -4, -4, -4,
-3, -3, -3, -3, -2, -2, -2, -2,
-2, -1, -1, -1, -1, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 4,
4, 4, 4, 4, 4, 4, 4, 5,
5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6,
6, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 8, 8, 8, 8, 8};
int
opl_calc_vol(regbyte, volume, mainvol)
int regbyte;
int volume;
int mainvol;
{
int level = ~regbyte & OPL_TOTAL_LEVEL_MASK;
if (mainvol > 127)
mainvol = 127;
volume = (volume * mainvol) / 127;
if (level)
level += opl_volume_table[volume];
if (level > OPL_TOTAL_LEVEL_MASK)
level = OPL_TOTAL_LEVEL_MASK;
if (level < 0)
level = 0;
return (~level & OPL_TOTAL_LEVEL_MASK);
}
void
oplsyn_noteon(ms, voice, freq, vel)
midisyn *ms;
u_int32_t voice, freq, vel;
{
struct opl_softc *sc = ms->data;
struct opl_voice *v;
struct opl_operators *p;
u_int32_t block_fnum;
int mult;
int c_mult, m_mult;
u_int8_t chars0, chars1, ksl0, ksl1;
u_int8_t r20m, r20c, r40m, r40c, rA0, rB0;
u_int8_t vol0, vol1;
DPRINTFN(3, ("oplsyn_noteon: %p %d %d\n", sc, voice,
MIDISYN_FREQ_TO_HZ(freq)));
#ifdef DIAGNOSTIC
if (voice < 0 || voice >= sc->syn.nvoice) {
printf("oplsyn_noteon: bad voice %d\n", voice);
return;
}
#endif
/* Turn off old note */
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);
v = &sc->voices[voice];
p = &opl2_instrs[MS_GETPGM(ms, voice)];
v->patch = p;
opl_load_patch(sc, voice);
mult = 1;
for (;;) {
block_fnum = opl_get_block_fnum(freq / mult);
if (block_fnum != OPL_FNUM_FAIL)
break;
mult *= 2;
if (mult == 16)
mult = 15;
}
chars0 = p->ops[OO_CHARS+0];
chars1 = p->ops[OO_CHARS+1];
m_mult = (chars0 & OPL_MULTIPLE_MASK) * mult;
c_mult = (chars1 & OPL_MULTIPLE_MASK) * mult;
if ((block_fnum == OPL_FNUM_FAIL) || (m_mult > 15) || (c_mult > 15)) {
printf("oplsyn_noteon: frequence out of range %d\n",
MIDISYN_FREQ_TO_HZ(freq));
return;
}
r20m = (chars0 &~ OPL_MULTIPLE_MASK) | m_mult;
r20c = (chars1 &~ OPL_MULTIPLE_MASK) | c_mult;
/* 2 voice */
ksl0 = p->ops[OO_KSL_LEV+0];
ksl1 = p->ops[OO_KSL_LEV+1];
if (p->ops[OO_FB_CONN] & 0x01) {
vol0 = opl_calc_vol(ksl0, vel, sc->volume);
vol1 = opl_calc_vol(ksl1, vel, sc->volume);
} else {
vol0 = ksl0;
vol1 = opl_calc_vol(ksl1, vel, sc->volume);
}
r40m = (ksl0 & OPL_KSL_MASK) | vol0;
r40c = (ksl1 & OPL_KSL_MASK) | vol1;
rA0 = block_fnum & 0xFF;
rB0 = (block_fnum >> 8) | OPL_KEYON_BIT;
v->rB0 = rB0;
opl_set_op_reg(sc, OPL_AM_VIB, voice, 0, r20m);
opl_set_op_reg(sc, OPL_AM_VIB, voice, 1, r20c);
opl_set_op_reg(sc, OPL_KSL_LEVEL, voice, 0, r40m);
opl_set_op_reg(sc, OPL_KSL_LEVEL, voice, 1, r40c);
opl_set_ch_reg(sc, OPL_FNUM_LOW, voice, rA0);
opl_set_ch_reg(sc, OPL_KEYON_BLOCK, voice, rB0);
}
void
oplsyn_noteoff(ms, voice, note, vel)
midisyn *ms;
u_int32_t voice, note, vel;
{
struct opl_softc *sc = ms->data;
struct opl_voice *v;
DPRINTFN(3, ("oplsyn_noteoff: %p %d %d\n", sc, voice,
MIDISYN_FREQ_TO_HZ(note)));
#ifdef DIAGNOSTIC
if (voice < 0 || voice >= sc->syn.nvoice) {
printf("oplsyn_noteoff: bad voice %d\n", voice);
return;
}
#endif
v = &sc->voices[voice];
opl_set_ch_reg(sc, 0xB0, voice, v->rB0 & ~OPL_KEYON_BIT);
}
void
oplsyn_keypressure(ms, voice, note, vel)
midisyn *ms;
u_int32_t voice, note, vel;
{
#ifdef AUDIO_DEBUG
struct opl_softc *sc = ms->data;
DPRINTFN(1, ("oplsyn_keypressure: %p %d\n", sc, note));
#endif
}
void
oplsyn_ctlchange(ms, voice, parm, w14)
midisyn *ms;
u_int32_t voice, parm, w14;
{
#ifdef AUDIO_DEBUG
struct opl_softc *sc = ms->data;
DPRINTFN(1, ("oplsyn_ctlchange: %p %d\n", sc, voice));
#endif
}
void
oplsyn_pitchbend(ms, voice, parm, x)
midisyn *ms;
u_int32_t voice, parm, x;
{
#ifdef AUDIO_DEBUG
struct opl_softc *sc = ms->data;
DPRINTFN(1, ("oplsyn_pitchbend: %p %d\n", sc, voice));
#endif
}
void
oplsyn_loadpatch(ms, sysex, uio)
midisyn *ms;
struct sysex_info *sysex;
struct uio *uio;
{
#if 0
struct opl_softc *sc = ms->data;
struct sbi_instrument ins;
DPRINTFN(1, ("oplsyn_loadpatch: %p\n", sc));
memcpy(&ins, sysex, sizeof *sysex);
if (uio->uio_resid >= sizeof ins - sizeof *sysex)
return EINVAL;
uiomove((char *)&ins + sizeof *sysex, sizeof ins - sizeof *sysex, uio);
/* XXX */
#endif
}

499
sys/dev/ic/oplinstrs.c Normal file
View File

@ -0,0 +1,499 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
#include <sys/device.h>
#include <sys/select.h>
#include <machine/bus.h>
#include <dev/midivar.h>
#include <dev/midisynvar.h>
#include <dev/ic/oplreg.h>
#include <dev/ic/oplvar.h>
/*
* Operator settings for the OPL2 and OPL3 FM synths.
* These tables are indexed by the General MIDI instrument number.
*/
struct opl_operators opl3_instrs[OPL_NINSTR] = {
{ 1, { 0x23, 0x01, 0x15, 0x00, 0xfd, 0x84, 0x7c, 0xf5, 0x03, 0x00, 0x10,
0x03, 0x01, 0x5d, 0x00, 0xf2, 0xf4, 0x35, 0xf5, 0x00, 0x04, 0x11, } },
{ 1, { 0x03, 0x01, 0x7d, 0x00, 0xf3, 0xf3, 0xf5, 0xf5, 0x00, 0x04, 0x10,
0x03, 0x01, 0x55, 0x00, 0xf2, 0xf2, 0xf5, 0xf5, 0x00, 0x04, 0x11, } },
{ 1, { 0x03, 0x01, 0x4d, 0x00, 0xfb, 0xf3, 0x55, 0xc5, 0x04, 0x04, 0x20,
0x03, 0x01, 0xce, 0x00, 0xf3, 0xf3, 0x55, 0xd5, 0x00, 0x04, 0x21, } },
{ 1, { 0x03, 0x01, 0xd7, 0x00, 0xf3, 0xf2, 0xf5, 0xf5, 0x04, 0x04, 0x20,
0x03, 0x01, 0xd5, 0x00, 0xf3, 0xf3, 0xf5, 0xf5, 0x00, 0x04, 0x21, } },
{ 1, { 0x16, 0x01, 0x57, 0x00, 0xff, 0xf3, 0x8a, 0x66, 0x00, 0x00, 0x2c,
0x0b, 0x81, 0x2b, 0x00, 0xe5, 0xe2, 0xb5, 0x86, 0x00, 0x00, 0x21, } },
{ 1, { 0x0a, 0x01, 0x5f, 0x00, 0xf4, 0xf4, 0x87, 0x86, 0x00, 0x00, 0x10,
0x03, 0x01, 0xcc, 0x00, 0xf2, 0xe2, 0x86, 0x86, 0x00, 0x00, 0x11, } },
{ 1, { 0x22, 0x01, 0xd1, 0x80, 0xe3, 0xf3, 0x79, 0xa7, 0x04, 0x04, 0x34,
0x22, 0x01, 0x96, 0x00, 0xf2, 0xf3, 0x79, 0xa7, 0x04, 0x04, 0x31, } },
{ 1, { 0x22, 0x01, 0x9c, 0x00, 0xf4, 0xf3, 0x19, 0xa6, 0x05, 0x05, 0x10,
0x22, 0x01, 0x97, 0x00, 0xf4, 0xf3, 0x19, 0xe6, 0x04, 0x04, 0x11, } },
{ 1, { 0x1b, 0x19, 0x5a, 0x00, 0xf4, 0xe3, 0xf6, 0xa2, 0x00, 0x00, 0x30,
0x1a, 0x11, 0x57, 0x00, 0xf3, 0xf2, 0xb2, 0xa3, 0x00, 0x00, 0x31, } },
{ 1, { 0x1b, 0x17, 0x5a, 0x00, 0xd6, 0xf3, 0x53, 0x53, 0x00, 0x00, 0x20,
0x1a, 0x11, 0x49, 0x00, 0xd1, 0xf3, 0x52, 0x52, 0x00, 0x00, 0x21, } },
{ 1, { 0x1b, 0x14, 0x5a, 0x00, 0xf6, 0x63, 0xf6, 0xa3, 0x00, 0x00, 0x30,
0x1b, 0x11, 0x52, 0x00, 0xd3, 0xf2, 0xb2, 0xa3, 0x00, 0x00, 0x31, } },
{ 1, { 0x8b, 0x84, 0x5a, 0x00, 0xd7, 0xf1, 0x15, 0x95, 0x00, 0x00, 0x30,
0x9b, 0x81, 0x49, 0x00, 0xdc, 0xd2, 0x25, 0xb5, 0x00, 0x00, 0x31, } },
{ 1, { 0x08, 0x01, 0xc0, 0x00, 0xfd, 0xf6, 0x56, 0x68, 0x00, 0x00, 0x20,
0x95, 0x81, 0x40, 0x00, 0xfe, 0xf0, 0x27, 0x05, 0x00, 0x00, 0x21, } },
{ 1, { 0x08, 0x03, 0xc0, 0x00, 0xfa, 0xf8, 0x56, 0x66, 0x00, 0x00, 0x30,
0x97, 0x81, 0x40, 0x00, 0xdf, 0xf8, 0x26, 0x06, 0x00, 0x00, 0x31, } },
{ 1, { 0x03, 0x00, 0x95, 0x80, 0xf3, 0xf3, 0x33, 0x23, 0x00, 0x00, 0x30,
0x03, 0x00, 0x8c, 0x80, 0xf4, 0xf3, 0x23, 0x03, 0x00, 0x00, 0x31, } },
{ 1, { 0x01, 0x00, 0x8b, 0x00, 0xa7, 0x94, 0xf9, 0x36, 0x06, 0x05, 0x30,
0x02, 0x81, 0x18, 0x80, 0xf6, 0xf4, 0x79, 0x55, 0x04, 0x04, 0x31, } },
{ 1, { 0x24, 0x24, 0x40, 0x00, 0xfd, 0xfb, 0xfd, 0x0e, 0x00, 0x00, 0x20,
0x20, 0x20, 0x95, 0x00, 0xfb, 0xf6, 0x0e, 0x0e, 0x00, 0x00, 0x21, } },
{ 1, { 0x04, 0x24, 0x17, 0x00, 0xfe, 0xf7, 0xb7, 0x67, 0x00, 0x00, 0x20,
0x20, 0xa0, 0x14, 0x00, 0xf9, 0xf6, 0x06, 0x07, 0x00, 0x00, 0x21, } },
{ 1, { 0xa2, 0x20, 0x1e, 0x00, 0xb9, 0xa9, 0x36, 0x0e, 0x00, 0x00, 0x30,
0xb4, 0x20, 0x1a, 0x00, 0x79, 0x77, 0x51, 0x4c, 0x04, 0x00, 0x31, } },
{ 1, { 0x25, 0xa1, 0x23, 0x00, 0x74, 0x60, 0x11, 0x05, 0x00, 0x00, 0x12,
0xb0, 0xb0, 0xd3, 0x00, 0x74, 0x60, 0x12, 0x05, 0x04, 0x01, 0x11, } },
{ 1, { 0x22, 0x21, 0x24, 0x40, 0x76, 0x76, 0x06, 0x06, 0x04, 0x04, 0x10,
0x20, 0x21, 0x21, 0x00, 0x76, 0x66, 0x06, 0x06, 0x00, 0x02, 0x11, } },
{ 1, { 0x22, 0x21, 0x1b, 0x00, 0x76, 0x76, 0x07, 0x07, 0x00, 0x04, 0x30,
0x21, 0x21, 0x19, 0x00, 0x76, 0x66, 0x07, 0x07, 0x00, 0x02, 0x31, } },
{ 1, { 0x21, 0x21, 0x20, 0x00, 0x93, 0x73, 0x09, 0x09, 0x04, 0x04, 0x30,
0x21, 0x21, 0x27, 0x00, 0x76, 0x76, 0x09, 0x09, 0x04, 0x04, 0x31, } },
{ 1, { 0x21, 0x21, 0x1e, 0x00, 0x76, 0x66, 0x09, 0x19, 0x04, 0x05, 0x30,
0x21, 0x21, 0x22, 0x00, 0x76, 0x66, 0x29, 0x19, 0x04, 0x04, 0x31, } },
{ 1, { 0x1b, 0x11, 0x4c, 0x00, 0xfe, 0xf2, 0xfe, 0xe3, 0x04, 0x00, 0x10,
0x31, 0x11, 0x4c, 0x00, 0xf2, 0xf2, 0x45, 0xf4, 0x04, 0x00, 0x11, } },
{ 1, { 0x30, 0x05, 0x00, 0x0b, 0xf2, 0xfe, 0x49, 0x43, 0x02, 0x01, 0x21,
0x01, 0x00, 0x00, 0x00, 0xf2, 0xf3, 0xe7, 0x9d, 0x01, 0x02, 0x21, } },
{ 1, { 0x34, 0x04, 0x00, 0x16, 0xf2, 0xfd, 0x49, 0x43, 0x00, 0x00, 0x31,
0x01, 0x01, 0x00, 0x00, 0xf2, 0xf3, 0xe7, 0x9d, 0x00, 0x00, 0x31, } },
{ 1, { 0x03, 0x23, 0x00, 0x00, 0xfb, 0xfc, 0x49, 0x64, 0x06, 0x00, 0x19,
0x01, 0x01, 0x00, 0x00, 0xf4, 0xf6, 0xc4, 0xc4, 0x02, 0x06, 0x11, } },
{ 1, { 0x01, 0x01, 0x06, 0x00, 0xf6, 0xf3, 0x27, 0xe7, 0x05, 0x01, 0x30,
0x02, 0x01, 0x05, 0x00, 0xfa, 0x65, 0x96, 0x9b, 0x04, 0x04, 0x31, } },
{ 1, { 0x21, 0x21, 0xc1, 0x40, 0xf2, 0xf3, 0x13, 0x16, 0x00, 0x04, 0x30,
0x21, 0x21, 0x03, 0x00, 0x97, 0x96, 0xae, 0x26, 0x03, 0x05, 0x31, } },
{ 1, { 0x21, 0x21, 0xc1, 0x00, 0xf2, 0xf2, 0x16, 0x16, 0x00, 0x04, 0x30,
0x21, 0x20, 0x03, 0x00, 0xc7, 0x90, 0x46, 0x16, 0x03, 0x03, 0x31, } },
{ 1, { 0x0b, 0x01, 0x40, 0x40, 0x65, 0xf2, 0x1a, 0x3e, 0x00, 0x03, 0x2c,
0x05, 0x0a, 0x00, 0x40, 0xe2, 0x54, 0x1a, 0x1a, 0x02, 0x01, 0x21, } },
{ 0, { 0x21, 0x21, 0x12, 0x00, 0xe4, 0xd3, 0x15, 0xa6, 0x00, 0x00, 0x30, } },
{ 1, { 0x21, 0x01, 0x00, 0x0b, 0xf2, 0xf2, 0x49, 0x97, 0x04, 0x05, 0x31,
0x01, 0x01, 0x00, 0x00, 0xf6, 0xf3, 0xe7, 0x9d, 0x01, 0x04, 0x31, } },
{ 1, { 0x21, 0x01, 0x00, 0x08, 0xf2, 0xf2, 0x49, 0x97, 0x04, 0x05, 0x11,
0x01, 0x01, 0x00, 0x00, 0xf6, 0xf3, 0xe7, 0x9d, 0x01, 0x04, 0x11, } },
{ 1, { 0x01, 0x01, 0xc0, 0x08, 0xf2, 0xc4, 0x6a, 0x97, 0x00, 0x00, 0x39,
0x01, 0x01, 0x00, 0x00, 0x91, 0xf2, 0xe7, 0x6d, 0x00, 0x00, 0x31, } },
{ 1, { 0x01, 0x0b, 0x00, 0x08, 0xfd, 0xfa, 0x49, 0x87, 0x06, 0x04, 0x11,
0x01, 0x01, 0x00, 0x00, 0xf3, 0xf3, 0xb7, 0x9d, 0x04, 0x04, 0x11, } },
{ 0, { 0x26, 0x21, 0x24, 0x00, 0xf6, 0xf2, 0x87, 0xf7, 0x04, 0x04, 0x30, } },
{ 1, { 0x21, 0x01, 0x08, 0x40, 0xf5, 0xf2, 0x47, 0xf7, 0x00, 0x00, 0x20,
0x21, 0x01, 0x07, 0x40, 0xf5, 0xf2, 0x47, 0xf7, 0x00, 0x00, 0x29, } },
{ 1, { 0xc1, 0x01, 0x00, 0x21, 0xf2, 0xf2, 0x48, 0x97, 0x00, 0x00, 0x21,
0x01, 0x01, 0x0a, 0x00, 0xf2, 0xf2, 0x97, 0x77, 0x00, 0x00, 0x20, } },
{ 1, { 0x22, 0x21, 0xca, 0x00, 0xb4, 0x44, 0x26, 0x06, 0x04, 0x04, 0x3c,
0x22, 0x01, 0xcc, 0x00, 0x89, 0x5d, 0x16, 0x06, 0x04, 0x04, 0x31, } },
{ 1, { 0x24, 0x21, 0xcb, 0x00, 0x88, 0x66, 0x26, 0x16, 0x04, 0x04, 0x3c,
0x34, 0x21, 0xc4, 0x00, 0x86, 0x66, 0x66, 0x06, 0x04, 0x04, 0x31, } },
{ 1, { 0x22, 0x01, 0xcb, 0x00, 0x72, 0x5f, 0x46, 0x86, 0x04, 0x04, 0x36,
0x22, 0x21, 0xcd, 0x00, 0x76, 0x54, 0x36, 0x06, 0x04, 0x04, 0x31, } },
{ 1, { 0x22, 0x01, 0xff, 0x00, 0x86, 0x6f, 0x06, 0x08, 0x04, 0x04, 0x36,
0x22, 0x21, 0xd2, 0x00, 0x74, 0x54, 0x16, 0x06, 0x04, 0x04, 0x31, } },
{ 1, { 0x60, 0x61, 0x00, 0x09, 0x68, 0x53, 0x04, 0x45, 0x02, 0x03, 0x11,
0x61, 0x60, 0x00, 0x00, 0x54, 0x78, 0x54, 0x35, 0x01, 0x03, 0x11, } },
{ 1, { 0x00, 0x00, 0x07, 0x00, 0xf9, 0xf6, 0xf1, 0x34, 0x03, 0x02, 0x16,
0x00, 0x00, 0x0c, 0x00, 0x89, 0xb5, 0xf1, 0x34, 0x03, 0x02, 0x11, } },
{ 1, { 0x12, 0x01, 0xd0, 0x00, 0xb5, 0xc3, 0x23, 0xe3, 0x04, 0x00, 0x30,
0x12, 0x11, 0xd9, 0x00, 0xe5, 0xa2, 0x15, 0xf3, 0x04, 0x00, 0x31, } },
{ 1, { 0x11, 0x10, 0xd0, 0x00, 0xe4, 0xd3, 0xe4, 0xf4, 0x01, 0x00, 0x30,
0x14, 0x10, 0x14, 0x00, 0xf6, 0xf3, 0xf4, 0xf4, 0x02, 0x02, 0x31, } },
{ 1, { 0x21, 0x21, 0x1b, 0xc0, 0xa9, 0x63, 0x23, 0x25, 0x00, 0x04, 0x3e,
0x21, 0x21, 0x22, 0x40, 0xa9, 0x43, 0x23, 0x24, 0x00, 0x04, 0x31, } },
{ 1, { 0x21, 0x21, 0x1f, 0xc0, 0xa9, 0x33, 0x23, 0x15, 0x00, 0x04, 0x3e,
0x21, 0x21, 0x23, 0x80, 0x60, 0x33, 0x23, 0x25, 0x00, 0x04, 0x31, } },
{ 1, { 0x20, 0x01, 0x00, 0x0c, 0x52, 0x50, 0xb6, 0x15, 0x02, 0x01, 0x31,
0x21, 0x20, 0x00, 0x40, 0x44, 0x41, 0x04, 0x27, 0x01, 0x02, 0x31, } },
{ 1, { 0x22, 0x01, 0x40, 0xc2, 0x51, 0x31, 0xa4, 0xf4, 0x04, 0x01, 0x11,
0x21, 0x21, 0x00, 0x40, 0x70, 0x34, 0xf4, 0x74, 0x01, 0x04, 0x11, } },
{ 1, { 0x21, 0x21, 0x10, 0x00, 0x61, 0x66, 0x04, 0x45, 0x00, 0x04, 0x3a,
0x20, 0x21, 0x1c, 0x00, 0x63, 0x63, 0x05, 0x04, 0x00, 0x00, 0x31, } },
{ 1, { 0x21, 0x21, 0x16, 0x00, 0xa6, 0x77, 0x66, 0x06, 0x00, 0x00, 0x10,
0x20, 0x21, 0xd8, 0x00, 0x66, 0x68, 0x36, 0x06, 0x00, 0x00, 0x11, } },
{ 1, { 0x21, 0x21, 0x12, 0x00, 0x75, 0x67, 0x66, 0x06, 0x00, 0x00, 0x10,
0x21, 0x21, 0x2d, 0x00, 0x62, 0x68, 0x36, 0x06, 0x00, 0x00, 0x11, } },
{ 1, { 0x02, 0x01, 0x0e, 0x00, 0x76, 0x64, 0x34, 0x35, 0x00, 0x04, 0x10,
0x01, 0x00, 0x2d, 0x00, 0x66, 0x63, 0x35, 0x04, 0x04, 0x00, 0x11, } },
{ 1, { 0x21, 0x21, 0x23, 0x00, 0x72, 0x72, 0x9b, 0x3b, 0x01, 0x04, 0x30,
0x21, 0x21, 0x23, 0x00, 0x82, 0x92, 0x9b, 0x3b, 0x01, 0x04, 0x31, } },
{ 1, { 0x21, 0x21, 0x23, 0x00, 0x63, 0x62, 0x9b, 0x3b, 0x01, 0x04, 0x30,
0x21, 0x21, 0x21, 0x00, 0x73, 0x82, 0x9b, 0x3b, 0x01, 0x04, 0x31, } },
{ 1, { 0x01, 0x01, 0x14, 0x00, 0x62, 0xe6, 0x0b, 0x2b, 0x05, 0x05, 0x26,
0x21, 0x22, 0x13, 0x00, 0x55, 0x72, 0x1b, 0x2b, 0x04, 0x00, 0x21, } },
{ 1, { 0x01, 0x21, 0x11, 0x00, 0x60, 0x62, 0xfb, 0x7b, 0x05, 0x00, 0x10,
0x01, 0x21, 0x10, 0x00, 0x60, 0x62, 0x3b, 0x7b, 0x05, 0x00, 0x11, } },
{ 0, { 0x21, 0x21, 0x23, 0x00, 0x41, 0x81, 0x94, 0xf6, 0x00, 0x00, 0x2e, } },
{ 1, { 0x22, 0x61, 0x4c, 0x40, 0x75, 0xf1, 0x37, 0xb7, 0x01, 0x05, 0x20,
0x21, 0x20, 0x4d, 0x00, 0x56, 0x72, 0x07, 0x17, 0x05, 0x02, 0x21, } },
{ 1, { 0x21, 0x21, 0x04, 0x00, 0x82, 0x71, 0xcb, 0x2b, 0x01, 0x01, 0x26,
0x21, 0x21, 0x11, 0x00, 0x75, 0x80, 0x8b, 0x3b, 0x00, 0x00, 0x21, } },
{ 1, { 0x21, 0x21, 0x83, 0x40, 0x84, 0xa2, 0x3b, 0x3b, 0x01, 0x00, 0x26,
0x21, 0x21, 0x0e, 0x00, 0x74, 0x73, 0x7b, 0x3b, 0x00, 0x00, 0x21, } },
{ 1, { 0x01, 0x02, 0x15, 0x00, 0x70, 0x70, 0xe7, 0xe8, 0x05, 0x00, 0x10,
0x01, 0x00, 0x42, 0x00, 0x70, 0x70, 0xf8, 0xe8, 0x07, 0x02, 0x11, } },
{ 1, { 0x01, 0x01, 0x13, 0x00, 0x70, 0x70, 0xe9, 0xe9, 0x05, 0x00, 0x10,
0x01, 0x40, 0x47, 0x40, 0x70, 0x70, 0xe9, 0xe9, 0x07, 0x02, 0x11, } },
{ 1, { 0x01, 0x01, 0x15, 0x00, 0x70, 0x70, 0xeb, 0xea, 0x05, 0x00, 0x10,
0x01, 0x40, 0x09, 0x00, 0x70, 0x70, 0xeb, 0xeb, 0x07, 0x02, 0x11, } },
{ 1, { 0x01, 0x04, 0x11, 0x00, 0xa4, 0x67, 0xbb, 0x6a, 0x00, 0x00, 0x20,
0x01, 0x02, 0x0c, 0x00, 0xd0, 0x80, 0xeb, 0xeb, 0x01, 0x02, 0x21, } },
{ 1, { 0x11, 0x34, 0x17, 0x00, 0x70, 0x61, 0x29, 0x29, 0x00, 0x00, 0x30,
0x31, 0x34, 0xff, 0x40, 0x60, 0x60, 0x09, 0x09, 0x00, 0x02, 0x31, } },
{ 1, { 0x01, 0x24, 0x11, 0x00, 0xf0, 0x80, 0x29, 0x09, 0x00, 0x00, 0x10,
0x31, 0x24, 0xda, 0x00, 0x80, 0x80, 0x09, 0x09, 0x00, 0x00, 0x11, } },
{ 1, { 0x01, 0x24, 0x13, 0x00, 0x60, 0x80, 0x22, 0x09, 0x00, 0x00, 0x10,
0x31, 0x24, 0x86, 0x00, 0x80, 0x80, 0x05, 0x09, 0x00, 0x00, 0x11, } },
{ 1, { 0x32, 0x31, 0x1d, 0x00, 0xa2, 0x51, 0x16, 0x26, 0x04, 0x00, 0x3a,
0x32, 0x31, 0x45, 0x00, 0xfe, 0x55, 0x52, 0x15, 0x04, 0x00, 0x31, } },
{ 1, { 0x24, 0xa2, 0x20, 0x00, 0x67, 0x65, 0xf6, 0x06, 0x00, 0x00, 0x10,
0x24, 0xa2, 0x1c, 0x00, 0x7f, 0x67, 0x27, 0x06, 0x00, 0x00, 0x11, } },
{ 1, { 0x22, 0xa1, 0x26, 0x00, 0x65, 0x67, 0x66, 0x06, 0x00, 0x00, 0x10,
0x02, 0x21, 0x2a, 0x00, 0xa2, 0x6f, 0x36, 0x06, 0x00, 0x00, 0x11, } },
{ 1, { 0x21, 0x31, 0x11, 0x00, 0x85, 0x68, 0x66, 0x06, 0x00, 0x00, 0x10,
0x32, 0x31, 0x19, 0x00, 0xd5, 0x68, 0x39, 0x06, 0x00, 0x00, 0x11, } },
{ 1, { 0x20, 0xa0, 0x00, 0x00, 0x77, 0x77, 0x08, 0x58, 0x00, 0x00, 0x2e,
0x24, 0x21, 0xd3, 0x00, 0x76, 0x76, 0xa9, 0x08, 0x04, 0x00, 0x21, } },
{ 1, { 0x2b, 0x26, 0x12, 0x00, 0x73, 0x67, 0x68, 0x97, 0x00, 0x00, 0x1e,
0x22, 0x21, 0x14, 0x00, 0x66, 0x60, 0x46, 0xb6, 0x00, 0x00, 0x11, } },
{ 1, { 0x61, 0xa1, 0x16, 0x00, 0x67, 0x77, 0x56, 0x06, 0x02, 0x00, 0x30,
0x21, 0x01, 0x15, 0x00, 0xd7, 0x40, 0x66, 0xb6, 0x02, 0x00, 0x31, } },
{ 1, { 0x61, 0xa1, 0x31, 0x00, 0xc4, 0x50, 0x56, 0xb6, 0x02, 0x00, 0x20,
0x61, 0x81, 0x30, 0x00, 0xc4, 0x50, 0x66, 0xb6, 0x01, 0x00, 0x21, } },
{ 1, { 0x31, 0x31, 0x2b, 0x00, 0x57, 0x68, 0x46, 0x06, 0x04, 0x00, 0x30,
0x32, 0x31, 0x30, 0x00, 0x47, 0x68, 0x69, 0x06, 0x04, 0x00, 0x31, } },
{ 1, { 0x21, 0x21, 0x00, 0x0d, 0xd4, 0xc2, 0x1b, 0x26, 0x04, 0x06, 0x21,
0x21, 0x21, 0x00, 0x00, 0xc6, 0xd0, 0x19, 0x27, 0x04, 0x06, 0x21, } },
{ 1, { 0x21, 0x20, 0x11, 0x00, 0xd4, 0xc2, 0x1b, 0x36, 0x04, 0x03, 0x10,
0x21, 0x21, 0x10, 0x00, 0xc9, 0xd0, 0x49, 0x37, 0x04, 0x01, 0x11, } },
{ 1, { 0x22, 0xa1, 0x0e, 0x00, 0x76, 0x67, 0x66, 0x06, 0x00, 0x00, 0x26,
0x22, 0x21, 0x1e, 0x00, 0x75, 0x75, 0x06, 0x06, 0x02, 0x00, 0x21, } },
{ 1, { 0xd1, 0xa0, 0x00, 0x00, 0xb7, 0x87, 0x66, 0x06, 0x02, 0x02, 0x20,
0x01, 0x60, 0x14, 0x00, 0x75, 0xb5, 0x66, 0x06, 0x02, 0x02, 0x21, } },
{ 1, { 0x30, 0x22, 0x0c, 0x00, 0xf4, 0x62, 0xa0, 0x0e, 0x00, 0x00, 0x10,
0x20, 0x21, 0x14, 0x00, 0x77, 0x90, 0x4e, 0x1c, 0x00, 0x00, 0x11, } },
{ 1, { 0x20, 0x32, 0x1a, 0x00, 0x76, 0x47, 0x64, 0x05, 0x00, 0x00, 0x16,
0x31, 0x21, 0x1b, 0x00, 0x75, 0x75, 0x03, 0x05, 0x00, 0x00, 0x11, } },
{ 1, { 0x03, 0x06, 0x00, 0x3f, 0xf2, 0xf0, 0xa6, 0xfb, 0x00, 0x00, 0x17,
0x01, 0x00, 0x15, 0x00, 0xf0, 0xf3, 0xf8, 0xc8, 0x00, 0x00, 0x10, } },
{ 1, { 0x02, 0x21, 0x0b, 0x00, 0xf3, 0xf1, 0xfb, 0x2b, 0x01, 0x01, 0x16,
0x01, 0x21, 0xe1, 0x00, 0xf3, 0xf0, 0xfb, 0x2b, 0x05, 0x00, 0x11, } },
{ 1, { 0x12, 0x12, 0xc0, 0x00, 0xf2, 0xe2, 0x23, 0x55, 0x00, 0x00, 0x10,
0x31, 0x30, 0x1c, 0x00, 0x69, 0x52, 0x33, 0x15, 0x02, 0x02, 0x11, } },
{ 1, { 0x01, 0x31, 0x18, 0x00, 0x21, 0x22, 0x53, 0x55, 0x00, 0x00, 0x30,
0x11, 0x31, 0xd4, 0x00, 0x21, 0x21, 0x53, 0x45, 0x01, 0x00, 0x31, } },
{ 1, { 0x20, 0x01, 0x00, 0x00, 0xc3, 0xf0, 0xf4, 0xf5, 0x02, 0x00, 0x10,
0x01, 0x21, 0x08, 0x00, 0x32, 0x20, 0x14, 0x04, 0x05, 0x00, 0x11, } },
{ 0, { 0x30, 0x20, 0xd1, 0x00, 0xa2, 0x63, 0x40, 0x48, 0x00, 0x00, 0x20, } },
{ 1, { 0x06, 0x21, 0x08, 0x00, 0xf0, 0x45, 0xe4, 0x36, 0x00, 0x00, 0x30,
0x01, 0x21, 0x46, 0x00, 0xe5, 0x40, 0x34, 0x05, 0x04, 0x00, 0x31, } },
{ 1, { 0x21, 0x21, 0x40, 0x00, 0x63, 0x30, 0x83, 0x13, 0x00, 0x00, 0x10,
0x21, 0x21, 0x17, 0x00, 0x63, 0x40, 0xa3, 0x13, 0x05, 0x04, 0x11, } },
{ 1, { 0x31, 0x30, 0x00, 0xc4, 0x60, 0x64, 0x15, 0xf8, 0x00, 0x02, 0x35,
0x31, 0x31, 0x00, 0x00, 0xb0, 0xd0, 0xc5, 0x45, 0x00, 0x00, 0x31, } },
{ 1, { 0x31, 0x12, 0x00, 0x8c, 0x44, 0x12, 0xf4, 0xb3, 0x00, 0x00, 0x25,
0x10, 0x30, 0x00, 0x00, 0x30, 0x74, 0xb4, 0x04, 0x01, 0x01, 0x21, } },
{ 1, { 0x08, 0x83, 0xc0, 0x00, 0xfb, 0xf5, 0x66, 0x68, 0x00, 0x00, 0x10,
0x21, 0x21, 0x14, 0x00, 0xf0, 0xde, 0x25, 0x05, 0x00, 0x00, 0x11, } },
{ 1, { 0x08, 0x01, 0x01, 0x00, 0x33, 0x31, 0xf2, 0xf2, 0x00, 0x00, 0x20,
0x01, 0x01, 0x04, 0x00, 0x31, 0x32, 0xf2, 0xf2, 0x01, 0x00, 0x21, } },
{ 1, { 0x17, 0x91, 0xc0, 0x00, 0xf1, 0xf1, 0x31, 0x22, 0x00, 0x00, 0x18,
0x95, 0x91, 0x9b, 0x00, 0xf1, 0xf1, 0x21, 0x23, 0x00, 0x00, 0x11, } },
{ 1, { 0x01, 0x17, 0x00, 0x00, 0xd2, 0xd8, 0x24, 0x34, 0x00, 0x00, 0x20,
0x01, 0x20, 0x17, 0x00, 0xea, 0xe1, 0x34, 0x14, 0x02, 0x02, 0x21, } },
{ 1, { 0x06, 0x01, 0x08, 0x00, 0xf0, 0xf5, 0xe4, 0x34, 0x00, 0x00, 0x30,
0x01, 0xa0, 0x44, 0x00, 0xe5, 0xe0, 0x34, 0x44, 0x02, 0x02, 0x31, } },
{ 1, { 0x04, 0x01, 0x02, 0x00, 0x11, 0x21, 0x32, 0x22, 0x00, 0x00, 0x18,
0x01, 0x01, 0x41, 0x00, 0x11, 0x11, 0x24, 0x23, 0x00, 0x00, 0x11, } },
{ 1, { 0x05, 0x01, 0xc0, 0x00, 0xf8, 0xe1, 0xd3, 0x03, 0x00, 0x00, 0x20,
0x21, 0x21, 0x10, 0x00, 0x69, 0x52, 0x33, 0x13, 0x01, 0x00, 0x21, } },
{ 1, { 0x02, 0x21, 0x00, 0x00, 0x83, 0x61, 0xf3, 0x23, 0x01, 0x00, 0x16,
0x01, 0x21, 0x0b, 0x00, 0x73, 0x52, 0xf3, 0x23, 0x05, 0x00, 0x11, } },
{ 1, { 0x25, 0x01, 0x12, 0x00, 0xf7, 0xf8, 0x44, 0x04, 0x04, 0x04, 0x30,
0xa7, 0x01, 0x17, 0x00, 0x80, 0xf3, 0x64, 0x74, 0x04, 0x04, 0x31, } },
{ 1, { 0x01, 0x05, 0x00, 0x25, 0xf4, 0xf8, 0xa6, 0xfb, 0x04, 0x00, 0x35,
0x01, 0x02, 0x10, 0x00, 0xf4, 0xf6, 0xfb, 0xc7, 0x00, 0x04, 0x30, } },
{ 1, { 0x04, 0x07, 0x09, 0x00, 0xfa, 0xf8, 0xa6, 0xfb, 0x00, 0x00, 0x24,
0x01, 0x01, 0x16, 0x00, 0xf3, 0xf3, 0x95, 0xc5, 0x04, 0x04, 0x21, } },
{ 1, { 0x01, 0x05, 0x00, 0x25, 0xf4, 0xfa, 0xa4, 0xfb, 0x04, 0x04, 0x25,
0x01, 0x01, 0x18, 0x00, 0xf4, 0xf3, 0xf5, 0xc5, 0x04, 0x04, 0x20, } },
{ 1, { 0x09, 0x03, 0x00, 0x00, 0xf8, 0xf8, 0x6e, 0x6e, 0x04, 0x04, 0x20,
0x01, 0x86, 0x00, 0x00, 0xf4, 0xf7, 0x16, 0xea, 0x00, 0x00, 0x21, } },
{ 1, { 0x11, 0x32, 0x0c, 0x00, 0xd0, 0x80, 0xf3, 0x05, 0x00, 0x00, 0x30,
0x31, 0x24, 0xc9, 0x00, 0x40, 0x50, 0x09, 0x09, 0x00, 0x04, 0x31, } },
{ 1, { 0x24, 0x20, 0xc9, 0x00, 0xaa, 0x95, 0x58, 0x08, 0x04, 0x03, 0x30,
0x24, 0x20, 0xc9, 0x00, 0xc7, 0x72, 0x88, 0x28, 0x05, 0x03, 0x31, } },
{ 1, { 0x11, 0x32, 0x0c, 0x00, 0xd0, 0x80, 0xf3, 0x05, 0x00, 0x00, 0x10,
0x31, 0x24, 0xcc, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x04, 0x11, } },
{ 1, { 0x16, 0x19, 0x4f, 0x00, 0xf6, 0xf3, 0x53, 0x53, 0x00, 0x00, 0x30,
0x15, 0x14, 0x41, 0x00, 0xf1, 0xf3, 0x52, 0x52, 0x06, 0x06, 0x31, } },
{ 1, { 0x17, 0x12, 0x00, 0x00, 0xfa, 0xf5, 0x57, 0x58, 0x00, 0x00, 0x10,
0x14, 0x12, 0x40, 0x00, 0xf7, 0xf5, 0x52, 0x59, 0x06, 0x06, 0x11, } },
{ 1, { 0x08, 0x01, 0x1f, 0x00, 0xc6, 0x82, 0x37, 0x95, 0x00, 0x00, 0x36,
0x05, 0x11, 0x0f, 0x00, 0x65, 0x52, 0x55, 0x75, 0x00, 0x00, 0x31, } },
{ 1, { 0x02, 0x01, 0x09, 0x00, 0xfc, 0xf7, 0xd6, 0xf7, 0x02, 0x00, 0x20,
0x07, 0x03, 0x3f, 0xc0, 0xfa, 0xf5, 0x4e, 0xfe, 0x00, 0x00, 0x21, } },
{ 1, { 0x1a, 0x30, 0x00, 0x00, 0xfb, 0xf3, 0x57, 0x54, 0x00, 0x01, 0x11,
0x11, 0x10, 0x40, 0x00, 0xc5, 0xc5, 0x52, 0x57, 0x01, 0x00, 0x11, } },
{ 1, { 0x12, 0x30, 0x01, 0x00, 0xfb, 0xf3, 0xa7, 0x53, 0x00, 0x00, 0x30,
0x10, 0x10, 0xff, 0x00, 0xf4, 0xc4, 0x52, 0x57, 0x00, 0x00, 0x31, } },
{ 1, { 0x2b, 0x0b, 0x00, 0x00, 0xff, 0xf7, 0x0e, 0xfe, 0x00, 0x00, 0x3e,
0x00, 0x20, 0xc0, 0x00, 0xf6, 0xff, 0xfe, 0x0c, 0x02, 0x00, 0x31, } },
{ 1, { 0x2a, 0x0b, 0x00, 0x00, 0xff, 0x2f, 0x0e, 0x0e, 0x04, 0x04, 0x2e,
0x28, 0x09, 0x00, 0x00, 0xf9, 0x29, 0x0e, 0x0e, 0x04, 0x04, 0x21, } },
{ 1, { 0x0b, 0x0b, 0x00, 0x00, 0x64, 0x77, 0xf8, 0xf8, 0x04, 0x04, 0x1e,
0x0b, 0x09, 0x10, 0x00, 0x56, 0x59, 0xf8, 0xe8, 0x04, 0x04, 0x11, } },
{ 1, { 0x2b, 0x25, 0x05, 0x00, 0x79, 0x77, 0x05, 0xa5, 0x00, 0x00, 0x2e,
0x26, 0x01, 0x10, 0x00, 0x66, 0x76, 0xb9, 0xde, 0x04, 0x00, 0x21, } },
{ 0, { 0x30, 0x10, 0x00, 0x00, 0x11, 0x11, 0x00, 0x32, 0x00, 0x03, 0x3e, } },
{ 0, { 0x0a, 0x09, 0x00, 0x00, 0x59, 0x69, 0xfe, 0xfe, 0x00, 0x00, 0x21, } },
{ 1, { 0x0a, 0x02, 0x0b, 0x00, 0xe5, 0xe4, 0xf5, 0xf5, 0x05, 0x00, 0x30,
0x08, 0x02, 0x43, 0x00, 0xf5, 0xf4, 0xf5, 0xf5, 0x03, 0x00, 0x31, } },
{ 1, { 0x0b, 0x04, 0x00, 0x80, 0x82, 0x77, 0xfa, 0xfa, 0x00, 0x05, 0x2e,
0x20, 0x20, 0x11, 0x00, 0xf7, 0xfa, 0xfa, 0xfb, 0x00, 0x00, 0x21, } },
{ 1, { 0x2b, 0x27, 0x00, 0x00, 0xf0, 0x23, 0x01, 0x13, 0x00, 0x05, 0x3e,
0x20, 0x20, 0x7f, 0x00, 0xfb, 0xf4, 0xe5, 0xf5, 0x00, 0x00, 0x31, } },
{ 1, { 0x0b, 0x01, 0x40, 0xc0, 0xf5, 0xf7, 0x67, 0x64, 0x00, 0x00, 0x1e,
0x07, 0x01, 0x3f, 0x00, 0xf7, 0xfa, 0x34, 0x9e, 0x04, 0x04, 0x11, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x52, 0x11, 0x1b, 0x00, 0x68, 0xd6, 0x1c, 0x43, 0x05, 0x00, 0x2a, } },
{ 0, { 0x40, 0x01, 0x18, 0x00, 0x68, 0xd6, 0x19, 0x46, 0x02, 0x00, 0x1e, } },
{ 0, { 0x02, 0x04, 0x07, 0x00, 0xfa, 0xda, 0xbb, 0xbe, 0x00, 0x00, 0x38, } },
{ 1, { 0x12, 0x01, 0xc0, 0x00, 0xf3, 0xf6, 0xf0, 0xf6, 0x07, 0x00, 0x3e,
0x10, 0x10, 0x0c, 0x00, 0xf0, 0x91, 0x00, 0x05, 0x03, 0x06, 0x30, } },
{ 0, { 0x01, 0x05, 0x07, 0x00, 0x9a, 0x9a, 0xb6, 0xbd, 0x02, 0x00, 0x3e, } },
{ 1, { 0x17, 0x01, 0xc0, 0x00, 0xf3, 0xf8, 0xf0, 0xb7, 0x00, 0x00, 0x1e,
0x10, 0x10, 0x0c, 0x00, 0xf0, 0xd1, 0x60, 0x75, 0x00, 0x06, 0x10, } },
{ 0, { 0x01, 0x01, 0x0d, 0x00, 0xe8, 0xa5, 0xec, 0xf7, 0x00, 0x00, 0x16, } },
{ 0, { 0x2f, 0x31, 0x07, 0x00, 0x73, 0xc4, 0xc2, 0xb4, 0x00, 0x00, 0x2a, } },
{ 0, { 0x01, 0x01, 0x0d, 0x00, 0xe8, 0xa5, 0xec, 0xf7, 0x01, 0x00, 0x36, } },
{ 0, { 0x13, 0x10, 0xcd, 0x80, 0xf5, 0xd5, 0x92, 0xd4, 0x01, 0x00, 0x1a, } },
{ 0, { 0x01, 0x01, 0x0d, 0x00, 0xe8, 0xa5, 0xec, 0xf5, 0x00, 0x00, 0x16, } },
{ 0, { 0x3c, 0x31, 0x90, 0x00, 0x73, 0xc4, 0xb1, 0xf3, 0x00, 0x00, 0x2a, } },
};
struct opl_operators opl2_instrs[OPL_NINSTR] = {
{ 0, { 0x01, 0x10, 0x1b, 0x00, 0xc3, 0x92, 0x23, 0x62, 0x02, 0x01, 0x1e, } },
{ 0, { 0x03, 0x01, 0x7d, 0x00, 0xf3, 0xf3, 0xf5, 0xf5, 0x00, 0x04, 0x30, } },
{ 0, { 0x03, 0x01, 0x61, 0x00, 0xfb, 0xf5, 0xf5, 0xf5, 0x04, 0x04, 0x30, } },
{ 0, { 0x03, 0x01, 0xd7, 0x00, 0xf3, 0xf2, 0xf5, 0xf5, 0x04, 0x04, 0x20, } },
{ 0, { 0x35, 0x12, 0xd4, 0x00, 0x94, 0x92, 0x91, 0x62, 0x02, 0x00, 0x2e, } },
{ 0, { 0x11, 0x10, 0x00, 0x00, 0xe1, 0x92, 0x63, 0x72, 0x02, 0x00, 0x17, } },
{ 0, { 0x22, 0x01, 0x8a, 0x00, 0xe3, 0xf4, 0x79, 0xa8, 0x05, 0x04, 0x24, } },
{ 0, { 0x22, 0x01, 0x9c, 0x00, 0xf4, 0xf3, 0x18, 0x55, 0x05, 0x05, 0x30, } },
{ 0, { 0x02, 0x01, 0x00, 0x00, 0x93, 0xb6, 0x74, 0x45, 0x00, 0x00, 0x25, } },
{ 0, { 0x1b, 0x17, 0x5a, 0x00, 0xd6, 0xf3, 0x53, 0x53, 0x00, 0x00, 0x20, } },
{ 0, { 0x1b, 0x14, 0x5a, 0x00, 0xf6, 0x63, 0xf6, 0x73, 0x00, 0x00, 0x20, } },
{ 0, { 0x8b, 0x84, 0x5a, 0x00, 0xd8, 0xf4, 0x16, 0xe5, 0x00, 0x00, 0x30, } },
{ 0, { 0x08, 0x01, 0xc0, 0x00, 0xfd, 0xf6, 0x56, 0x68, 0x00, 0x00, 0x30, } },
{ 0, { 0x08, 0x03, 0xc0, 0x00, 0xf9, 0xf7, 0x56, 0x68, 0x00, 0x00, 0x30, } },
{ 0, { 0x35, 0x11, 0xcd, 0x00, 0xf2, 0xf2, 0xf1, 0xf2, 0x00, 0x00, 0x34, } },
{ 0, { 0x18, 0x02, 0x9a, 0x00, 0xb3, 0xf0, 0x8a, 0xd3, 0x01, 0x01, 0x1c, } },
{ 0, { 0x24, 0x61, 0xd4, 0x00, 0x81, 0x61, 0x06, 0xa6, 0x03, 0x00, 0x12, } },
{ 0, { 0xa3, 0x21, 0x95, 0x00, 0x81, 0xd1, 0xf9, 0x0d, 0x01, 0x00, 0x12, } },
{ 0, { 0x25, 0x61, 0xd2, 0x00, 0x81, 0xd1, 0x06, 0x35, 0x00, 0x00, 0x3e, } },
{ 0, { 0x27, 0x21, 0x23, 0x00, 0x74, 0x60, 0x11, 0x05, 0x00, 0x00, 0x22, } },
{ 0, { 0x22, 0x21, 0x24, 0x00, 0x76, 0x76, 0x06, 0x06, 0x04, 0x04, 0x30, } },
{ 0, { 0x22, 0x21, 0x1b, 0x00, 0x66, 0x66, 0x05, 0x06, 0x00, 0x04, 0x30, } },
{ 0, { 0x22, 0xb2, 0x15, 0x00, 0x41, 0x31, 0x04, 0x04, 0x03, 0x01, 0x22, } },
{ 0, { 0x21, 0x21, 0x1e, 0x00, 0x76, 0x66, 0x04, 0x17, 0x04, 0x05, 0x10, } },
{ 0, { 0x01, 0x11, 0xc0, 0x00, 0xb5, 0xd2, 0x52, 0x72, 0x01, 0x00, 0x20, } },
{ 0, { 0x23, 0x11, 0x8a, 0x00, 0x85, 0xd2, 0x54, 0x73, 0x01, 0x00, 0x28, } },
{ 0, { 0x04, 0x01, 0x12, 0x00, 0xfd, 0xf2, 0x43, 0xa6, 0x00, 0x00, 0x20, } },
{ 0, { 0x23, 0x01, 0x00, 0x00, 0xfc, 0xf4, 0x67, 0xc6, 0x03, 0x02, 0x20, } },
{ 0, { 0x01, 0x01, 0x06, 0x00, 0xf6, 0xf6, 0x27, 0x25, 0x04, 0x01, 0x10, } },
{ 0, { 0x21, 0x21, 0xc1, 0x00, 0xf2, 0xf2, 0x13, 0x16, 0x00, 0x04, 0x30, } },
{ 0, { 0x21, 0x21, 0xc1, 0x00, 0xf2, 0xf2, 0x14, 0x15, 0x00, 0x04, 0x10, } },
{ 0, { 0x0b, 0x01, 0x40, 0x00, 0x65, 0xf2, 0x1a, 0x3e, 0x00, 0x03, 0x3c, } },
{ 0, { 0x01, 0x01, 0x0f, 0x00, 0xd8, 0x82, 0x96, 0x66, 0x00, 0x00, 0x10, } },
{ 0, { 0x01, 0x01, 0x0b, 0x00, 0xf2, 0xf6, 0x97, 0xe6, 0x04, 0x01, 0x20, } },
{ 0, { 0x01, 0x01, 0x04, 0x00, 0xf2, 0xf6, 0x95, 0xe6, 0x04, 0x01, 0x10, } },
{ 0, { 0x01, 0x01, 0x48, 0x00, 0xc7, 0x91, 0x96, 0xe6, 0x00, 0x00, 0x30, } },
{ 0, { 0x0b, 0x01, 0x00, 0x00, 0xfa, 0xf3, 0x86, 0xb6, 0x06, 0x01, 0x10, } },
{ 0, { 0x0b, 0x01, 0x00, 0x00, 0xfa, 0xf3, 0x87, 0xb7, 0x02, 0x01, 0x10, } },
{ 0, { 0xc1, 0x01, 0x00, 0x00, 0xe5, 0xf5, 0x65, 0x95, 0x00, 0x00, 0x21, } },
{ 0, { 0xc1, 0x01, 0x00, 0x00, 0xf2, 0xf2, 0x45, 0x96, 0x00, 0x00, 0x21, } },
{ 0, { 0x62, 0x61, 0xca, 0x00, 0xb4, 0x44, 0x25, 0x06, 0x04, 0x04, 0x3e, } },
{ 0, { 0x24, 0x21, 0xcb, 0x00, 0x88, 0x66, 0x24, 0x15, 0x04, 0x04, 0x1e, } },
{ 0, { 0x24, 0x21, 0xd3, 0x00, 0x88, 0x66, 0x24, 0x16, 0x04, 0x04, 0x1e, } },
{ 0, { 0x71, 0x61, 0x23, 0x00, 0x51, 0x52, 0x43, 0x15, 0x00, 0x00, 0x1e, } },
{ 0, { 0xa2, 0xa1, 0xcb, 0x00, 0x84, 0x51, 0x13, 0x55, 0x00, 0x02, 0x2a, } },
{ 0, { 0xf1, 0xe2, 0x00, 0x80, 0xf5, 0xfd, 0xa8, 0xac, 0x00, 0x00, 0x37, } },
{ 0, { 0x22, 0x02, 0x00, 0x00, 0xd4, 0xc4, 0x34, 0x26, 0x01, 0x00, 0x29, } },
{ 0, { 0x10, 0x10, 0x55, 0x00, 0x30, 0xb0, 0x09, 0x04, 0x03, 0x03, 0x2a, } },
{ 0, { 0x62, 0xa2, 0x8b, 0x40, 0x71, 0x43, 0x33, 0xe5, 0x01, 0x00, 0x24, } },
{ 0, { 0x61, 0x21, 0x8b, 0x40, 0x71, 0x43, 0x33, 0xe5, 0x01, 0x00, 0x14, } },
{ 0, { 0x61, 0x22, 0x8b, 0x40, 0x71, 0x43, 0x33, 0xe5, 0x01, 0x00, 0x26, } },
{ 0, { 0x01, 0x21, 0x13, 0x00, 0x51, 0x44, 0x15, 0x04, 0x02, 0x01, 0x10, } },
{ 0, { 0xf3, 0xc1, 0x95, 0x00, 0x32, 0x43, 0x40, 0x46, 0x02, 0x01, 0x3e, } },
{ 0, { 0xf3, 0xc1, 0x51, 0x00, 0xa2, 0x62, 0xa4, 0x84, 0x00, 0x01, 0x1e, } },
{ 0, { 0xe0, 0xe3, 0x4d, 0x00, 0x52, 0x65, 0x51, 0x35, 0x02, 0x00, 0x36, } },
{ 0, { 0x20, 0x00, 0x07, 0x00, 0xf7, 0x96, 0xb5, 0x46, 0x00, 0x00, 0x20, } },
{ 0, { 0x21, 0xa1, 0x1c, 0x00, 0x53, 0x52, 0x14, 0x35, 0x00, 0x00, 0x1c, } },
{ 0, { 0x21, 0xa2, 0x1a, 0x80, 0x53, 0x52, 0x19, 0x39, 0x00, 0x00, 0x2a, } },
{ 0, { 0x21, 0x21, 0x21, 0x00, 0x63, 0x85, 0x8c, 0x2c, 0x00, 0x00, 0x3c, } },
{ 0, { 0xe1, 0xe3, 0x98, 0x00, 0x71, 0x81, 0xa5, 0x96, 0x01, 0x00, 0x1c, } },
{ 0, { 0x31, 0x21, 0x55, 0x00, 0x53, 0xaa, 0x54, 0x15, 0x00, 0x00, 0x3e, } },
{ 0, { 0x21, 0xa2, 0x1b, 0x80, 0x53, 0x52, 0x15, 0x36, 0x00, 0x00, 0x3a, } },
{ 0, { 0x21, 0x21, 0x20, 0x00, 0x83, 0x81, 0x75, 0x86, 0x05, 0x04, 0x1e, } },
{ 0, { 0x21, 0x21, 0x8e, 0x80, 0x9b, 0x90, 0x25, 0x05, 0x00, 0x00, 0x18, } },
{ 0, { 0x01, 0x02, 0x15, 0x00, 0x70, 0x70, 0xe5, 0xe6, 0x05, 0x00, 0x20, } },
{ 0, { 0x01, 0x01, 0x14, 0x00, 0x80, 0x70, 0xe5, 0xe6, 0x05, 0x00, 0x30, } },
{ 0, { 0x01, 0x01, 0x12, 0x00, 0x80, 0x70, 0xe5, 0xe6, 0x05, 0x00, 0x30, } },
{ 0, { 0x01, 0xa3, 0x91, 0x00, 0x51, 0x52, 0x57, 0x77, 0x01, 0x00, 0x2a, } },
{ 0, { 0x71, 0x64, 0xc9, 0x00, 0x6e, 0x8b, 0x13, 0x07, 0x00, 0x01, 0x12, } },
{ 0, { 0xa1, 0xa3, 0x25, 0x00, 0x71, 0x82, 0xa5, 0x97, 0x00, 0x00, 0x10, } },
{ 0, { 0x01, 0x24, 0x13, 0x00, 0xf0, 0x80, 0x22, 0x07, 0x00, 0x00, 0x20, } },
{ 0, { 0x32, 0x31, 0x1d, 0x00, 0xa2, 0x51, 0x14, 0x24, 0x04, 0x00, 0x3a, } },
{ 0, { 0x21, 0xa1, 0x20, 0x00, 0x77, 0x65, 0x43, 0x06, 0x00, 0x00, 0x20, } },
{ 0, { 0x01, 0xa1, 0xa4, 0x00, 0x6a, 0x63, 0x64, 0x66, 0x02, 0x00, 0x20, } },
{ 0, { 0x22, 0x21, 0xac, 0x00, 0x67, 0x65, 0x89, 0x28, 0x00, 0x00, 0x2e, } },
{ 0, { 0xe3, 0xa1, 0xe9, 0x00, 0x6d, 0x65, 0x8d, 0x29, 0x00, 0x00, 0x1e, } },
{ 0, { 0x20, 0x26, 0x10, 0x00, 0xd8, 0x68, 0x68, 0x97, 0x00, 0x00, 0x3e, } },
{ 0, { 0x22, 0x21, 0x6c, 0x00, 0x47, 0x65, 0x0f, 0x2a, 0x00, 0x00, 0x1e, } },
{ 0, { 0xe1, 0xe2, 0xff, 0x00, 0x70, 0x62, 0x0c, 0xfb, 0x00, 0x00, 0x3e, } },
{ 0, { 0x31, 0x31, 0x2b, 0x00, 0x57, 0x68, 0x46, 0x06, 0x04, 0x00, 0x20, } },
{ 0, { 0x91, 0x13, 0x97, 0x80, 0x2a, 0x42, 0x02, 0xf3, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0xa2, 0x91, 0x00, 0x51, 0x52, 0x53, 0x76, 0x01, 0x00, 0x3e, } },
{ 0, { 0x23, 0x21, 0xd8, 0x00, 0x50, 0x72, 0x00, 0xf8, 0x03, 0x00, 0x1e, } },
{ 0, { 0xd1, 0xa0, 0x00, 0x00, 0xb7, 0x87, 0x66, 0x06, 0x02, 0x02, 0x10, } },
{ 0, { 0x00, 0x15, 0x4f, 0x00, 0x71, 0x52, 0x53, 0x74, 0x00, 0x00, 0x26, } },
{ 0, { 0xe0, 0xe1, 0xc5, 0x00, 0x52, 0x65, 0xa1, 0x35, 0x00, 0x00, 0x36, } },
{ 0, { 0xb0, 0xb1, 0x00, 0x00, 0xd5, 0x26, 0x13, 0x13, 0x01, 0x00, 0x35, } },
{ 0, { 0x21, 0xa1, 0x1d, 0x80, 0x53, 0x52, 0x14, 0x35, 0x00, 0x00, 0x2a, } },
{ 0, { 0x21, 0xa1, 0x1b, 0x00, 0x51, 0x82, 0x15, 0x45, 0x01, 0x00, 0x10, } },
{ 0, { 0xe1, 0xa1, 0xa3, 0x00, 0x6e, 0x65, 0x8f, 0x06, 0x01, 0x00, 0x2e, } },
{ 0, { 0x20, 0x01, 0x00, 0x00, 0xc3, 0xf0, 0xf4, 0xf5, 0x02, 0x00, 0x10, } },
{ 0, { 0xf1, 0xc2, 0x51, 0x00, 0xa2, 0x63, 0x40, 0x46, 0x00, 0x00, 0x3e, } },
{ 0, { 0xe1, 0xa2, 0x4d, 0x00, 0x71, 0x43, 0x33, 0xe5, 0x01, 0x00, 0x16, } },
{ 0, { 0x21, 0x21, 0x40, 0x00, 0x63, 0x30, 0x83, 0x15, 0x00, 0x00, 0x10, } },
{ 0, { 0x24, 0x21, 0x24, 0x00, 0x67, 0x65, 0x8f, 0x2a, 0x02, 0x00, 0x3e, } },
{ 0, { 0x24, 0x21, 0x15, 0x00, 0x27, 0x65, 0x88, 0x26, 0x02, 0x00, 0x1e, } },
{ 0, { 0x08, 0x83, 0xc0, 0x00, 0xfb, 0xf5, 0x66, 0x66, 0x00, 0x00, 0x10, } },
{ 0, { 0xf4, 0xe1, 0x54, 0x00, 0x25, 0xf0, 0xbd, 0x47, 0x00, 0x01, 0x10, } },
{ 0, { 0xb4, 0xa1, 0x0a, 0x00, 0x67, 0x65, 0x88, 0x2a, 0x02, 0x00, 0x20, } },
{ 0, { 0x23, 0x21, 0xdb, 0x00, 0x47, 0x65, 0x8f, 0x2a, 0x02, 0x00, 0x1e, } },
{ 0, { 0x24, 0x21, 0x22, 0x00, 0x47, 0x65, 0x8f, 0x2a, 0x02, 0x00, 0x1e, } },
{ 0, { 0xe6, 0x30, 0x0b, 0x00, 0x25, 0xf0, 0xb5, 0x45, 0x00, 0x00, 0x28, } },
{ 0, { 0xe3, 0x70, 0x50, 0x80, 0x25, 0xf0, 0xb0, 0x45, 0x00, 0x00, 0x30, } },
{ 0, { 0xe6, 0xe0, 0x15, 0x00, 0x70, 0x62, 0x07, 0xf7, 0x00, 0x00, 0x2e, } },
{ 0, { 0x25, 0x01, 0x12, 0x00, 0xf7, 0xf8, 0x43, 0x05, 0x04, 0x04, 0x30, } },
{ 0, { 0x01, 0x00, 0x00, 0x00, 0xf4, 0xf8, 0xa6, 0x35, 0x04, 0x00, 0x35, } },
{ 0, { 0x04, 0x07, 0x09, 0x00, 0xfa, 0xf8, 0xa6, 0xfb, 0x00, 0x00, 0x14, } },
{ 0, { 0x00, 0x01, 0x13, 0x00, 0xf2, 0xf4, 0x13, 0xf5, 0x00, 0x00, 0x18, } },
{ 0, { 0x00, 0x01, 0x0f, 0x00, 0xf2, 0xf4, 0x13, 0xf5, 0x00, 0x00, 0x30, } },
{ 0, { 0x11, 0x32, 0x0c, 0x00, 0xd0, 0x80, 0xf2, 0x05, 0x00, 0x00, 0x10, } },
{ 0, { 0x10, 0x21, 0x43, 0x40, 0x9b, 0x69, 0x30, 0x0e, 0x03, 0x05, 0x30, } },
{ 0, { 0x11, 0x32, 0x0c, 0x00, 0xd0, 0x80, 0xf3, 0x05, 0x00, 0x00, 0x20, } },
{ 0, { 0x16, 0x17, 0x4f, 0x00, 0xf6, 0xf3, 0x53, 0x53, 0x00, 0x00, 0x20, } },
{ 0, { 0x17, 0x12, 0x00, 0x00, 0xfa, 0xf5, 0x57, 0x58, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x0d, 0x00, 0xa8, 0xd6, 0x4b, 0x4a, 0x00, 0x01, 0x28, } },
{ 0, { 0x32, 0x10, 0x4a, 0x00, 0xf8, 0xf5, 0xff, 0x7f, 0x00, 0x00, 0x3e, } },
{ 0, { 0x00, 0x00, 0x0d, 0x00, 0xa8, 0xd6, 0x4c, 0x4f, 0x00, 0x00, 0x10, } },
{ 0, { 0x12, 0x30, 0x01, 0x00, 0xfb, 0xf3, 0xa7, 0x53, 0x00, 0x00, 0x10, } },
{ 0, { 0x2b, 0x0b, 0x00, 0x00, 0xff, 0xf7, 0x0e, 0xfe, 0x00, 0x00, 0x3e, } },
{ 0, { 0x01, 0x10, 0x07, 0x00, 0xf5, 0x54, 0xb5, 0x2f, 0x00, 0x00, 0x26, } },
{ 0, { 0x00, 0x18, 0x80, 0x00, 0xb3, 0xaf, 0x3f, 0xf0, 0x00, 0x00, 0x1a, } },
{ 0, { 0x60, 0xef, 0x40, 0x00, 0xb1, 0xb2, 0x73, 0x9b, 0x02, 0x03, 0x3e, } },
{ 0, { 0xaf, 0xb0, 0x40, 0x00, 0xa1, 0x52, 0x53, 0x73, 0x00, 0x00, 0x3e, } },
{ 0, { 0x00, 0x07, 0x2e, 0x00, 0xf0, 0x5f, 0xf0, 0xf0, 0x00, 0x00, 0x1e, } },
{ 0, { 0xe5, 0x70, 0x13, 0x00, 0x70, 0x62, 0x0f, 0xff, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x10, 0x00, 0x00, 0x68, 0xa5, 0xcf, 0x6b, 0x02, 0x00, 0x2e, } },
{ 0, { 0x2b, 0x27, 0x00, 0x00, 0x82, 0x77, 0x0a, 0x0a, 0x00, 0x05, 0x2e, } },
{ 0, { 0x00, 0x00, 0x0b, 0x00, 0xfa, 0xf6, 0x6f, 0x8f, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } },
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, } },
{ 0, { 0x42, 0x01, 0x1b, 0x00, 0x68, 0xd6, 0x1c, 0x45, 0x03, 0x00, 0x2e, } },
{ 0, { 0x40, 0x01, 0x18, 0x00, 0x68, 0xd6, 0x19, 0x46, 0x02, 0x00, 0x2e, } },
{ 0, { 0x02, 0x04, 0x07, 0x00, 0xfa, 0xda, 0xbb, 0xbe, 0x00, 0x00, 0x38, } },
{ 0, { 0x17, 0x00, 0x00, 0x00, 0xf3, 0xf8, 0xf0, 0xb7, 0x02, 0x00, 0x1e, } },
{ 0, { 0x01, 0x05, 0x07, 0x00, 0x9a, 0x9a, 0xb6, 0xb9, 0x02, 0x00, 0x3e, } },
{ 0, { 0x17, 0x03, 0x00, 0x00, 0xf1, 0xf7, 0xf0, 0xb7, 0x02, 0x00, 0x1e, } },
{ 0, { 0x01, 0x01, 0x0d, 0x00, 0xe8, 0xa5, 0xec, 0xf7, 0x00, 0x00, 0x16, } },
{ 0, { 0x2f, 0x31, 0x07, 0x00, 0x73, 0xc4, 0xc2, 0xb4, 0x00, 0x00, 0x3a, } },
{ 0, { 0x01, 0x01, 0x0d, 0x00, 0xe8, 0xa5, 0xec, 0xf7, 0x01, 0x00, 0x36, } },
{ 0, { 0x13, 0x10, 0xcd, 0x80, 0xf5, 0xd5, 0x92, 0xd4, 0x01, 0x00, 0x2a, } },
{ 0, { 0x01, 0x01, 0x0d, 0x00, 0xe8, 0xa5, 0xec, 0xf5, 0x00, 0x00, 0x16, } },
{ 0, { 0x3c, 0x31, 0x0a, 0x40, 0x73, 0xc4, 0xb1, 0xf3, 0x00, 0x00, 0x1a, } },
};

203
sys/dev/ic/oplreg.h Normal file
View File

@ -0,0 +1,203 @@
/* $NetBSD: oplreg.h,v 1.1 1998/08/17 21:16:13 augustss Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Author: Lennart Augustsson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Offsets from base address */
#define OPL_LO 0
#define OPL_HI 2
/* Offsets from base+[LO|HI] */
#define OPL_STATUS 0
#define OPL_STATUS_IRQ 0x80
#define OPL_STATUS_FT1 0x40
#define OPL_STATUS_FT2 0x20
#define OPL_STATUS_MASK 0xE0
#define OPL_ADDR 0
#define OPL_DATA 1
#define OPL_TEST 0x01
#define OPL_ENABLE_WAVE_SELECT 0x20
#define OPL_TIMER1 0x02
#define OPL_TIMER2 0x03
#define OPL_TIMER_CONTROL 0x04 /* LO */
#define OPL_TIMER1_START 0x01
#define OPL_TIMER2_START 0x02
#define OPL_TIMER2_MASK 0x20
#define OPL_TIMER1_MASK 0x40
#define OPL_IRQ_RESET 0x80
#define OPL_CONNECTION_SELECT 0x04 /* HI */
#define OPL_NOCONNECTION 0x00
#define OPL_HI_4OP_0 0x01
#define OPL_HI_4OP_1 0x02
#define OPL_HI_4OP_2 0x04
#define OPL_LO_4OP_0 0x08
#define OPL_LO_4OP_1 0x10
#define OPL_LO_4OP_2 0x20
#define OPL_MODE 0x05 /* HI */
#define OPL3_ENABLE 0x01
#define OPL4_ENABLE 0x02
#define OPL_KBD_SPLIT 0x08 /* LO */
#define OPL_KEYBOARD_SPLIT 0x40
#define OPL_COMPOSITE_SINE_WAVE_MODE 0x80
#define OPL_PERCUSSION 0xbd /* LO */
#define OPL_NOPERCUSSION 0x00
#define OPL_HIHAT 0x01
#define OPL_CYMBAL 0x02
#define OPL_TOMTOM 0x04
#define OPL_SNAREDRUM 0x08
#define OPL_BASSDRUM 0x10
#define OPL_PERCUSSION_ENABLE 0x20
#define OPL_VIBRATO_DEPTH 0x40
#define OPL_TREMOLO_DEPTH 0x80
/*
* Offsets to the register banks for operators. To get the
* register number just add the operator offset to the bank offset
*
* AM/VIB/EG/KSR/Multiple (0x20 to 0x35)
*/
#define OPL_AM_VIB 0x20
#define OPL_KSR 0x10
#define OPL_SUSTAIN 0x20
#define OPL_VIBRATO 0x40
#define OPL_TREMOLO 0x80
#define OPL_MULTIPLE_MASK 0x0f
/*
* KSL/Total level (0x40 to 0x55)
*/
#define OPL_KSL_LEVEL 0x40
#define OPL_KSL_MASK 0xc0 /* Envelope scaling bits */
#define OPL_TOTAL_LEVEL_MASK 0x3f /* Strength (volume) of OP */
/*
* Attack / Decay rate (0x60 to 0x75)
*/
#define OPL_ATTACK_DECAY 0x60
#define OPL_ATTACK_MASK 0xf0
#define DECAY_MASK 0x0f
/*
* Sustain level / Release rate (0x80 to 0x95)
*/
#define OPL_SUSTAIN_RELEASE 0x80
#define OPL_SUSTAIN_MASK 0xf0
#define OPL_RELEASE_MASK 0x0f
/*
* Wave select (0xE0 to 0xF5)
*/
#define OPL_WAVE_SELECT 0xe0
#define OPL_MAXREG 0xf5
/*
* Offsets to the register banks for voices. Just add to the
* voice number to get the register number.
*
* F-Number low bits (0xA0 to 0xA8).
*/
#define OPL_FNUM_LOW 0xa0
/*
* F-number high bits / Key on / Block (octave) (0xB0 to 0xB8)
*/
#define OPL_KEYON_BLOCK 0xb0
#define OPL_KEYON_BIT 0x20
#define OPL_BLOCKNUM_MASK 0x1c
#define OPL_FNUM_HIGH_MASK 0x03
/*
* Feedback / Connection (0xc0 to 0xc8)
*
* These registers have two new bits when the OPL-3 mode
* is selected. These bits controls connecting the voice
* to the stereo channels. For 4 OP voices this bit is
* defined in the second half of the voice (add 3 to the
* register offset).
*
* For 4 OP voices the connection bit is used in the
* both halves (gives 4 ways to connect the operators).
*/
#define OPL_FEEDBACK_CONNECTION 0xc0
#define OPL_FEEDBACK_MASK 0x0e /* Valid just for 1st OP of a voice */
#define OPL_CONNECTION_BIT 0x01
/*
* In the 4 OP mode there is four possible configurations how the
* operators can be connected together (in 2 OP modes there is just
* AM or FM). The 4 OP connection mode is defined by the rightmost
* bit of the FEEDBACK_CONNECTION (0xC0-0xC8) on the both halves.
*
* First half Second half Mode
*
* +---+
* v |
* 0 0 >+-1-+--2--3--4-->
*
*
*
* +---+
* | |
* 0 1 >+-1-+--2-+
* |->
* >--3----4-+
*
* +---+
* | |
* 1 0 >+-1-+-----+
* |->
* >--2--3--4-+
*
* +---+
* | |
* 1 1 >+-1-+--+
* |
* >--2--3-+->
* |
* >--4----+
*/
#define OPL_STEREO_BITS 0x30 /* OPL-3 only */
#define OPL_VOICE_TO_LEFT 0x10
#define OPL_VOICE_TO_RIGHT 0x20
#define OPL2_NVOICE 9
#define OPL3_NVOICE 18

87
sys/dev/ic/oplvar.h Normal file
View File

@ -0,0 +1,87 @@
/* $NetBSD: oplvar.h,v 1.1 1998/08/17 21:16:13 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Author: Lennart Augustsson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <dev/midivar.h>
#include <dev/midisynvar.h>
struct opl_voice {
int voiceno;
int iooffs;
u_int8_t op[4];
struct opl_operators *patch;
u_int8_t rB0;
};
struct opl_softc {
struct midi_softc sc_mididev;
bus_space_tag_t iot;
bus_space_handle_t ioh;
int offs;
int model;
#define OPL_2 2
#define OPL_3 3
struct midisyn syn;
struct opl_voice voices[OPL3_NVOICE];
int volume;
};
struct opl_attach_arg {
bus_space_tag_t iot;
bus_space_handle_t ioh;
int offs;
int done;
};
struct opl_operators {
u_int8_t opl3;
u_int8_t ops[22];
#define OO_CHARS 0
#define OO_KSL_LEV 2
#define OO_ATT_DEC 4
#define OO_SUS_REL 6
#define OO_WAV_SEL 8
#define OO_FB_CONN 10
#define OO_4OP_OFFS 11
};
#define OPL_NINSTR 256
extern struct opl_operators opl2_instrs[];
extern struct opl_operators opl3_instrs[];
int opl_find __P((struct opl_softc *));
void opl_attach __P((struct opl_softc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: tms320av110.c,v 1.5 1997/10/20 19:07:59 is Exp $ */
/* $NetBSD: tms320av110.c,v 1.6 1998/08/17 21:16:13 augustss Exp $ */
/*-
* Copyright (c) 1997 Ignatios Souvatzis. All rights reserved.
@ -131,7 +131,7 @@ tms320av110_attach_mi(sc)
tav_write_byte(iot, ioh, TAV_SYNC_ECM, TAV_ECM_REPEAT);
tav_write_byte(iot, ioh, TAV_CRC_ECM, TAV_ECM_REPEAT);
audio_attach_mi(&tav_audio_if, 0, sc, &sc->sc_dev);
audio_attach_mi(&tav_audio_if, sc, &sc->sc_dev);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: aria.c,v 1.5 1998/07/21 07:48:36 mycroft Exp $ */
/* $NetBSD: aria.c,v 1.6 1998/08/17 21:16:13 augustss Exp $ */
/*-
* Copyright (c) 1995, 1996, 1998 Roland C. Dowdeswell. All rights reserved.
@ -458,7 +458,7 @@ ariaattach(parent, self, aux)
sprintf(aria_device.version, "%s",
ARIA_MODEL & sc->sc_hardware ? "SC18026" : "SC18025");
audio_attach_mi(&aria_hw_if, 0, (void *)sc, &sc->sc_dev);
audio_attach_mi(&aria_hw_if, (void *)sc, &sc->sc_dev);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ess.c,v 1.22 1998/08/12 19:13:14 mycroft Exp $ */
/* $NetBSD: ess.c,v 1.23 1998/08/17 21:16:13 augustss Exp $ */
/*
* Copyright 1997
@ -875,7 +875,7 @@ essattach(sc)
sprintf(ess_device.name, "ES%s", essmodel[sc->sc_model]);
sprintf(ess_device.version, "0x%04x", sc->sc_version);
audio_attach_mi(&ess_hw_if, 0, sc, &sc->sc_dev);
audio_attach_mi(&ess_hw_if, sc, &sc->sc_dev);
#ifdef AUDIO_DEBUG
ess_printsc(sc);

View File

@ -1,4 +1,4 @@
# $NetBSD: files.isa,v 1.71 1998/08/13 04:53:18 kim Exp $
# $NetBSD: files.isa,v 1.72 1998/08/17 21:16:14 augustss Exp $
#
# Config file and device description for machine-independent ISA code.
# Included by ports that need it. Requires that the SCSI files be
@ -250,7 +250,7 @@ define mpu401
file dev/isa/mpu401.c mpu401 & midi
# the SoundBlaster DSP, or close likenesses; used by other drivers
define sbdsp
define sbdsp { }
file dev/isa/sbdsp.c sbdsp
# SoundBlaster family
@ -260,6 +260,9 @@ file dev/isa/sb.c sb needs-flag
attach sb at isa with sb_isa
file dev/isa/sb_isa.c sb_isa needs-flag
attach opl at sbdsp with opl_sb
file dev/isa/opl_sb.c opl_sb
# ProAudio Spectrum
device pas: audio, isadma, sbdsp, mulaw, auconv
attach pas at isa

View File

@ -1,4 +1,4 @@
/* $NetBSD: gus.c,v 1.58 1998/07/02 14:39:51 mycroft Exp $ */
/* $NetBSD: gus.c,v 1.59 1998/08/17 21:16:14 augustss Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -1029,7 +1029,7 @@ gusattach(parent, self, aux)
* Attach to the generic audio layer
*/
audio_attach_mi(&gus_hw_if, 0, HAS_CODEC(sc) ? (void *)&sc->sc_codec : (void *)sc, &sc->sc_dev);
audio_attach_mi(&gus_hw_if, HAS_CODEC(sc) ? (void *)&sc->sc_codec : (void *)sc, &sc->sc_dev);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: midi_pcppi.c,v 1.2 1998/08/12 21:36:21 augustss Exp $ */
/* $NetBSD: midi_pcppi.c,v 1.3 1998/08/17 21:16:14 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -50,6 +50,7 @@
#include <dev/isa/pcppivar.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/midivar.h>
#include <dev/midisynvar.h>
@ -116,7 +117,8 @@ midi_pcppi_attach(parent, self, aux)
midi_pcppi_attached++;
midisyn_attach(&sc->sc_mididev, ms, parent);
midisyn_attach(&sc->sc_mididev, ms);
midi_attach(&sc->sc_mididev, parent);
}
void
@ -126,7 +128,7 @@ midi_pcppi_on(ms, chan, note, vel)
{
pcppi_tag_t t = ms->data;
/*printf("ON %p %d\n", t, note >> 16);*/
/*printf("ON %p %d\n", t, MIDISYN_FREQ_TO_HZ(note));*/
pcppi_bell(t, MIDISYN_FREQ_TO_HZ(note), MAX_DURATION * hz, 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpu401.c,v 1.1 1998/08/07 00:01:00 augustss Exp $ */
/* $NetBSD: mpu401.c,v 1.2 1998/08/17 21:16:14 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -49,8 +49,7 @@
#include <machine/intr.h>
#include <machine/bus.h>
#include <sys/audioio.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/isa/isavar.h>
#include <dev/isa/isadmavar.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: pas.c,v 1.43 1998/08/10 00:20:39 mycroft Exp $ */
/* $NetBSD: pas.c,v 1.44 1998/08/17 21:16:14 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -71,6 +71,7 @@
#include <sys/audioio.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/isa/isavar.h>
#include <dev/isa/isadmavar.h>
@ -501,7 +502,7 @@ pasattach(parent, self, aux)
sprintf(pas_device.name, "pas,%s", pasnames[sc->model]);
sprintf(pas_device.version, "%d", sc->rev);
audio_attach_mi(&pas_hw_if, 0, &sc->sc_sbdsp, &sc->sc_sbdsp.sc_dev);
audio_attach_mi(&pas_hw_if, &sc->sc_sbdsp, &sc->sc_sbdsp.sc_dev);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: pss.c,v 1.46 1998/06/30 08:24:56 mycroft Exp $ */
/* $NetBSD: pss.c,v 1.47 1998/08/17 21:16:14 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@ -1073,7 +1073,7 @@ pssattach(parent, self, aux)
(void)pss_set_treble(sc, AUDIO_MAX_GAIN/2);
(void)pss_set_bass(sc, AUDIO_MAX_GAIN/2);
audio_attach_mi(&pss_audio_if, 0, sc->ad1848_sc, &sc->ad1848_sc->sc_dev);
audio_attach_mi(&pss_audio_if, sc->ad1848_sc, &sc->ad1848_sc->sc_dev);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: sb.c,v 1.62 1998/08/12 18:15:04 augustss Exp $ */
/* $NetBSD: sb.c,v 1.63 1998/08/17 21:16:15 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -50,6 +50,9 @@
#include <sys/audioio.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/midi_if.h>
#include <dev/isa/isavar.h>
#include <dev/isa/isadmavar.h>
@ -180,29 +183,6 @@ sbmatch(sc)
} else
sc->sc_drq16 = sc->sc_drq8;
#ifdef NEWCONFIG
/*
* If the IRQ wasn't compiled in, auto-detect it.
*/
if (sc->sc_irq == IRQUNK) {
sc->sc_irq = isa_discoverintr(sbforceintr, sc);
sbdsp_reset(sc);
if (ISSBPROCLASS(sc)) {
if (!SBP_IRQ_VALID(sc->sc_irq)) {
printf("%s: couldn't auto-detect interrupt\n",
sc->sc_dev.dv_xname);
return 0;
}
}
else {
if (!SB_IRQ_VALID(sc->sc_irq)) {
printf("%s: couldn't auto-detect interrupt\n",
sc->sc_dev.dv_xname);
return 0;
}
}
} else
#endif
if (ISSBPROCLASS(sc)) {
if (!SBP_IRQ_VALID(sc->sc_irq)) {
printf("%s: configured irq %d invalid\n",
@ -266,10 +246,9 @@ void
sbattach(sc)
struct sbdsp_softc *sc;
{
struct audio_attach_args arg;
#if NMIDI > 0
struct midi_hw_if *mhw = &sb_midi_hw_if;
#else
struct midi_hw_if *mhw = 0;
#endif
sc->sc_ih = isa_intr_establish(sc->sc_ic, sc->sc_irq, sc->sc_ist,
@ -286,9 +265,15 @@ sbattach(sc)
mhw = &sb_mpu401_hw_if;
}
}
midi_attach_mi(mhw, sc, &sc->sc_dev);
#endif
audio_attach_mi(&sb_hw_if, mhw, sc, &sc->sc_dev);
audio_attach_mi(&sb_hw_if, sc, &sc->sc_dev);
arg.type = AUDIODEV_TYPE_OPL;
arg.hwif = 0;
arg.hdl = 0;
(void)config_found(&sc->sc_dev, &arg, audioprint);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: sb_isa.c,v 1.18 1998/06/29 22:42:09 thorpej Exp $ */
/* $NetBSD: sb_isa.c,v 1.19 1998/08/17 21:16:15 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -46,6 +46,7 @@
#include <sys/audioio.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/mulaw.h>
#include <dev/isa/isavar.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbdsp.c,v 1.87 1998/08/10 20:02:48 augustss Exp $ */
/* $NetBSD: sbdsp.c,v 1.88 1998/08/17 21:16:15 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -62,6 +62,7 @@
#include <sys/audioio.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/mulaw.h>
#include <dev/auconv.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbreg.h,v 1.25 1998/08/07 00:01:00 augustss Exp $ */
/* $NetBSD: sbreg.h,v 1.26 1998/08/17 21:16:15 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -109,6 +109,7 @@
#define SBP_IRQ_MPU401 0x04
#define SBP_IRQ_DMA16 0x02
#define SBP_IRQ_DMA8 0x01
#define SBP_MPU_ADDR 0x84 /* Vibra16 register */
#define SB16P_MASTER_L 0x30
#define SB16P_VOICE_L 0x32

View File

@ -1,4 +1,4 @@
/* $NetBSD: wss.c,v 1.50 1998/07/29 11:39:25 augustss Exp $ */
/* $NetBSD: wss.c,v 1.51 1998/08/17 21:16:15 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@ -157,7 +157,7 @@ wssattach(sc)
sc->sc_ad1848.parent = sc;
audio_attach_mi(&wss_hw_if, 0, &sc->sc_ad1848, &sc->sc_dev);
audio_attach_mi(&wss_hw_if, &sc->sc_ad1848, &sc->sc_dev);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: ym.c,v 1.3 1998/06/17 08:17:25 augustss Exp $ */
/* $NetBSD: ym.c,v 1.4 1998/08/17 21:16:15 augustss Exp $ */
/*
@ -129,7 +129,7 @@ ym_attach(sc)
sc->mic_mute = 1;
ym_mute(sc, SA3_MIC, sc->mic_mute);
audio_attach_mi(&ym_hw_if, 0, &sc->sc_ad1848, &sc->sc_dev);
audio_attach_mi(&ym_hw_if, &sc->sc_ad1848, &sc->sc_dev);
}
static __inline int

View File

@ -1,4 +1,4 @@
/* $NetBSD: sb_isapnp.c,v 1.28 1998/08/07 00:01:00 augustss Exp $ */
/* $NetBSD: sb_isapnp.c,v 1.29 1998/08/17 21:16:16 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -48,6 +48,7 @@
#include <sys/audioio.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/mulaw.h>
#include <dev/isa/isavar.h>
@ -82,7 +83,7 @@ sb_isapnp_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
return isapnp_devmatch(aux, &isapnp_sb_devinfo);
return (isapnp_devmatch(aux, &isapnp_sb_devinfo));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: midi.c,v 1.3 1998/08/13 00:13:56 augustss Exp $ */
/* $NetBSD: midi.c,v 1.4 1998/08/17 21:16:11 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -58,6 +58,7 @@
#include <sys/device.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/midivar.h>
#ifdef AUDIO_DEBUG
@ -87,6 +88,17 @@ struct cfattach midi_ca = {
sizeof(struct midi_softc), midiprobe, midiattach
};
#ifdef MIDI_SAVE
#define MIDI_SAVE_SIZE 100000
int midicnt;
struct {
int cnt;
u_char buf[MIDI_SAVE_SIZE];
} midisave;
#define MIDI_GETSAVE _IOWR('m', 100, int)
#endif
extern struct cfdriver midi_cd;
int
@ -354,6 +366,13 @@ midiopen(dev, flags, ifmt, p)
sc->pbus = 0;
sc->async = 0;
#ifdef MIDI_SAVE
if (midicnt != 0) {
midisave.cnt = midicnt;
midicnt = 0;
}
#endif
return 0;
}
@ -477,6 +496,10 @@ midi_start_output(sc, intr)
splx(s);
DPRINTFN(4, ("midi_start_output: %p i=%d, data=0x%02x\n",
sc, i, *outp));
#ifdef MIDI_SAVE
midisave.buf[midicnt] = *outp;
midicnt = (midicnt + 1) % MIDI_SAVE_SIZE;
#endif
error = sc->hw_if->output(sc->hw_hdl, *outp++);
if (outp >= mb->end)
outp = mb->start;
@ -598,6 +621,12 @@ midiioctl(dev, cmd, addr, flag, p)
break;
#endif
#ifdef MIDI_SAVE
case MIDI_GETSAVE:
error = copyout(&midisave, *(void **)addr, sizeof midisave);
break;
#endif
default:
if (hw->ioctl)
error = hw->ioctl(sc->hw_hdl, cmd, addr, flag, p);
@ -655,4 +684,26 @@ midi_getinfo(dev, mi)
sc->hw_if->getinfo(sc->hw_hdl, mi);
}
int audioprint __P((void *, const char *));
void
midi_attach_mi(mhwp, hdlp, dev)
struct midi_hw_if *mhwp;
void *hdlp;
struct device *dev;
{
struct audio_attach_args arg;
#ifdef DIAGNOSTIC
if (mhwp == NULL) {
printf("midi_attach_mi: NULL\n");
return;
}
#endif
arg.type = AUDIODEV_TYPE_MIDI;
arg.hwif = mhwp;
arg.hdl = hdlp;
(void)config_found(dev, &arg, audioprint);
}
#endif /* NMIDI > 0 */

67
sys/dev/midi_if.h Normal file
View File

@ -0,0 +1,67 @@
/* $NetBSD: midi_if.h,v 1.1 1998/08/17 21:16:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Author: Lennart Augustsson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_DEV_MIDI_IF_H_
#define _SYS_DEV_MIDI_IF_H_
struct midi_info {
char *name; /* Name of MIDI hardware */
int props;
};
#define MIDI_PROP_OUT_INTR 1
#define MIDI_PROP_CAN_INPUT 2
struct midi_softc;
struct midi_hw_if {
int (*open)__P((void *, int, /* open hardware */
void (*)__P((void *, int)), /* input callback */
void (*)__P((void *)), /* output callback */
void *));
void (*close)__P((void *)); /* close hardware */
int (*output)__P((void *, int)); /* output a byte */
void (*getinfo)__P((void *, struct midi_info *));
int (*ioctl)__P((void *, u_long, caddr_t, int, struct proc *));
};
void midi_attach __P((struct midi_softc *, struct device *));
void midi_attach_mi __P((struct midi_hw_if *, void *, struct device *));
int midi_unit_count __P((void));
void midi_getinfo __P((dev_t, struct midi_info *));
#endif /* _SYS_DEV_MIDI_IF_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: midisyn.c,v 1.2 1998/08/13 00:13:56 augustss Exp $ */
/* $NetBSD: midisyn.c,v 1.3 1998/08/17 21:16:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -51,6 +51,7 @@
#include <sys/device.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/midivar.h>
#include <dev/midisynvar.h>
@ -67,6 +68,7 @@ int midisyn_findvoice __P((midisyn *, int, int));
void midisyn_freevoice __P((midisyn *, int));
int midisyn_allocvoice __P((midisyn *, u_int32_t, u_int32_t));
u_int32_t midisyn_note_to_freq __P((int));
u_int32_t midisyn_finetune __P((u_int32_t, int, int, int));
int midisyn_open __P((void *, int,
void (*iintr)__P((void *, int)),
@ -153,18 +155,17 @@ midisyn_findvoice(ms, chan, note)
if (!(ms->flags & MS_DOALLOC))
return (chan);
cn = CHANNOTE(chan, note);
cn = MS_CHANNOTE(chan, note);
for (v = 0; v < ms->nvoice; v++)
if (ms->voices[v].chan_note == cn)
if (ms->voices[v].chan_note == cn && ms->voices[v].inuse)
return (v);
return (-1);
}
void
midisyn_attach(sc, ms, parent)
midisyn_attach(sc, ms)
struct midi_softc *sc;
midisyn *ms;
struct device *parent;
{
if (ms->flags & MS_DOALLOC) {
ms->voices = malloc(ms->nvoice * sizeof (struct voice),
@ -177,7 +178,6 @@ midisyn_attach(sc, ms, parent)
sc->hw_if = &midisyn_hw_if;
sc->hw_hdl = ms;
DPRINTF(("midisyn_attach: ms=%p\n", sc->hw_hdl));
midi_attach(sc, parent);
}
void
@ -187,7 +187,7 @@ midisyn_freevoice(ms, voice)
{
if (!(ms->flags & MS_DOALLOC))
return;
ms->voices[voice].chan_note = ~0;
ms->voices[voice].inuse = 0;
}
int
@ -202,16 +202,28 @@ midisyn_allocvoice(ms, chan, note)
return (chan);
/* Find a free voice, or if no free voice is found the oldest. */
bestv = 0;
bestseq = ms->voices[0].seqno;
bestseq = ms->voices[0].seqno + (ms->voices[0].inuse ? 0x40000000 : 0);
for (v = 1; v < ms->nvoice; v++) {
s = ms->voices[v].seqno;
if (ms->voices[v].inuse)
s += 0x40000000;
if (s < bestseq) {
bestseq = s;
bestv = v;
}
}
ms->voices[bestv].chan_note = CHANNOTE(chan, note);
DPRINTFN(10,("midisyn_allocvoice: v=%d seq=%d cn=%x inuse=%d\n",
bestv, ms->voices[bestv].seqno,
ms->voices[bestv].chan_note,
ms->voices[bestv].inuse));
#ifdef AUDIO_DEBUG
if (ms->voices[bestv].inuse)
DPRINTFN(1,("midisyn_allocvoice: steal %x\n",
ms->voices[bestv].chan_note));
#endif
ms->voices[bestv].chan_note = MS_CHANNOTE(chan, note);
ms->voices[bestv].seqno = ms->seqno++;
ms->voices[bestv].inuse = 1;
return (bestv);
}
@ -328,3 +340,79 @@ midisyn_note_to_freq(note)
return (f);
}
u_int32_t
midisyn_finetune(base_freq, bend, range, vibrato_cents)
u_int32_t base_freq;
int bend;
int range;
int vibrato_cents;
{
static u_int16_t semitone_tuning[24] =
{
/* 0 */ 10000, 10595, 11225, 11892, 12599, 13348, 14142, 14983,
/* 8 */ 15874, 16818, 17818, 18877, 20000, 21189, 22449, 23784,
/* 16 */ 25198, 26697, 28284, 29966, 31748, 33636, 35636, 37755
};
static u_int16_t cent_tuning[100] =
{
/* 0 */ 10000, 10006, 10012, 10017, 10023, 10029, 10035, 10041,
/* 8 */ 10046, 10052, 10058, 10064, 10070, 10075, 10081, 10087,
/* 16 */ 10093, 10099, 10105, 10110, 10116, 10122, 10128, 10134,
/* 24 */ 10140, 10145, 10151, 10157, 10163, 10169, 10175, 10181,
/* 32 */ 10187, 10192, 10198, 10204, 10210, 10216, 10222, 10228,
/* 40 */ 10234, 10240, 10246, 10251, 10257, 10263, 10269, 10275,
/* 48 */ 10281, 10287, 10293, 10299, 10305, 10311, 10317, 10323,
/* 56 */ 10329, 10335, 10341, 10347, 10353, 10359, 10365, 10371,
/* 64 */ 10377, 10383, 10389, 10395, 10401, 10407, 10413, 10419,
/* 72 */ 10425, 10431, 10437, 10443, 10449, 10455, 10461, 10467,
/* 80 */ 10473, 10479, 10485, 10491, 10497, 10503, 10509, 10515,
/* 88 */ 10521, 10528, 10534, 10540, 10546, 10552, 10558, 10564,
/* 96 */ 10570, 10576, 10582, 10589
};
u_int32_t amount;
int negative, semitones, cents, multiplier;
if (range == 0)
return base_freq;
if (base_freq == 0)
return base_freq;
if (range >= 8192)
range = 8192;
bend = bend * range / 8192;
bend += vibrato_cents;
if (bend == 0)
return base_freq;
if (bend < 0) {
bend = -bend;
negative = 1;
} else
negative = 0;
if (bend > range)
bend = range;
multiplier = 1;
while (bend > 2399) {
multiplier *= 4;
bend -= 2400;
}
semitones = bend / 100;
if (semitones > 99)
semitones = 99;
cents = bend % 100;
amount = semitone_tuning[semitones] * multiplier * cent_tuning[cents]
/ 10000;
if (negative)
return (base_freq * 10000 / amount); /* Bend down */
else
return (base_freq * amount / 10000); /* Bend up */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: midisynvar.h,v 1.1 1998/08/12 18:14:02 augustss Exp $ */
/* $NetBSD: midisynvar.h,v 1.2 1998/08/17 21:16:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -35,6 +35,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_DEV_MIDISYNVAR_H_
#define _SYS_DEV_MIDISYNVAR_H_
typedef struct midisyn midisyn;
struct midisyn_methods {
@ -54,10 +57,14 @@ struct midisyn_methods {
struct voice {
u_int chan_note; /* channel and note */
#define CHANNOTE(chan, note) ((chan) * 256 + (note))
#define MS_CHANNOTE(chan, note) ((chan) * 256 + (note))
#define MS_GETCHAN(v) ((v)->chan_note >> 8)
u_int seqno; /* allocation index (increases with time) */
u_char inuse;
};
#define MIDI_MAX_CHANS 16
struct midisyn {
/* Filled by synth driver */
struct midisyn_methods *mets;
@ -73,8 +80,17 @@ struct midisyn {
int pos;
struct voice *voices;
u_int seqno;
u_int16_t pgms[MIDI_MAX_CHANS];
};
void midisyn_attach __P((struct midi_softc *, midisyn *, struct device *));
#define MS_GETPGM(ms, vno) ((ms)->pgms[MS_GETCHAN(&(ms)->voices[vno])])
struct midi_softc;
extern struct midi_hw_if midisyn_hw_if;
void midisyn_attach __P((struct midi_softc *, midisyn *));
#define MIDISYN_FREQ_TO_HZ(f) ((f) >> 16)
#endif /* _SYS_DEV_MIDISYNVAR_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: midivar.h,v 1.3 1998/08/12 21:29:29 augustss Exp $ */
/* $NetBSD: midivar.h,v 1.4 1998/08/17 21:16:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -35,6 +35,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_DEV_MIDIVAR_H_
#define _SYS_DEV_MIDIVAR_H_
#define MIDI_BUFSIZE 1024
#include "sequencer.h"
@ -85,6 +88,4 @@ struct midi_softc {
#define MIDIUNIT(d) ((d) & 0xff)
int midi_unit_count __P((void));
void midi_getinfo __P((dev_t, struct midi_info *));
void midi_attach __P((struct midi_softc *, struct device *));
#endif /* _SYS_DEV_MIDIVAR_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: eap.c,v 1.15 1998/08/15 03:02:46 mycroft Exp $ */
/* $NetBSD: eap.c,v 1.16 1998/08/17 21:16:16 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -458,7 +458,7 @@ eap_attach(parent, self, aux)
ctl.un.mask = 1 << EAP_MIC_VOL;
eap_mixer_set_port(sc, &ctl);
audio_attach_mi(&eap_hw_if, 0, sc, &sc->sc_dev);
audio_attach_mi(&eap_hw_if, sc, &sc->sc_dev);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: sequencer.c,v 1.7 1998/08/13 15:50:57 augustss Exp $ */
/* $NetBSD: sequencer.c,v 1.8 1998/08/17 21:16:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -55,7 +55,7 @@
#include <sys/midiio.h>
#include <sys/device.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/midivar.h>
#include <dev/sequencervar.h>
@ -138,6 +138,7 @@ int midiseq_noteon __P((struct midi_dev *, int, int, int));
int midiseq_noteoff __P((struct midi_dev *, int, int, int));
int midiseq_keypressure __P((struct midi_dev *, int, int, int));
int midiseq_pgmchange __P((struct midi_dev *, int, int));
int midiseq_chnpressure __P((struct midi_dev *, int, int));
int midiseq_ctlchange __P((struct midi_dev *, int, int, int));
int midiseq_pitchbend __P((struct midi_dev *, int, int));
int midiseq_loadpatch __P((struct midi_dev *, struct sysex_info *,
@ -786,6 +787,9 @@ seq_do_chncommon(sc, b)
case MIDI_PITCH_BEND:
error = midiseq_pitchbend(md, chan, w14);
break;
case MIDI_CHN_PRESSURE:
error = midiseq_chnpressure(md, chan, p1);
break;
default:
DPRINTFN(-1,("seq_do_chncommon: unimpl command %02x\n", cmd));
error = EINVAL;
@ -1224,6 +1228,21 @@ midiseq_pgmchange(md, chan, parm)
return midiseq_out(md, buf, 2, 1);
}
int
midiseq_chnpressure(md, chan, parm)
struct midi_dev *md;
int chan, parm;
{
u_char buf[2];
if (chan < 0 || chan > 15 ||
parm < 0 || parm > 127)
return EINVAL;
buf[0] = MIDI_CHN_PRESSURE | chan;
buf[1] = parm;
return midiseq_out(md, buf, 2, 1);
}
int
midiseq_ctlchange(md, chan, parm, w14)
struct midi_dev *md;