Ejemplo n.º 1
0
 public static bool ReadOutSegmentSuitabilityFlag(int bitfield, SegmentSuitability suitability)
 {
     return ((int)(bitfield & (int)suitability) > 0);
 }
Ejemplo n.º 2
0
 public static void SetSegmentSuitabilityFlag(ref int bitfield, SegmentSuitability snippetType)
 {
     int argAsBitmask = (int)snippetType;
     bitfield = bitfield | argAsBitmask;
 }
Ejemplo n.º 3
0
        private List <Segment> GetSetOfAllSourceSegmentsCompatibleToSegment(Segment targetSnippet, float minCompatibilityThreshold, SegmentSuitability doNotIncludeSegmentsWithThisSuitability)
        {
            List <Segment> sourceSnippets = new List <Segment>();

            foreach (Segment tmpSnippet in m_segments)
            {
                if (tmpSnippet.IsUsableAs(doNotIncludeSegmentsWithThisSuitability) == false)
                {
                    foreach (Follower tmpFollower in tmpSnippet.Followers)
                    {
                        if (tmpFollower.snippetId == targetSnippet.Id && tmpFollower.compatibility >= minCompatibilityThreshold)
                        {
                            sourceSnippets.Add(tmpSnippet);
                        }
                    }
                }
            }

            return(sourceSnippets);
        }
Ejemplo n.º 4
0
        private void PlaySegmentOfCurrentTheme(SegmentSuitability snippetType)
	    {
		    #if !(PSAI_NOLOG)
		    {
			    if (LogLevel.debug <= Logger.Instance.LogLevel)
			    {
			    	Logger.Instance.Log("PlaySegmentOfCurrentTheme() " + snippetType, LogLevel.debug);
			    }
		    }
		    #endif

		    if (m_effectiveTheme != null)
		    {
			    Segment nextSnippet;
			    float currentIntensity = getCurrentIntensity();

                if (m_currentSegmentPlaying != null)
                {

                    nextSnippet = GetBestCompatibleSegment(m_currentSegmentPlaying, m_effectiveTheme.id, currentIntensity, (int)snippetType);

                    m_targetSegmentSuitabilitiesRequested = (int)snippetType;

                    if (nextSnippet == null)
                    {
                        #if !(PSAI_NOLOG)
                        {
                            if (LogLevel.warnings <= Logger.Instance.LogLevel)
                            {
	                            StringBuilder sb = new StringBuilder();
	                            sb.Append("No compatible Segment of suitability ");
	                            sb.Append(snippetType);
	                            sb.Append(" found for Segment ");
	                            sb.Append(m_currentSegmentPlaying.Name);
	                            sb.Append("  Trying to substitute..!");
	                            Logger.Instance.Log(sb.ToString(), LogLevel.warnings);
                            }
                        }
                        #endif

                        nextSnippet = substituteSegment(m_effectiveTheme.id);
                    }

                    if (nextSnippet != null)
                    {
                        PlaySegment(nextSnippet, false);
                    }
                }
                else
                {
                    #if !(PSAI_NOLOG)
                    {
                        if (LogLevel.errors <= Logger.Instance.LogLevel)
                        {
                        	Logger.Instance.Log("INTERNAL ERROR! PlayEndSegmentOfCurrentTheme() - m_currentSegmentPlaying was NULL", LogLevel.errors);
                        }
                    }
                    #endif
                }
		    }
	    }
Ejemplo n.º 5
0
 private void SetSnippetTypeFlag(SegmentSuitability snippetType)
 {
     int argAsBitmask = (int)snippetType;
     this.SnippetTypeBitfield = this.SnippetTypeBitfield | argAsBitmask;
 }
Ejemplo n.º 6
0
        private List<Segment> GetSetOfAllSourceSegmentsCompatibleToSegment(Segment targetSnippet, float minCompatibilityThreshold, SegmentSuitability doNotIncludeSegmentsWithThisSuitability)
        {
            List<Segment> sourceSnippets = new List<Segment>();

            foreach (Segment tmpSnippet in m_segments)
            {
                if (tmpSnippet.IsUsableAs(doNotIncludeSegmentsWithThisSuitability) == false)
                {
                    foreach (Follower tmpFollower in tmpSnippet.Followers)
                    {
                        if (tmpFollower.snippetId == targetSnippet.Id && tmpFollower.compatibility >= minCompatibilityThreshold)
                        {
                            sourceSnippets.Add(tmpSnippet);
                        }
                    }
                }
            }

            return sourceSnippets;
        }
Ejemplo n.º 7
0
 public bool IsUsableOnlyAs(SegmentSuitability snippetType)
 {
     return ((int)(this.SnippetTypeBitfield & (int)snippetType) == (int)snippetType);
 }
Ejemplo n.º 8
0
        private void ClearSnippetTypeFlag(SegmentSuitability snippetType)
        {
            int argAsBitmask = (int)snippetType;

            this.SnippetTypeBitfield = this.SnippetTypeBitfield & ~argAsBitmask;
        }
Ejemplo n.º 9
0
 public bool IsUsableOnlyAs(SegmentSuitability snippetType)
 {
     return((int)(this.SnippetTypeBitfield & (int)snippetType) == (int)snippetType);
 }
Ejemplo n.º 10
0
        public static void ClearSegmentSuitabilityFlag(ref int bitfield, SegmentSuitability snippetType)
        {
            int argAsBitmask = (int)snippetType;

            bitfield = bitfield & ~argAsBitmask;
        }
Ejemplo n.º 11
0
 public static bool ReadOutSegmentSuitabilityFlag(int bitfield, SegmentSuitability suitability)
 {
     return((int)(bitfield & (int)suitability) > 0);
 }