Changeset 5977:6b7d6fcf80b5 in roaraudio for roard


Ignore:
Timestamp:
01/27/14 18:57:46 (6 years ago)
Author:
phi
Branch:
default
Message:

Added support for rangeset to roard and roarlight.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/codecfilter_roardmx.c

    r5961 r5977  
    5353} 
    5454 
     55static inline int __read_rangeset(int id, struct roar_stream_server * ss, struct roar_roardmx_message * mes) { 
     56 uint16_t start, end; 
     57 uint8_t value; 
     58 size_t p; 
     59 int i, c; 
     60 
     61 // we ignore errors here at the moment as 0 not < -1 
     62 c = roar_roardmx_message_numchannels(mes); 
     63 ROAR_DBG("__read_rangeset(id=%i, ...): Number of subframes: %u", id, c); 
     64 
     65 for (i = 0; i < c; i++) { 
     66  ROAR_DBG("__read_rangeset(id=%i, ...): i=%i", id, i); 
     67 
     68  if ( roar_roardmx_message_get_rangeval(mes, &start, &end, &value, i) == -1 ) { 
     69   ROAR_WARN("__read_rangeset(id=%i, ...): Can not read subframe: %i: %s", id, i, roar_errorstring); 
     70   return -1; 
     71  } 
     72 
     73  ROAR_DBG("__read_rangeset(id=%i, ...): i=%i, start=%u, end=%u, value=%u", id, i, start, end, value); 
     74 
     75  if ( start > end ) { 
     76   ROAR_WARN("__read_rangeset(id=%i, ...): Bad RoarDMX Rangeset frame: start > end.", id); 
     77   continue; 
     78  } 
     79 
     80  if ( g_light_state.channels < end ) { 
     81   ROAR_WARN("__read_rangeset(id=%i, ...): Range out of DMX universe: %u-%u", id, start, end); 
     82   continue; 
     83  } 
     84 
     85  for (p = start; p <= end; p++) { 
     86   g_light_state.state[p]   = value; 
     87   g_light_state.changes[p] = 0xFF; // the channel changed  
     88  } 
     89 } 
     90 
     91 return 0; 
     92} 
     93 
    5594static inline int __read_events(int id, struct roar_stream_server * ss, struct roar_roardmx_message * mes) { 
    5695 const uint8_t * events; 
     
    77116 switch (type) { 
    78117  case ROAR_ROARDMX_TYPE_SSET: return __read_sset(id, ss, &mes); break; 
     118  case ROAR_ROARDMX_TYPE_RANGESET: return __read_rangeset(id, ss, &mes); break; 
    79119  case ROAR_ROARDMX_TYPE_EVENT: return __read_events(id, ss, &mes); break; 
    80120 } 
Note: See TracChangeset for help on using the changeset viewer.