Changeset 1822:d2c299cb9a27 in roaraudio


Ignore:
Timestamp:
05/23/09 00:13:18 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support for DMX512

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/light.c

    r1821 r1822  
    6565 
    6666int light_check_stream  (int id) { 
     67 int len; 
     68 struct roar_stream        *   s; 
     69 struct roar_stream_server *  ss; 
     70 
     71 if ( g_streams[id] == NULL ) 
     72  return -1; 
     73 
     74 ROAR_DBG("light_check_stream(id=%i) = ?", id); 
     75 
     76 s = ROAR_STREAM(ss = g_streams[id]); 
     77 
    6778 return 0; 
    6879} 
    6980 
    7081int light_send_stream   (int id) { 
     82 int chans; 
     83 struct roar_stream        *   s; 
     84 struct roar_stream_server *  ss; 
     85 char buf[512]; 
     86 
     87 if ( g_streams[id] == NULL ) 
     88  return -1; 
     89 
     90 ROAR_DBG("light_check_stream(id=%i) = ?", id); 
     91 
     92 s = ROAR_STREAM(ss = g_streams[id]); 
     93 
     94 switch (s->info.codec) { 
     95  case ROAR_CODEC_DMX512: 
     96    chans = g_light_state.channels; 
     97 
     98    if ( chans > 512 ) 
     99     chans = 512; 
     100 
     101    if ( stream_vio_s_write(ss, g_light_state.state, chans) != chans ) { 
     102     streams_delete(id); 
     103     return -1; 
     104    } 
     105 
     106    if ( chans < 512 ) { 
     107     chans = 512 - chans; 
     108     memset(buf, 0, chans); 
     109     if ( stream_vio_s_write(ss, g_light_state.state, chans) != chans ) { 
     110      streams_delete(id); 
     111      return -1; 
     112     } 
     113    } 
     114 
     115    return 0; 
     116   break; 
     117  default: 
     118    streams_delete(id); 
     119    return -1; 
     120 } 
     121 
    71122 return 0; 
    72123} 
Note: See TracChangeset for help on using the changeset viewer.