| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#include "gtkhelper.h" |
| 5 |
#include "iface-no-mixer.h" |
| 6 |
#include "stringhelper.h" |
| 7 |
#include "tooltips.h" |
| 8 |
#include "widget-boolean.h" |
| 9 |
#include "widget-drop-down.h" |
| 10 |
#include "window-helper.h" |
| 11 |
#include "window-startup.h" |
| 12 |
|
| 13 |
GtkWidget *create_iface_no_mixer_main(struct alsa_card *card) { |
| 14 |
GPtrArray *elems = card->elems; |
| 15 |
|
| 16 |
GtkWidget *top = gtk_frame_new(NULL); |
| 17 |
gtk_widget_add_css_class(top, "window-frame"); |
| 18 |
|
| 19 |
GtkWidget *content = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 15); |
| 20 |
gtk_widget_add_css_class(content, "window-content"); |
| 21 |
gtk_widget_add_css_class(content, "iface-no-mixer"); |
| 22 |
gtk_frame_set_child(GTK_FRAME(top), content); |
| 23 |
|
| 24 |
GtkWidget *input_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 25 |
GtkWidget *output_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 26 |
gtk_box_append(GTK_BOX(content), input_box); |
| 27 |
gtk_box_append(GTK_BOX(content), output_box); |
| 28 |
|
| 29 |
GtkWidget *label_ic = gtk_label_new("Input Controls"); |
| 30 |
GtkWidget *label_oc = gtk_label_new("Output Controls"); |
| 31 |
|
| 32 |
gtk_widget_add_css_class(label_ic, "controls-label"); |
| 33 |
gtk_widget_add_css_class(label_oc, "controls-label"); |
| 34 |
|
| 35 |
gtk_widget_set_halign(label_ic, GTK_ALIGN_START); |
| 36 |
gtk_widget_set_halign(label_oc, GTK_ALIGN_START); |
| 37 |
|
| 38 |
gtk_box_append(GTK_BOX(input_box), label_ic); |
| 39 |
gtk_box_append(GTK_BOX(output_box), label_oc); |
| 40 |
|
| 41 |
GtkWidget *input_grid = gtk_grid_new(); |
| 42 |
gtk_grid_set_spacing(GTK_GRID(input_grid), 10); |
| 43 |
gtk_widget_add_css_class(input_grid, "controls-content"); |
| 44 |
gtk_widget_set_vexpand(input_grid, TRUE); |
| 45 |
gtk_box_append(GTK_BOX(input_box), input_grid); |
| 46 |
|
| 47 |
GtkWidget *output_grid = gtk_grid_new(); |
| 48 |
gtk_grid_set_spacing(GTK_GRID(output_grid), 10); |
| 49 |
gtk_widget_add_css_class(output_grid, "controls-content"); |
| 50 |
gtk_widget_set_vexpand(output_grid, TRUE); |
| 51 |
gtk_box_append(GTK_BOX(output_box), output_grid); |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
int is_solo = !!get_elem_by_name( |
| 57 |
elems, "Line In 1 Phantom Power Capture Switch" |
| 58 |
); |
| 59 |
|
| 60 |
for (int i = 0; i < 2; i++) { |
| 61 |
char s[20]; |
| 62 |
snprintf(s, 20, "%d", i + 1); |
| 63 |
GtkWidget *label = gtk_label_new(s); |
| 64 |
gtk_grid_attach(GTK_GRID(input_grid), label, i, 0, 1, 1); |
| 65 |
} |
| 66 |
|
| 67 |
for (int i = 0; i < elems->len; i++) { |
| 68 |
struct alsa_elem *elem = g_ptr_array_index(elems, i); |
| 69 |
GtkWidget *w; |
| 70 |
|
| 71 |
|
| 72 |
if (!elem->card) |
| 73 |
continue; |
| 74 |
|
| 75 |
if (strstr(elem->name, "Validity")) |
| 76 |
continue; |
| 77 |
|
| 78 |
int line_num = get_num_from_string(elem->name); |
| 79 |
|
| 80 |
if (strstr(elem->name, "Level Capture Enum")) { |
| 81 |
w = make_boolean_alsa_elem(elem, "Inst", NULL); |
| 82 |
gtk_widget_add_css_class(w, "inst"); |
| 83 |
gtk_widget_set_tooltip_text(w, level_descr); |
| 84 |
gtk_grid_attach(GTK_GRID(input_grid), w, line_num - 1, 1, 1, 1); |
| 85 |
} else if (strstr(elem->name, "Air Capture Switch")) { |
| 86 |
w = make_boolean_alsa_elem(elem, "Air", NULL); |
| 87 |
gtk_widget_add_css_class(w, "air"); |
| 88 |
gtk_widget_set_tooltip_text(w, air_descr); |
| 89 |
gtk_grid_attach( |
| 90 |
GTK_GRID(input_grid), w, line_num - 1, 1 + !is_solo, 1, 1 |
| 91 |
); |
| 92 |
} else if (strstr(elem->name, "Phantom Power Capture Switch")) { |
| 93 |
w = make_boolean_alsa_elem(elem, "48V", NULL); |
| 94 |
gtk_widget_add_css_class(w, "phantom"); |
| 95 |
gtk_widget_set_tooltip_text(w, phantom_descr); |
| 96 |
gtk_grid_attach(GTK_GRID(input_grid), w, 0, 3, 1 + !is_solo, 1); |
| 97 |
} else if (strcmp(elem->name, "Direct Monitor Playback Switch") == 0) { |
| 98 |
w = make_boolean_alsa_elem(elem, "Direct Monitor", NULL); |
| 99 |
gtk_widget_add_css_class(w, "direct-monitor"); |
| 100 |
gtk_widget_set_tooltip_text( |
| 101 |
w, |
| 102 |
"Direct Monitor sends the analogue input signals to the " |
| 103 |
"analogue outputs for zero-latency monitoring." |
| 104 |
); |
| 105 |
gtk_grid_attach(GTK_GRID(output_grid), w, 0, 0, 1, 1); |
| 106 |
} else if (strcmp(elem->name, "Direct Monitor Playback Enum") == 0) { |
| 107 |
w = make_drop_down_alsa_elem(elem, "Direct Monitor"); |
| 108 |
gtk_widget_add_css_class(w, "direct-monitor"); |
| 109 |
gtk_widget_set_tooltip_text( |
| 110 |
w, |
| 111 |
"Direct Monitor sends the analogue input signals to the " |
| 112 |
"analogue outputs for zero-latency monitoring. Mono sends " |
| 113 |
"both inputs to the left and right outputs. Stereo sends " |
| 114 |
"input 1 to the left, and input 2 to the right output." |
| 115 |
); |
| 116 |
gtk_grid_attach(GTK_GRID(output_grid), w, 0, 0, 1, 1); |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
card->window_startup = create_subwindow( |
| 121 |
card, "Startup Configuration", G_CALLBACK(window_startup_close_request) |
| 122 |
); |
| 123 |
|
| 124 |
GtkWidget *startup = create_startup_controls(card); |
| 125 |
gtk_window_set_child(GTK_WINDOW(card->window_startup), startup); |
| 126 |
|
| 127 |
return top; |
| 128 |
} |