Lines Matching refs:devc
78 static struct opl_devinfo *devc = NULL; variable
94 devc->cmask = 0x3f; /* Connect all possible 4 OP voice operators */ in enter_4op_mode()
95 opl3_command(devc->right_io, CONNECTION_SELECT_REGISTER, 0x3f); in enter_4op_mode()
108 devc->lv_map[i] = v4op[i]; in enter_4op_mode()
109 devc->v_alloc->max_voice = devc->nr_voice = 12; in enter_4op_mode()
128 devc->fm_info.nr_voices = (devc->nr_voice == 12) ? 6 : devc->nr_voice; in opl3_ioctl()
129 if (copy_to_user(arg, &devc->fm_info, sizeof(devc->fm_info))) in opl3_ioctl()
137 if (devc->model == 2) in opl3_ioctl()
162 if (devc != NULL) in opl3_detect()
168 devc = kzalloc(sizeof(*devc), GFP_KERNEL); in opl3_detect()
170 if (devc == NULL) in opl3_detect()
177 strcpy(devc->fm_info.name, "OPL2"); in opl3_detect()
179 if (!request_region(ioaddr, 4, devc->fm_info.name)) { in opl3_detect()
184 devc->base = ioaddr; in opl3_detect()
263 kfree(devc); in opl3_detect()
264 devc = NULL; in opl3_detect()
272 if (voice < 0 || voice >= devc->nr_voice) in opl3_kill_note()
275 devc->v_alloc->map[voice] = 0; in opl3_kill_note()
277 map = &pv_map[devc->lv_map[voice]]; in opl3_kill_note()
282 opl3_command(map->ioaddr, KEYON_BLOCK + map->voice_num, devc->voc[voice].keyon_byte & ~0x20); in opl3_kill_note()
283 devc->voc[voice].keyon_byte = 0; in opl3_kill_note()
284 devc->voc[voice].bender = 0; in opl3_kill_note()
285 devc->voc[voice].volume = 64; in opl3_kill_note()
286 devc->voc[voice].panning = 0xffff; /* Not set */ in opl3_kill_note()
287 devc->voc[voice].bender_range = 200; in opl3_kill_note()
288 devc->voc[voice].orig_freq = 0; in opl3_kill_note()
289 devc->voc[voice].current_freq = 0; in opl3_kill_note()
290 devc->voc[voice].mode = 0; in opl3_kill_note()
304 if (instr->key != FM_PATCH && (instr->key != OPL3_PATCH || devc->model != 2)) in store_instr()
306 memcpy((char *) &(devc->i_map[instr_no]), (char *) instr, sizeof(*instr)); in store_instr()
312 if (voice < 0 || voice >= devc->nr_voice) in opl3_set_instr()
317 devc->act_i[voice] = &devc->i_map[instr_no]; in opl3_set_instr()
376 if (voice < 0 || voice >= devc->nr_voice) in set_voice_volume()
379 map = &pv_map[devc->lv_map[voice]]; in set_voice_volume()
380 instr = devc->act_i[voice]; in set_voice_volume()
383 instr = &devc->i_map[0]; in set_voice_volume()
388 if (devc->voc[voice].mode == 0) in set_voice_volume()
391 if (devc->voc[voice].mode == 2) in set_voice_volume()
464 if (voice < 0 || voice >= devc->nr_voice) in opl3_start_note()
467 map = &pv_map[devc->lv_map[voice]]; in opl3_start_note()
468 pan = devc->voc[voice].panning; in opl3_start_note()
477 set_voice_volume(voice, volume, devc->voc[voice].volume); in opl3_start_note()
506 instr = devc->act_i[voice]; in opl3_start_note()
509 instr = &devc->i_map[0]; in opl3_start_note()
528 voice_shift = (map->ioaddr == devc->left_io) ? 0 : 3; in opl3_start_note()
536 devc->cmask &= ~(1 << voice_shift); in opl3_start_note()
540 devc->cmask |= (1 << voice_shift); in opl3_start_note()
543 opl3_command(devc->right_io, CONNECTION_SELECT_REGISTER, devc->cmask); in opl3_start_note()
644 devc->voc[voice].mode = voice_mode; in opl3_start_note()
645 set_voice_volume(voice, volume, devc->voc[voice].volume); in opl3_start_note()
647 freq = devc->voc[voice].orig_freq = note_to_freq(note) / 1000; in opl3_start_note()
654 …freq = compute_finetune(devc->voc[voice].orig_freq, devc->voc[voice].bender, devc->voc[voice].bend… in opl3_start_note()
655 devc->voc[voice].current_freq = freq; in opl3_start_note()
669 devc->voc[voice].keyon_byte = data; in opl3_start_note()
729 if (devc->model != 2) in opl3_command()
737 if (devc->model != 2) in opl3_command()
749 devc->lv_map[i] = i; in opl3_reset()
751 for (i = 0; i < devc->nr_voice; i++) in opl3_reset()
753 opl3_command(pv_map[devc->lv_map[i]].ioaddr, in opl3_reset()
754 KSL_LEVEL + pv_map[devc->lv_map[i]].op[0], 0xff); in opl3_reset()
756 opl3_command(pv_map[devc->lv_map[i]].ioaddr, in opl3_reset()
757 KSL_LEVEL + pv_map[devc->lv_map[i]].op[1], 0xff); in opl3_reset()
759 if (pv_map[devc->lv_map[i]].voice_mode == 4) in opl3_reset()
761 opl3_command(pv_map[devc->lv_map[i]].ioaddr, in opl3_reset()
762 KSL_LEVEL + pv_map[devc->lv_map[i]].op[2], 0xff); in opl3_reset()
764 opl3_command(pv_map[devc->lv_map[i]].ioaddr, in opl3_reset()
765 KSL_LEVEL + pv_map[devc->lv_map[i]].op[3], 0xff); in opl3_reset()
771 if (devc->model == 2) in opl3_reset()
773 devc->v_alloc->max_voice = devc->nr_voice = 18; in opl3_reset()
785 if (devc->busy) in opl3_open()
787 devc->busy = 1; in opl3_open()
789 devc->v_alloc->max_voice = devc->nr_voice = (devc->model == 2) ? 18 : 9; in opl3_open()
790 devc->v_alloc->timestamp = 0; in opl3_open()
794 devc->v_alloc->map[i] = 0; in opl3_open()
795 devc->v_alloc->alloc_times[i] = 0; in opl3_open()
798 devc->cmask = 0x00; /* in opl3_open()
801 if (devc->model == 2) in opl3_open()
802 opl3_command(devc->right_io, CONNECTION_SELECT_REGISTER, devc->cmask); in opl3_open()
808 devc->busy = 0; in opl3_close()
809 devc->v_alloc->max_voice = devc->nr_voice = (devc->model == 2) ? 18 : 9; in opl3_close()
811 devc->fm_info.nr_drums = 0; in opl3_close()
812 devc->fm_info.perc_mode = 0; in opl3_close()
848 if (voice < 0 || voice >= devc->nr_voice) in opl3_panning()
851 devc->voc[voice].panning = value; in opl3_panning()
870 if (voice < 0 || voice >= devc->nr_voice) in opl3_aftertouch()
873 map = &pv_map[devc->lv_map[voice]]; in opl3_aftertouch()
882 instr = devc->act_i[voice]; in opl3_aftertouch()
885 instr = &devc->i_map[0]; in opl3_aftertouch()
887 if (devc->voc[voice].mode == 4) in opl3_aftertouch()
937 map = &pv_map[devc->lv_map[voice]]; in bend_pitch()
942 devc->voc[voice].bender = value; in bend_pitch()
945 if (!(devc->voc[voice].keyon_byte & 0x20)) in bend_pitch()
950 …freq = compute_finetune(devc->voc[voice].orig_freq, devc->voc[voice].bender, devc->voc[voice].bend… in bend_pitch()
951 devc->voc[voice].current_freq = freq; in bend_pitch()
961 devc->voc[voice].keyon_byte = data; in bend_pitch()
967 if (voice < 0 || voice >= devc->nr_voice) in opl3_controller()
977 devc->voc[voice].bender_range = value; in opl3_controller()
981 devc->voc[voice].volume = value / 128; in opl3_controller()
985 devc->voc[voice].panning = (value * 2) - 128; in opl3_controller()
992 if (voice < 0 || voice >= devc->nr_voice) in opl3_bender()
1008 instr_no = devc->chn_info[chn].pgm_num; in opl3_alloc_voice()
1010 instr = &devc->i_map[instr_no]; in opl3_alloc_voice()
1012 devc->nr_voice != 12) /* Not in 4 OP mode */ in opl3_alloc_voice()
1014 else if (devc->nr_voice == 12) /* 4 OP mode */ in opl3_alloc_voice()
1026 if (devc->nr_voice == 12) /* 4 OP mode. Use the '2 OP only' operators first */ in opl3_alloc_voice()
1030 avail = devc->nr_voice; in opl3_alloc_voice()
1058 if (best > devc->nr_voice) in opl3_alloc_voice()
1059 best -= devc->nr_voice; in opl3_alloc_voice()
1068 if (voice < 0 || voice >= devc->nr_voice) in opl3_setup_voice()
1078 devc->voc[voice].bender = 0; in opl3_setup_voice()
1079 devc->voc[voice].bender_range = info->bender_range; in opl3_setup_voice()
1080 devc->voc[voice].volume = info->controllers[CTL_MAIN_VOLUME]; in opl3_setup_voice()
1081 devc->voc[voice].panning = (info->controllers[CTL_PAN] * 2) - 128; in opl3_setup_voice()
1115 if (devc == NULL) in opl3_init()
1127 devc->nr_voice = 9; in opl3_init()
1129 devc->fm_info.device = 0; in opl3_init()
1130 devc->fm_info.synth_type = SYNTH_TYPE_FM; in opl3_init()
1131 devc->fm_info.synth_subtype = FM_TYPE_ADLIB; in opl3_init()
1132 devc->fm_info.perc_mode = 0; in opl3_init()
1133 devc->fm_info.nr_voices = 9; in opl3_init()
1134 devc->fm_info.nr_drums = 0; in opl3_init()
1135 devc->fm_info.instr_bank_size = SBFM_MAXINSTR; in opl3_init()
1136 devc->fm_info.capabilities = 0; in opl3_init()
1137 devc->left_io = ioaddr; in opl3_init()
1138 devc->right_io = ioaddr + 2; in opl3_init()
1141 devc->model = 1; in opl3_init()
1144 devc->model = 2; in opl3_init()
1146 devc->is_opl4 = 1; in opl3_init()
1149 opl3_operations.info = &devc->fm_info; in opl3_init()
1157 devc->v_alloc = &opl3_operations.alloc; in opl3_init()
1158 devc->chn_info = &opl3_operations.chn_info[0]; in opl3_init()
1160 if (devc->model == 2) in opl3_init()
1162 if (devc->is_opl4) in opl3_init()
1163 strcpy(devc->fm_info.name, "Yamaha OPL4/OPL3 FM"); in opl3_init()
1165 strcpy(devc->fm_info.name, "Yamaha OPL3"); in opl3_init()
1167 devc->v_alloc->max_voice = devc->nr_voice = 18; in opl3_init()
1168 devc->fm_info.nr_drums = 0; in opl3_init()
1169 devc->fm_info.synth_subtype = FM_TYPE_OPL3; in opl3_init()
1170 devc->fm_info.capabilities |= SYNTH_CAP_OPL3; in opl3_init()
1175 pv_map[i].ioaddr = devc->left_io; in opl3_init()
1177 pv_map[i].ioaddr = devc->right_io; in opl3_init()
1179 opl3_command(devc->right_io, OPL3_MODE_REGISTER, OPL3_ENABLE); in opl3_init()
1180 opl3_command(devc->right_io, CONNECTION_SELECT_REGISTER, 0x00); in opl3_init()
1184 strcpy(devc->fm_info.name, "Yamaha OPL2"); in opl3_init()
1185 devc->v_alloc->max_voice = devc->nr_voice = 9; in opl3_init()
1186 devc->fm_info.nr_drums = 0; in opl3_init()
1189 pv_map[i].ioaddr = devc->left_io; in opl3_init()
1191 conf_printf2(devc->fm_info.name, ioaddr, 0, -1, -1); in opl3_init()
1194 devc->i_map[i].channel = -1; in opl3_init()
1224 if (devc && io != -1) in cleanup_opl3()
1226 if (devc->base) { in cleanup_opl3()
1227 release_region(devc->base,4); in cleanup_opl3()
1228 if (devc->is_opl4) in cleanup_opl3()
1229 release_region(devc->base - 8, 2); in cleanup_opl3()
1231 kfree(devc); in cleanup_opl3()
1232 devc = NULL; in cleanup_opl3()