public void Execute()
        {
            #if DEBUG
            Console.WriteLine("CommandAddSegments::Execute()");
            #endif

            if (_newSegments.Count == 0)
            {
                foreach (string path in _filenames)
                {
                    int segmentId = EditorModel.Instance.GetNextFreeSnippetIdBasedOnGroup(_parentGroup);
                    AudioData audioData = EditorModel.Instance.CreateAudioData(path);
                    Segment segment = new Segment(segmentId, audioData);

                    string filename = EditorModel.Instance.GetPathRelativeToProjectFileBasedOnAbsolutePath(path);

                    segment.ThemeId = _parentGroup.Theme.Id;
                    segment.Id = EditorModel.Instance.GetNextFreeSnippetIdBasedOnGroup(_parentGroup);
                    segment.Group = _parentGroup;

                    System.Diagnostics.Debug.Assert(_parentGroup != null, "_parentGroup is NULL");

                    //System.Diagnostics.Debug.Assert(snippetId < 0, "snippetId=" + snippetId);
                    segment.AudioData.FilePathRelativeToProjectDir = filename;
                    segment.AudioData._prebeatLengthInSamplesEnteredManually = EditorModel.Instance.Project.Properties.DefaultPrebeatLengthInSamples;
                    segment.AudioData._postbeatLengthInSamplesEnteredManually = EditorModel.Instance.Project.Properties.DefaultPostbeatLengthInSamples;
                    segment.AudioData.Bpm = EditorModel.Instance.Project.Properties.DefaultBpm;
                    segment.AudioData.PreBeats = EditorModel.Instance.Project.Properties.DefaultPrebeats;
                    segment.AudioData.PostBeats = EditorModel.Instance.Project.Properties.DefaultPostbeats;
                    segment.AudioData.CalculatePostAndPrebeatLengthBasedOnBeats = EditorModel.Instance.Project.Properties.DefaultCalculatePostAndPrebeatLengthBasedOnBeats;
                    segment.SetStartMiddleEndPropertiesFromBitfield(EditorModel.Instance.Project.Properties.DefaultSegmentSuitabilites);

                    _newSegments.Add(segment);
                }
            }

            foreach (Segment segment in _newSegments)
            {
                #if DEBUG
                    Console.WriteLine("...adding Segment " + segment.Name + "  " + segment.GetHashCode() + "  to Group " + segment.Group.Name + "   " + segment.Group.GetHashCode());
                #endif
                _psaiProject.AddPsaiMusicEntity(segment);
                EventArgs_PsaiEntityAdded e = new EventArgs_PsaiEntityAdded(segment);
                EditorModel.Instance.RaiseEvent_PsaiEntityAdded(e);
            }
        }
예제 #2
0
        // returns true if the given Snippet is a manual Bridge Snippet to any group, false otherwise.
        // If a reference to a List<Group> is passed, the method will clear it and fill it with all
        // groups, for which this Snippet is a Manual Bridge Snippet. Pass null to speed up the calculation.
        public bool CheckIfSnippetIsManualBridgeSnippetToAnyGroup(Segment snippet, bool getGroups, out List<Group> groups)
        {
            groups = new List<Group>();

            foreach (Theme theme in Themes)
            {
                foreach (Group group in theme.Groups)
                {
                    if (group.ManualBridgeSnippetsOfTargetGroups.Contains(snippet))
                    {
                        if (!getGroups)
                        {
                            return true;
                        }
                        else
                        {
                            groups.Add(group);
                        }
                    }
                }
            }

            return (groups.Count > 0);
        }
예제 #3
0
 public bool CheckIfSnippetIsManualBridgeSnippetForSourceGroup(Segment snippet, Group sourceGroup)
 {
     return (sourceGroup.ManualBridgeSnippetsOfTargetGroups.Contains(snippet));
 }
 public EventArgs_SegmentMovedToGroup(List<Group> affectedGroups, Segment[] movedSegments)
 {
     AffectedGroups = affectedGroups;
     MovedSegmentsCount = movedSegments.Length;
     FirstSegmentMoved = movedSegments[0];
 }
 internal CommandRevertBridgeSnippet(Segment snippet, Group sourceGroup)
 {
     _snippet = snippet;
     _sourceGroup = sourceGroup;
 }
 public EventArgs_BridgeSegmentToggled(Segment snippet, Group sourceGroup)
 {
     _segment = snippet;
     _sourceGroup = sourceGroup;
 }
 internal CommandDeleteSegment(PsaiProject project, Segment segmentToDelete)
 {
     _psaiProject = project;
     _entityToDelete = segmentToDelete;
     _segmentToDelete = segmentToDelete;
 }
 internal CommandDeclareManualBridgeSegment(Segment snippet, Group sourceGroup)
 {
     _snippet = snippet;
     _sourceGroup = sourceGroup;
 }
예제 #9
0
 public void RemoveSegment(Segment snippet)
 {
     this.m_segments.Remove(snippet);
 }
예제 #10
0
        private void AddSnippet_internal(Segment snippet, int insertIndex)
        {
            snippet.Group = this;

            if (this.Theme != null)
            {
                snippet.ThemeId = this.Theme.Id;
            }

            if (insertIndex < 0  || insertIndex >= m_segments.Count)
            {
                m_segments.Add(snippet);
            }
            else
            {
                m_segments.Insert(insertIndex, snippet);
            }
        }
예제 #11
0
 public void AddSegment(Segment snippet, int index)
 {
     AddSnippet_internal(snippet, index);
 }
예제 #12
0
 public void AddSegment(Segment snippet)
 {
     AddSnippet_internal(snippet, -1);       // special case: -1 to enqueue at end of list
 }
예제 #13
0
 public void RemoveSegment(Segment snippet)
 {
     this.m_segments.Remove(snippet);
 }
예제 #14
0
 public void AddSegment(Segment snippet, int index)
 {
     AddSnippet_internal(snippet, index);
 }
예제 #15
0
 public void AddSegment(Segment snippet)
 {
     AddSnippet_internal(snippet, -1);       // special case: -1 to enqueue at end of list
 }