Changeset 3329:d939b3aedbc5 in roaraudio for libroardsp


Ignore:
Timestamp:
02/04/10 02:58:20 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added function to calc a channel map

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/channels.c

    r3328 r3329  
    7070} 
    7171 
     72int roardsp_chanmap_calc(struct roardsp_chanmap * map, int what, int err_on_none) { 
     73 int a, b; 
     74 
     75 if ( map == NULL ) 
     76  return -1; 
     77 
     78 switch (what) { 
     79  case ROARDSP_CHANMAP_MAP: 
     80    memset(map->map, (char)-1, sizeof(map->map)); 
     81 
     82    for (a = 0; a < ROAR_MAX_CHANNELS; a++) { 
     83     if ( map->in[a] == ROARDSP_CHAN_NONE ) 
     84      continue; 
     85 
     86     for (b = 0; b < ROAR_MAX_CHANNELS; b++) { 
     87      if ( map->in[a] == map->out[b] ) { 
     88       map->map[a] = b; 
     89       break; 
     90      } 
     91     } 
     92     if ( b == ROAR_MAX_CHANNELS ) { // src not found in dest 
     93      if ( err_on_none ) 
     94       return -1; 
     95 
     96      map->map[a] = -1; 
     97     } 
     98    } 
     99   break; 
     100  case ROARDSP_CHANMAP_IN: 
     101  case ROARDSP_CHANMAP_OUT: 
     102  default: 
     103    return -1; 
     104   break; 
     105 } 
     106 
     107 return 0; 
     108} 
     109 
    72110//ll 
Note: See TracChangeset for help on using the changeset viewer.