void MagicLightCircle::update() { if(activePixelMappingFunction) { usePixelMapping = true; pixelMapping.startNewFunction(pixelMappingPerno); activePixelMappingFunction = false; } if(lightLife < 1) lightLife = 1; timerNoPoints++; if(timerNoPoints > 100 && blobs.size() > 0) blobs.clear(); updateOSC(); if(!useOSC) update(blobs); if(useSound) updateSound(); if(usePixelMapping) { pixelMapping.update(); for(int a = 0; a < totMagicPoints; a++) { magicPoints[a]->intensity = float(pixelMapping.values[a]/255.0); } } sendDMX(); checkLightInputControllerChanged(); }
void Artnetnode::tickDMX(uint32_t time){ msSinceDMXSend += time; if(msSinceDMXSend > DMX_MS_BETWEEN_TICKS){ sendDMX(); msSinceDMXSend = 0; } }
int main() { struct timeval now,next,diff,delay; int success; printf("%s: Starting dmx deamon\n", ProgName); // intialize USB device success = initUSB(); if ( !success ) { printf ( "%s: Error initializing USB interface\n" , ProgName ); (*exitAddr)++; return ( -1 ); } // initialize shared memory segment success = initSHM(); if ( !success ) { printf ( "%s: Error initializing shared memory\n" , ProgName ); (*exitAddr)++; return ( -2 ); } // start timer delay.tv_sec = 0; delay.tv_usec= UpdateInt; gettimeofday ( &next , NULL ); printf("%s: Init done. Entering loop cycle...\n", ProgName); // loop until commanded to shutdown while( !*exitAddr ) { // send DMX data success = sendDMX(); if ( !success ) { printf ( "%s: DMX send error\n" , ProgName ); (*exitAddr)++; } // wait for update interval timeadd ( &next , &next , &delay ); gettimeofday ( &now , NULL ); timediff ( &diff, &next , &now ); while (diff.tv_sec || diff.tv_usec) { select ( 0, NULL, NULL, NULL, &diff ); gettimeofday ( &now, NULL ); timediff ( &diff, &next, &now ); }; } printf ( "%s: dmx deamon is shutting down\n" , ProgName ); // on shutdown reset all DMX channels memset ( chanData , 0, 512 * sizeof (ubyte) ); sendDMX(); // exit the system exitUSB(); exitSHM(); return ( 0 ); }