Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Implement program change. From Martin Cernohorsk...



details:   https://anonhg.NetBSD.org/src/rev/06d7e248cee0
branches:  trunk
changeset: 476941:06d7e248cee0
user:      augustss <augustss%NetBSD.org@localhost>
date:      Mon Oct 04 19:31:39 1999 +0000

description:
Implement program change.  From Martin Cernohorsky <cerno%ics.muni.cz@localhost>.

diffstat:

 sys/dev/ic/opl.c |  27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diffs (76 lines):

diff -r 984f358b6a6c -r 06d7e248cee0 sys/dev/ic/opl.c
--- a/sys/dev/ic/opl.c  Mon Oct 04 19:31:05 1999 +0000
+++ b/sys/dev/ic/opl.c  Mon Oct 04 19:31:39 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: opl.c,v 1.8 1999/05/23 16:07:04 augustss Exp $ */
+/*     $NetBSD: opl.c,v 1.9 1999/10/04 19:31:39 augustss Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -80,8 +80,8 @@
 };
 
 struct opl_voice voicetab[] = {
-/*       No    I/O offs                OP1     OP2     OP3   OP4       */
-/*     ---------------------------------------------------     */
+/*       No    I/O offs        OP1     OP2     OP3   OP4       */
+/*     ---------------------------------------------   */
        { 0,   OPL_L,   {0x00,  0x03,   0x08, 0x0b}},
        { 1,   OPL_L,   {0x01,  0x04,   0x09, 0x0c}},
        { 2,   OPL_L,   {0x02,  0x05,   0x0a, 0x0d}},
@@ -117,6 +117,7 @@
 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_programchange __P((midisyn *, 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 *));
 
@@ -136,7 +137,7 @@
        oplsyn_noteoff,
        oplsyn_keypressure,
        oplsyn_ctlchange,
-       0,
+       oplsyn_programchange,
        0,
        oplsyn_pitchbend,
        0
@@ -237,7 +238,7 @@
                sc->model = OPL_2;
                break;
        default:
-               return 0;
+               return (0);
        }
 
        DPRINTFN(2,("opl_find: OPL%d at 0x%x detected\n", 
@@ -297,7 +298,7 @@
        u_int32_t f_num = freq / 3125;
        u_int32_t  block = 0;
 
-       while (f_num > 0x3FF && block < 8) {
+       while (f_num > 0x3ff && block < 8) {
                block++;
                f_num >>= 1;
        }
@@ -557,6 +558,20 @@
 #endif
 }
 
+/* PROGRAM CHANGE midi event: */
+void
+oplsyn_programchange(ms, chan, prog)
+       midisyn *ms;
+       u_int32_t chan;
+       u_int32_t prog;
+{
+       /* sanity checks */
+       if (chan >= MIDI_MAX_CHANS || prog >= OPL_NINSTR)
+               return;
+
+       ms->pgms[chan] = prog;
+}
+
 void
 oplsyn_pitchbend(ms, voice, parm, x)
        midisyn *ms;



Home | Main Index | Thread Index | Old Index