/* $NetBSD: midisynvar.h,v 1.1 1998/08/12 18:14:02 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. */ typedef struct midisyn midisyn; struct midisyn_methods { int (*open) __P((midisyn *, int)); void (*close) __P((midisyn *)); int (*ioctl) __P((midisyn *, u_long, caddr_t, int, struct proc *)); int (*allocv) __P((midisyn *, u_int32_t, u_int32_t)); void (*noteon) __P((midisyn *, u_int32_t, u_int32_t, u_int32_t)); void (*noteoff) __P((midisyn *, u_int32_t, u_int32_t, u_int32_t)); void (*keypres) __P((midisyn *, u_int32_t, u_int32_t, u_int32_t)); void (*ctlchg) __P((midisyn *, u_int32_t, u_int32_t, u_int32_t)); void (*pgmchg) __P((midisyn *, u_int32_t, u_int32_t)); void (*chnpres) __P((midisyn *, u_int32_t, u_int32_t)); void (*pitchb) __P((midisyn *, u_int32_t, u_int32_t, u_int32_t)); void (*sysex) __P((midisyn *, u_int32_t)); }; struct voice { u_int chan_note; /* channel and note */ #define CHANNOTE(chan, note) ((chan) * 256 + (note)) u_int seqno; /* allocation index (increases with time) */ }; struct midisyn { /* Filled by synth driver */ struct midisyn_methods *mets; char name[32]; int nvoice; int flags; #define MS_DOALLOC 1 #define MS_FREQXLATE 2 void *data; /* Used by midisyn driver */ u_int8_t buf[3]; int pos; struct voice *voices; u_int seqno; }; void midisyn_attach __P((struct midi_softc *, midisyn *, struct device *)); #define MIDISYN_FREQ_TO_HZ(f) ((f) >> 16)