コード例 #1
0
		public void Enqueue(PlayData resource)
		{
			Random = false;
			Loop = false;
			mode = PlaylistMode.Queue;
			playQueue.Enqueue(resource);
		}
コード例 #2
0
ファイル: MainBot.cs プロジェクト: CodeDevLab/TS3AudioBot
		public void SongUpdateEvent(object sender, PlayData data)
		{
			if (!QuizMode)
			{
				QueryConnection.ChangeDescription(data.Resource.ResourceTitle);
			}
		}
コード例 #3
0
		internal void OnResourceStarted(object sender, PlayData playData)
		{
			Log.Write(Log.Level.Debug, "BC Ressource started");
			BobStart();
			Pause = false;
			Sending = true;
			RestoreSubscriptions(playData.Invoker);
		}
コード例 #4
0
		/// <summary>
		/// <para>Do NOT call this method directly! Use the FactoryManager instead.</para>
		/// <para>Stops the old resource and starts the new one.</para>
		/// <para>The volume gets resetted and the OnStartEvent gets triggered.</para>
		/// </summary>
		/// <param name="playData">The info struct contaiting the AudioResource to start.</param>
		/// <returns>An infocode on what happened.</returns>
		internal AudioResultCode StartResource(PlayData playData)
		{
			if (playData == null || playData.Resource == null)
			{
				Log.Write(Log.Level.Debug, "AF audioResource is null");
				return AudioResultCode.NoNewResource;
			}

			Stop(true);

			string resourceLink = playData.Resource.Play();
			if (string.IsNullOrWhiteSpace(resourceLink))
				return AudioResultCode.ResouceInternalError;

			Log.Write(Log.Level.Debug, "AF ar start: {0}", playData.Resource);
			playerConnection.AudioStart(resourceLink);

			if (playData.Volume == -1)
				Volume = audioFrameworkData.defaultVolume;
			else
				Volume = playData.Volume;
			Log.Write(Log.Level.Debug, "AF set volume: {0}", Volume);

			OnResourceStarted?.Invoke(this, playData);
			CurrentPlayData = playData;

			if (!playerConnection.SupportsEndCallback)
			{
				endTime = Util.GetNow();
				waitEndTick.Active = true;
			}
			return AudioResultCode.Success;
		}