mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-29 05:40:25 -04:00
fixes/extension by Ross Vandegrift <ross@willow.seitz.com>:
* HW In level meters were broken * The last PCM Out meter was broken * S/PDIF channels can now be controlled with -s, --spdif * The Patchbay/Router and Analog Volume tabs now accurately reflect the number of requested channels in all cases.
This commit is contained in:
parent
fcf97f8e4c
commit
1febedba63
6 changed files with 110 additions and 14 deletions
|
|
@ -30,6 +30,15 @@ normally this will be of the form hw:\fIn\fP where \fIn\fP is the sound
|
|||
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
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#define _GNU_SOURCE
|
||||
#include <getopt.h>
|
||||
|
||||
int input_channels, output_channels, spdif_channels;
|
||||
ice1712_eeprom_t card_eeprom;
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
|
|
@ -329,8 +330,11 @@ static void create_mixer(GtkWidget *main, GtkWidget *notebook, int page)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +424,7 @@ static void create_router_frame(GtkWidget *box, int stream, int pos)
|
|||
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));
|
||||
|
|
@ -462,7 +466,11 @@ static void create_router(GtkWidget *main, GtkWidget *notebook, int page)
|
|||
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++);
|
||||
}
|
||||
|
|
@ -1360,7 +1368,12 @@ static void create_analog_volume(GtkWidget *main, GtkWidget *notebook, int page)
|
|||
|
||||
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)
|
||||
|
|
@ -1376,6 +1389,9 @@ 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'}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1386,7 +1402,10 @@ int main(int argc, char **argv)
|
|||
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);
|
||||
|
|
@ -1400,6 +1419,27 @@ int main(int argc, char **argv)
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ static GdkGC *penRedLight[21] = { NULL, };
|
|||
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;
|
||||
|
|
@ -195,7 +197,33 @@ gint level_meters_timeout_callback(gpointer data)
|
|||
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))
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
#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;
|
||||
|
|
@ -153,6 +155,10 @@ void mixer_postinit(void)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
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)
|
||||
{
|
||||
|
|
@ -69,7 +70,7 @@ void patchbay_update(void)
|
|||
{
|
||||
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);
|
||||
|
|
@ -135,7 +136,8 @@ void patchbay_init(void)
|
|||
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)
|
||||
|
|
@ -144,7 +146,7 @@ void patchbay_init(void)
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ static int dac_sense_items;
|
|||
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)
|
||||
{
|
||||
|
|
@ -310,7 +311,11 @@ void analog_volume_init(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);
|
||||
|
|
@ -338,7 +343,10 @@ void analog_volume_init(void)
|
|||
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);
|
||||
|
|
@ -366,7 +374,10 @@ void analog_volume_init(void)
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue