示例#1
0
 // --- constructors ---
 /// <summary>Creates a new sound source.</summary>
 /// <param name="buffer">The sound buffer.</param>
 /// <param name="radius">The effective sound radius.</param>
 /// <param name="pitch">The pitch change factor.</param>
 /// <param name="volume">The volume change factor.</param>
 /// <param name="position">The position. If a train and car are specified, the position is relative to the car, otherwise absolute.</param>
 /// <param name="parent">The parent object this sound source is attached to, or a null reference.</param>
 /// <param name="looped">Whether this sound source plays in a loop.</param>
 internal SoundSource(SoundBuffer buffer, double radius, double pitch, double volume, Vector3 position, object parent, bool looped)
 {
     Buffer           = buffer;
     Radius           = radius;
     Pitch            = pitch;
     Volume           = volume;
     Position         = position;
     Parent           = parent;
     Looped           = looped;
     State            = SoundSourceState.PlayPending;
     OpenAlSourceName = 0;
     //Set the sound type to undefined to use Michelle's original processing
     if (parent is AbstractCar)
     {
         Type = SoundType.TrainCar;
     }
     else if (parent is WorldObject)
     {
         Type = SoundType.AnimatedObject;
     }
     else
     {
         Type = SoundType.Undefined;
     }
 }
示例#2
0
 // --- constructors ---
 /// <summary>Creates a new sound source.</summary>
 /// <param name="buffer">The sound buffer.</param>
 /// <param name="radius">The effective sound radius.</param>
 /// <param name="pitch">The pitch change factor.</param>
 /// <param name="volume">The volume change factor.</param>
 /// <param name="position">The position. If a train and car are specified, the position is relative to the car, otherwise absolute.</param>
 /// <param name="parent">The parent object this sound source is attached to, or a null reference.</param>
 /// <param name="car">The car this sound source is attached to, or a null reference.</param>
 /// <param name="looped">Whether this sound source plays in a loop.</param>
 internal SoundSource(SoundBuffer buffer, double radius, double pitch, double volume, OpenBveApi.Math.Vector3 position, object parent, int car, bool looped)
 {
     this.Buffer           = buffer;
     this.Radius           = radius;
     this.Pitch            = pitch;
     this.Volume           = volume;
     this.Position         = position;
     this.Parent           = parent;
     this.Car              = car;
     this.Looped           = looped;
     this.State            = SoundSourceState.PlayPending;
     this.OpenAlSourceName = 0;
     //Set the sound type to undefined to use Michelle's original processing
     if (parent is TrainManager.Train)
     {
         this.Type = SoundType.TrainCar;
     }
     else if (parent is ObjectManager.WorldSound)
     {
         this.Type = SoundType.AnimatedObject;
     }
     else
     {
         this.Type = SoundType.Undefined;
     }
 }
			// --- functions ---
			/// <summary>Stops this sound.</summary>
			internal void Stop() {
				if (this.State == SoundSourceState.PlayPending) {
					this.State = SoundSourceState.Stopped;
				} else if (this.State == SoundSourceState.Playing) {
					this.State = SoundSourceState.StopPending;
				}
			}
示例#4
0
 /// <summary>Stops this sound.</summary>
 public void Stop()
 {
     if (State == SoundSourceState.PlayPending)
     {
         State = SoundSourceState.Stopped;
     }
     else if (State == SoundSourceState.Playing)
     {
         State = SoundSourceState.StopPending;
     }
 }
示例#5
0
 // --- functions ---
 /// <summary>Stops this sound.</summary>
 internal void Stop()
 {
     if (this.State == SoundSourceState.PlayPending)
     {
         this.State = SoundSourceState.Stopped;
     }
     else if (this.State == SoundSourceState.Playing)
     {
         this.State = SoundSourceState.StopPending;
     }
 }
			// --- constructors ---
			/// <summary>Creates a new sound source.</summary>
			/// <param name="buffer">The sound buffer.</param>
			/// <param name="radius">The effective sound radius.</param>
			/// <param name="pitch">The pitch change factor.</param>
			/// <param name="volume">The volume change factor.</param>
			/// <param name="position">The position. If a train and car are specified, the position is relative to the car, otherwise absolute.</param>
			/// <param name="train">The train this sound source is attached to, or a null reference.</param>
			/// <param name="car">The car this sound source is attached to, or a null reference.</param>
			/// <param name="looped">Whether this sound source plays in a loop.</param>
			internal SoundSource(SoundBuffer buffer, double radius, double pitch, double volume, OpenBveApi.Math.Vector3D position, TrainManager.Train train, int car, bool looped) {
				this.Buffer = buffer;
				this.Radius = radius;
				this.Pitch = pitch;
				this.Volume = volume;
				this.Position = position;
				this.Train = train;
				this.Car = car;
				this.Looped = looped;
				this.State = SoundSourceState.PlayPending;
				this.OpenAlSourceName = 0;
			}
示例#7
0
 // --- constructors ---
 /// <summary>Creates a new sound source.</summary>
 /// <param name="buffer">The sound buffer.</param>
 /// <param name="radius">The effective sound radius.</param>
 /// <param name="pitch">The pitch change factor.</param>
 /// <param name="volume">The volume change factor.</param>
 /// <param name="position">The position. If a train and car are specified, the position is relative to the car, otherwise absolute.</param>
 /// <param name="train">The train this sound source is attached to, or a null reference.</param>
 /// <param name="car">The car this sound source is attached to, or a null reference.</param>
 /// <param name="looped">Whether this sound source plays in a loop.</param>
 internal SoundSource(SoundBuffer buffer, double radius, double pitch, double volume, OpenBveApi.Math.Vector3 position, TrainManager.Train train, int car, bool looped)
 {
     this.Buffer           = buffer;
     this.Radius           = radius;
     this.Pitch            = pitch;
     this.Volume           = volume;
     this.Position         = position;
     this.Train            = train;
     this.Car              = car;
     this.Looped           = looped;
     this.State            = SoundSourceState.PlayPending;
     this.OpenAlSourceName = 0;
 }
示例#8
0
 /// <summary>Creates a new sound source.</summary>
 /// <param name="buffer">The sound buffer.</param>
 /// <param name="radius">The effective sound radius.</param>
 /// <param name="pitch">The pitch change factor.</param>
 /// <param name="volume">The volume change factor.</param>
 /// <param name="position">The position. If a train and car are specified, the position is relative to the car, otherwise absolute.</param>
 /// <param name="train">The train this sound source is attached to, or a null reference.</param>
 /// <param name="type">The type of sound</param>
 /// <param name="looped">Whether this sound source plays in a loop.</param>
 internal SoundSource(SoundBuffer buffer, double radius, double pitch, double volume, Vector3 position, AbstractTrain train, SoundType type, bool looped)
 {
     Buffer           = buffer;
     Radius           = radius;
     Pitch            = pitch;
     Volume           = volume;
     Position         = position;
     Parent           = train;
     Looped           = looped;
     State            = SoundSourceState.PlayPending;
     OpenAlSourceName = 0;
     //Set sound type manually
     Type = type;
 }
示例#9
0
			// --- constructors ---
			/// <summary>Creates a new sound source.</summary>
			/// <param name="buffer">The sound buffer.</param>
			/// <param name="radius">The effective sound radius.</param>
			/// <param name="pitch">The pitch change factor.</param>
			/// <param name="volume">The volume change factor.</param>
			/// <param name="position">The position. If a train and car are specified, the position is relative to the car, otherwise absolute.</param>
			/// <param name="train">The train this sound source is attached to, or a null reference.</param>
			/// <param name="car">The car this sound source is attached to, or a null reference.</param>
			/// <param name="looped">Whether this sound source plays in a loop.</param>
			internal SoundSource(SoundBuffer buffer, double radius, double pitch, double volume, OpenBveApi.Math.Vector3 position, TrainManager.Train train, int car, bool looped) {
				this.Buffer = buffer;
				this.Radius = radius;
				this.Pitch = pitch;
				this.Volume = volume;
				this.Position = position;
				this.Train = train;
				this.Car = car;
				this.Looped = looped;
				this.State = SoundSourceState.PlayPending;
				this.OpenAlSourceName = 0;
				//Set the sound type to undefined to use Michelle's original processing
				if (train != null)
				{
					this.Type = SoundType.TrainCar;
				}
				else
				{
					this.Type = SoundType.Undefined;	
				}
				
			}