public void Play(bool looping) { //Console.WriteLine(String.Format("{0} {1} PLAY", DateTime.Now.TimeOfDay, Sound != null ? Sound.Name : "NullSound")); Priority = random.Next(255); if (Sound is ISoundResource) { ((Client.Sound.ISoundResource)Sound).Priority = (Priority)Priority; } var args = new PlayArgs { Looping = false }; if (Is3DSound) { args.Position = Position; args.Velocity = Vector3.Zero; } if (looping) { Channel = Sound.PlayLoopedWithIntervals(0, 0, 0, args); } else { Channel = Sound.Play(args); } Virtual = false; Channel.PlaybackStopped += new EventHandler(Channel_PlaybackStopped); Channel.GoesVirtual += new EventHandler(Unit_DebugGoesVirtual); Channel.LeavesVirtual += new EventHandler(Unit_DebugLeavesVirtual); }
public PlayPayload(ulong guildId, PlayArgs playArgs) : base(guildId, "play") { Hash = playArgs.Track.Hash; NoReplace = playArgs.NoReplace; Volume = playArgs.Volume; Pause = playArgs.ShouldPause; if (playArgs.StartTime.HasValue) { StartTime = (int)playArgs.StartTime.Value.TotalMilliseconds; } if (playArgs.EndTime.HasValue) { EndTime = (int)playArgs.EndTime.Value.TotalMilliseconds; } }