/// <summary> /// A new phrase is being recorded, so create and return it. /// </summary> public PhraseNode StartRecordingPhrase(Events.Audio.Recorder.PhraseEventArgs e, SectionNode parent, int index) { PhraseNode phrase = CreatePhraseNode(e.Audio); parent.Insert(phrase, index); return(phrase); }
/// <summary> /// Create a new phrase node from an audio media. /// </summary> public PhraseNode CreatePhraseNode(ManagedAudioMedia audio) { PhraseNode node = CreatePhraseNode(); node.Audio = audio; return(node); }
/// <summary> /// Create a phrase node belonging to this presentation. /// </summary> public PhraseNode CreatePhraseNode() { PhraseNode node = (PhraseNode)m_ObiNodeFactory.createNode(XukAble.GetXukName(typeof(PhraseNode)).z(PrettyFormat), DataModelFactory.NS); //sdk2 :local ObiNode factory used node.AddProperty(PropertyFactory.CreateChannelsProperty()); return(node); }
/// <summary> /// Unset the heading node, if it was indeed this one. /// </summary> public void UnsetHeading(PhraseNode node) { if (node == mHeading) { mHeading = null; } }
/// <summary> /// Test whether this node is before some other node in the project. /// </summary> public bool IsBeforeInProject(PhraseNode other) { SectionNode parent = ParentAs <SectionNode>(); SectionNode otherParent = other.ParentAs <SectionNode>(); return(parent.Position < otherParent.Position || (parent == otherParent && Index < other.Index)); }
public AudioClipboard(PhraseNode node, AudioRange range) : base(node, true) { mAudioRange = range; if (mAudioRange.HasCursor) { throw new Exception("Expected actual audio selection."); } if (!(Node is PhraseNode)) { throw new Exception("Expected phrase node."); } }
// 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); }
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); }
public AudioSelection(PhraseNode node, IControlWithSelection control, AudioRange audioRange) : base(node, control) { mAudioRange = audioRange; }