Changeset 2373:a1204eac6898 in roaraudio


Ignore:
Timestamp:
08/15/09 17:12:15 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

first try to convert sndio device names -> RoarAuidio?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarsndio/libroarsndio.c

    r2372 r2373  
    3535 
    3636static char * sndio_to_roar_names (char * name) { 
     37 char * unitoffset = NULL; 
     38 char * optsoffset = NULL; 
     39 int    unit; 
    3740 
    3841 if ( name == NULL ) 
    3942  return NULL; 
     43 
     44 if ( !strncmp(name, "sun:", 4) ) { 
     45  unitoffset = name + 4; 
     46 } else if ( !strncmp(name, "aucat:", 6) ) { 
     47  unitoffset = name + 6; 
     48 } else if ( !strncmp(name, "rmidi:", 6) ) { 
     49  unitoffset = name + 6; 
     50 } else if ( !strncmp(name, "midithru:", 9) ) { 
     51  unitoffset = name + 9; 
     52 } else { 
     53  return name; 
     54 } 
     55 
     56 if ( (optsoffset = strstr(unitoffset, ".")) != NULL ) { 
     57  // TODO: add some code to strip the options of the end 
     58  return name; 
     59 } else { 
     60  unit = atoi(unitoffset); 
     61  switch (unit) { 
     62   // use defaulst 
     63   case 0: return NULL; break; 
     64   // use UNIX user sock, TODO: need some code here... 
     65   case 1: return NULL; break; 
     66   // use UNIX global sock: 
     67   case 2: return ROAR_DEFAULT_SOCK_GLOBAL; break; 
     68   // use DECnet localnode: 
     69   case 3: return "::"; break; 
     70   // use IPv4 localhost: 
     71   case 4: return ROAR_DEFAULT_HOST; break; 
     72   // undefined: 
     73   case 5: 
     74   // use IPv6 localhost: 
     75   case 6: 
     76   // default: 
     77   default: 
     78     return name; 
     79  } 
     80 } 
    4081 
    4182 return name; 
Note: See TracChangeset for help on using the changeset viewer.