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