comparison src/audacious/input.c @ 3170:603577228518 trunk

get_current_input_playback() cleanups.
author William Pitcock <nenolod@atheme-project.org>
date Thu, 26 Jul 2007 14:22:26 -0500
parents 56121fc7a4cb
children 93d2cda7e072
comparison
equal deleted inserted replaced
3168:ee8a1ed30826 3170:603577228518
1 /* Audacious - Cross-platform multimedia player 1 /* Audacious - Cross-platform multimedia player
2 * Copyright (C) 2005-2006 Audacious development team 2 * Copyright (C) 2005-2007 Audacious development team
3 * 3 *
4 * Based on BMP: 4 * Based on BMP:
5 * Copyright (C) 2003-2004 BMP development team 5 * Copyright (C) 2003-2004 BMP development team
6 * 6 *
7 * Based on XMMS: 7 * Based on XMMS:
509 509
510 510
511 void 511 void
512 input_set_eq(gint on, gfloat preamp, gfloat * bands) 512 input_set_eq(gint on, gfloat preamp, gfloat * bands)
513 { 513 {
514 InputPlayback *playback;
515
514 if (!ip_data.playing) 516 if (!ip_data.playing)
515 return; 517 return;
516 518
517 if (!get_current_input_playback()) 519 if ((playback = get_current_input_playback()) == NULL)
518 return; 520 return;
519 521
520 if (get_current_input_playback()->plugin->set_eq) 522 if (playback->plugin->set_eq)
521 get_current_input_playback()->plugin->set_eq(on, preamp, bands); 523 playback->plugin->set_eq(on, preamp, bands);
522 } 524 }
523 525
524 void 526 void
525 input_get_song_info(const gchar * filename, gchar ** title, gint * length) 527 input_get_song_info(const gchar * filename, gchar ** title, gint * length)
526 { 528 {
762 } 764 }
763 765
764 void 766 void
765 input_get_volume(gint * l, gint * r) 767 input_get_volume(gint * l, gint * r)
766 { 768 {
769 InputPlayback *playback;
770
767 *l = -1; 771 *l = -1;
768 *r = -1; 772 *r = -1;
769 if (playback_get_playing()) { 773 if (playback_get_playing()) {
770 if (get_current_input_playback() && 774 if ((playback = get_current_input_playback()) != NULL &&
771 get_current_input_playback()->plugin->get_volume && 775 playback->plugin->get_volume &&
772 get_current_input_playback()->plugin->get_volume(l, r)) { 776 playback->plugin->get_volume(l, r))
773 return; 777 return;
774 }
775 } 778 }
776 output_get_volume(l, r); 779 output_get_volume(l, r);
777 } 780 }
778 781
779 void 782 void
780 input_set_volume(gint l, gint r) 783 input_set_volume(gint l, gint r)
781 { 784 {
785 InputPlayback *playback;
786
782 gint h_vol[2]; 787 gint h_vol[2];
783 788
784 if (playback_get_playing() &&
785 get_current_input_playback() &&
786 get_current_input_playback()->plugin->set_volume &&
787 get_current_input_playback()->plugin->set_volume(l, r))
788 return;
789
790 output_set_volume(l, r);
791
792 h_vol[0] = l; 789 h_vol[0] = l;
793 h_vol[1] = r; 790 h_vol[1] = r;
794 hook_call("volume set", h_vol); 791 hook_call("volume set", h_vol);
792
793 if (playback_get_playing() &&
794 (playback = get_current_input_playback()) != NULL &&
795 playback->plugin->set_volume &&
796 playback->plugin->set_volume(l, r))
797 return;
798
799 output_set_volume(l, r);
795 } 800 }
796 801
797 void 802 void
798 input_update_vis(gint time) 803 input_update_vis(gint time)
799 { 804 {