// ---------------------------------------------------------------------------- // void SceneChannelFilter::initAnimation( AnimationTask* task, DWORD time_ms, BYTE* dmx_packet ) { m_animation_task = task; m_channel_animations.clear(); double start_angle = 0.0; // Determine which channels will be participating for ( UID actor_uid : populateActors() ) { Fixture* pf = m_animation_task->getActorRepresentative( actor_uid ); if ( !pf ) continue; for ( channel_t channel : m_channels ) { if ( pf->getNumChannels() <= channel ) continue; // Each fixture may have a different start value so do independantly (and for random) ChannelValueArray value_array; // Get unmodified initial value SceneActor* actor = m_animation_task->getActor( actor_uid ); BYTE start_value = actor->getChannelValue( channel ); switch ( m_filter ) { case CF_SINE_WAVE: start_angle += m_offset; // We want this first to be able to offset multiple filters value_array = generateSineWave( start_value, start_angle, m_amplitude, m_step ); break; case CF_STEP_WAVE: value_array = generateStepWave( start_value, m_step ); break; case CF_RAMP_UP: value_array = generateRampUp( start_value, m_step, m_amplitude ); break; case CF_RAMP_DOWN: value_array = generateRampDown( start_value, m_step, m_amplitude ); break; case CF_RANDOM: value_array = generateRandom( start_value, m_amplitude ); break; } m_channel_animations.push_back( ChannelAnimation( actor_uid, channel, CAM_LIST, value_array ) ); } } return SceneChannelAnimator::initAnimation( task, time_ms, dmx_packet ); }
// ---------------------------------------------------------------------------- // void SceneChannelFilterTask::generateProgram( AnimationDefinition* definition ) { double start_angle = 0.0; SceneChannelFilter* config = dynamic_cast<SceneChannelFilter *>( definition ); // Determine which channels will be participating for ( SceneActor& actor : getActors() ) { Fixture* pf = getActorRepresentative( actor.getActorUID() ); if ( !pf ) continue; for ( channel_address channel : config->getChannels() ) { if ( pf->getNumChannels() <= channel ) continue; // Each fixture may have a different start value so do independantly (and for random) ChannelValueArray value_array; // Get unmodified initial value BYTE start_value = actor.getFinalChannelValue( pf->getUID(), channel ); switch ( config->getFilter() ) { case CF_SINE_WAVE: start_angle += config->getOffset(); // We want this first to be able to offset multiple filters value_array = generateSineWave( start_value, start_angle, config->getAmplitude(), config->getStep() ); break; case CF_STEP_WAVE: value_array = generateStepWave( start_value, config->getStep() ); break; case CF_RAMP_UP: value_array = generateRampUp( start_value, config->getStep(), config->getAmplitude() ); break; case CF_RAMP_DOWN: value_array = generateRampDown( start_value, config->getStep(), config->getAmplitude() ); break; case CF_RANDOM: value_array = generateRandom( start_value, config->getAmplitude() ); break; } add( actor.getActorUID(), channel, CAM_LIST, value_array ); } } }