rate_reset_update();
else if (!strcmp(name, "Multi Playback Volume"))
mixer_update_stream(index + 1, 1, 0);
- else if (!strcmp(name, "Multi Capture Volume"))
+ else if (!strcmp(name, "H/W Multi Capture Volume"))
mixer_update_stream(index + 11, 1, 0);
+ else if (!strcmp(name, "IEC958 Multi Capture Volume"))
+ mixer_update_stream(index + 19, 1, 0);
else if (!strcmp(name, "Multi Playback Switch"))
mixer_update_stream(index + 1, 0, 1);
- else if (!strcmp(name, "Multi Capture Switch"))
+ else if (!strcmp(name, "H/W Multi Capture Switch"))
mixer_update_stream(index + 11, 0, 1);
+ else if (!strcmp(name, "IEC958 Multi Capture Switch"))
+ mixer_update_stream(index + 19, 0, 1);
else if (!strcmp(name, "H/W Playback Route"))
patchbay_update();
else if (!strcmp(name, "IEC958 Playback Route"))
card in your ALSA driver setup.
.TP
\fI-o\fP outputs
-Limit number of analog line outputs to display. Default is 8.
+Limit number of analog line outputs to display. Default is the number of
+DACs in the driver specification. Maximum is 8.
+The number of analog output lines can only be reduced from the available
+number of output lines.
.TP
\fI-i\fP inputs
-Limit number of analog line inputs to display. Default is 8.
+Limit number of analog line inputs to display. Default is the number of
+ADCS in the driver specification. Maximum is 8.
+The number of analog input lines can only be reduced from the available
+number of input lines.
.TP
-\fI-s\fP outputs
+\fI-p\fP pcm outputs
+Limit number of PCM outputs to display. Default is 8.
+.TP
+\fI-s\fP spdif inputs/outputs
Limit number of SPDIF inputs/outputs to display. Default is 2.
+.TP
+\fI-v\fP view spdif playback channels in the mixer.
+It is not possible to manage something (muting, volume levels).
+It is only to view the levelmeters.
+Default is '0' - no view. Set to other than '0' to view.
.SH SEE ALSO
\fB
#define _GNU_SOURCE
#include <getopt.h>
-int input_channels, output_channels, spdif_channels;
+int input_channels, output_channels, pcm_output_channels, spdif_channels, view_spdif_playback;
ice1712_eeprom_t card_eeprom;
snd_ctl_t *ctl;
GtkWidget *toggle;
char str[64], drawname[32];
- if (stream <= 10) {
+ if (stream <= MAX_PCM_OUTPUT_CHANNELS) {
sprintf(str, "PCM Out %i", stream);
+ } else if (stream <= (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS)) {
+ sprintf(str, "S/PDIF Out %s", stream & 1 ? "L": "R");
} else if ((card_eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE) && (stream == 11)) {
sprintf(str, "CD In L");
} else if ((card_eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE) && (stream == 12)) {
sprintf(str, "Phono/Mic In L");
} else if ((card_eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE) && (stream == 16)) {
sprintf(str, "Phono/Mic In R");
- } else if (stream <= 18) {
- sprintf(str, "H/W In %i", stream - 10);
- } else if (stream == 19) {
- strcpy(str, "S/PDIF In L");
- } else if (stream == 20) {
- strcpy(str, "S/PDIF In R");
+ } else if (stream <= (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS)) {
+ sprintf(str, "H/W In %i", stream - (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS));
+ } else if (stream <= (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS + MAX_SPDIF_CHANNELS)) {
+ sprintf(str, "S/PDIF In %s", stream & 1 ? "L": "R");
} else {
strcpy(str, "???");
}
gtk_widget_show(hbox);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
- 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);
+ for(stream = 1; stream <= pcm_output_channels; stream ++) {
+ if (mixer_stream_is_active(stream))
+ create_mixer_frame(hbox, stream);
+ }
+ for(stream = (MAX_PCM_OUTPUT_CHANNELS + 1); \
+ stream <= spdif_channels + MAX_PCM_OUTPUT_CHANNELS; stream ++) {
+ if (mixer_stream_is_active(stream) && view_spdif_playback)
+ create_mixer_frame(hbox, stream);
+ }
+ for(stream = (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + 1); \
+ stream <= input_channels + (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS); stream ++) {
+ if (mixer_stream_is_active(stream))
+ create_mixer_frame(hbox, stream);
+ }
+ for(stream = (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS + 1); \
+ stream <= spdif_channels + (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS); stream ++) {
+ if (mixer_stream_is_active(stream))
+ create_mixer_frame(hbox, stream);
+ }
}
static void create_router_frame(GtkWidget *box, int stream, int pos)
GSList *group = NULL;
char str[64], str1[64];
int idx;
+ int pcm_channel,s_pdif_channel;
static char *table[10] = {
"S/PDIF In L",
"S/PDIF In R",
table[7] = "Phono/Mic In R";
}
- if (stream <= 8) {
+ if (stream <= MAX_OUTPUT_CHANNELS) {
sprintf(str, "H/W Out %i (%s)", stream, stream & 1 ? "L" : "R");
- } else if (stream == 9) {
+ } else if (stream == (MAX_OUTPUT_CHANNELS + 1)) {
strcpy(str, "S/PDIF Out (L)");
- } else if (stream == 10) {
+ } else if (stream == (MAX_OUTPUT_CHANNELS + 2)) {
strcpy(str, "S/PDIF Out (R)");
} else {
strcpy(str, "???");
}
- sprintf(str1, "PCM Out %i", stream);
+ if ((stream == MAX_PCM_OUTPUT_CHANNELS + 1) || (stream == MAX_PCM_OUTPUT_CHANNELS + 2)) {
+ sprintf(str1, "S/PDIF Out (%s)", stream & 1 ? "L" : "R");
+ } else {
+ sprintf(str1, "PCM Out %i", stream);
+ }
frame = gtk_frame_new(str);
gtk_widget_show(frame);
gtk_container_add(GTK_CONTAINER(frame), vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
-
radiobutton = gtk_radio_button_new_with_label(group, str1);
router_radio[stream-1][0] = radiobutton;
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radiobutton));
label = gtk_label_new("");
gtk_widget_show(label);
- if(stream == 1 || stream == 2 || stream == 9 || stream == 10) {
+ if(stream <= MAX_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS) {
radiobutton = gtk_radio_button_new_with_label(group, stream & 1 ? "Digital Mix L" : "Digital Mix R");
router_radio[stream-1][1] = radiobutton;
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radiobutton));
if (patchbay_stream_is_active(stream))
create_router_frame(hbox, stream, pos++);
}
- for (stream = 8; stream <= 8 + spdif_channels; stream++) {
+ for (stream = MAX_OUTPUT_CHANNELS + 1; stream <= MAX_OUTPUT_CHANNELS + 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] [-o num-outputs] [-i num-inputs]\n");
+ fprintf(stderr, "usage: envy24control [-c card#] [-D control-name] [-o num-outputs] [-i num-inputs] [-p num-pcm-outputs] [-s num-spdif-in/outs] [-v]\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");
+ fprintf(stderr, "\t-o, --outputs\tLimit number of analog line outputs to display\n");
+ fprintf(stderr, "\t-i, --input\tLimit number of analog line inputs to display\n");
+ fprintf(stderr, "\t-p, --pcm_output\tLimit number of PCM outputs to display\n");
+ fprintf(stderr, "\t-s, --spdif\tLimit number of spdif inputs/outputs to display\n");
+ fprintf(stderr, "\t-v, --view_spdif_playback\tshows the spdif playback channels in the mixer\n");
}
int main(int argc, char **argv)
int npfds;
struct pollfd *pfds;
int page;
- int output_channels_set = 0;
int input_channels_set = 0;
+ int output_channels_set = 0;
static struct option long_options[] = {
{"device", 1, 0, 'D'},
{"card", 1, 0, 'c'},
{"inputs", 1, 0, 'i'},
{"outputs", 1, 0, 'o'},
+ {"pcm_outputs", 1, 0, 'p'},
{"spdif", 1, 0, 's'},
- {0, 0, 0, 0}
+ {"view_spdif_playback", 1, 0, 'v'}
};
name = "hw:0";
input_channels = MAX_INPUT_CHANNELS;
output_channels = MAX_OUTPUT_CHANNELS;
+ pcm_output_channels = MAX_PCM_OUTPUT_CHANNELS;
spdif_channels = MAX_SPDIF_CHANNELS;
- while ((c = getopt_long(argc, argv, "D:c:i:o:s:", long_options, NULL)) != -1) {
+ view_spdif_playback = 0;
+ while ((c = getopt_long(argc, argv, "D:c:i:o:p:s:v:", long_options, NULL)) != -1) {
switch (c) {
case 'c':
i = atoi(optarg);
if (output_channels < 0 || output_channels > MAX_OUTPUT_CHANNELS) {
fprintf(stderr, "envy24control: must have 0-%i outputs\n", MAX_OUTPUT_CHANNELS);
exit(1);
+ }
output_channels_set = 1;
+ break;
+ case 'p':
+ pcm_output_channels = atoi(optarg);
+ if (pcm_output_channels < 0 || pcm_output_channels > MAX_PCM_OUTPUT_CHANNELS) {
+ fprintf(stderr, "envy24control: must have 0-%i pcm outputs\n", MAX_PCM_OUTPUT_CHANNELS);
+ exit(1);
}
break;
case 's':
exit(1);
}
break;
+ case 'v':
+ view_spdif_playback = atoi(optarg);
+ break;
default:
usage();
exit(1);
/* Initialize code */
level_meters_init();
+ mixer_init();
patchbay_init();
hardware_init();
analog_volume_init();
+ fprintf(stderr, "using\t --- input_channels: %i\n\t --- output_channels: %i\n\t --- pcm_output_channels: %i\n\t --- spdif in/out channels: %i\n", \
+ input_channels, output_channels, pcm_output_channels, spdif_channels);
+
/* Make the title */
sprintf(title, "Envy24 Control Utility %s (%s)", VERSION, snd_ctl_card_info_get_longname(hw_info));
/* Hoontech */
#define ICE1712_SUBDEVICE_STDSP24 0x12141217 /* Hoontech SoundTrack Audio DSP 24 */
+/* max number of cards for alsa */
#define MAX_CARD_NUMBERS 8
+/* max number of HW input/output channels (analog lines)
+ * the number of available HW input/output channels is defined
+ * at 'adcs/dacs' in the driver
+ */
+/* max number of HW input channels (analog lines) */
#define MAX_INPUT_CHANNELS 8
+/* max number of HW output channels (analog lines) */
#define MAX_OUTPUT_CHANNELS 8
+/* max number of spdif input/output channels */
#define MAX_SPDIF_CHANNELS 2
+/* max number of PCM output channels */
+#define MAX_PCM_OUTPUT_CHANNELS 8
typedef struct {
unsigned int subvendor; /* PCI[2c-2f] */
void level_meters_init(void);
void level_meters_postinit(void);
+int mixer_stream_is_active(int stream);
void mixer_update_stream(int stream, int vol_flag, int sw_flag);
void mixer_toggled_solo(GtkWidget *togglebutton, gpointer data);
void mixer_toggled_mute(GtkWidget *togglebutton, gpointer data);
void mixer_adjust(GtkAdjustment *adj, gpointer data);
+void mixer_init(void);
void mixer_postinit(void);
int patchbay_stream_is_active(int stream);
static GdkPixmap *pixmap[21] = { NULL, };
static snd_ctl_elem_value_t *peaks;
-extern int input_channels, output_channels, spdif_channels;
+extern int input_channels, output_channels, pcm_output_channels, spdif_channels, view_spdif_playback;
static void update_peak_switch(void)
{
int idx, l1, l2;
update_peak_switch();
- for (idx = 0; idx <= output_channels; idx++) {
+ for (idx = 0; idx <= pcm_output_channels; idx++) {
get_levels(idx, &l1, &l2);
widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
if (!GTK_WIDGET_VISIBLE(widget))
0, 0,
widget->allocation.width, widget->allocation.height);
}
- for (idx = 11; idx <= input_channels + 10; idx++) {
+ if (view_spdif_playback) {
+ for (idx = MAX_PCM_OUTPUT_CHANNELS + 1; idx <= MAX_OUTPUT_CHANNELS + spdif_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 = MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + 1; idx <= input_channels + MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS; idx++) {
get_levels(idx, &l1, &l2);
widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
if (!GTK_WIDGET_VISIBLE(widget))
0, 0,
widget->allocation.width, widget->allocation.height);
}
- for (idx = 19; idx <= spdif_channels + 18; idx++) {
+ for (idx = MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS + 1; \
+ idx <= spdif_channels + MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS; idx++) {
get_levels(idx, &l1, &l2);
widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
if (!GTK_WIDGET_VISIBLE(widget))
#include "envy24control.h"
+#define MULTI_PLAYBACK_SWITCH "Multi Playback Switch"
+#define MULTI_PLAYBACK_VOLUME "Multi Playback Volume"
+
+#define HW_MULTI_CAPTURE_SWITCH "H/W Multi Capture Switch"
+#define IEC958_MULTI_CAPTURE_SWITCH "IEC958 Multi Capture Switch"
+
+#define HW_MULTI_CAPTURE_VOLUME "H/W Multi Capture Volume"
+#define IEC958_MULTI_CAPTURE_VOLUME "IEC958 Multi Capture Volume"
+
#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 stream_is_active[MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + \
+ MAX_INPUT_CHANNELS + MAX_SPDIF_CHANNELS];
+extern int input_channels, output_channels, pcm_output_channels, spdif_channels, view_spdif_playback;
static int is_active(GtkWidget *widget)
{
{
int err;
+ if (! stream_is_active[stream - 1])
+ return;
+
if (vol_flag) {
snd_ctl_elem_value_t *vol;
int v[2];
snd_ctl_elem_value_alloca(&vol);
snd_ctl_elem_value_set_interface(vol, SND_CTL_ELEM_IFACE_MIXER);
- snd_ctl_elem_value_set_name(vol, stream <= 10 ? "Multi Playback Volume" : "Multi Capture Volume");
- snd_ctl_elem_value_set_index(vol, (stream - 1) % 10);
+ snd_ctl_elem_value_set_name(vol, stream <= 10 ? MULTI_PLAYBACK_VOLUME : (stream <= 18 ? HW_MULTI_CAPTURE_VOLUME : IEC958_MULTI_CAPTURE_VOLUME));
+ snd_ctl_elem_value_set_index(vol, stream <= 18 ? (stream - 1) % 10 : (stream - 1) % 18 );
if ((err = snd_ctl_elem_read(ctl, vol)) < 0)
g_print("Unable to read multi playback volume: %s\n", snd_strerror(err));
v[0] = snd_ctl_elem_value_get_integer(vol, 0);
int v[2];
snd_ctl_elem_value_alloca(&sw);
snd_ctl_elem_value_set_interface(sw, SND_CTL_ELEM_IFACE_MIXER);
- snd_ctl_elem_value_set_name(sw, stream <= 10 ? "Multi Playback Switch" : "Multi Capture Switch");
- snd_ctl_elem_value_set_index(sw, (stream - 1) % 10);
+ snd_ctl_elem_value_set_name(sw, stream <= 10 ? MULTI_PLAYBACK_SWITCH : (stream <= 18 ? HW_MULTI_CAPTURE_SWITCH : IEC958_MULTI_CAPTURE_SWITCH));
+ snd_ctl_elem_value_set_index(sw, stream <= 18 ? (stream - 1) % 10 : (stream - 1) % 18 );
if ((err = snd_ctl_elem_read(ctl, sw)) < 0)
g_print("Unable to read multi playback switch: %s\n", snd_strerror(err));
v[0] = snd_ctl_elem_value_get_boolean(sw, 0);
snd_ctl_elem_value_alloca(&sw);
snd_ctl_elem_value_set_interface(sw, SND_CTL_ELEM_IFACE_MIXER);
- snd_ctl_elem_value_set_name(sw, stream <= 10 ? "Multi Playback Switch" : "Multi Capture Switch");
- snd_ctl_elem_value_set_index(sw, (stream - 1) % 10);
+ snd_ctl_elem_value_set_name(sw, stream <= 10 ? MULTI_PLAYBACK_SWITCH : (stream <= 18 ? HW_MULTI_CAPTURE_SWITCH : IEC958_MULTI_CAPTURE_SWITCH));
+ snd_ctl_elem_value_set_index(sw, stream <= 18 ? (stream - 1) % 10 : (stream - 1) % 18 );
if ((err = snd_ctl_elem_read(ctl, sw)) < 0)
g_print("Unable to read multi switch: %s\n", snd_strerror(err));
if (left >= 0 && left != snd_ctl_elem_value_get_boolean(sw, 0)) {
snd_ctl_elem_value_alloca(&vol);
snd_ctl_elem_value_set_interface(vol, SND_CTL_ELEM_IFACE_MIXER);
- snd_ctl_elem_value_set_name(vol, stream <= 10 ? "Multi Playback Volume" : "Multi Capture Volume");
- snd_ctl_elem_value_set_index(vol, (stream - 1) % 10);
+ snd_ctl_elem_value_set_name(vol, stream <= 10 ? MULTI_PLAYBACK_VOLUME : (stream <= 18 ? HW_MULTI_CAPTURE_VOLUME : IEC958_MULTI_CAPTURE_VOLUME));
+ snd_ctl_elem_value_set_index(vol, stream <= 18 ? (stream - 1) % 10 : (stream - 1) % 18 );
if ((err = snd_ctl_elem_read(ctl, vol)) < 0)
g_print("Unable to read multi volume: %s\n", snd_strerror(err));
if (left >= 0) {
set_volume1(stream, vol[0], vol[1]);
}
+int mixer_stream_is_active(int stream)
+{
+ return stream_is_active[stream - 1];
+}
+
+void mixer_init(void)
+{
+ int i;
+ int nb_active_channels;
+ snd_ctl_elem_value_t *val;
+
+ snd_ctl_elem_value_alloca(&val);
+ snd_ctl_elem_value_set_interface(val, SND_CTL_ELEM_IFACE_MIXER);
+ memset (stream_is_active, 0, (MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS + MAX_SPDIF_CHANNELS) * sizeof(int));
+ snd_ctl_elem_value_set_name(val, MULTI_PLAYBACK_SWITCH);
+ nb_active_channels = 0;
+ for (i = 0; i < pcm_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)
+ continue;
+
+ stream_is_active[i] = 1;
+ nb_active_channels++;
+ }
+ pcm_output_channels = nb_active_channels;
+ for (i = MAX_PCM_OUTPUT_CHANNELS; i < MAX_PCM_OUTPUT_CHANNELS + 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)
+ continue;
+ stream_is_active[i] = 1;
+ }
+ snd_ctl_elem_value_set_name(val, HW_MULTI_CAPTURE_SWITCH);
+ nb_active_channels = 0;
+ for (i = 0; i < input_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)
+ continue;
+
+ stream_is_active[i + MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS] = 1;
+ nb_active_channels++;
+ }
+ input_channels = nb_active_channels;
+ snd_ctl_elem_value_set_name(val, IEC958_MULTI_CAPTURE_SWITCH);
+ 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)
+ continue;
+ stream_is_active[i + MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS] = 1;
+ }
+}
+
void mixer_postinit(void)
{
int stream;
- for (stream = 1; stream <= output_channels; stream++)
- mixer_update_stream(stream, 1, 1);
- for (stream = 11; stream <= input_channels + 10; stream++)
- mixer_update_stream(stream, 1, 1);
- for (stream = 19; stream <= spdif_channels + 18; stream++)
- mixer_update_stream(stream, 1, 1);
+ for (stream = 1; stream <= pcm_output_channels; stream++) {
+ if (stream_is_active[stream - 1])
+ mixer_update_stream(stream, 1, 1);
+ }
+ for (stream = MAX_PCM_OUTPUT_CHANNELS + 1; \
+ stream <= MAX_PCM_OUTPUT_CHANNELS + spdif_channels; stream++) {
+ if (stream_is_active[stream - 1] && view_spdif_playback)
+ mixer_update_stream(stream, 1, 1);
+ }
+ for (stream = MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + 1; \
+ stream <= MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + input_channels; stream++) {
+ if (stream_is_active[stream - 1])
+ mixer_update_stream(stream, 1, 1);
+ }
+ for (stream = MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS + 1; \
+ stream <= MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS + spdif_channels; stream++) {
+ if (stream_is_active[stream - 1])
+ mixer_update_stream(stream, 1, 1);
+ }
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), state);
static int stream_active[MAX_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS];
-extern int output_channels, input_channels, spdif_channels;
+extern int output_channels, input_channels, pcm_output_channels, spdif_channels;
static int is_active(GtkWidget *widget)
{
}
snd_ctl_elem_value_alloca(&val);
snd_ctl_elem_value_set_interface(val, SND_CTL_ELEM_IFACE_MIXER);
- if (stream >= 8) {
+ if (stream >= MAX_OUTPUT_CHANNELS) {
snd_ctl_elem_value_set_name(val, SPDIF_PLAYBACK_ROUTE_NAME);
- snd_ctl_elem_value_set_index(val, stream - 8);
+ snd_ctl_elem_value_set_index(val, stream - MAX_OUTPUT_CHANNELS);
} else {
snd_ctl_elem_value_set_name(val, ANALOG_PLAYBACK_ROUTE_NAME);
snd_ctl_elem_value_set_index(val, stream);
if ((err = snd_ctl_elem_read(ctl, val)) < 0)
return 0;
out = snd_ctl_elem_value_get_enumerated(val, 0);
- if (out >= 11) {
- if (stream >= 8 || stream < 2)
+ if (out >= MAX_INPUT_CHANNELS + MAX_SPDIF_CHANNELS + 1) {
+ if (stream >= MAX_PCM_OUTPUT_CHANNELS || stream < MAX_SPDIF_CHANNELS)
return 1; /* digital mixer */
- } else if (out >= 9)
- return out - 9 + 2; /* spdif left (=2) / right (=3) */
+ } else if (out >= MAX_INPUT_CHANNELS + 1)
+ return out - (MAX_INPUT_CHANNELS + 1) + 2; /* spdif left (=2) / right (=3) */
else if (out >= 1)
- return out + 3; /* analog (4-) */
+ return out + spdif_channels + 1; /* analog (4-) */
return 0; /* pcm */
}
{
int stream, tidx;
- for (stream = 1; stream <= output_channels; stream++) {
+ for (stream = 1; stream <= (MAX_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS); stream++) {
if (stream_active[stream - 1]) {
tidx = get_toggle_index(stream);
toggle_set(router_radio[stream - 1][tidx], TRUE);
return;
out = 0;
if (idx == 1)
- out = 11;
+ out = MAX_INPUT_CHANNELS + MAX_SPDIF_CHANNELS + 1;
else if (idx == 2 || idx == 3) /* S/PDIF left & right */
out = idx + 7; /* 9-10 */
else if (idx >= 4) /* analog */
snd_ctl_elem_value_alloca(&val);
snd_ctl_elem_value_set_interface(val, SND_CTL_ELEM_IFACE_MIXER);
- if (stream >= 8) {
+ if (stream >= MAX_OUTPUT_CHANNELS) {
snd_ctl_elem_value_set_name(val, SPDIF_PLAYBACK_ROUTE_NAME);
- snd_ctl_elem_value_set_index(val, stream - 8);
+ snd_ctl_elem_value_set_index(val, stream - MAX_OUTPUT_CHANNELS);
} else {
snd_ctl_elem_value_set_name(val, ANALOG_PLAYBACK_ROUTE_NAME);
snd_ctl_elem_value_set_index(val, stream);
void patchbay_init(void)
{
int i;
+ int nb_active_channels;
snd_ctl_elem_value_t *val;
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);
memset (stream_active, 0, (MAX_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS) * sizeof(int));
+ nb_active_channels = 0;
for (i = 0; i < output_channels; i++) {
snd_ctl_elem_value_set_numid(val, 0);
snd_ctl_elem_value_set_index(val, i);
continue;
stream_active[i] = 1;
+ nb_active_channels++;
}
+ output_channels = nb_active_channels;
snd_ctl_elem_value_set_name(val, SPDIF_PLAYBACK_ROUTE_NAME);
+ nb_active_channels = 0;
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)
continue;
- stream_active[i + 8] = 1;
+ stream_active[i + MAX_OUTPUT_CHANNELS] = 1;
+ nb_active_channels++;
}
+ spdif_channels = nb_active_channels;
}
void patchbay_postinit(void)