Lines Matching defs:opl3

25 int snd_opl3_synth_use_inc(struct snd_opl3 * opl3)
27 if (!try_module_get(opl3->card->module))
33 void snd_opl3_synth_use_dec(struct snd_opl3 * opl3)
35 module_put(opl3->card->module);
38 int snd_opl3_synth_setup(struct snd_opl3 * opl3)
41 struct snd_hwdep *hwdep = opl3->hwdep;
49 snd_opl3_reset(opl3);
52 opl3->voices[idx].state = SNDRV_OPL3_ST_OFF;
53 opl3->voices[idx].time = 0;
54 opl3->voices[idx].keyon_reg = 0x00;
56 opl3->use_time = 0;
57 opl3->connection_reg = 0x00;
58 if (opl3->hardware >= OPL3_HW_OPL3) {
60 opl3->command(opl3, OPL3_RIGHT | OPL3_REG_CONNECTION_SELECT,
61 opl3->connection_reg);
62 opl3->max_voices = MAX_OPL3_VOICES;
67 void snd_opl3_synth_cleanup(struct snd_opl3 * opl3)
72 scoped_guard(spinlock_irq, &opl3->sys_timer_lock) {
73 if (opl3->sys_timer_status) {
74 timer_delete(&opl3->tlist);
75 opl3->sys_timer_status = 0;
79 snd_opl3_reset(opl3);
80 hwdep = opl3->hwdep;
89 struct snd_opl3 *opl3 = private_data;
92 err = snd_opl3_synth_setup(opl3);
98 opl3->voices[6].state = opl3->voices[7].state =
99 opl3->voices[8].state = SNDRV_OPL3_ST_NOT_AVAIL;
100 snd_opl3_load_drums(opl3);
101 opl3->drum_reg = OPL3_PERCUSSION_ENABLE;
102 opl3->command(opl3, OPL3_LEFT | OPL3_REG_PERCUSSION, opl3->drum_reg);
104 opl3->drum_reg = 0x00;
108 err = snd_opl3_synth_use_inc(opl3);
112 opl3->synth_mode = SNDRV_OPL3_MODE_SEQ;
118 struct snd_opl3 *opl3 = private_data;
120 snd_opl3_synth_cleanup(opl3);
123 snd_opl3_synth_use_dec(opl3);
143 struct snd_opl3 *opl3 = private_data;
145 snd_midi_process_event(&opl3_ops, ev, opl3->chset);
153 struct snd_opl3 *opl3 = private_data;
155 snd_midi_channel_free_set(opl3->chset);
158 static int snd_opl3_synth_create_port(struct snd_opl3 * opl3)
164 voices = (opl3->hardware < OPL3_HW_OPL3) ?
166 opl3->chset = snd_midi_channel_alloc_set(16);
167 if (opl3->chset == NULL)
169 opl3->chset->private_data = opl3;
177 callbacks.private_data = opl3;
179 opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8;
182 opl3->chset->client = opl3->seq_client;
183 opl3->chset->port = snd_seq_event_port_attach(opl3->seq_client, &callbacks,
193 if (opl3->chset->port < 0) {
195 port = opl3->chset->port;
196 snd_midi_channel_free_set(opl3->chset);
207 struct snd_opl3 *opl3;
212 opl3 = *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
213 if (opl3 == NULL)
216 spin_lock_init(&opl3->voice_lock);
218 opl3->seq_client = -1;
221 opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8;
223 client = opl3->seq_client =
224 snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num,
229 err = snd_opl3_synth_create_port(opl3);
232 opl3->seq_client = -1;
237 timer_setup(&opl3->tlist, snd_opl3_timer_func, 0);
238 spin_lock_init(&opl3->sys_timer_lock);
239 opl3->sys_timer_status = 0;
242 snd_opl3_init_seq_oss(opl3, name);
250 struct snd_opl3 *opl3;
252 opl3 = *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
253 if (opl3 == NULL)
257 snd_opl3_free_seq_oss(opl3);
259 if (opl3->seq_client >= 0) {
260 snd_seq_delete_kernel_client(opl3->seq_client);
261 opl3->seq_client = -1;