Lines Matching refs:opl3
11 #include <sound/opl3.h>
60 static int snd_opl3_play_note(struct snd_opl3 * opl3, struct snd_dm_fm_note * note);
61 static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * voice);
62 static int snd_opl3_set_params(struct snd_opl3 * opl3, struct snd_dm_fm_params * params);
63 static int snd_opl3_set_mode(struct snd_opl3 * opl3, int mode);
64 static int snd_opl3_set_connection(struct snd_opl3 * opl3, int connection);
82 struct snd_opl3 *opl3 = hw->private_data;
85 if (snd_BUG_ON(!opl3))
96 info.fm_mode = opl3->fm_mode;
97 info.rhythm = opl3->rhythm;
107 snd_opl3_reset(opl3);
118 return snd_opl3_play_note(opl3, ¬e);
129 return snd_opl3_set_voice(opl3, &voice);
140 return snd_opl3_set_params(opl3, ¶ms);
147 return snd_opl3_set_mode(opl3, (int) arg);
153 return snd_opl3_set_connection(opl3, (int) arg);
157 snd_opl3_clear_patches(opl3);
174 struct snd_opl3 *opl3 = hw->private_data;
176 snd_opl3_reset(opl3);
187 struct snd_opl3 *opl3 = hw->private_data;
203 err = snd_opl3_load_patch(opl3, inst.prog, inst.bank, type,
241 int snd_opl3_load_patch(struct snd_opl3 *opl3,
250 patch = snd_opl3_find_patch(opl3, prog, bank, 1);
304 struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank,
311 for (patch = opl3->patch_table[key]; patch; patch = patch->next) {
323 patch->next = opl3->patch_table[key];
324 opl3->patch_table[key] = patch;
332 void snd_opl3_clear_patches(struct snd_opl3 *opl3)
337 for (patch = opl3->patch_table[i]; patch; patch = next) {
342 memset(opl3->patch_table, 0, sizeof(opl3->patch_table));
348 void snd_opl3_reset(struct snd_opl3 * opl3)
357 max_voices = (opl3->hardware < OPL3_HW_OPL3) ?
372 opl3->command(opl3, opl3_reg, OPL3_TOTAL_LEVEL_MASK); /* Operator 1 volume */
374 opl3->command(opl3, opl3_reg, OPL3_TOTAL_LEVEL_MASK); /* Operator 2 volume */
377 opl3->command(opl3, opl3_reg, 0x00); /* Note off */
380 opl3->max_voices = MAX_OPL2_VOICES;
381 opl3->fm_mode = SNDRV_DM_FM_MODE_OPL2;
383 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TEST, OPL3_ENABLE_WAVE_SELECT);
384 opl3->command(opl3, OPL3_LEFT | OPL3_REG_PERCUSSION, 0x00); /* Melodic mode */
385 opl3->rhythm = 0;
390 static int snd_opl3_play_note(struct snd_opl3 * opl3, struct snd_dm_fm_note * note)
400 if (note->voice >= ((opl3->fm_mode == SNDRV_DM_FM_MODE_OPL3) ?
418 opl3->command(opl3, opl3_reg, reg_val);
431 opl3->command(opl3, opl3_reg, reg_val);
437 static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * voice)
451 if (voice->voice >= ((opl3->fm_mode == SNDRV_DM_FM_MODE_OPL3) ?
488 opl3->command(opl3, opl3_reg, reg_val);
497 opl3->command(opl3, opl3_reg, reg_val);
506 opl3->command(opl3, opl3_reg, reg_val);
515 opl3->command(opl3, opl3_reg, reg_val);
523 if (opl3->fm_mode == SNDRV_DM_FM_MODE_OPL3) {
531 opl3->command(opl3, opl3_reg, reg_val);
536 opl3->command(opl3, opl3_reg, reg_val);
541 static int snd_opl3_set_params(struct snd_opl3 * opl3, struct snd_dm_fm_params * params)
549 opl3->command(opl3, OPL3_LEFT | OPL3_REG_KBD_SPLIT, reg_val);
561 opl3->rhythm = 1;
563 opl3->rhythm = 0;
577 opl3->command(opl3, OPL3_LEFT | OPL3_REG_PERCUSSION, reg_val);
581 static int snd_opl3_set_mode(struct snd_opl3 * opl3, int mode)
583 if ((mode == SNDRV_DM_FM_MODE_OPL3) && (opl3->hardware < OPL3_HW_OPL3))
586 opl3->fm_mode = mode;
587 if (opl3->hardware >= OPL3_HW_OPL3)
588 opl3->command(opl3, OPL3_RIGHT | OPL3_REG_CONNECTION_SELECT, 0x00); /* Clear 4-op connections */
593 static int snd_opl3_set_connection(struct snd_opl3 * opl3, int connection)
598 if (opl3->fm_mode != SNDRV_DM_FM_MODE_OPL3)
604 opl3->command(opl3, OPL3_RIGHT | OPL3_REG_CONNECTION_SELECT, reg_val);