ERIS CORE

◆ ParseConnectString()

void AudioDirector::ParseConnectString ( const char *  connectionString,
ParsedConnection p 
)
protected

Definition at line 429 of file AudioDirector.cpp.

429  {
430 //parse connectionString
431  //format: "SRCTYPE(CHAR):INSTANCE(INT) SRCPORT(INT) DESTTYPE(CHAR):INSTANCE(INT) DESTPORT(INT)"
432  //example: "MIXER:2 0 CHORUS:2 1"
433  //the example above connects mixer instance 2 output 0 with chorus instance 1 input 1
434  char buffer[MAX_CONNECTION_STRING_LENGTH];
435  char *token;
436 
437  if(strlen(connectionString)>MAX_CONNECTION_STRING_LENGTH-1) return;
438 
439  memset(buffer, '\0', sizeof(buffer));
440  memset(p->src, '\0', sizeof(p->src));
441  memset(p->dst, '\0', sizeof(p->dst));
442  strcpy(buffer,connectionString);
443 
444  token = strtok(buffer, " ");
445  if(strlen(token)>MAX_NAME_LENGTH-1) return;
446  strcpy(p->src,token);
447 
448  token = strtok(NULL, " ");
449  if(strlen(token)>MAX_NAME_LENGTH-1) return;
450  p->src_port = atoi(token);
451 
452  token = strtok(NULL, " ");
453  if(strlen(token)>MAX_NAME_LENGTH-1) return;
454  strcpy(p->dst,token);
455  token = strtok(NULL, " ");
456  p->dst_port = atoi(token);
457 
458 
459  //Serial.print(F("M AudioDirector::ParseConnectString "));
460  //Serial.println(connectionString);
461  //Serial.print(F("M Source: "));Serial.print(p->src);Serial.print(F(" Port:"));Serial.print(p->src_port);
462  //Serial.print(F("\tDest: "));Serial.print(p->dst);Serial.print(F(" Port:"));Serial.println(p->dst_port);
463 
464  return;
465 }
const char PROGMEM p[][16]
Definition: Eris.h:247

References p, and token.

Referenced by connect().

+ Here is the caller graph for this function: