/* trigger callback */ int snd_line6_capture_trigger(struct snd_line6_pcm *line6pcm, int cmd) { int err; switch (cmd) { case SNDRV_PCM_TRIGGER_START: #ifdef CONFIG_PM case SNDRV_PCM_TRIGGER_RESUME: #endif err = line6_pcm_start(line6pcm, MASK_PCM_ALSA_CAPTURE); if (err < 0) return err; break; case SNDRV_PCM_TRIGGER_STOP: #ifdef CONFIG_PM case SNDRV_PCM_TRIGGER_SUSPEND: #endif err = line6_pcm_stop(line6pcm, MASK_PCM_ALSA_CAPTURE); if (err < 0) return err; break; default: return -EINVAL; } return 0; }
/* "write" request on "impulse_volume" special file. */ static ssize_t pcm_set_impulse_volume(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct snd_line6_pcm *line6pcm = dev2pcm(dev); int value = simple_strtoul(buf, NULL, 10); line6pcm->impulse_volume = value; if (value > 0) line6_pcm_start(line6pcm, MASK_PCM_IMPULSE); else line6_pcm_stop(line6pcm, MASK_PCM_IMPULSE); return count; }
/* monitor put callback */ static int snd_toneport_monitor_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor) return 0; line6pcm->volume_monitor = ucontrol->value.integer.value[0]; if (line6pcm->volume_monitor > 0) line6_pcm_start(line6pcm, MASK_PCM_MONITOR); else line6_pcm_stop(line6pcm, MASK_PCM_MONITOR); return 1; }
static void toneport_start_pcm(unsigned long arg) { struct usb_line6_toneport *toneport = (struct usb_line6_toneport *)arg; struct usb_line6 *line6 = &toneport->line6; line6_pcm_start(line6->line6pcm, MASK_PCM_MONITOR); }