Lines Matching refs:opl3

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; in snd_opl3_ioctl() local
85 if (snd_BUG_ON(!opl3)) in snd_opl3_ioctl()
96 info.fm_mode = opl3->fm_mode; in snd_opl3_ioctl()
97 info.rhythm = opl3->rhythm; in snd_opl3_ioctl()
107 snd_opl3_reset(opl3); in snd_opl3_ioctl()
118 return snd_opl3_play_note(opl3, &note); in snd_opl3_ioctl()
129 return snd_opl3_set_voice(opl3, &voice); in snd_opl3_ioctl()
140 return snd_opl3_set_params(opl3, &params); in snd_opl3_ioctl()
147 return snd_opl3_set_mode(opl3, (int) arg); in snd_opl3_ioctl()
153 return snd_opl3_set_connection(opl3, (int) arg); in snd_opl3_ioctl()
157 snd_opl3_clear_patches(opl3); in snd_opl3_ioctl()
162 dev_dbg(opl3->card->dev, "unknown IOCTL: 0x%x\n", cmd); in snd_opl3_ioctl()
172 struct snd_opl3 *opl3 = hw->private_data; in snd_opl3_release() local
174 snd_opl3_reset(opl3); in snd_opl3_release()
185 struct snd_opl3 *opl3 = hw->private_data; in snd_opl3_write() local
201 err = snd_opl3_load_patch(opl3, inst.prog, inst.bank, type, in snd_opl3_write()
239 int snd_opl3_load_patch(struct snd_opl3 *opl3, in snd_opl3_load_patch() argument
248 patch = snd_opl3_find_patch(opl3, prog, bank, 1); in snd_opl3_load_patch()
302 struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank, in snd_opl3_find_patch() argument
309 for (patch = opl3->patch_table[key]; patch; patch = patch->next) { in snd_opl3_find_patch()
321 patch->next = opl3->patch_table[key]; in snd_opl3_find_patch()
322 opl3->patch_table[key] = patch; in snd_opl3_find_patch()
330 void snd_opl3_clear_patches(struct snd_opl3 *opl3) in snd_opl3_clear_patches() argument
335 for (patch = opl3->patch_table[i]; patch; patch = next) { in snd_opl3_clear_patches()
340 memset(opl3->patch_table, 0, sizeof(opl3->patch_table)); in snd_opl3_clear_patches()
346 void snd_opl3_reset(struct snd_opl3 * opl3) in snd_opl3_reset() argument
355 max_voices = (opl3->hardware < OPL3_HW_OPL3) ? in snd_opl3_reset()
370 opl3->command(opl3, opl3_reg, OPL3_TOTAL_LEVEL_MASK); /* Operator 1 volume */ in snd_opl3_reset()
372 opl3->command(opl3, opl3_reg, OPL3_TOTAL_LEVEL_MASK); /* Operator 2 volume */ in snd_opl3_reset()
375 opl3->command(opl3, opl3_reg, 0x00); /* Note off */ in snd_opl3_reset()
378 opl3->max_voices = MAX_OPL2_VOICES; in snd_opl3_reset()
379 opl3->fm_mode = SNDRV_DM_FM_MODE_OPL2; in snd_opl3_reset()
381 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TEST, OPL3_ENABLE_WAVE_SELECT); in snd_opl3_reset()
382 opl3->command(opl3, OPL3_LEFT | OPL3_REG_PERCUSSION, 0x00); /* Melodic mode */ in snd_opl3_reset()
383 opl3->rhythm = 0; in snd_opl3_reset()
388 static int snd_opl3_play_note(struct snd_opl3 * opl3, struct snd_dm_fm_note * note) in snd_opl3_play_note() argument
398 if (note->voice >= ((opl3->fm_mode == SNDRV_DM_FM_MODE_OPL3) ? in snd_opl3_play_note()
416 opl3->command(opl3, opl3_reg, reg_val); in snd_opl3_play_note()
429 opl3->command(opl3, opl3_reg, reg_val); in snd_opl3_play_note()
435 static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * voice) in snd_opl3_set_voice() argument
449 if (voice->voice >= ((opl3->fm_mode == SNDRV_DM_FM_MODE_OPL3) ? in snd_opl3_set_voice()
486 opl3->command(opl3, opl3_reg, reg_val); in snd_opl3_set_voice()
495 opl3->command(opl3, opl3_reg, reg_val); in snd_opl3_set_voice()
504 opl3->command(opl3, opl3_reg, reg_val); in snd_opl3_set_voice()
513 opl3->command(opl3, opl3_reg, reg_val); in snd_opl3_set_voice()
521 if (opl3->fm_mode == SNDRV_DM_FM_MODE_OPL3) { in snd_opl3_set_voice()
529 opl3->command(opl3, opl3_reg, reg_val); in snd_opl3_set_voice()
534 opl3->command(opl3, opl3_reg, reg_val); in snd_opl3_set_voice()
539 static int snd_opl3_set_params(struct snd_opl3 * opl3, struct snd_dm_fm_params * params) in snd_opl3_set_params() argument
547 opl3->command(opl3, OPL3_LEFT | OPL3_REG_KBD_SPLIT, reg_val); in snd_opl3_set_params()
559 opl3->rhythm = 1; in snd_opl3_set_params()
561 opl3->rhythm = 0; in snd_opl3_set_params()
575 opl3->command(opl3, OPL3_LEFT | OPL3_REG_PERCUSSION, reg_val); in snd_opl3_set_params()
579 static int snd_opl3_set_mode(struct snd_opl3 * opl3, int mode) in snd_opl3_set_mode() argument
581 if ((mode == SNDRV_DM_FM_MODE_OPL3) && (opl3->hardware < OPL3_HW_OPL3)) in snd_opl3_set_mode()
584 opl3->fm_mode = mode; in snd_opl3_set_mode()
585 if (opl3->hardware >= OPL3_HW_OPL3) in snd_opl3_set_mode()
586 opl3->command(opl3, OPL3_RIGHT | OPL3_REG_CONNECTION_SELECT, 0x00); /* Clear 4-op connections */ in snd_opl3_set_mode()
591 static int snd_opl3_set_connection(struct snd_opl3 * opl3, int connection) in snd_opl3_set_connection() argument
596 if (opl3->fm_mode != SNDRV_DM_FM_MODE_OPL3) in snd_opl3_set_connection()
602 opl3->command(opl3, OPL3_RIGHT | OPL3_REG_CONNECTION_SELECT, reg_val); in snd_opl3_set_connection()