Ejemplo n.º 1
0
// ----------------------------------------------------------------------------
//
SceneColorFader* VenueReader::read( TiXmlElement* self, SceneColorFader* animation )
{
    animation = new SceneColorFader();

    animation->m_uid = (UID)read_dword_attribute( self, "uid" );
    animation->m_fader_effect = (FaderEffect)read_unsigned_attribute( self, "fader_effect", FaderEffect::FADER_EFFECT_ALL );
    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_strobe_flashes = read_unsigned_attribute(self, "strobe_flashes", 1 );

    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 );

    read_colors( self, "custom_colors", animation->m_custom_colors );

    return animation;
}
Ejemplo n.º 2
0
// ----------------------------------------------------------------------------
//
ScenePixelAnimator* VenueReader::read( TiXmlElement* self, ScenePixelAnimator* animation )
{
    animation = new ScenePixelAnimator();

    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_effect = (PixelEffect)read_unsigned_attribute( self, "pixel_effect", 1 );
    animation->m_generations = read_unsigned_attribute( self, "generations", 1 );
    animation->m_num_pixels = read_unsigned_attribute( self, "pixels", 1 );
    animation->m_increment = read_unsigned_attribute( self, "increment", 1 );
    animation->m_color_fade = read_bool_attribute( self, "fade", 1 );
    animation->m_combine_fixtures = read_bool_attribute( self, "combine", 1 );
    animation->m_empty_color = read_rgbw_attribute( self, "pixel_off_color" );

    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 );

    read_colors( self, "custom_colors", animation->m_custom_colors );

    return animation;
}
Ejemplo n.º 3
0
// ----------------------------------------------------------------------------
//
SceneChannelAnimator* VenueReader::read( TiXmlElement* self, SceneChannelAnimator* animation )
{
    animation = new SceneChannelAnimator();

    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" );

    TiXmlElement* signal_element = self->FirstChildElement( "signal" );
    if ( signal_element ) {
        AnimationSignal* signal = read( signal_element, (AnimationSignal*)NULL );
        animation->m_signal = *signal;
        delete signal;
    }

    std::vector<ChannelAnimation *> channel_animation = 
        read_xml_list<ChannelAnimation>( self->FirstChildElement( "channel_animations" ), "channel_animation" );

    for ( std::vector<ChannelAnimation *>::iterator it=channel_animation.begin(); 
          it != channel_animation.end(); ++it ) {
        animation->m_channel_animations.push_back( *(*it) );
        delete (*it);
    }

    return animation;
}
Ejemplo n.º 4
0
// ----------------------------------------------------------------------------
//
FixtureDefinition* DefinitionReader::read( TiXmlElement* self, FixtureDefinition* fixture )
{
    fixture = new FixtureDefinition();

    try {
        fixture->m_fuid = (FUID)read_dword_attribute( self, "fuid" );
        fixture->m_type = fixture->convertTextToFixtureType( read_text_attribute( self, "type" ) );
        fixture->m_manufacturer = read_text_element( self, "manufacturer" );
        fixture->m_model = read_text_element( self, "model" );

        // Add channel list(s)
        std::vector<Channel *> channels = 
            read_xml_list<Channel>( self->FirstChildElement( "channels" ), "channel" );

        for ( std::vector<Channel *>::iterator it=channels.begin(); it != channels.end(); ++it ) {
            fixture->m_channels.push_back( *(*it) );
            delete (*it);
        }

        if ( fixture->m_fuid == 0 ) {                           // Generate FUID with a (hopefully) unique hash
            fixture->m_fuid = fixture->generateFUID( );
        }

        fixture->chooseCapabilities();
    }
    catch ( ... ) {
        delete fixture;
        throw;
    }

    return fixture;
}
Ejemplo n.º 5
0
// ----------------------------------------------------------------------------
//
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");
    channel_t temp_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* channels = self->FirstChildElement( "channels" );
    if ( channels )
        animation->m_channels = read_value_list<ChannelList, channel_t>( channels, "channel" );
    else
        animation->m_channels.push_back( temp_channel );

    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;
}
Ejemplo n.º 6
0
// ----------------------------------------------------------------------------
//
SceneMovementAnimator* VenueReader::read( TiXmlElement* self, SceneMovementAnimator* animation )
{
    animation = new SceneMovementAnimator();

    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" );

    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 );

    TiXmlElement* movement_element = self->FirstChildElement( "movement" );
    if ( movement_element ) {
        MovementAnimation* movement = read( movement_element, (MovementAnimation*)NULL );
        animation->m_movement = *movement;
        delete movement;
    }

    return animation;
}
Ejemplo n.º 7
0
// ----------------------------------------------------------------------------
//
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" );
}
Ejemplo n.º 8
0
// ----------------------------------------------------------------------------
//
void DefinitionReader::readFixtureDefinitions( LPCSTR directory )
{
    CFileFind finder;
    
    CString directory_search( directory );
    directory_search.Append( "\\*" );

    BOOL working = finder.FindFile( directory_search );
    if ( !working ) 
        throw StudioException( "Unable to find fixture definition directory '%s'", directory );

    while ( working ) {
        working = finder.FindNextFile();
        if ( finder.IsDots() )
            continue;

        CString file_name = finder.GetFilePath();
        if ( finder.IsDirectory() )
            readFixtureDefinitions( file_name );

        CString test_name( file_name );
        if ( test_name.MakeLower().Find( ".xml" ) == -1 )
            continue;

        // Check for definition file
        TiXmlDocument doc;
        if ( !doc.LoadFile( file_name ) )
            throw StudioException( "Error reading fixture definition '%s'", file_name );

        try {
            TiXmlElement* root = doc.FirstChildElement( "fixture_definitions" );
            LPCSTR author = read_text_element( root, "author" );
            LPCSTR version = read_text_element( root, "version" );

            FixtureDefinitionPtrArray fixture_definitions = read_xml_list<FixtureDefinition>( root, "fixture" );

            //DefinitionWriter writer;
            //writer.writeFixtureDefinition( file_name, author, version, fixture_definitions );

            for ( FixtureDefinition* definition : fixture_definitions ) {
                definition->setSourceFile( file_name );
                definition->m_author = author;
                definition->m_version = version;

                FixtureDefinition::addFixtureDefinition( definition );
                delete definition;
            }
        }
        catch ( StudioException e ) {
            throw StudioException( "%s: %s", file_name, e.what() );
        }
    }
    
    finder.Close();
}
Ejemplo n.º 9
0
// ----------------------------------------------------------------------------
//
MusicSceneSelector* VenueReader::read( TiXmlElement* self, MusicSceneSelector* music_scene_selection )
{
    music_scene_selection = new MusicSceneSelector();

    music_scene_selection->m_selection_uid = (UID)read_dword_attribute( self, "uid" );
    music_scene_selection->m_selection_type = (MusicSelectorType)read_dword_attribute( self, "type" );
    music_scene_selection->m_track_link  = read_text_element( self, "track_link" );
    music_scene_selection->m_track_full_name = read_text_element( self, "track_full_name" );

    return music_scene_selection;
}
Ejemplo n.º 10
0
// ----------------------------------------------------------------------------
//
bool TrackInfoCacheFile::read( AudioTrackInfoCache& cache )
{
    TiXmlDocument doc;
    if ( !doc.LoadFile( m_filename ) ) {
        m_last_error = doc.ErrorDesc();
        return false;
    }

    cache.clear();

    TiXmlElement* root = doc.FirstChildElement( "audio_track_info" );
    if ( root ) {
        TiXmlElement* entry = root->FirstChildElement( "entry" );
        while ( entry ) {
            AudioInfo info;
            CString link = read_text_element( entry, "link" );

            strncpy_s( info.id, read_text_element( entry, "id" ), 512 );
            strncpy_s( info.song_type, read_text_element( entry, "song_type" ), 512 );

            TiXmlElement* attrs = entry->FirstChildElement( "attrs" );
            if ( !attrs )
                continue;

            info.key = read_int_attribute( attrs, "key" );
            info.mode = read_int_attribute( attrs, "mode" );
            info.time_signature = read_int_attribute( attrs, "time_signature" );

            info.energy = read_double_attribute( attrs, "energy" );
            info.liveness = read_double_attribute( attrs, "liveness" );
            info.tempo = read_double_attribute( attrs, "tempo" );
            info.speechiness = read_double_attribute( attrs, "speechiness" );
            info.acousticness = read_double_attribute( attrs, "acousticness" );
            info.instrumentalness = read_double_attribute( attrs, "instrumentalness" );
            info.duration = read_double_attribute( attrs, "duration" );
            info.loudness = read_double_attribute( attrs, "loudness" );
            info.valence = read_double_attribute( attrs, "valence" );
            info.danceability = read_double_attribute( attrs, "danceability" );

            cache[ link ] = info;

            entry = entry->NextSiblingElement();
        }
    }

    return true;
}
Ejemplo n.º 11
0
// ----------------------------------------------------------------------------
//
ChannelValueRange* DefinitionReader::read( TiXmlElement* self, ChannelValueRange* range )
{
    range = new ChannelValueRange();

    range->m_start = (BYTE)read_dword_attribute( self, "start" );
    range->m_end = (BYTE)read_dword_attribute( self, "end" );
    range->m_name = read_text_element( self, "name" );

    return range;
}
Ejemplo n.º 12
0
// ----------------------------------------------------------------------------
//
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;
}
Ejemplo n.º 13
0
// ----------------------------------------------------------------------------
//
Universe* VenueReader::read( TiXmlElement* self, Universe* universe )
{
    universe = new Universe();

    universe->m_id = (universe_t)read_unsigned_attribute( self, "id", 0 );
    universe->m_type = (UniverseType)read_unsigned_attribute( self, "type", OPEN_DMX );
    universe->m_dmx_packet_delay = read_unsigned_attribute( self, "packet_delay_ms", DEFAULT_PACKET_DELAY_MS );
    universe->m_dmx_packet_min_delay = read_unsigned_attribute( self, "minimum_delay_ms", DEFAULT_MINIMUM_DELAY_MS );
    universe->m_dmx_port = read_text_element( self, "comm_port" );

    return universe;
}
Ejemplo n.º 14
0
// ----------------------------------------------------------------------------
//
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;
}
Ejemplo n.º 15
0
// ----------------------------------------------------------------------------
//
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;
}
Ejemplo n.º 16
0
// ----------------------------------------------------------------------------
//
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;
}
Ejemplo n.º 17
0
// ----------------------------------------------------------------------------
//
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;
}