Changeset 5706:db47b2d9c689 in roaraudio for roard


Ignore:
Timestamp:
10/24/12 13:15:26 (7 years ago)
Author:
phi
Branch:
default
Message:

make it more easy to access DMX channels via plugin

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/include/light.h

    r5381 r5706  
    5353int light_send_stream   (int id); 
    5454 
     55// for plugins: 
     56int light_dmxchannel_get(size_t index); 
     57int light_dmxchannel_set(size_t index, unsigned char val); 
     58 
    5559#endif 
    5660 
  • roard/include/plugins.h

    r5664 r5706  
    3030 
    3131#define ROARD_DL_APPNAME    "roard " ROAR_VSTR_ROARAUDIO 
    32 #define ROARD_DL_ABIVERSION "1.0beta7" 
     32#define ROARD_DL_ABIVERSION "1.0beta8" 
    3333 
    3434int plugins_preinit  (void); 
  • roard/light.c

    r5381 r5706  
    3232struct light_mixer g_light_mixer; 
    3333// // 
     34 
     35static inline void __set_channel(size_t index, unsigned char val) { 
     36 g_light_state.changes[index] |= g_light_state.state[index] ^ val; 
     37 g_light_state.state[index]    =                              val; 
     38} 
    3439 
    3540int light_init  (uint32_t channels) { 
     
    140145 
    141146    for (i = 0; i < (g_light_state.channels < 512 ? g_light_state.channels : 512); i++) { 
    142      g_light_state.changes[i] |= g_light_state.state[i] ^ buf[i]; 
    143      g_light_state.state[i]    =                          buf[i]; 
     147     __set_channel(i, buf[i]); 
    144148    } 
    145149//    memcpy(g_light_state.state, buf, g_light_state.channels < 512 ? g_light_state.channels : 512); 
     
    257261} 
    258262 
     263int light_dmxchannel_get(size_t index) { 
     264 if ( (size_t)g_light_state.channels <= index ) { 
     265  roar_err_set(ROAR_ERROR_NOENT); 
     266  return -1; 
     267 } 
     268 
     269 return (int)(unsigned int)(unsigned char)g_light_state.state[index]; 
     270} 
     271 
     272int light_dmxchannel_set(size_t index, unsigned char val) { 
     273 if ( (size_t)g_light_state.channels <= index ) { 
     274  roar_err_set(ROAR_ERROR_NOENT); 
     275  return -1; 
     276 } 
     277 
     278 __set_channel(index, val); 
     279 return 0; 
     280} 
     281 
    259282#endif 
    260283 
Note: See TracChangeset for help on using the changeset viewer.