comparison src/audtool/audtool_handlers_equalizer.c @ 4611:895297e46ee3

Cure some 'repetitive code syndromes' from audtool.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Jun 2008 01:25:22 +0300
parents ea194fd79267
children
comparison
equal deleted inserted replaced
4610:c9b0da38d07d 4611:895297e46ee3
62 { 62 {
63 int band; 63 int band;
64 64
65 if (argc < 2) 65 if (argc < 2)
66 { 66 {
67 audtool_whine("invalid parameters for %s.", argv[0]); 67 audtool_whine_args(argv[0], "<band>");
68 audtool_whine("syntax: %s <band>", argv[0]);
69 exit(1); 68 exit(1);
70 } 69 }
71 70
72 band = atoi(argv[1]); 71 band = atoi(argv[1]);
73 72
73 /* FIXME, XXX, TODO: we should have a function for requesting
74 * the actual number of bands, if we support dynamic amount some day ...
75 * -- ccr
76 */
74 if (band < 0 || band > 9) 77 if (band < 0 || band > 9)
75 { 78 {
76 audtool_whine("band number out of range"); 79 audtool_whine("band number out of range\n");
77 exit(1); 80 exit(1);
78 } 81 }
79 82
80 audtool_report("band %d = %.2f", band, audacious_remote_get_eq_band(dbus_proxy, band)); 83 audtool_report("band %d = %.2f", band, audacious_remote_get_eq_band(dbus_proxy, band));
81 84
87 GArray *bands = g_array_sized_new(FALSE, FALSE, sizeof(gdouble), 10); 90 GArray *bands = g_array_sized_new(FALSE, FALSE, sizeof(gdouble), 10);
88 int i; 91 int i;
89 92
90 if (argc < 12) 93 if (argc < 12)
91 { 94 {
92 audtool_whine("invalid parameters for %s.", argv[0]); 95 audtool_whine_args(argv[0], "<preamp> <band0> <band1> <band2> <band3> <band4> <band5> <band6> <band7> <band8> <band9>");
93 audtool_whine("syntax: %s <preamp> <band0> <band1> <band2> <band3> <band4> <band5> <band6> <band7> <band8> <band9>", argv[0]);
94 exit(1); 96 exit(1);
95 } 97 }
96 98
97 preamp = atof(argv[1]); 99 preamp = atof(argv[1]);
98 100
108 { 110 {
109 gdouble preamp; 111 gdouble preamp;
110 112
111 if (argc < 2) 113 if (argc < 2)
112 { 114 {
113 audtool_whine("invalid parameters for %s.", argv[0]); 115 audtool_whine_args(argv[0], "<preamp>");
114 audtool_whine("syntax: %s <preamp>", argv[0]);
115 exit(1); 116 exit(1);
116 } 117 }
117 118
118 preamp = atof(argv[1]); 119 preamp = atof(argv[1]);
119 120
125 int band; 126 int band;
126 gdouble preamp; 127 gdouble preamp;
127 128
128 if (argc < 3) 129 if (argc < 3)
129 { 130 {
130 audtool_whine("invalid parameters for %s.", argv[0]); 131 audtool_whine_args(argv[0], "<band> <value>");
131 audtool_whine("syntax: %s <band> <value>", argv[0]);
132 exit(1); 132 exit(1);
133 } 133 }
134 134
135 band = atoi(argv[1]); 135 band = atoi(argv[1]);
136 preamp = atof(argv[2]); 136 preamp = atof(argv[2]);
140 140
141 void equalizer_active(gint argc, gchar **argv) 141 void equalizer_active(gint argc, gchar **argv)
142 { 142 {
143 if (argc < 2) 143 if (argc < 2)
144 { 144 {
145 audtool_whine("invalid parameters for %s.", argv[0]); 145 audtool_whine_args(argv[0], "<on/off>");
146 audtool_whine("syntax: %s <on/off>", argv[0]);
147 exit(1); 146 exit(1);
148 } 147 }
149 148
150 if (!g_ascii_strcasecmp(argv[1], "on")) { 149 if (!g_ascii_strcasecmp(argv[1], "on")) {
151 audacious_remote_eq_activate(dbus_proxy, TRUE); 150 audacious_remote_eq_activate(dbus_proxy, TRUE);
152 return;
153 } 151 }
154 else if (!g_ascii_strcasecmp(argv[1], "off")) { 152 else if (!g_ascii_strcasecmp(argv[1], "off")) {
155 audacious_remote_eq_activate(dbus_proxy, FALSE); 153 audacious_remote_eq_activate(dbus_proxy, FALSE);
156 return;
157 } 154 }
158 } 155 }