Don't export alsa_cards from alsa.c

This commit is contained in:
Geoffrey D. Bennett
2024-02-17 00:38:27 +10:30
parent 05006284c6
commit e95cbff3d5
3 changed files with 12 additions and 13 deletions

View File

@@ -18,7 +18,7 @@ const char *port_category_names[PC_COUNT] = {
};
// global array of cards
GArray *alsa_cards;
static GArray *alsa_cards;
// static fd and wd for ALSA inotify
static int inotify_fd, inotify_wd;
@@ -696,7 +696,7 @@ static void alsa_get_serial_number(struct alsa_card *card) {
card->serial = strdup(serial);
}
void alsa_scan_cards(void) {
static void alsa_scan_cards(void) {
snd_ctl_card_info_t *info;
snd_ctl_t *ctl;
int card_num = -1;
@@ -787,7 +787,7 @@ static gboolean inotify_callback(
return TRUE;
}
void alsa_inotify_init(void) {
static void alsa_inotify_init(void) {
GIOChannel *io_channel;
inotify_fd = inotify_init();
@@ -799,3 +799,9 @@ void alsa_inotify_init(void) {
inotify_callback, NULL, NULL
);
}
void alsa_init(void) {
alsa_cards = g_array_new(FALSE, TRUE, sizeof(struct alsa_card *));
alsa_inotify_init();
alsa_scan_cards();
}

View File

@@ -193,9 +193,6 @@ struct alsa_card {
double drag_x, drag_y;
};
// global array of cards
extern GArray *alsa_cards;
// utility
void fatal_alsa_error(const char *msg, int err);
@@ -226,6 +223,5 @@ char *alsa_get_item_name(struct alsa_elem *elem, int i);
// add to alsa_cards array
struct alsa_card *card_create(int card_num);
// scan/rescan for cards
void alsa_scan_cards(void);
void alsa_inotify_init(void);
// init
void alsa_init(void);

View File

@@ -32,12 +32,9 @@ static void load_css(void) {
static void startup(GtkApplication *app, gpointer user_data) {
gtk_application_set_menubar(app, G_MENU_MODEL(create_app_menu(app)));
alsa_inotify_init();
alsa_cards = g_array_new(FALSE, TRUE, sizeof(struct alsa_card *));
load_css();
alsa_scan_cards();
alsa_init();
create_no_card_window();
create_hardware_window(app);