Пример #1
0
        // Create a new phrase node with the audio from the clipboard
        // and merge the selected node with this one.
        protected virtual urakawa.command.Command PasteCommandAudio(ProjectView.ProjectView view)
        {
            AudioClipboard c = (AudioClipboard)view.Clipboard;

            //urakawa.media.data.audio.ManagedAudioMedia media = ((PhraseNode)view.Clipboard.Node).Audio.copy(
            urakawa.media.data.audio.ManagedAudioMedia media = view.Presentation.MediaFactory.CreateManagedAudioMedia();

            WavAudioMediaData wavData = ((WavAudioMediaData)((PhraseNode)view.Clipboard.Node).Audio.AudioMediaData).Copy(
                new Time(Convert.ToInt64(c.AudioRange.SelectionBeginTime * Time.TIME_UNIT)),
                new Time(Convert.ToInt64(c.AudioRange.SelectionEndTime * Time.TIME_UNIT)));//sdk2

            media.AudioMediaData = wavData;

            CompositeCommand p = view.Presentation.CreateCompositeCommand(Localizer.Message("paste_audio"));

            if (Node is EmptyNode)
            {
                if (view.TransportBar.CurrentState == Obi.ProjectView.TransportBar.State.Paused)
                {
                    Command pasteCommand = new Commands.Audio.Paste(view, view.TransportBar.SplitBeginTime);
                    p.ChildCommands.Insert(p.ChildCommands.Count, pasteCommand);
                }
                else
                {
                    PhraseNode phrase = view.Presentation.CreatePhraseNode(media);
                    p.ChildCommands.Insert(p.ChildCommands.Count, new Commands.Node.AddNode(view, phrase, ParentForNewNode(phrase), IndexForNewNode(phrase)));
                    p.ChildCommands.Insert(p.ChildCommands.Count, Commands.Node.MergeAudio.GetMergeCommand(view, (EmptyNode)Node, phrase));
                    if (Node is PhraseNode)
                    {
                        p.ChildCommands.Insert(p.ChildCommands.Count, new Commands.UpdateSelection(view, new AudioSelection((PhraseNode)Node, Control, new AudioRange(Node.Duration, Node.Duration + phrase.Duration))));
                    }
                    else if (Node is EmptyNode)
                    {
                        p.ChildCommands.Insert(p.ChildCommands.Count, new Commands.UpdateSelection(view, new NodeSelection(phrase, Control)));
                    }
                }
            }
            else
            {
                PhraseNode phrase = view.Presentation.CreatePhraseNode(media);
                p.ChildCommands.Insert(p.ChildCommands.Count, new Commands.Node.AddNode(view, phrase, ParentForNewNode(phrase), IndexForNewNode(phrase)));
            }
            return(p);
        }
Пример #2
0
        protected override urakawa.command.Command PasteCommandAudio(Obi.ProjectView.ProjectView view)
        {
            AudioClipboard c = (AudioClipboard)view.Clipboard;

            urakawa.media.data.audio.ManagedAudioMedia media = view.Presentation.MediaFactory.CreateManagedAudioMedia();

            WavAudioMediaData wavData = ((WavAudioMediaData)((PhraseNode)view.Clipboard.Node).Audio.AudioMediaData).Copy(
                new Time(Convert.ToInt64(c.AudioRange.SelectionBeginTime * Time.TIME_UNIT)),
                new Time(Convert.ToInt64(c.AudioRange.SelectionEndTime * Time.TIME_UNIT)));//sdk2

            media.AudioMediaData = wavData;

            PhraseNode       phrase = view.Presentation.CreatePhraseNode(media);
            CompositeCommand p      = view.Presentation.CreateCompositeCommand(Localizer.Message("paste_audio"));

            p.ChildCommands.Insert(p.ChildCommands.Count, new Commands.Node.AddNode(view, phrase, ParentForNewNode(phrase), IndexForNewNode(phrase)));
            if (!Node.Used)
            {
                view.AppendMakeUnused(p, phrase);
            }
            return(p);
        }