mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-29 05:40:25 -04:00
Dirk Kalis <Dirk.Kalis@t-online.de>
The second patch is for envy24control. this patch uses the new driver design. it is not necessary to give the parameters for inputs and/or outputs. only the available controls given by the driver will be displayed. this patch needs the kernel driver patch.
This commit is contained in:
parent
8e8896bcbe
commit
9a5420b76a
7 changed files with 236 additions and 65 deletions
|
|
@ -54,12 +54,16 @@ void control_input_callback(gpointer data, gint source, GdkInputCondition condit
|
|||
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"))
|
||||
|
|
|
|||
|
|
@ -32,13 +32,27 @@ 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 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
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#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;
|
||||
|
||||
|
|
@ -131,8 +131,10 @@ static void create_mixer_frame(GtkWidget *box, int stream)
|
|||
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)) {
|
||||
|
|
@ -145,12 +147,10 @@ static void create_mixer_frame(GtkWidget *box, int stream)
|
|||
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, "???");
|
||||
}
|
||||
|
|
@ -356,12 +356,25 @@ 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 <= 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)
|
||||
|
|
@ -374,6 +387,7 @@ 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",
|
||||
|
|
@ -397,16 +411,20 @@ static void create_router_frame(GtkWidget *box, int stream, int pos)
|
|||
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);
|
||||
|
|
@ -419,7 +437,6 @@ static void create_router_frame(GtkWidget *box, int stream, int pos)
|
|||
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));
|
||||
|
|
@ -437,7 +454,7 @@ static void create_router_frame(GtkWidget *box, int stream, int pos)
|
|||
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));
|
||||
|
|
@ -506,7 +523,7 @@ static void create_router(GtkWidget *main, GtkWidget *notebook, int page)
|
|||
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++);
|
||||
}
|
||||
|
|
@ -1643,12 +1660,14 @@ static void create_analog_volume(GtkWidget *main, GtkWidget *notebook, int page)
|
|||
|
||||
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)
|
||||
|
|
@ -1661,15 +1680,16 @@ 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'}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1682,8 +1702,10 @@ int main(int argc, char **argv)
|
|||
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);
|
||||
|
|
@ -1710,7 +1732,14 @@ int main(int argc, char **argv)
|
|||
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':
|
||||
|
|
@ -1720,6 +1749,9 @@ int main(int argc, char **argv)
|
|||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
view_spdif_playback = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
exit(1);
|
||||
|
|
@ -1763,10 +1795,14 @@ int main(int argc, char **argv)
|
|||
|
||||
/* 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));
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,20 @@
|
|||
/* 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] */
|
||||
|
|
@ -143,10 +153,12 @@ void level_meters_reset_peaks(GtkButton *button, gpointer data);
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ 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;
|
||||
extern int input_channels, output_channels, pcm_output_channels, spdif_channels, view_spdif_playback;
|
||||
|
||||
static void update_peak_switch(void)
|
||||
{
|
||||
|
|
@ -197,7 +197,7 @@ gint level_meters_timeout_callback(gpointer data)
|
|||
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))
|
||||
|
|
@ -210,7 +210,22 @@ gint level_meters_timeout_callback(gpointer data)
|
|||
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))
|
||||
|
|
@ -223,7 +238,8 @@ gint level_meters_timeout_callback(gpointer data)
|
|||
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))
|
||||
|
|
|
|||
|
|
@ -19,10 +19,21 @@
|
|||
|
||||
#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)
|
||||
{
|
||||
|
|
@ -33,13 +44,16 @@ void mixer_update_stream(int stream, int vol_flag, int sw_flag)
|
|||
{
|
||||
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);
|
||||
|
|
@ -54,8 +68,8 @@ void mixer_update_stream(int stream, int vol_flag, int sw_flag)
|
|||
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);
|
||||
|
|
@ -74,8 +88,8 @@ static void set_switch1(int stream, int left, int right)
|
|||
|
||||
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)) {
|
||||
|
|
@ -118,8 +132,8 @@ static void set_volume1(int stream, int left, int right)
|
|||
|
||||
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) {
|
||||
|
|
@ -151,14 +165,82 @@ void mixer_adjust(GtkAdjustment *adj, gpointer data)
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
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)
|
||||
{
|
||||
|
|
@ -45,9 +45,9 @@ static int get_toggle_index(int stream)
|
|||
}
|
||||
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);
|
||||
|
|
@ -55,13 +55,13 @@ static int get_toggle_index(int 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 */
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ void patchbay_update(void)
|
|||
{
|
||||
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);
|
||||
|
|
@ -93,7 +93,7 @@ static void set_routes(int stream, int idx)
|
|||
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 */
|
||||
|
|
@ -101,9 +101,9 @@ static void set_routes(int stream, int idx)
|
|||
|
||||
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);
|
||||
|
|
@ -131,12 +131,14 @@ int patchbay_stream_is_active(int 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);
|
||||
|
|
@ -144,15 +146,20 @@ void patchbay_init(void)
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue