void AudioOutputCoreConfBridge::on_property_changed (std::string key, GmConfEntry *entry) { std::string name; std::string file_name; bool enabled; if (key == AUDIO_DEVICES_KEY "output_device") { std::vector <AudioOutputDevice> devices; bool found = false; gchar* value = gm_conf_entry_get_string (entry); audiooutput_core.get_devices (devices); if (value != NULL) for (std::vector<AudioOutputDevice>::iterator it = devices.begin (); it < devices.end (); it++) if ((*it).GetString () == value) { found = true; break; } AudioOutputDevice device; if (found) device.SetFromString (value); else { if (!devices.empty()) device.SetFromString (devices.begin ()->GetString ()); else { // if there is no audio device / ptlib plugin, use fallback device below g_warning ("Error: no audio device found!"); device.type == ""; } } g_free (value); if ( (device.type == "" ) || (device.source == "") || (device.name == "" ) ) { PTRACE(1, "AudioOutputCore\tTried to set malformed device"); device.type = AUDIO_OUTPUT_FALLBACK_DEVICE_TYPE; device.source = AUDIO_OUTPUT_FALLBACK_DEVICE_SOURCE; device.name = AUDIO_OUTPUT_FALLBACK_DEVICE_NAME; } PTRACE(4, "AudioOutputCoreConfBridge\tSet device to " << device.source << "/" << device.name); audiooutput_core.set_device (primary, device); } if (key == SOUND_EVENTS_KEY "output_device") { PTRACE(4, "AudioOutputCoreConfBridge\tUpdating device"); AudioOutputDevice device; gchar* audio_device = gm_conf_entry_get_string (entry); if (audio_device == NULL) PTRACE(1, "AudioOutputCoreConfBridge\t" << AUDIO_DEVICES_KEY "output_device" << " is NULL"); else { device.SetFromString(audio_device); g_free (audio_device); } if ( (device.type == "") || (device.source == "") || (device.name == "") ) { PTRACE(1, "AudioOutputCore\tTried to set malformed device"); device.type = AUDIO_OUTPUT_FALLBACK_DEVICE_TYPE; device.source = AUDIO_OUTPUT_FALLBACK_DEVICE_SOURCE; device.name = AUDIO_OUTPUT_FALLBACK_DEVICE_NAME; } audiooutput_core.set_device (secondary, device); } if ( (key == SOUND_EVENTS_KEY "busy_tone_sound") || (key == SOUND_EVENTS_KEY "enable_busy_tone_sound") ) { gchar *c_file_name = NULL; c_file_name = gm_conf_get_string (SOUND_EVENTS_KEY "busy_tone_sound"); if (c_file_name == NULL) { PTRACE(1, "AudioOutputCoreConfBridge\t" << SOUND_EVENTS_KEY "busy_tone_sound" << " is NULL"); return; } name = "busy_tone_sound"; file_name = c_file_name; g_free (c_file_name); enabled = gm_conf_get_bool (SOUND_EVENTS_KEY "enable_busy_tone_sound"); audiooutput_core.map_event (name, file_name, primary, enabled); } if ( (key == SOUND_EVENTS_KEY "incoming_call_sound") || (key == SOUND_EVENTS_KEY "enable_incoming_call_sound") ) { gchar *c_file_name = NULL; c_file_name = gm_conf_get_string (SOUND_EVENTS_KEY "incoming_call_sound"); if (c_file_name == NULL) { PTRACE(1, "AudioOutputCoreConfBridge\t" << SOUND_EVENTS_KEY "incoming_call_sound" << " is NULL"); return; } name = "incoming_call_sound"; file_name = c_file_name; g_free (c_file_name); enabled = gm_conf_get_bool (SOUND_EVENTS_KEY "enable_incoming_call_sound"); audiooutput_core.map_event (name, file_name, secondary, enabled); } if ( (key == SOUND_EVENTS_KEY "new_message_sound") || (key == SOUND_EVENTS_KEY "enable_new_message_sound") ) { gchar *c_file_name = NULL; c_file_name = gm_conf_get_string (SOUND_EVENTS_KEY "new_message_sound"); if (c_file_name == NULL) { PTRACE(1, "AudioOutputCoreConfBridge\t" << SOUND_EVENTS_KEY "new_message_sound" << " is NULL"); return; } name = "new_message_sound"; file_name = c_file_name; g_free (c_file_name); enabled = gm_conf_get_bool (SOUND_EVENTS_KEY "enable_new_message_sound"); audiooutput_core.map_event (name, file_name, secondary, enabled); } if ( (key == SOUND_EVENTS_KEY "new_voicemail_sound") || (key == SOUND_EVENTS_KEY "enable_new_voicemail_sound") ) { gchar *c_file_name = NULL; c_file_name = gm_conf_get_string (SOUND_EVENTS_KEY "new_voicemail_sound"); if (c_file_name == NULL) { PTRACE(1, "AudioOutputCoreConfBridge\t" << SOUND_EVENTS_KEY "new_voicemail_sound" << " is NULL"); return; } name = "new_voicemail_sound"; file_name = c_file_name; g_free (c_file_name); enabled = gm_conf_get_bool (SOUND_EVENTS_KEY "enable_new_voicemail_sound"); audiooutput_core.map_event (name, file_name, secondary, enabled); } if ( (key == SOUND_EVENTS_KEY "ring_tone_sound") || (key == SOUND_EVENTS_KEY "enable_ring_tone_sound") ) { gchar *c_file_name = NULL; c_file_name = gm_conf_get_string (SOUND_EVENTS_KEY "ring_tone_sound"); if (c_file_name == NULL) { PTRACE(1, "AudioOutputCoreConfBridge\t" << SOUND_EVENTS_KEY "ring_tone_sound" << " is NULL"); return; } name = "ring_tone_sound"; file_name = c_file_name; g_free (c_file_name); enabled = gm_conf_get_bool (SOUND_EVENTS_KEY "enable_ring_tone_sound"); audiooutput_core.map_event (name, file_name, primary, enabled); } }