OpenBve.Sounds.IsPlaying C# (CSharp) Метод

IsPlaying() статический приватный Метод

Checks whether the specified sound is playing or supposed to be playing.
static private IsPlaying ( SoundSource source ) : bool
source SoundSource The sound source, or a null reference.
Результат bool
		internal static bool IsPlaying(SoundSource source) {
			if (source != null) {
				if (source.State == SoundSourceState.PlayPending | source.State == SoundSourceState.Playing) {
					return true;
				}
			}
			return false;
		}

Usage Example

Пример #1
0
 /// <summary>Called by the controls loop to stop playback of this horn</summary>
 internal void Stop()
 {
     //Reset loop control variable
     LoopStarted = false;
     if (!StartEndSounds & !Loop)
     {
         //Don't stop horns which are play-once single part sounds
         return;
     }
     if (!StartEndSounds & Loop)
     {
         //This sound is a toggle music horn sound
         return;
     }
     if (Sounds.IsPlaying(Source))
     {
         //Stop the loop sound playing
         Sounds.StopSound(Source);
     }
     if (StartEndSounds && !Sounds.IsPlaying(Source) && EndSound != null)
     {
         //If our end sound is defined and in use, play once
         Source = Sounds.PlaySound(EndSound, 1.0, 1.0, SoundPosition,
                                   TrainManager.PlayerTrain,
                                   TrainManager.PlayerTrain.DriverCar, false);
     }
 }
All Usage Examples Of OpenBve.Sounds::IsPlaying