viewgit/index.php:465 Only variables should be passed by reference [2048]
viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <pulse/pulseaudio.h> #include <libnotify/notify.h> /* Global variable to keep track of the main pulse audio loop */ pa_mainloop* mainloop; void success_callback(pa_context *c, int success, char* new_output) { /* Notify to the user that the switch was successful */ GError* error = NULL; char body[255]; if (strlen(new_output) < 200) sprintf(body, "New active output: %s", new_output); else strncpy(body, new_output, 255); NotifyNotification *notification = notify_notification_new ("Audio switched", body, "gnome-mixer"); notify_notification_show (notification, &error); /* Exit the pulseaudio mainloop */ pa_mainloop_quit(mainloop, success); } void toggle_mute(pa_context *c, pa_sink_info *i, void* user_data) { int j; if (i) { /* Cycle through available active ports. This should * rotate between headphones and/or analog output. */ for(j = 0; j < i->n_ports; j++) { if (i->active_port == i->ports[j]) { pa_context_set_sink_port_by_index(c, i->index, i->ports[(j + 1) % i->n_ports]->name, (pa_context_success_cb_t) success_callback, (char*) i->ports[(j+1) % i->n_ports]->description); } } } } void context_connected_cb(pa_context *c, void* user_data) { if (pa_context_get_state(c) == PA_CONTEXT_READY) { pa_context_get_sink_info_list(c, (pa_sink_info_cb_t) toggle_mute, NULL); } } int main() { mainloop = pa_mainloop_new(); pa_mainloop_api *api = pa_mainloop_get_api (mainloop); pa_context *c; pa_operation* operation; pa_operation_state_t state = PA_OPERATION_RUNNING; int retval; pa_proplist *proplist; notify_init ("AudioSwitch"); proplist = pa_proplist_new(); pa_proplist_sets(proplist, PA_PROP_DEVICE_API, "alsa"); c = pa_context_new_with_proplist(api, "Audio Switcher", proplist); /* Connect to the default Pulseaudio server, ask for * information about Front so we can check if it is * already muted or not. */ pa_context_connect(c, NULL, PA_CONTEXT_NOFLAGS, NULL); pa_context_set_state_callback(c, (pa_context_notify_cb_t) context_connected_cb, mainloop); /* Loop :) */ pa_mainloop_run(mainloop, &retval); return retval; }