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 |
*/ |
*/ |
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 |
/* |
/* |
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) |
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) |
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, |
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 |
|
|
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 |
|
|