Update of /cvsroot/alsa/alsa-kernel/drivers/opl4
In directory sc8-pr-cvs1:/tmp/cvs-serv10681/drivers/opl4

Modified Files:
        opl4_local.h opl4_synth.c 
Log Message:
Clemens Ladisch <[EMAIL PROTECTED]>
OPL4 fixes
- cache more registers
- when initializing a voice, set the direct level bit to prevent
  interpolating from the previous level


Index: opl4_local.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/drivers/opl4/opl4_local.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- opl4_local.h        23 May 2003 11:15:12 -0000      1.1
+++ opl4_local.h        16 Jun 2003 07:32:08 -0000      1.2
@@ -163,8 +163,10 @@
        int note;
        int velocity;
        const opl4_sound_t *sound;
+       u8 level_direct;
        u8 reg_f_number;
        u8 reg_misc;
+       u8 reg_lfo_vibrato;
 } opl4_voice_t;
 
 struct opl4 {

Index: opl4_synth.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/drivers/opl4/opl4_synth.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- opl4_synth.c        23 May 2003 16:01:52 -0000      1.2
+++ opl4_synth.c        16 Jun 2003 07:32:08 -0000      1.3
@@ -267,11 +267,6 @@
          2,  2,  2,  1,  1,  0,  0,  0
 };
 
-static void snd_opl4_write_mask(opl4_t *opl4, u8 reg, u8 mask, u8 value)
-{
-       snd_opl4_write(opl4, reg, ((snd_opl4_read(opl4, reg)) & ~mask) | (value & 
mask));
-}
-
 /*
  * Initializes all voices.
  */
@@ -302,7 +297,8 @@
        int i;
 
        for (i = 0; i < OPL4_MAX_VOICES; i++)
-               snd_opl4_write_mask(opl4, OPL4_REG_MISC + i, OPL4_KEY_ON_BIT, 0);
+               snd_opl4_write(opl4, OPL4_REG_MISC + i,
+                              opl4->voices[i].reg_misc & ~OPL4_KEY_ON_BIT);
 }
 
 /*
@@ -378,7 +374,9 @@
                att = 0;
        else if (att > 0x7e)
                att = 0x7e;
-       snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number, att << 1);
+       snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number,
+                      (att << 1) | voice->level_direct);
+       voice->level_direct = 0;
 }
 
 static void snd_opl4_update_pan(opl4_t *opl4, opl4_voice_t *voice)
@@ -405,8 +403,10 @@
        depth = (7 - voice->sound->vibrato)
                * (voice->chan->control[MIDI_CTL_VIBRATO_DEPTH] & 0x7f);
        depth = (depth >> 7) + voice->sound->vibrato;
-       snd_opl4_write_mask(opl4, OPL4_REG_LFO_VIBRATO + voice->number,
-                           OPL4_VIBRATO_DEPTH_MASK, depth);
+       voice->reg_lfo_vibrato &= ~OPL4_VIBRATO_DEPTH_MASK;
+       voice->reg_lfo_vibrato |= depth & OPL4_VIBRATO_DEPTH_MASK;
+       snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number,
+                      voice->reg_lfo_vibrato);
 }
 
 static void snd_opl4_update_pitch(opl4_t *opl4, opl4_voice_t *voice)
@@ -441,8 +441,6 @@
 
 static void snd_opl4_update_tone_parameters(opl4_t *opl4, opl4_voice_t *voice)
 {
-       snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number,
-                      voice->sound->reg_lfo_vibrato);
        snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number,
                       voice->sound->reg_attack_decay1);
        snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number,
@@ -521,6 +519,7 @@
                voice[i]->reg_misc = OPL4_LFO_RESET_BIT;
                snd_opl4_update_pan(opl4, voice[i]);
                snd_opl4_update_pitch(opl4, voice[i]);
+               voice[i]->level_direct = OPL4_LEVEL_DIRECT_BIT;
                snd_opl4_update_volume(opl4, voice[i]);
        }
 
@@ -530,6 +529,7 @@
        /* set remaining parameters */
        for (i = 0; i < voices; i++) {
                snd_opl4_update_tone_parameters(opl4, voice[i]);
+               voice[i]->reg_lfo_vibrato = voice[i]->sound->reg_lfo_vibrato;
                snd_opl4_update_vibrato_depth(opl4, voice[i]);
        }
 



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to