void capability_discoverer::dispatch_capabilities_changed(int wiimote, dolphiimote_callbacks callbacks) { dolphiimote_capability_status status = { 0 }; fill_capabilities(status, wiimote_states[wiimote]); if(callbacks.capabilities_changed) callbacks.capabilities_changed(wiimote, &status, callbacks.userdata); }
static int alsa_init (struct output_driver_caps *caps) { int err; if ((err = snd_mixer_open(&mixer_handle, 0)) < 0) { error ("Can't open ALSA mixer: %s", snd_strerror(err)); mixer_handle = NULL; } else if ((err = snd_mixer_attach(mixer_handle, options_get_str("AlsaDevice"))) < 0) { snd_mixer_close (mixer_handle); mixer_handle = NULL; error ("Can't attach mixer: %s", snd_strerror(err)); } else if ((err = snd_mixer_selem_register(mixer_handle, NULL, NULL)) < 0) { snd_mixer_close (mixer_handle); mixer_handle = NULL; error ("Can't register mixer: %s", snd_strerror(err)); } else if ((err = snd_mixer_load(mixer_handle)) < 0) { snd_mixer_close (mixer_handle); mixer_handle = NULL; error ("Can't load mixer: %s", snd_strerror(err)); } if (mixer_handle) { mixer_elem1 = alsa_init_mixer_channel ( options_get_str("AlsaMixer"), &mixer1_min, &mixer1_max); mixer_elem2 = alsa_init_mixer_channel ( options_get_str("AlsaMixer2"), &mixer2_min, &mixer2_max); } mixer_elem_curr = mixer_elem1 ? mixer_elem1 : mixer_elem2; if (mixer_elem_curr) { if (mixer_elem1 && (real_volume1 = alsa_read_mixer_raw(mixer_elem1)) != -1) volume1 = scale_volume1 (real_volume1); else { mixer_elem1 = NULL; mixer_elem_curr = mixer_elem2; } if (mixer_elem2 && (real_volume2 = alsa_read_mixer_raw(mixer_elem2)) != -1) volume2 = scale_volume2 (real_volume2); else { mixer_elem2 = NULL; mixer_elem_curr = mixer_elem1; } if (!mixer_elem_curr) { snd_mixer_close (mixer_handle); mixer_handle = NULL; } } else if (mixer_handle) { snd_mixer_close (mixer_handle); mixer_handle = NULL; } return fill_capabilities (caps); }