Simplify sound_card_init() by using a loop

This commit is contained in:
Jasmine Iwanek
2024-07-20 01:39:07 -04:00
parent 05e7d9239c
commit 539dccdcd1

View File

@@ -221,14 +221,9 @@ sound_card_get_from_internal_name(const char *s)
void void
sound_card_init(void) sound_card_init(void)
{ {
if ((sound_card_current[0] > SOUND_INTERNAL) && (sound_cards[sound_card_current[0]].device)) for (uint8_t i = 0; i < SOUND_CARD_MAX; i++)
device_add_inst(sound_cards[sound_card_current[0]].device, 1); if ((sound_card_current[i] > SOUND_INTERNAL) && (sound_cards[sound_card_current[i]].device))
if ((sound_card_current[1] > SOUND_INTERNAL) && (sound_cards[sound_card_current[1]].device)) device_add_inst(sound_cards[sound_card_current[i]].device, i + 1);
device_add_inst(sound_cards[sound_card_current[1]].device, 2);
if ((sound_card_current[2] > SOUND_INTERNAL) && (sound_cards[sound_card_current[2]].device))
device_add_inst(sound_cards[sound_card_current[2]].device, 3);
if ((sound_card_current[3] > SOUND_INTERNAL) && (sound_cards[sound_card_current[3]].device))
device_add_inst(sound_cards[sound_card_current[3]].device, 4);
} }
void void