card number (zero-based). This is only needed if you have more than one
Envy24-based card or if your Envy24 card is not configured as the first
card in your ALSA driver setup.
+.TP
+\fI-o\fP outputs
+Limit number of outputs to display. Default is 8.
+.TP
+\fI-i\fP inputs
+Limit number of inputs to display. Default is 10.
+.TP
+\fI-s\fP outputs
+Limit number of SPDIF outputs to display. Default is 2.
.SH SEE ALSO
\fB
#define _GNU_SOURCE
#include <getopt.h>
+int input_channels, output_channels, spdif_channels;
ice1712_eeprom_t card_eeprom;
snd_ctl_t *ctl;
gtk_widget_show(hbox);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
-
- for (stream = 1; stream <= 20; stream++)
+ for(stream = 1; stream <= output_channels; stream ++)
+ create_mixer_frame(hbox, stream);
+ for(stream = 11; stream <= input_channels + 10; stream ++)
+ create_mixer_frame(hbox, stream);
+ for(stream = 19; stream <= spdif_channels + 18; stream ++)
create_mixer_frame(hbox, stream);
}
gtk_box_pack_start(GTK_BOX(vbox), hseparator, FALSE, TRUE, 0);
- for(idx = 0; idx < 10; idx++) {
+ for(idx = 2 - spdif_channels; idx < input_channels + 2; idx++) {
radiobutton = gtk_radio_button_new_with_label(group, table[idx]);
router_radio[stream-1][2+idx] = radiobutton;
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radiobutton));
gtk_container_add(GTK_CONTAINER(viewport), hbox);
pos = 0;
- for (stream = 1; stream <= 10; stream++) {
+ for (stream = 1; stream <= output_channels; stream++) {
+ if (patchbay_stream_is_active(stream))
+ create_router_frame(hbox, stream, pos++);
+ }
+ for (stream = 8; stream <= 8 + spdif_channels; stream++) {
if (patchbay_stream_is_active(stream))
create_router_frame(hbox, stream, pos++);
}
static void usage(void)
{
- fprintf(stderr, "usage: envy24control [-c card#] [-D control-name]\n");
+ fprintf(stderr, "usage: envy24control [-c card#] [-D control-name] [-o num-outputs] [-i num-inputs]\n");
+ fprintf(stderr, "\t-c, --card\tAlsa card number to control\n");
+ fprintf(stderr, "\t-D, --device\tcontrol-name\n");
+ fprintf(stderr, "\t-o, --outputs\tLimit number of outputs to display\n");
+ fprintf(stderr, "\t-i, --input\tLimit number of inputs to display\n");
+ fprintf(stderr, "\t-s, --spdif\tLimit number of spdif outputs to display\n");
}
int main(int argc, char **argv)
static struct option long_options[] = {
{"device", 1, 0, 'D'},
{"card", 1, 0, 'c'},
+ {"inputs", 1, 0, 'i'},
+ {"outputs", 1, 0, 'o'},
+ {"spdif", 1, 0, 's'}
};
gtk_init(&argc, &argv);
name = "hw:0";
- while ((c = getopt_long(argc, argv, "D:c:", long_options, NULL)) != -1) {
+ input_channels = 8;
+ output_channels = 10;
+ spdif_channels = 2;
+ while ((c = getopt_long(argc, argv, "D:c:i:o:s:", long_options, NULL)) != -1) {
switch (c) {
case 'c':
i = atoi(optarg);
case 'D':
name = optarg;
break;
+ case 'i':
+ input_channels = atoi(optarg);
+ if (input_channels < 0 || input_channels > 8) {
+ fprintf(stderr, "envy24control: must have 0-8 inputs\n");
+ exit(1);
+ }
+ break;
+ case 'o':
+ output_channels = atoi(optarg);
+ if (output_channels < 0 || output_channels > 10) {
+ fprintf(stderr, "envy24control: must have 0-10 outputs\n");
+ exit(1);
+ }
+ break;
+ case 's':
+ spdif_channels = atoi(optarg);
+ if (spdif_channels < 0 || spdif_channels > 2) {
+ fprintf(stderr, "envy24control: must have 0-2 spdifs\n");
+ exit(1);
+ }
+ break;
default:
usage();
exit(1);
static GdkPixmap *pixmap[21] = { NULL, };
static snd_ctl_elem_value_t *peaks;
+extern int input_channels, output_channels, spdif_channels;
+
static void update_peak_switch(void)
{
int err;
int idx, l1, l2;
update_peak_switch();
- for (idx = 0; idx <= 20; idx++) {
+ for (idx = 0; idx <= output_channels; idx++) {
+ get_levels(idx, &l1, &l2);
+ widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
+ if (!GTK_WIDGET_VISIBLE(widget))
+ continue;
+ redraw_meters(idx, widget->allocation.width, widget->allocation.height, l1, l2);
+ gdk_draw_pixmap(widget->window,
+ widget->style->black_gc,
+ pixmap[idx],
+ 0, 0,
+ 0, 0,
+ widget->allocation.width, widget->allocation.height);
+ }
+ for (idx = 11; idx <= input_channels + 10; idx++) {
+ get_levels(idx, &l1, &l2);
+ widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
+ if (!GTK_WIDGET_VISIBLE(widget))
+ continue;
+ redraw_meters(idx, widget->allocation.width, widget->allocation.height, l1, l2);
+ gdk_draw_pixmap(widget->window,
+ widget->style->black_gc,
+ pixmap[idx],
+ 0, 0,
+ 0, 0,
+ widget->allocation.width, widget->allocation.height);
+ }
+ for (idx = 19; idx <= spdif_channels + 18; idx++) {
get_levels(idx, &l1, &l2);
widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
if (!GTK_WIDGET_VISIBLE(widget))
#define toggle_set(widget, state) \
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), state);
+extern int input_channels, output_channels, spdif_channels;
+
static int is_active(GtkWidget *widget)
{
return GTK_TOGGLE_BUTTON(widget)->active ? 1 : 0;
{
int stream;
- for (stream = 1; stream <= 20; stream++)
+ for (stream = 1; stream <= output_channels; stream++)
+ mixer_update_stream(stream, 1, 1);
+ for (stream = 11; stream <= input_channels + 8; stream++)
+ mixer_update_stream(stream, 1, 1);
+ for (stream = 19; stream <= spdif_channels + 18; stream++)
mixer_update_stream(stream, 1, 1);
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), state);
static int stream_active[10];
+extern int output_channels, input_channels, spdif_channels;
static int is_active(GtkWidget *widget)
{
{
int stream, tidx;
- for (stream = 1; stream <= 10; stream++) {
+ for (stream = 1; stream <= output_channels; stream++) {
if (stream_active[stream - 1]) {
tidx = get_toggle_index(stream);
toggle_set(router_radio[stream - 1][tidx], TRUE);
snd_ctl_elem_value_alloca(&val);
snd_ctl_elem_value_set_interface(val, SND_CTL_ELEM_IFACE_MIXER);
snd_ctl_elem_value_set_name(val, ANALOG_PLAYBACK_ROUTE_NAME);
- for (i = 0; i < 8; i++) {
+ memset (stream_active, 0, 10 * sizeof(int));
+ for (i = 0; i < output_channels; i++) {
snd_ctl_elem_value_set_numid(val, 0);
snd_ctl_elem_value_set_index(val, i);
if (snd_ctl_elem_read(ctl, val) < 0)
stream_active[i] = 1;
}
snd_ctl_elem_value_set_name(val, SPDIF_PLAYBACK_ROUTE_NAME);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < spdif_channels; i++) {
snd_ctl_elem_value_set_numid(val, 0);
snd_ctl_elem_value_set_index(val, i);
if (snd_ctl_elem_read(ctl, val) < 0)
static int adc_sense_items;
static char *dac_sense_name[4];
static char *adc_sense_name[4];
+extern int input_channels, output_channels;
int envy_dac_volumes(void)
{
break;
dac_max = snd_ctl_elem_info_get_max(info);
}
- dac_volumes = i;
+ if (i < output_channels - 1)
+ dac_volumes = i;
+ else
+ dac_volumes = output_channels;
+
snd_ctl_elem_info_set_name(info, DAC_SENSE_NAME);
for (i = 0; i < dac_volumes; i++) {
snd_ctl_elem_info_set_numid(info, 0);
if (snd_ctl_elem_info(ctl, info) < 0)
break;
}
- adc_volumes = i;
+ if (i < input_channels - 1)
+ adc_volumes = i;
+ else
+ adc_volumes = input_channels;
snd_ctl_elem_info_set_name(info, ADC_SENSE_NAME);
for (i = 0; i < adc_volumes; i++) {
snd_ctl_elem_info_set_numid(info, 0);
if (snd_ctl_elem_info(ctl, info) < 0)
break;
}
- ipga_volumes = i;
+ if (i < input_channels - 1)
+ ipga_volumes = i;
+ else
+ ipga_volumes = input_channels;
}
void analog_volume_postinit(void)