private void TestSplit(Time begin, Time end, Time split) { mExternalAudioMedia1.ClipEnd = Time.MaxValue; mExternalAudioMedia1.ClipBegin = Time.Zero; mExternalAudioMedia1.ClipBegin = begin; mExternalAudioMedia1.ClipEnd = end; ExternalAudioMedia secondPartAudio = mExternalAudioMedia1.Split(split); Assert.IsTrue( begin.IsEqualTo(mExternalAudioMedia1.ClipBegin), "Unexpected clip begin, was '{0}' expected '{1}'", mExternalAudioMedia1.ClipBegin, begin.ToString()); Assert.IsTrue( split.IsEqualTo(mExternalAudioMedia1.ClipEnd), "Unexpected clip end, was '{0}' expected '{1}'", mExternalAudioMedia1.ClipBegin, begin.ToString()); Assert.IsTrue( split.IsEqualTo(secondPartAudio.ClipBegin), "Unexpected clip begin, was '{0}' expected '{1}'", secondPartAudio.ClipBegin, split.ToString()); Assert.IsTrue( end.IsEqualTo(secondPartAudio.ClipEnd), "Unexpected clip end, was '{0}' expected '{1}'", secondPartAudio.ClipEnd, end.ToString()); }
public override bool ValueEquals(WithPresentation other) { if (!base.ValueEquals(other)) { return(false); } ExternalAudioMedia otherz = other as ExternalAudioMedia; if (otherz == null) { return(false); } if (Src != otherz.Src) { return(false); } if (!ClipBegin.IsEqualTo(otherz.ClipBegin)) { return(false); } if (!ClipEnd.IsEqualTo(otherz.ClipEnd)) { return(false); } return(true); }
/// <summary> /// Fires the <see cref="ClipChanged"/> event /// </summary> /// <param name="source">The source, that is the <see cref="ExternalAudioMedia"/> whoose clip has changed</param> /// <param name="newCB">The new clip begin value</param> /// <param name="newCE">The new clip begin value</param> /// <param name="prevCB">The clip begin value prior to the change</param> /// <param name="prevCE">The clip end value prior to the change</param> protected void NotifyClipChanged(ExternalAudioMedia source, Time newCB, Time newCE, Time prevCB, Time prevCE) { EventHandler <events.media.ClipChangedEventArgs> d = ClipChanged; if (d != null) { d(this, new urakawa.events.media.ClipChangedEventArgs(source, newCB, newCE, prevCB, prevCE)); } }
/// <summary> /// Exports the external audio media to a destination <see cref="Presentation"/> /// - part of technical construct to have <see cref="Export"/> return <see cref="ExternalAudioMedia"/> /// </summary> /// <param name="destPres">The destination presentation</param> /// <returns>The exported external audio media</returns> protected override Media ExportProtected(Presentation destPres) { ExternalAudioMedia exported = (ExternalAudioMedia)base.ExportProtected(destPres); exported.Src = Src; exported.ClipBegin = ClipBegin.Copy(); exported.ClipEnd = ClipEnd.Copy(); return(exported); }
///<summary> /// ///</summary> ///<returns></returns> protected override Media CopyProtected() { ExternalAudioMedia copy = (ExternalAudioMedia)base.CopyProtected(); copy.Src = Src; copy.ClipBegin = ClipBegin.Copy(); copy.ClipEnd = ClipEnd.Copy(); return(copy); }
/// <summary> /// Splits <c>this</c> at a given <see cref="Time"/> /// </summary> /// <param name="splitPoint">The <see cref="Time"/> at which to split - /// must be between clip begin and clip end <see cref="Time"/>s</param> /// <returns> /// A newly created <see cref="AbstractAudioMedia"/> containing the audio after <paramref localName="splitPoint"/>, /// <c>this</c> retains the audio before <paramref localName="splitPoint"/>. /// </returns> /// <exception cref="exception.MethodParameterIsNullException"> /// Thrown when <paramref name="splitPoint"/> is <c>null</c> /// </exception> /// <exception cref="exception.MethodParameterIsOutOfBoundsException"> /// Thrown when <paramref name="splitPoint"/> is not between clip begin and clip end /// </exception> protected override AbstractAudioMedia SplitProtected(Time splitPoint) { if (splitPoint == null) { throw new exception.MethodParameterIsNullException( "The time at which to split can not be null"); } if (splitPoint.IsLessThan(ClipBegin)) { throw new exception.MethodParameterIsOutOfBoundsException( "The split time can not be before ClipBegin"); } if (splitPoint.IsGreaterThan(ClipEnd)) { throw new exception.MethodParameterIsOutOfBoundsException( "The split time can not be after ClipEnd"); } ExternalAudioMedia splitAM = Copy(); ClipEnd = splitPoint; splitAM.ClipBegin = splitPoint; return(splitAM); }