/[openvortex]/alsa/alsa-kernel/drivers/opl4/opl4_synth.c
ViewVC logotype

Diff of /alsa/alsa-kernel/drivers/opl4/opl4_synth.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by vizard, Sun Jun 15 21:01:31 2003 UTC revision 1.2 by vizard, Mon Aug 11 00:06:39 2003 UTC
# Line 267  static unsigned char snd_opl4_volume_tab Line 267  static unsigned char snd_opl4_volume_tab
267            2,  2,  2,  1,  1,  0,  0,  0            2,  2,  2,  1,  1,  0,  0,  0
268  };  };
269    
 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));  
 }  
   
270  /*  /*
271   * Initializes all voices.   * Initializes all voices.
272   */   */
# Line 302  void snd_opl4_synth_shutdown(opl4_t *opl Line 297  void snd_opl4_synth_shutdown(opl4_t *opl
297          int i;          int i;
298    
299          for (i = 0; i < OPL4_MAX_VOICES; i++)          for (i = 0; i < OPL4_MAX_VOICES; i++)
300                  snd_opl4_write_mask(opl4, OPL4_REG_MISC + i, OPL4_KEY_ON_BIT, 0);                  snd_opl4_write(opl4, OPL4_REG_MISC + i,
301                                   opl4->voices[i].reg_misc & ~OPL4_KEY_ON_BIT);
302  }  }
303    
304  /*  /*
# Line 378  static void snd_opl4_update_volume(opl4_ Line 374  static void snd_opl4_update_volume(opl4_
374                  att = 0;                  att = 0;
375          else if (att > 0x7e)          else if (att > 0x7e)
376                  att = 0x7e;                  att = 0x7e;
377          snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number, att << 1);          snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number,
378                           (att << 1) | voice->level_direct);
379            voice->level_direct = 0;
380  }  }
381    
382  static void snd_opl4_update_pan(opl4_t *opl4, opl4_voice_t *voice)  static void snd_opl4_update_pan(opl4_t *opl4, opl4_voice_t *voice)
# Line 405  static void snd_opl4_update_vibrato_dept Line 403  static void snd_opl4_update_vibrato_dept
403          depth = (7 - voice->sound->vibrato)          depth = (7 - voice->sound->vibrato)
404                  * (voice->chan->control[MIDI_CTL_VIBRATO_DEPTH] & 0x7f);                  * (voice->chan->control[MIDI_CTL_VIBRATO_DEPTH] & 0x7f);
405          depth = (depth >> 7) + voice->sound->vibrato;          depth = (depth >> 7) + voice->sound->vibrato;
406          snd_opl4_write_mask(opl4, OPL4_REG_LFO_VIBRATO + voice->number,          voice->reg_lfo_vibrato &= ~OPL4_VIBRATO_DEPTH_MASK;
407                              OPL4_VIBRATO_DEPTH_MASK, depth);          voice->reg_lfo_vibrato |= depth & OPL4_VIBRATO_DEPTH_MASK;
408            snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number,
409                           voice->reg_lfo_vibrato);
410  }  }
411    
412  static void snd_opl4_update_pitch(opl4_t *opl4, opl4_voice_t *voice)  static void snd_opl4_update_pitch(opl4_t *opl4, opl4_voice_t *voice)
# Line 441  static void snd_opl4_update_pitch(opl4_t Line 441  static void snd_opl4_update_pitch(opl4_t
441    
442  static void snd_opl4_update_tone_parameters(opl4_t *opl4, opl4_voice_t *voice)  static void snd_opl4_update_tone_parameters(opl4_t *opl4, opl4_voice_t *voice)
443  {  {
         snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number,  
                        voice->sound->reg_lfo_vibrato);  
444          snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number,          snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number,
445                         voice->sound->reg_attack_decay1);                         voice->sound->reg_attack_decay1);
446          snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number,          snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number,
# Line 521  void snd_opl4_note_on(void *private_data Line 519  void snd_opl4_note_on(void *private_data
519                  voice[i]->reg_misc = OPL4_LFO_RESET_BIT;                  voice[i]->reg_misc = OPL4_LFO_RESET_BIT;
520                  snd_opl4_update_pan(opl4, voice[i]);                  snd_opl4_update_pan(opl4, voice[i]);
521                  snd_opl4_update_pitch(opl4, voice[i]);                  snd_opl4_update_pitch(opl4, voice[i]);
522                    voice[i]->level_direct = OPL4_LEVEL_DIRECT_BIT;
523                  snd_opl4_update_volume(opl4, voice[i]);                  snd_opl4_update_volume(opl4, voice[i]);
524          }          }
525    
# Line 530  void snd_opl4_note_on(void *private_data Line 529  void snd_opl4_note_on(void *private_data
529          /* set remaining parameters */          /* set remaining parameters */
530          for (i = 0; i < voices; i++) {          for (i = 0; i < voices; i++) {
531                  snd_opl4_update_tone_parameters(opl4, voice[i]);                  snd_opl4_update_tone_parameters(opl4, voice[i]);
532                    voice[i]->reg_lfo_vibrato = voice[i]->sound->reg_lfo_vibrato;
533                  snd_opl4_update_vibrato_depth(opl4, voice[i]);                  snd_opl4_update_vibrato_depth(opl4, voice[i]);
534          }          }
535    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26