/// <summary> /// Plays the sample through the specified player's track trackNb /// </summary> public void PlayThroughTrack(GATPlayer player, int trackNb, float gain = 1f) { if (PlayingStatus != Status.ReadyToPlay) { return; } PlayingStatus = Status.Scheduled; player.PlayData(_dataOwner.AudioData, trackNb, gain, PlayerWillMixSample); _endDspTime = AudioSettings.dspTime + MaxDuration; }
/// <summary> /// Plays the sample directly through the specified player /// If no AGATPanInfo reference was specified when creating the instance, /// doesn't do anything. /// </summary> public void PlayPanned(GATPlayer player, float gain = 1f) { if (panInfo == null) { #if GAT_DEBUG Debug.LogWarning("No panInfo set!"); return; #endif } if (PlayingStatus != Status.ReadyToPlay) { return; } PlayingStatus = Status.Scheduled; player.PlayData(_dataOwner.AudioData, panInfo, gain, PlayerWillMixSample); _endDspTime = AudioSettings.dspTime + MaxDuration; }
/// <summary> /// Starts playback through the user specified player. /// </summary> public void PlayThroughTrack(GATPlayer player, int trackNb, float gain = 1f) { #if GAT_DEBUG if (IsPlaying) { Debug.LogWarning("Already playing!"); return; } #endif IsPlaying = true; _keepLooping = true; _nextIndex = _attackStartIndex; //reset the play head _currentState = State.Attack; _data = _dataOwner.AudioData; if (!_noLoop) { UpdateZeroCrossings(); } player.PlayData(_data, trackNb, gain, PlayerWillMixSample); }
public IGATBufferedSampleOptions Play(GATPlayer player, int trackNb, float gain = 1f, GATPlayer.OnShouldMixSample mixCallback = null) { UpdateAudioData(); return(player.PlayData(_audioData, trackNb, gain, mixCallback)); //Only use AudioData property when playing, as it updates }