Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Introduce "flags 1", which causes left and right ...



details:   https://anonhg.NetBSD.org/src/rev/8dcc76ec1021
branches:  trunk
changeset: 516992:8dcc76ec1021
user:      itohy <itohy%NetBSD.org@localhost>
date:      Sun Nov 04 06:44:31 2001 +0000

description:
Introduce "flags 1", which causes left and right channels swapped.

diffstat:

 sys/dev/ic/opl.c    |  22 ++++++++++++++++------
 sys/dev/ic/oplvar.h |  12 +++++++++---
 2 files changed, 25 insertions(+), 9 deletions(-)

diffs (80 lines):

diff -r f56505f974cc -r 8dcc76ec1021 sys/dev/ic/opl.c
--- a/sys/dev/ic/opl.c  Sun Nov 04 06:18:26 2001 +0000
+++ b/sys/dev/ic/opl.c  Sun Nov 04 06:44:31 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: opl.c,v 1.15 2001/10/23 17:58:15 augustss Exp $        */
+/*     $NetBSD: opl.c,v 1.16 2001/11/04 06:44:31 itohy Exp $   */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -165,13 +165,23 @@
        for (i = 0; i < OPL3_NVOICE; i++)
                sc->voices[i] = voicetab[i];
 
+       opl_reset(sc);
+
+       printf(": model OPL%d", sc->model);
+
        /* Set up panpot */
        for (i = 0; i < MIDI_MAX_CHANS; i++)
                sc->pan[i] = OPL_VOICE_TO_LEFT | OPL_VOICE_TO_RIGHT;
+       sc->panl = OPL_VOICE_TO_LEFT;
+       sc->panr = OPL_VOICE_TO_RIGHT;
+       if (sc->model == OPL_3 &&
+           sc->mididev.dev.dv_cfdata->cf_flags & OPL_FLAGS_SWAP_LR) {
+               sc->panl = OPL_VOICE_TO_RIGHT;
+               sc->panr = OPL_VOICE_TO_LEFT;
+               printf(": LR swapped");
+       }
 
-       opl_reset(sc);
-
-       printf(": model OPL%d\n", sc->model);
+       printf("\n");
 
        sc->sc_mididev =
            midi_attach_mi(&midisyn_hw_if, &sc->syn, &sc->mididev.dev);
@@ -585,8 +595,8 @@
        switch (parm) {
        case MIDI_CTRL_PAN_MSB:
                sc->pan[chan] =
-                   (w14 <= OPL_MIDI_CENTER_MAX ? OPL_VOICE_TO_LEFT : 0) |
-                   (w14 >= OPL_MIDI_CENTER_MIN ? OPL_VOICE_TO_RIGHT : 0);
+                   (w14 <= OPL_MIDI_CENTER_MAX ? sc->panl : 0) |
+                   (w14 >= OPL_MIDI_CENTER_MIN ? sc->panr : 0);
                break;
        }
 }
diff -r f56505f974cc -r 8dcc76ec1021 sys/dev/ic/oplvar.h
--- a/sys/dev/ic/oplvar.h       Sun Nov 04 06:18:26 2001 +0000
+++ b/sys/dev/ic/oplvar.h       Sun Nov 04 06:44:31 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oplvar.h,v 1.7 2001/10/23 13:09:43 itohy Exp $ */
+/*     $NetBSD: oplvar.h,v 1.8 2001/11/04 06:44:31 itohy Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -61,8 +61,7 @@
        struct opl_voice voices[OPL3_NVOICE];
        int volume;
        u_int8_t pan[MIDI_MAX_CHANS];
-#define OPL_MIDI_CENTER_MIN    (64 - 20)
-#define OPL_MIDI_CENTER_MAX    (64 + 20)
+       u_int8_t panl, panr;
 
        int     (*spkrctl)__P((void *, int));
        void    *spkrarg;
@@ -73,6 +72,13 @@
 #endif
 };
 
+/* for panpot */
+#define OPL_MIDI_CENTER_MIN    (64 - 20)
+#define OPL_MIDI_CENTER_MAX    (64 + 20)
+
+/* config flags */
+#define OPL_FLAGS_SWAP_LR      0x0001  /* swap L and R channels */
+
 struct opl_attach_arg {
        bus_space_tag_t iot;
        bus_space_handle_t ioh;



Home | Main Index | Thread Index | Old Index