--- g15daemon-audacious-2.5.2/g15daemon_audacious_spectrum.c 2007-09-15 06:48:10.000000000 -0400 +++ g15daemon-audacious-2.5.2-new/g15daemon_audacious_spectrum.c 2007-12-31 00:01:24.000000000 -0500 @@ -39,10 +39,9 @@ #include #include -#include +#include #include #include -#include #include #include @@ -197,23 +196,23 @@ VisPlugin g15analyser_vp = { - NULL, - NULL, - 0, - PLUGIN_NAME " " PLUGIN_VERSION, - 1, - 1, - g15analyser_init, /* init */ - g15analyser_cleanup, /* cleanup */ - g15analyser_about, /* about */ - g15analyser_conf, /* configure */ - NULL, /* disable_plugin */ - g15analyser_playback_start, /* playback_start */ - g15analyser_playback_stop, /* playback_stop */ - g15analyser_render_pcm, /* render_pcm */ - g15analyser_render_freq /* render_freq */ + .description = PLUGIN_NAME " " PLUGIN_VERSION, + .num_pcm_chs_wanted = 1, + .num_freq_chs_wanted = 1, + .init = g15analyser_init, /* init */ + .cleanup = g15analyser_cleanup, /* cleanup */ + .about = g15analyser_about, /* about */ + .configure = g15analyser_conf, /* configure */ + .playback_start = g15analyser_playback_start, /* playback_start */ + .playback_stop = g15analyser_playback_stop, /* playback_stop */ + .render_pcm = g15analyser_render_pcm, /* render_pcm */ + .render_freq = g15analyser_render_freq /* render_freq */ }; +VisPlugin *g15_vp[] = { &g15analyser_vp, NULL }; + +SIMPLE_VISUAL_PLUGIN(g15, g15_vp); + gint g15analyser_disable(gpointer data){ g15analyser_vp.disable_plugin (&g15analyser_vp); /* disable if unusable */ return FALSE; @@ -223,6 +222,11 @@ return &g15analyser_vp; } +int get_main_volume() { + int tmpvol; + audacious_drct_get_main_volume(&tmpvol); + return tmpvol; +} void g15spectrum_read_config(void) { @@ -725,52 +729,52 @@ if(event.xkey.keycode==XKeysymToKeycode(dpy, XF86XK_AudioPlay)) { if(playing) { if (paused) { - xmms_remote_play(g15analyser_vp.xmms_session); + audacious_drct_play(); paused = 0; } else { - xmms_remote_pause(g15analyser_vp.xmms_session); + audacious_drct_pause(); paused = 1; } } else - xmms_remote_play(g15analyser_vp.xmms_session); + audacious_drct_play(); } if(event.xkey.keycode==XKeysymToKeycode(dpy, XF86XK_AudioStop)) - xmms_remote_stop(g15analyser_vp.xmms_session); + audacious_drct_stop(); if(event.xkey.keycode==XKeysymToKeycode(dpy, XF86XK_AudioLowerVolume)){ - volume = xmms_remote_get_main_volume(g15analyser_vp.xmms_session); + volume = get_main_volume(); if(volume<1) volume=1; - xmms_remote_set_main_volume(g15analyser_vp.xmms_session, --volume); + audacious_drct_set_main_volume(--volume); } if(event.xkey.keycode==XKeysymToKeycode(dpy, XF86XK_AudioRaiseVolume)){ - volume = xmms_remote_get_main_volume(g15analyser_vp.xmms_session); + volume = get_main_volume(); if(volume>99) volume=99; - xmms_remote_set_main_volume(g15analyser_vp.xmms_session, ++volume); + audacious_drct_set_main_volume(++volume); } if(event.xkey.keycode==XKeysymToKeycode(dpy, XF86XK_AudioMute)){ - if(xmms_remote_get_main_volume(g15analyser_vp.xmms_session)!=0){ - lastvolume = xmms_remote_get_main_volume(g15analyser_vp.xmms_session); + if(get_main_volume()!=0){ + volume = get_main_volume(); volume = 0; } else { volume = lastvolume; } - xmms_remote_set_main_volume(g15analyser_vp.xmms_session, volume); + audacious_drct_set_main_volume(volume); } if(event.xkey.keycode==XKeysymToKeycode(dpy, XF86XK_AudioNext)) if (playing) - xmms_remote_playlist_next(g15analyser_vp.xmms_session); + audacious_drct_playlist_next(); if(event.xkey.keycode==XKeysymToKeycode(dpy, XF86XK_AudioPrev)) if (playing) - xmms_remote_playlist_prev(g15analyser_vp.xmms_session); + audacious_drct_playlist_prev(); } return TRUE; @@ -790,11 +794,11 @@ pthread_mutex_lock (&g15buf_mutex); g15r_clearScreen (canvas, G15_COLOR_WHITE); - if (xmms_remote_get_playlist_length(g15analyser_vp.xmms_session) > 0) + if (audacious_drct_get_playlist_length() > 0) { - playlist_pos = xmms_remote_get_playlist_pos(g15analyser_vp.xmms_session); + playlist_pos = audacious_drct_get_playlist_pos(); - title = xmms_remote_get_playlist_title(g15analyser_vp.xmms_session, playlist_pos); + title = audacious_drct_get_playlist_title(playlist_pos); if(title!=NULL && show_title){ if (rownum != 1) { /* @@ -891,8 +895,8 @@ } } if (show_pbar){ - int output_time = xmms_remote_get_output_time(g15analyser_vp.xmms_session)/1000; - int playlist_time = xmms_remote_get_playlist_time(g15analyser_vp.xmms_session,playlist_pos)/1000; + int output_time = audacious_drct_get_output_time()/1000; + int playlist_time = audacious_drct_get_playlist_time(playlist_pos)/1000; /* bugfix: Sometimes xmms don't get the output time */ if (playlist_time == 0){ playlist_time = 1000; @@ -974,13 +978,13 @@ else g15r_renderString (canvas, (unsigned char *)"Playlist Empty", 0, G15_TEXT_LARGE, 24, 16); - if(lastvolume!=xmms_remote_get_main_volume(g15analyser_vp.xmms_session) || vol_timeout>=0) { - if(lastvolume!=xmms_remote_get_main_volume(g15analyser_vp.xmms_session)) + if(lastvolume!=get_main_volume() || vol_timeout>=0) { + if(lastvolume!=get_main_volume()) vol_timeout=10; else vol_timeout--; /* render volume */ - lastvolume = xmms_remote_get_main_volume(g15analyser_vp.xmms_session); + lastvolume = get_main_volume(); if (lastvolume >= 0) g15r_drawBar (canvas, 10, 15, 149, 28, G15_COLOR_BLACK, lastvolume, 100, 1); canvas->mode_xor=1; @@ -1193,4 +1197,3 @@ return; } -