/// <summary> /// Plays one of the available animations that matches the specified name. /// </summary> /// <param name="name"></param> /// <param name="resetAnim"></param> /// <param name="loopMode"></param> public void PlayAnimation(string name, bool resetAnim = false, LoopMode loopMode = LoopMode.Default) { ActorAnimation anim = this.GetAnimation(name); // When specifying default, let the animation decide which loop mode to use. if (anim != null && loopMode == LoopMode.Default) { loopMode = anim.PreferredLoopMode; } // Still set to default? Use a regular loop then. if (loopMode == LoopMode.Default) { loopMode = LoopMode.Loop; } // If we're already playing that animation, just continue doing it. if (this.activeAnim == anim && !resetAnim) { return; } this.activeAnim = anim; this.activeLoopMode = loopMode; if (this.activeAnim != null && loopMode == LoopMode.RandomSingle) { this.animTime = MathF.Rnd.NextFloat(0.0f, this.activeAnim.Duration); } else { this.animTime = 0.0f; } }
public bool AdvanceSong(int songLength, LoopMode loopMode) { bool advancedPattern = false; bool forceResetTempo = false; if (++playNote >= song.GetPatternLength(playPattern)) { playNote = 0; if (loopMode != LoopMode.Pattern) { playPattern++; advancedPattern = true; forceResetTempo = playPattern == song.LoopPoint; } } if (playPattern >= songLength) { loopCount++; if (maxLoopCount > 0 && loopCount >= maxLoopCount) { return(false); } if (loopMode == LoopMode.LoopPoint) // This loop mode is actually unused. { if (song.LoopPoint >= 0) { playPattern = song.LoopPoint; playNote = 0; advancedPattern = true; forceResetTempo = true; loopCount++; } else { return(false); } } else if (loopMode == LoopMode.Song) { playPattern = Math.Max(0, song.LoopPoint); playNote = 0; advancedPattern = true; forceResetTempo = true; } else if (loopMode == LoopMode.None) { return(false); } } if (advancedPattern) { ResetFamiStudioTempo(forceResetTempo); } return(true); }
public Animation(LoopMode loopMode) { this.frames = new List <AnimationFrame>(); this.duration = 0; this.nextStrip = null; this.loopMode = loopMode; }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public Animation() { this.frames = new List<AnimationFrame>(); this.duration = 0; this.nextStrip = null; this.loopMode = LoopMode.Repeat; }
public AudioItem(AudioItem orig) { Name = orig.Name; Loop = orig.Loop; LoopSequenceCount = orig.LoopSequenceCount; LoopSequenceOverlap = orig.LoopSequenceOverlap; LoopSequenceRandomDelay = orig.LoopSequenceRandomDelay; LoopSequenceRandomPitch = orig.LoopSequenceRandomPitch; LoopSequenceRandomVolume = orig.LoopSequenceRandomVolume; DestroyOnLoad = orig.DestroyOnLoad; Volume = orig.Volume; SubItemPickMode = orig.SubItemPickMode; MinTimeBetweenPlayCalls = orig.MinTimeBetweenPlayCalls; MaxInstanceCount = orig.MaxInstanceCount; Delay = orig.Delay; RandomVolume = orig.RandomVolume; RandomPitch = orig.RandomPitch; RandomDelay = orig.RandomDelay; OverrideAudioSourceSettings = orig.OverrideAudioSourceSettings; AudioSourceMinDistance = orig.AudioSourceMinDistance; AudioSourceMaxDistance = orig.AudioSourceMaxDistance; SpatialBlend = orig.SpatialBlend; for (var index = 0; index < orig.SubItems.Length; ++index) { ArrayHelper.AddArrayElement(ref SubItems, new AudioSubItem(orig.SubItems[index], this)); } }
public static MODE CreateModeForLowLevelEmitter(LoopMode l, Positioning p, LoadType t) { MODE mode = MODE.DEFAULT; mode |= ModeFromLoop(l) | ModeFromPosition(p) | ModeFromLoadType(t); return(mode); }
/// <summary> /// Sets the tween to yoyo once. /// Percent will run from [0 -> 1 -> 0]. /// </summary> public Tween Yoyo(bool inbMirrored = false) { m_Mode = LoopMode.Yoyo; m_NumLoops = 0; m_MirrorCurve = inbMirrored; return(this); }
public void ChangeLoopMode() { switch (_loopMode) { case LoopMode.NoLoop: _loopMode = LoopMode.OneLoop; break; case LoopMode.OneLoop: _loopMode = LoopMode.TwoLoop; break; case LoopMode.TwoLoop: _loopMode = LoopMode.InfiniteLoop; break; case LoopMode.InfiniteLoop: _loopMode = LoopMode.NoLoop; break; default: throw new ArgumentOutOfRangeException(); } OnPropertyChanged(nameof(LoopModeString)); }
/// <summary> /// Disposes of the tween and resets all variables. /// </summary> public void Dispose() { if (m_TweenData != null) { if (m_State == State.Run && m_Cancel != CancelMode.Nothing) { m_Reversed = false; float curvedPercent = 0; switch (m_Cancel) { case CancelMode.Revert: curvedPercent = Evaluate(0); break; case CancelMode.RevertNoWave: curvedPercent = EvaluateNoWave(0); break; case CancelMode.ForceEnd: curvedPercent = Evaluate(m_Mode == LoopMode.Yoyo || m_Mode == LoopMode.YoyoLoop ? 0 : 1); break; case CancelMode.ForceEndNoWave: curvedPercent = EvaluateNoWave(m_Mode == LoopMode.Yoyo || m_Mode == LoopMode.YoyoLoop ? 0 : 1); break; } m_TweenData.ApplyTween(curvedPercent); if (m_OnUpdate != null) { m_OnUpdate(m_FromMode ? 1 - curvedPercent : curvedPercent); } } m_TweenData.OnTweenEnd(); m_TweenData = null; TweenPool.Free(this); } m_Cancel = CancelMode.Nothing; m_Mode = LoopMode.Single; m_Curve = Curve.Linear; m_AnimCurve = null; m_WaveFunc = default(Wave); m_NumLoops = 0; m_OnStart = null; m_OnUpdate = null; m_OnComplete = null; m_Reversed = false; m_MirrorCurve = false; m_FromMode = false; m_Instant = false; m_StartMode = StartMode.Restart; m_StartTime = 0; m_CurrentPercent = 0; m_PercentIncrement = 0; m_State = State.Begin; }
/// <summary> /// Sets the tween to yoyo and loop forever. /// Percent will run from [0 -> 1 -> 0] and loop. /// </summary> public Tween YoyoLoop(bool inbMirrored = false) { m_Mode = LoopMode.YoyoLoop; m_NumLoops = LOOPING_FOREVER; m_MirrorCurve = inbMirrored; return(this); }
public PlayControl play(LoopMode loopMode) { if (!fileOpened) { status = Status.EXCEPTION; throw new FileNotOpenedException(); } if (status == Status.PAUSED) { resume(); return(this); } status = Status.PLAYING; this.loopMode = loopMode; String command = "play MediaFile notify"; changeLoopMode(loopMode); mciSendString(command, null, 0, handle); setVolume(volume); return(this); }
/// <summary> /// Sets the tween to yoyo and loop the given number of times. /// Percent will run from [0 -> 1 -> 0] and loop. /// </summary> public Tween YoyoLoop(int inNumLoops, bool inbMirrored = false) { m_Mode = LoopMode.YoyoLoop; m_NumLoops = inNumLoops < 1 ? 1 : inNumLoops; m_MirrorCurve = inbMirrored; return(this); }
private void EditorValidate() { LineManager lineManagerinParent = GetComponentInParent <LineManager>(); if (lineManager != lineManagerinParent) { Validate(lineManagerinParent); } if (!lineManager) { return; } if (lastIndex != order || lastRow != row || lastParent != transform.parent || _path != lastPath || lastLoopMode != pathLoopMode) { if (lineManager.autoNameGameobject) { name = "#" + order + " (Row " + row + ")"; } if (lineManager.autoSetTextNumber) { textIndex.text = "" + (order + (lineManager.incrementTextNumber ? 1 : 0)); } SetPaths(); lastIndex = order; lastRow = row; lastParent = transform.parent; lastPath = _path; lastLoopMode = pathLoopMode; } }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public Animation() { this.frames = new List <AnimationFrame>(); this.duration = 0; this.nextStrip = null; this.loopMode = LoopMode.Repeat; }
public Animation(LoopMode loopMode) { this.frames = new List<AnimationFrame>(); this.duration = 0; this.nextStrip = null; this.loopMode = loopMode; }
public void Start(short[] data, LoopMode loopMode, int sampleRate, int start, int end, int startLoop, int endLoop, int rootKey, int coarseTune, int fineTune, int scaleTuning) { this.data = data; this.loopMode = loopMode; this.sampleRate = sampleRate; this.start = start; this.end = end; this.startLoop = startLoop; this.endLoop = endLoop; this.rootKey = rootKey; tune = coarseTune + 0.01F * fineTune; pitchChangeScale = 0.01F * scaleTuning; sampleRateRatio = (float)sampleRate / synthesizer.SampleRate; if (loopMode == LoopMode.NoLoop) { looping = false; } else { looping = true; } position = start; }
public static bool AdvanceTempo(Song song, int speed, LoopMode loopMode, ref int tempoCounter, ref int playPattern, ref int playNote, ref int playFrame, ref bool advance) { // Tempo/speed logic. tempoCounter += song.Tempo * 256 / 150; // NTSC if ((tempoCounter >> 8) >= speed) { tempoCounter -= (speed << 8); if (++playNote == song.PatternLength) { playNote = 0; if (loopMode != LoopMode.Pattern) { if (++playPattern == song.Length) { if (loopMode == LoopMode.None) { return(false); } playPattern = 0; } } } playFrame = playPattern * song.PatternLength + playNote; advance = true; } return(true); }
private async Task <bool> TryPlayPreviousAsync(bool ignoreLoopOne) { this.isPlayingPreviousTrack = true; if (this.GetCurrentTime.Seconds > 3) { // If we're more than 3 seconds into the Track, try to // jump to the beginning of the current Track. this.player.Skip(0); return(true); } // When "loop one" is enabled and ignoreLoopOne is true, act like "loop all". LoopMode loopMode = this.LoopMode == LoopMode.One && ignoreLoopOne ? LoopMode.All : this.LoopMode; KeyValuePair <string, PlayableTrack> previousTrack = await this.queueManager.PreviousTrackAsync(loopMode); if (previousTrack.Equals(default(KeyValuePair <string, PlayableTrack>))) { this.Stop(); return(true); } return(await this.TryPlayAsync(previousTrack)); }
public AnimationData(string name, List<FrameData> frames, PixelPoint animSize, PixelRect hitbox, LoopMode loopMode) { this.name = name; this.frames = frames; this.animSize = animSize; this.hitbox = hitbox; this.loopMode = loopMode; }
void Awake() { if ((int)Loop == 3) // deprecated LoopGapless { Loop = LoopMode.LoopSequence; } _lastChosen = -1; }
public FrameTag(string name, int from, int to, LoopMode loopMode, IEnumerable <string> properties) { this.Properties = new HashSet <string>(properties); this.Name = name; this.From = from; this.To = to; this.LoopMode = loopMode; }
public void CheckForMusic() { if (music != null) { loopMode = music.loopMode; spatializeSound = music.spatialize; } }
private void Awake() { if (Loop == (LoopMode.LoopSubitem | LoopMode.LoopSequence)) { Loop = LoopMode.LoopSequence; } LastChosen = -1; }
private void Awake() { if (Loop == (LoopMode)3) { Loop = LoopMode.LoopSequence; } _lastChosen = -1; }
public AnimationData(string name, List <FrameData> frames, PixelPoint animSize, PixelRect hitbox, LoopMode loopMode) { this.name = name; this.frames = frames; this.animSize = animSize; this.hitbox = hitbox; this.loopMode = loopMode; }
public void Play(string name, LoopMode?loopMode = null) { _animationActive = true; CurrentAnimation = _animations[name]; SetSprite(CurrentAnimation.Sprites[0]); _elapsedTime = 0; _loopMode = loopMode ?? LoopMode.Loop; _currentAnimationName = name; }
public void PlayContinuing(string name, LoopMode?loopMode = null) { CurrentAnimation = _animations[name]; CurrentAnimationName = name; AnimationState = State.Running; Sprite = CurrentAnimation.Sprites[CurrentFrame]; _loopMode = loopMode ?? LoopMode.Loop; }
public Animation(Sprite sprite) { this.frames = new List <AnimationFrame>(); this.duration = 0; this.nextStrip = null; this.loopMode = LoopMode.Repeat; this.frames.Add(new AnimationFrame(0, 0, sprite)); }
public Animation(Sprite sprite) { this.frames = new List<AnimationFrame>(); this.duration = 0; this.nextStrip = null; this.loopMode = LoopMode.Repeat; this.frames.Add(new AnimationFrame(0, 0, sprite)); }
public Animation(int framerate, AnimationMode animMode, LoopMode loopMode) { this.frames = new List<Rectangle>(); this.framerate = framerate; this.animationMode = animMode; this.loopMode = loopMode; SetDirectionForwards(); loopFrom = 0; }
public Animation(int framerate, AnimationMode animMode, LoopMode loopMode) { this.frames = new List <Rectangle>(); this.framerate = framerate; this.animationMode = animMode; this.loopMode = loopMode; SetDirectionForwards(); loopFrom = 0; }
// Start is called before the first frame update protected void Start() { if (audioObject == null) { DesignateMusic(); loopMode = audioObject.loopMode; spatializeSound = audioObject.spatialize; } }
/// <summary> /// Open next item in the list, using visible items first if using search /// </summary> /// <param name="loopMode"></param> public void OpenNext(LoopMode loopMode) { for (var i = 0; i < items.Count; i++) { if (items[i].Content.Playing) { if (SearchActive) { for (var j = 0; j < findlist.Length; j++) { if (i == findlist[j]) { // item was part of found list, let's open next in shown list if (j >= findlist.Length - 1) { // last item in the list if (loopMode == LoopMode.LoopAll) { RaiseLoadEvent(items[findlist[0]].Content); } // stop playing } else { RaiseLoadEvent(items[findlist[++j]].Content); } return; // item was found, no need to search further } } // item was not in the visible list, play next item from overall then instead PlayNextListItem(i, loopMode); } else { PlayNextListItem(i, loopMode); } return; // item was found, no need to search further } } if (items.Count <= 0) { return; } if (SearchActive && findlist.Length > 0) { RaiseLoadEvent(items[findlist[0]].Content); } else { RaiseLoadEvent(items[0].Content); } }
public PlaybackControlsViewModel(IPlaybackService playbackService, IEventAggregator eventAggregator) { // Injection this.playbackService = playbackService; this.eventAggregator = eventAggregator; // Timers this.isLoadingTrackTimer.Interval = 1000; this.isLoadingTrackTimer.Elapsed += IsLoadingTrackTimer_Elapsed; // Commands this.PauseCommand = new DelegateCommand(() => this.playbackService.PlayOrPauseAsync()); this.PreviousCommand = new DelegateCommand(async() => await this.playbackService.PlayPreviousAsync()); this.NextCommand = new DelegateCommand(async() => await this.playbackService.PlayNextAsync()); this.LoopCommand = new DelegateCommand(() => this.SetPlayBackServiceLoop()); this.ShuffleCommand = new DelegateCommand(() => this.SetPlayBackServiceShuffle(!this.shuffle)); this.PlayCommand = new DelegateCommand(async() => await this.playbackService.PlayOrPauseAsync()); // Event handlers this.playbackService.PlaybackFailed += (_, __) => this.ShowPause = false; this.playbackService.PlaybackPaused += (_, __) => this.ShowPause = false; this.playbackService.PlaybackResumed += (_, __) => this.ShowPause = true; this.playbackService.PlaybackStopped += (_, __) => this.ShowPause = false; this.playbackService.PlaybackSuccess += (_, __) => this.ShowPause = true; this.playbackService.PlaybackLoopChanged += (_, __) => this.GetPlayBackServiceLoop(); this.playbackService.PlaybackShuffleChanged += (_, __) => this.GetPlayBackServiceShuffle(); this.playbackService.LoadingTrack += (isLoadingTrack) => { if (isLoadingTrack) { this.isLoadingTrackTimer.Stop(); this.isLoadingTrackTimer.Start(); } else { this.isLoadingTrackTimer.Stop(); this.IsLoadingTrack = false; } }; // Initial Loop and Shuffle state this.loopMode = (LoopMode)SettingsClient.Get <int>("Playback", "LoopMode"); this.shuffle = SettingsClient.Get <bool>("Playback", "Shuffle"); // Initial status of the Play/Pause button if (this.playbackService.IsPlaying) { this.ShowPause = true; } else { this.ShowPause = false; } }
/// <summary> /// plays the animation with the given name. If no loopMode is specified it is defaults to Loop /// </summary> public void Play(string name, LoopMode?loopMode = null) { CurrentAnimation = _animations[name]; CurrentAnimationName = name; CurrentFrame = 0; AnimationState = State.Running; Sprite = CurrentAnimation.Sprites[0]; _elapsedTime = 0; _loopMode = loopMode ?? LoopMode.Loop; }
public Animation(Animation copy) { frames = new List<AnimationFrame>(); nextStrip = null; duration = copy.duration; loopMode = copy.loopMode; for (int i = 0; i < copy.frames.Count; i++) frames.Add(new AnimationFrame(copy.frames[i])); if (copy.nextStrip != null) nextStrip = new Animation(copy.nextStrip); }
public void SetLoopMode(LoopMode loopType) { _loopMode = loopType; PlayerPrefs.SetInt("loopMode", (int)_loopMode); if(_loopMode == LoopMode.Loops) { _editor.LoopTypeString = "-->LOOP-->"; } else if(_loopMode == LoopMode.PlayOnce) { _editor.LoopTypeString = "PLAY ONCE-->"; } else if(_loopMode == LoopMode.PingPong) { _editor.LoopTypeString = "<--PING PONG-->"; _pingPongForward = true; } else if(_loopMode == LoopMode.RandomFrame) { _editor.LoopTypeString = "?--RANDOM--?"; } }
private void SetLoopModeOnDropdown(LoopMode loopMode) { if (loopMode == LoopMode.FullLoop) cmbLoopMode.SelectedIndex = 0; if (loopMode == LoopMode.PartialLoopAnchorStart) cmbLoopMode.SelectedIndex = 1; if (loopMode == LoopMode.PartialLoopAnchorEnd) cmbLoopMode.SelectedIndex = 2; }
void Awake() { if ( (int) Loop == 3 ) // deprecated LoopGapless { Loop = LoopMode.LoopSequence; } _lastChosen = -1; }
public virtual void PlayAnimation(string animName, LoopMode overriddenLoopMode) { PlayAnimation(animName); _overrideLoopMode = true; _overriddenLoopMode = overriddenLoopMode; }
private void SetLoopMode(LoopMode loopAnimation, bool checkParentAnimator) { if (_loopMode == loopAnimation) return; if (_parentAnimator != null && checkParentAnimator && !_isInitializing) throw new InvalidOperationException(SET_PROP_WITH_PARENT_ANIMATOR_ERROR_MESSAGE); _loopMode = loopAnimation; foreach (AnimatorBase childAnimator in _childAnimators) childAnimator.SetLoopMode(loopAnimation, false); OnLoopAnimationChanged(EventArgs.Empty); }
public AnimationBuilder SetLoopMode(LoopMode loopMode) { animation.LoopMode = loopMode; return this; }
public Animation(List<Rectangle> frames, int framerate, AnimationMode animMode, LoopMode loopMode, int loopFrom, int loopTo) { this.frames = frames; this.framerate = framerate; this.animationMode = animMode; this.loopMode = loopMode; this.loopFrom = loopFrom; this.loopTo = loopTo; SetDirectionForwards(); }
/// <summary> /// Plays one of the available animations that matches the specified name. /// </summary> /// <param name="name"></param> /// <param name="resetAnim"></param> /// <param name="loopMode"></param> public void PlayAnimation(string name, bool resetAnim = false, LoopMode loopMode = LoopMode.Default) { ActorAnimation anim = this.GetAnimation(name); // When specifying default, let the animation decide which loop mode to use. if (anim != null && loopMode == LoopMode.Default) loopMode = anim.PreferredLoopMode; // Still set to default? Use a regular loop then. if (loopMode == LoopMode.Default) loopMode = LoopMode.Loop; // If we're already playing that animation, just continue doing it. if (this.activeAnim == anim && !resetAnim) return; this.activeAnim = anim; this.activeLoopMode = loopMode; if (this.activeAnim != null && loopMode == LoopMode.RandomSingle) this.animTime = MathF.Rnd.NextFloat(0.0f, this.activeAnim.Duration); else this.animTime = 0.0f; }
public void SetLoopMode(LoopMode loopMode) { this.loopMode = loopMode; }