// ---------------------------------------------------------------------------- // SceneActor* VenueReader::read( TiXmlElement* self, SceneActor* actor ) { actor = new SceneActor(); actor->m_uid = (UID)read_dword_attribute( self, "fixure_uid" ); actor->m_group = read_bool_attribute( self, "group", false ); TiXmlElement * container = self->FirstChildElement( "channels" ); channel_t max_channel = 0; if ( container ) { TiXmlElement* element = container->FirstChildElement( "channel" ); while ( element ) { channel_t channel = read_int_attribute( element, "number" ); BYTE value = (BYTE)read_int_attribute( element, "value" ); actor->m_channel_values[ channel ] = value; if ( channel+1 > max_channel ) max_channel = channel+1; element = element->NextSiblingElement(); } } actor->m_channels = (size_t)max_channel; return actor; }
// ---------------------------------------------------------------------------- // void VenueReader::readDObject( TiXmlElement* self, DObject* dobject, LPCSTR number_name ) { dobject->m_uid = (UID)read_dword_attribute( self, "uid" ); dobject->m_number = (SceneNumber)read_word_attribute( self, number_name ); dobject->m_name = read_text_element( self, "name" ); dobject->m_description = read_text_element( self, "description" ); }
// ---------------------------------------------------------------------------- // ScenePatternDimmer* VenueReader::read( TiXmlElement* self, ScenePatternDimmer* animation ) { animation = new ScenePatternDimmer(); animation->m_uid = (UID)read_dword_attribute( self, "uid" ); animation->m_dimmer_pattern = (DimmerPattern)read_dword_attribute( self, "dimmer_pattern" ); animation->m_name = read_text_element( self, "name" ); animation->m_description = read_text_element( self, "description" ); TiXmlElement* signal_element = self->FirstChildElement( "signal" ); if ( signal_element ) { AnimationSignal* signal = read( signal_element, (AnimationSignal*)NULL ); animation->m_signal = *signal; delete signal; } read_uids( self, "pfuids", animation->m_actors ); return animation; }
// ---------------------------------------------------------------------------- // ChannelAnimation* VenueReader::read( TiXmlElement* self, ChannelAnimation* channel_animation ) { channel_animation = new ChannelAnimation(); channel_animation->m_actor_uid = (UID)read_dword_attribute( self, "actor_uid" ); channel_animation->m_channel = (channel_t)read_word_attribute( self, "channel" ); channel_animation->m_animation_style = (ChannelAnimationStyle)read_int_attribute( self, "style" ); TiXmlElement * values = self->FirstChildElement( "channel_values" ); if ( values ) { TiXmlElement* element = values->FirstChildElement( "channel_value" ); while ( element ) { BYTE value = (BYTE)read_int_attribute( element, "value" ); channel_animation->m_value_list.push_back( value ); element = element->NextSiblingElement(); } } return channel_animation; }
// ---------------------------------------------------------------------------- // SceneSoundLevel* VenueReader::read( TiXmlElement* self, SceneSoundLevel* animation ) { animation = new SceneSoundLevel(); animation->m_uid = (UID)read_dword_attribute( self, "uid" ); animation->m_fade_what = (WORD)read_int_attribute( self, "fade" ); animation->m_name = read_text_element( self, "name" ); animation->m_description = read_text_element( self, "description" ); TiXmlElement* signal_element = self->FirstChildElement( "signal" ); if ( signal_element ) { AnimationSignal* signal = read( signal_element, (AnimationSignal*)NULL ); animation->m_signal = *signal; delete signal; } read_uids( self, "pfuids", animation->m_actors ); return animation; }
// ---------------------------------------------------------------------------- // SceneStrobeAnimator* VenueReader::read( TiXmlElement* self, SceneStrobeAnimator* animation ) { animation = new SceneStrobeAnimator(); animation->m_uid = (UID)read_dword_attribute( self, "uid" ); animation->m_strobe_neg_color = read_rgbw_attribute( self, "strobe_neg_color" ); animation->m_strobe_pos_ms = read_unsigned_attribute( self, "strobe_pos_ms" ); animation->m_strobe_neg_ms = read_unsigned_attribute( self, "strobe_neg_ms" ); animation->m_name = read_text_element( self, "name" ); animation->m_description = read_text_element( self, "description" ); TiXmlElement* signal_element = self->FirstChildElement( "signal" ); if ( signal_element ) { AnimationSignal* signal = read( signal_element, (AnimationSignal*)NULL ); animation->m_signal = *signal; delete signal; } read_uids( self, "pfuids", animation->m_actors ); return animation; }
// ---------------------------------------------------------------------------- // FixtureGroup* VenueReader::read( TiXmlElement* self, FixtureGroup* fixture_group ) { fixture_group = new FixtureGroup(); readDObject( self, fixture_group, "group_number" ); TiXmlElement * fixture_container = self->FirstChildElement( "pfuids" ); if ( fixture_container ) { TiXmlElement* element = fixture_container->FirstChildElement( "uid" ); while ( element ) { fixture_group->m_fixtures.insert( read_dword_attribute( element, "value" ) ); element = element->NextSiblingElement(); } } TiXmlElement * container = self->FirstChildElement( "channels" ); channel_t max_channel = 0; if ( container ) { TiXmlElement* element = container->FirstChildElement( "channel" ); while ( element ) { channel_t channel = read_int_attribute( element, "number" ); BYTE value = (BYTE)read_int_attribute( element, "value" ); fixture_group->m_channel_values[ channel ] = value; if ( channel+1 > max_channel ) max_channel = channel+1; element = element->NextSiblingElement(); } } fixture_group->m_channels = (size_t)max_channel; return fixture_group; }
// ---------------------------------------------------------------------------- // SceneChannelFilter* VenueReader::read( TiXmlElement* self, SceneChannelFilter* animation ) { animation = new SceneChannelFilter(); animation->m_uid = (UID)read_dword_attribute( self, "uid" ); animation->m_name = read_text_element( self, "name" ); animation->m_description = read_text_element( self, "description" ); animation->m_filter = (ChannelFilter)read_unsigned_attribute( self, "filter"); animation->m_channel = (channel_t)read_unsigned_attribute( self, "channel" ); animation->m_step = read_unsigned_attribute( self, "step" ); animation->m_amplitude = read_unsigned_attribute( self, "amplitude" ); animation->m_offset = read_int_attribute( self, "offset" ); TiXmlElement* signal_element = self->FirstChildElement( "signal" ); if ( signal_element ) { AnimationSignal* signal = read( signal_element, (AnimationSignal*)NULL ); animation->m_signal = *signal; delete signal; } read_uids( self, "pfuids", animation->m_actors ); return animation; }
// ---------------------------------------------------------------------------- // Venue * VenueReader::read( TiXmlElement* self, Venue* venue ) { venue = new Venue(); venue->m_scenes.clear(); // Kill the auto generated default scene venue->m_uid_pool = read_dword_attribute( self, "next_uid" ); venue->m_current_scene = (UID)read_dword_attribute( self, "current_scene" ); venue->m_name = read_text_element( self, "name" ); venue->m_description = read_text_element( self, "description" ); // Add all universes (up to the max, must be in correct order) std::vector<Universe *> universes = read_xml_list<Universe>( self->FirstChildElement( "dmx_universes" ), "universe" ); for ( std::vector<Universe *>::iterator it=universes.begin(); it != universes.end(); ++it ) { venue->addUniverse( (*it) ); } TiXmlElement *dimmer = self->FirstChildElement( "dimmer" ); if ( dimmer ) { venue->m_master_dimmer = (BYTE)read_int_attribute( dimmer, "master_dimmer" ); venue->m_auto_backout_ms = read_dword_attribute( dimmer, "auto_blackout" ); venue->m_whiteout_strobe_ms = read_unsigned_attribute( dimmer, "whiteout_strobe", venue->getWhiteoutStrobeMS() ); venue->m_whiteout_color = read_rgbw_attribute( dimmer, "whiteout_color", RGBWA::WHITE ); } TiXmlElement *audio = self->FirstChildElement( "audio" ); if ( audio ) { venue->m_audio_capture_device = read_text_element( audio, "capture_device" ); venue->m_audio_boost = (float)read_double_attribute( audio, "scale" ); venue->m_audio_boost_floor = (float)read_double_attribute( audio, "floor" ); venue->m_audio_sample_size = (UINT)read_unsigned_attribute( audio, "sample_size", 1024 ); } venue->m_venue_layout = read_text_element( self, "venue_layout" ); // Add all fixtures std::vector<Fixture *> fixtures = read_xml_list<Fixture>( self->FirstChildElement( "fixtures" ), "fixture" ); for ( std::vector<Fixture *>::iterator it=fixtures.begin(); it != fixtures.end(); ++it ) { venue->addFixture( *(*it) ); delete (*it); } // Add scenes std::vector<Scene *> scenes = read_xml_list<Scene>( self->FirstChildElement( "scenes" ), "scene" ); for ( std::vector<Scene *>::iterator it=scenes.begin(); it != scenes.end(); ++it ) { venue->addScene( *(*it), (*it)->getNumber() == DEFAULT_SCENE_NUMBER); delete (*it); } // Add fixture groups std::vector<FixtureGroup *> fixture_groups = read_xml_list<FixtureGroup>( self->FirstChildElement( "fixture_groups" ), "fixture_group" ); for ( std::vector<FixtureGroup *>::iterator it=fixture_groups.begin(); it != fixture_groups.end(); ++it ) { venue->addFixtureGroup( *(*it) ); delete (*it); } // Add chases std::vector<Chase *> chases = read_xml_list<Chase>( self->FirstChildElement( "chases" ), "chase" ); for ( std::vector<Chase *>::iterator it=chases.begin(); it != chases.end(); ++it ) { venue->addChase( *(*it) ); delete (*it); } // Add music mappings TiXmlElement *music_scenes_element = self->FirstChildElement( "music_scenes" ); if ( music_scenes_element ) { venue->m_music_scene_select_enabled = read_bool_attribute( music_scenes_element, "enabled" ); std::vector<MusicSceneSelector *> music_scenes = read_xml_list<MusicSceneSelector>( self->FirstChildElement( "music_scenes" ), "music_mapping" ); for ( std::vector<MusicSceneSelector *>::iterator it=music_scenes.begin(); it != music_scenes.end(); ++it ) { venue->addMusicMapping( *(*it) ); delete (*it); } } return venue; }
// ---------------------------------------------------------------------------- // Channel* DefinitionReader::read( TiXmlElement* self, Channel* channel ) { channel = new Channel(); try { channel->m_channel_offset = (channel_t)read_dword_attribute( self, "index" ); channel->m_type = Channel::convertTextToChannelType( read_text_attribute( self, "type" ) ); channel->m_name = read_text_element( self, "name" ); channel->m_is_color = read_bool_attribute( self, "color" ); channel->m_can_blackout = read_bool_attribute( self, "blackout" ); channel->m_can_whiteout = read_bool_attribute( self, "whiteout", true ); channel->m_default_value = (BYTE)read_int_attribute( self, "value" ); channel->m_home_value = (BYTE)read_int_attribute( self, "home_value" ); channel->m_pixel_index = (BYTE)read_int_attribute( self, "pixel" ); channel->m_head_number = (BYTE)read_int_attribute( self, "head" ); // If head number is not set on tilt or pan, default to 1 if ( channel->m_head_number == 0 && (channel->m_type == CHNLT_TILT || channel->m_type == CHNLT_PAN || channel->m_type == CHNLT_PAN_FINE || channel->m_type == CHNLT_TILT_FINE) ) channel->m_head_number = 1; STUDIO_ASSERT( channel->m_channel_offset > 0, "Channel '%s' index < 1", channel->m_name ); channel->m_channel_offset--; // Adjust offset for internal zero based TiXmlElement *dimmer = self->FirstChildElement( "dimmer" ); if ( dimmer ) { channel->m_is_dimmer = true; channel->m_lowest_intensity = (BYTE)read_int_attribute( dimmer, "lowest_intensity", 0 ); channel->m_highest_intensity = (BYTE)read_int_attribute( dimmer, "highest_intensity", 255 ); } else { channel->m_is_dimmer = ( channel->m_type == CHNLT_DIMMER ); // Implies this is the default 0-255 dimmer channel type channel->m_lowest_intensity = 0; channel->m_highest_intensity = 255; } // Add channel ranges std::vector<ChannelValueRange *> ranges = read_xml_list<ChannelValueRange>( self->FirstChildElement( "ranges" ), "range" ); for ( std::vector<ChannelValueRange *>::iterator it=ranges.begin(); it != ranges.end(); ++it ) { STUDIO_ASSERT( (*it)->getEnd() >= (*it)->getStart(), "Channel '%s' range %s invalid", channel->m_name, (*it)->getName() ); STUDIO_ASSERT( channel->getRange( (*it)->getEnd() ) == NULL, "Channel '%s' range %s overlaps", channel->m_name, (*it)->getName() ); STUDIO_ASSERT( channel->getRange( (*it)->getStart() ) == NULL, "Channel '%s' range %s overlaps", channel->m_name, (*it)->getName() ); channel->m_ranges.push_back( *(*it) ); delete (*it); } // Add angles std::vector<ChannelAngle *> angles = read_xml_list<ChannelAngle>( self->FirstChildElement( "angles" ), "angle" ); for ( std::vector<ChannelAngle *>::iterator it=angles.begin(); it != angles.end(); ++it ) { channel->m_angles[ (*it)->getAngle() ] = *(*it); delete (*it); } channel->generateAngleTable(); } catch( ... ) { delete channel; throw; } return channel; }