예제 #1
0
        /// <summary>
        /// Form to manage the Color Organ functionality
        /// </summary>
        /// <param name="xmlData"></param>
        /// <param name="sequence"></param>
        public ColorOrgan(ref XmlNode xmlData, EventSequence sequence)
        {
            // save the reference to the xml data
            m_xmlData = xmlData;

            // save the list of bands we have available to us
            foreach (int frequency in m_frequencyArray)
            {
                FrequencyBand newBand = new FrequencyBand(frequency);
                m_mapOfFrequencyBands.Add(newBand.CenterFrequency, newBand);
            }             // end build base frequency objects

            // record the sequence
            m_sequence = sequence;

            // go find out what the peaks and valleys are for this sound track
            analyzeSoundTrack();

            // process xml data and set up any pre defined groups
            // mark the frequency bands that are a member of this color organ band
            XmlNodeList colorOrganBandNodes = xmlData.SelectNodes(m_xmlName_listOfColorOrganBands + "/*");

            foreach (XmlNode xmlColorOrganBandNode in colorOrganBandNodes)
            {
                ColorOrganBand newBand = new ColorOrganBand(xmlColorOrganBandNode, m_mapOfFrequencyBands, m_sequence, this);
                m_mapOfColorOrganBands.Add(newBand.ID, newBand);
            }             // end build color organ band list

            // did we get any groups?
            if (0 == m_mapOfColorOrganBands.Count)
            {
                createDefaultColorOrganBandSet(-1, 1);
            }     // end create default color band
        }         // ColorOrganForm
        }         // colorOrganFrequencyBand

        /// <summary>
        /// Copy constructuor: init the Color Organ wrapper around a frequency band
        /// </summary>
        /// <param name="template"></param>
        public ColorOrganFrequencyBand(ColorOrganFrequencyBand template)
        {
            // save the frequency band
            m_frequencyBand = template.m_frequencyBand;

            // set the group membership flag
            m_member = template.m_member;
        }         // colorOrganFrequencyBand
        /// <summary>
        /// init the Color Organ wrapper around a frequency band
        /// </summary>
        /// <param name="frequencyBand"></param>
        /// <param name="defaultState"></param>
        public ColorOrganFrequencyBand(FrequencyBand frequencyBand, bool defaultState)
        {
            // save the frequency band
            m_frequencyBand = frequencyBand;

            // set the group membership flag
            m_member = defaultState;
        }         // colorOrganFrequencyBand