@@ -1507,7 +1507,7 @@ void Visualizer::UpdateClientSettings()
15071507 {
15081508 bool found_match = false ;
15091509
1510- for (unsigned int search_controller_idx = controller_idx; search_controller_idx < controllers .size (); search_controller_idx++)
1510+ for (unsigned int search_controller_idx = controller_idx; search_controller_idx < controller_settings .size (); search_controller_idx++)
15111511 {
15121512 /* -----------------------------------------------------*\
15131513 | If the client settings at this index matches the |
@@ -1536,6 +1536,15 @@ void Visualizer::UpdateClientSettings()
15361536 ControllerSettingsType* new_settings = new ControllerSettingsType ();
15371537
15381538 new_settings->controller_ptr = controllers[controller_idx];
1539+ new_settings->enabled = false ;
1540+
1541+ for (int mode_idx = 0 ; mode_idx < controllers[controller_idx]->modes .size (); mode_idx++)
1542+ {
1543+ if (controllers[controller_idx]->modes [mode_idx].name == " Direct" )
1544+ {
1545+ new_settings->enabled = true ;
1546+ }
1547+ }
15391548
15401549 controller_settings.insert (controller_settings.begin () + controller_idx, new_settings);
15411550 }
@@ -1693,6 +1702,8 @@ void Visualizer::LEDUpdateThreadFunction()
16931702 {
16941703 for (unsigned int client_idx = 0 ; client_idx < rgb_clients.size (); client_idx++)
16951704 {
1705+ rgb_clients[client_idx]->ControllerListMutex .lock ();
1706+
16961707 if (client_idx < rgb_client_settings.size ())
16971708 {
16981709 if (rgb_client_settings[client_idx]->client_ptr == rgb_clients[client_idx])
@@ -1810,6 +1821,8 @@ void Visualizer::LEDUpdateThreadFunction()
18101821 }
18111822 }
18121823 }
1824+
1825+ rgb_clients[client_idx]->ControllerListMutex .unlock ();
18131826 }
18141827 Sleep (delay);
18151828 }
0 commit comments