comparison src/evdev-plug/ed.c @ 457:f5ed9a6ad3f1 trunk

[svn] - evdev-plug: added volume->mute and win->jumptofile actions
author giacomo
date Wed, 17 Jan 2007 09:14:03 -0800
parents f757e1aa62e6
children d124034ebea3
comparison
equal deleted inserted replaced
456:2e0b55117302 457:f5ed9a6ad3f1
40 void ed_action_pb_eject ( gpointer ); 40 void ed_action_pb_eject ( gpointer );
41 void ed_action_vol_up5 ( gpointer ); 41 void ed_action_vol_up5 ( gpointer );
42 void ed_action_vol_down5 ( gpointer ); 42 void ed_action_vol_down5 ( gpointer );
43 void ed_action_vol_up10 ( gpointer ); 43 void ed_action_vol_up10 ( gpointer );
44 void ed_action_vol_down10 ( gpointer ); 44 void ed_action_vol_down10 ( gpointer );
45 void ed_action_vol_mute ( gpointer );
45 void ed_action_win_main ( gpointer ); 46 void ed_action_win_main ( gpointer );
46 void ed_action_win_playlist ( gpointer ); 47 void ed_action_win_playlist ( gpointer );
47 void ed_action_win_equalizer ( gpointer ); 48 void ed_action_win_equalizer ( gpointer );
49 void ed_action_win_jtf ( gpointer );
48 void ed_action_pl_repeat ( gpointer ); 50 void ed_action_pl_repeat ( gpointer );
49 void ed_action_pl_shuffle ( gpointer ); 51 void ed_action_pl_shuffle ( gpointer );
50 52
51 /* map action codes to ed_action_t objects */ 53 /* map action codes to ed_action_t objects */
52 ed_action_t player_actions[] = 54 ed_action_t player_actions[] =
63 65
64 [ED_ACTION_VOL_UP5] = { N_("Volume->Up_5") , ed_action_vol_up5 }, 66 [ED_ACTION_VOL_UP5] = { N_("Volume->Up_5") , ed_action_vol_up5 },
65 [ED_ACTION_VOL_DOWN5] = { N_("Volume->Down_5") , ed_action_vol_down5 }, 67 [ED_ACTION_VOL_DOWN5] = { N_("Volume->Down_5") , ed_action_vol_down5 },
66 [ED_ACTION_VOL_UP10] = { N_("Volume->Up_10") , ed_action_vol_up10 }, 68 [ED_ACTION_VOL_UP10] = { N_("Volume->Up_10") , ed_action_vol_up10 },
67 [ED_ACTION_VOL_DOWN10] = { N_("Volume->Down_10") , ed_action_vol_down10 }, 69 [ED_ACTION_VOL_DOWN10] = { N_("Volume->Down_10") , ed_action_vol_down10 },
70 [ED_ACTION_VOL_MUTE] = { N_("Volume->Mute") , ed_action_vol_mute },
68 71
69 [ED_ACTION_WIN_MAIN] = { N_("Window->Main") , ed_action_win_main }, 72 [ED_ACTION_WIN_MAIN] = { N_("Window->Main") , ed_action_win_main },
70 [ED_ACTION_WIN_PLAYLIST] = { N_("Window->Playlist") , ed_action_win_playlist }, 73 [ED_ACTION_WIN_PLAYLIST] = { N_("Window->Playlist") , ed_action_win_playlist },
71 [ED_ACTION_WIN_EQUALIZER] = { N_("Window->Equalizer") , ed_action_win_equalizer } 74 [ED_ACTION_WIN_EQUALIZER] = { N_("Window->Equalizer") , ed_action_win_equalizer },
75 [ED_ACTION_WIN_JTF] = { N_("Window->JumpToFile") , ed_action_win_jtf }
72 }; 76 };
73 77
74 78
75 79
76 /* ***************** */ 80 /* ***************** */
219 xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr ); 223 xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr );
220 xmms_remote_set_volume( ed_gp.xmms_session , CLAMP(vl - 10, 0, 100) , CLAMP(vr - 10, 0, 100) ); 224 xmms_remote_set_volume( ed_gp.xmms_session , CLAMP(vl - 10, 0, 100) , CLAMP(vr - 10, 0, 100) );
221 } 225 }
222 226
223 void 227 void
228 ed_action_vol_mute ( gpointer param )
229 {
230 static gint vl = -1;
231 static gint vr = -1;
232
233 if ( vl == -1 ) /* no previous memory of volume before mute action */
234 {
235 xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr ); /* memorize volume before mute */
236 xmms_remote_set_volume( ed_gp.xmms_session , 0 , 0 ); /* mute */
237 }
238 else /* memorized volume values exist */
239 {
240 gint vl_now = 0;
241 gint vr_now = 0;
242
243 xmms_remote_get_volume( ed_gp.xmms_session , &vl_now , &vr_now );
244 if (( vl_now == 0 ) && ( vr_now == 0 ))
245 {
246 /* the volume is still muted, restore the old values */
247 xmms_remote_set_volume( ed_gp.xmms_session , vl , vr );
248 vl = -1; vr = -1; /* reset these for next use */
249 }
250 else
251 {
252 /* the volume has been raised with other commands, act as if there wasn't a previous memory */
253 xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr ); /* memorize volume before mute */
254 xmms_remote_set_volume( ed_gp.xmms_session , 0 , 0 ); /* mute */
255 }
256 }
257 }
258
259 void
224 ed_action_win_main ( gpointer param ) 260 ed_action_win_main ( gpointer param )
225 { 261 {
226 xmms_remote_main_win_toggle( ed_gp.xmms_session , 262 xmms_remote_main_win_toggle( ed_gp.xmms_session ,
227 !xmms_remote_is_main_win ( ed_gp.xmms_session ) ); 263 !xmms_remote_is_main_win ( ed_gp.xmms_session ) );
228 } 264 }
238 ed_action_win_equalizer ( gpointer param ) 274 ed_action_win_equalizer ( gpointer param )
239 { 275 {
240 xmms_remote_eq_win_toggle( ed_gp.xmms_session , 276 xmms_remote_eq_win_toggle( ed_gp.xmms_session ,
241 !xmms_remote_is_eq_win ( ed_gp.xmms_session ) ); 277 !xmms_remote_is_eq_win ( ed_gp.xmms_session ) );
242 } 278 }
279
280 void
281 ed_action_win_jtf ( gpointer param )
282 {
283 xmms_remote_show_jtf_box( ed_gp.xmms_session );
284 }