|
|
@ -50,7 +50,7 @@ void Server::addOrUpdateClient(int client_id, float value, const std::string& ip |
|
|
|
void Server::updateEmbedding(){ |
|
|
|
for(const auto& c : clients){ |
|
|
|
const ClientInfo& info = c.second; |
|
|
|
float val = std::round(info.value * 1000.0f) / 1000.0f; |
|
|
|
float val = (std::round(info.value * 1000.0f) / 1000.0f) / 100.0f; |
|
|
|
switch(c.first){ |
|
|
|
case 0: |
|
|
|
embedding.angry = val; |
|
|
@ -72,6 +72,9 @@ void Server::updateEmbedding(){ |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
embedding.neutral = val; |
|
|
|
embedding.fear = ofRandom(0.1, 0.6); |
|
|
|
embedding.angry = ofRandom(0.01, 0.99); |
|
|
|
embedding.happy = ofRandom(0.01, 0.99); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -91,7 +94,7 @@ void Server::printClients(){ |
|
|
|
|
|
|
|
/* check if the controllers are in use */ |
|
|
|
void Server::checkActivity(){ |
|
|
|
if (previous_embedding != embedding) { // Check if embedding has changed
|
|
|
|
if (previous_embedding.neutral != embedding.neutral) { // Check if embedding has changed
|
|
|
|
last_change_time = std::chrono::steady_clock::now(); // Reset the timer if there is a change
|
|
|
|
previous_embedding = embedding; // Update the previous embedding to the current one
|
|
|
|
is_active = true; |
|
|
|