void enable_vis_plugin(int i, gboolean enable) { GList *node = g_list_nth(vp_data->vis_list, i); VisPlugin *vp; if (!node || !(node->data)) return; vp = (VisPlugin *) node->data; if (enable && !g_list_find(vp_data->enabled_list, vp)) { vp_data->enabled_list = g_list_append(vp_data->enabled_list, vp); if (vp->init) vp->init(); if(get_input_playing() && vp->playback_start) vp->playback_start(); } else if (!enable && g_list_find(vp_data->enabled_list, vp)) { vp_data->enabled_list = g_list_remove(vp_data->enabled_list, vp); if(get_input_playing() && vp->playback_stop) vp->playback_stop(); if (vp->cleanup) vp->cleanup(); } }
void vis_enable_from_stringified_list(gchar * list) { gchar **plugins, *base; GList *node; gint i; VisPlugin *vp; if (!list || !strcmp(list, "")) return; plugins = g_strsplit(list, ",", 0); for(i = 0; plugins[i]; i++) { node = vp_data->vis_list; while (node) { base = xmms_g_basename(((VisPlugin *) node->data)->filename); if (!strcmp(plugins[i], base)) { vp = node->data; vp_data->enabled_list = g_list_append(vp_data->enabled_list, (VisPlugin *) vp); if(vp->init) vp->init(); if(get_input_playing() && vp->playback_start) vp->playback_start(); } node = node->next; } } g_strfreev(plugins); }
void vis_playback_start(void) { GList *node = vp_data->enabled_list; VisPlugin *vp; if(vp_data->playback_started) return; while(node) { vp = node->data; if(vp->playback_start) vp->playback_start(); node = g_list_next(node); } vp_data->playback_started = TRUE; }
gint disable_projectm(void *something) { projectM_vtable.disable_plugin(&projectM_vtable); return 0; }
static gint disable_func(gpointer data) { oglspectrum_vp.disable_plugin(&oglspectrum_vp); return FALSE; }
static void sanalyzer_destroy_cb(GtkWidget *w,gpointer data) { sanalyzer_vp.disable_plugin(&sanalyzer_vp); }
void vis_send_data(gint16 pcm_data[2][512], int nch, int length) { GList *node = vp_data->enabled_list; VisPlugin *vp; gint16 mono_freq[2][256], stereo_freq[2][256]; gboolean mono_freq_calced = FALSE, stereo_freq_calced = FALSE; gint16 mono_pcm[2][512], stereo_pcm[2][512]; gboolean mono_pcm_calced = FALSE, stereo_pcm_calced = FALSE; gint8 intern_vis_data[512]; gint i; if (!pcm_data || nch < 1) { if (cfg.vis_type != VIS_OFF) { if (cfg.player_shaded && cfg.player_visible) svis_timeout_func(mainwin_svis, NULL); else vis_timeout_func(active_vis, NULL); } return; } while (node) { vp = node->data; if (vp->num_pcm_chs_wanted > 0 && vp->render_pcm) { if (vp->num_pcm_chs_wanted == 1) { if (!mono_pcm_calced) { calc_mono_pcm(mono_pcm, pcm_data, nch); mono_pcm_calced = TRUE; } vp->render_pcm(mono_pcm); } else { if (!stereo_pcm_calced) { calc_stereo_pcm(stereo_pcm, pcm_data, nch); stereo_pcm_calced = TRUE; } vp->render_pcm(stereo_pcm); } } if (vp->num_freq_chs_wanted > 0 && vp->render_freq) { if (vp->num_freq_chs_wanted == 1) { if (!mono_freq_calced) { calc_mono_freq(mono_freq, pcm_data, nch); mono_freq_calced = TRUE; } vp->render_freq(mono_freq); } else { if (!stereo_freq_calced) { calc_stereo_freq(stereo_freq, pcm_data, nch); stereo_freq_calced = TRUE; } vp->render_freq(stereo_freq); } } node = g_list_next(node); } if (cfg.vis_type == VIS_OFF) return; if (cfg.vis_type == VIS_ANALYZER) { if (cfg.player_shaded && cfg.player_visible) { /* VU */ gint vu ,val; if (!stereo_pcm_calced) calc_stereo_pcm(stereo_pcm, pcm_data, nch); vu = 0; for (i = 0; i < 512; i++) { val = abs(stereo_pcm[0][i]); if (val > vu) vu = val; } intern_vis_data[0] = (vu * 37) >> 15; if (intern_vis_data[0] > 37) intern_vis_data[0] = 37; if (nch == 2) { vu = 0; for (i = 0; i < 512; i++) { val = abs(stereo_pcm[1][i]); if (val > vu) vu = val; } intern_vis_data[1] = (vu * 37) >> 15; if (intern_vis_data[1] > 37) intern_vis_data[1] = 37; } else