OpenBve.NetPlugin.PlaySound C# (CSharp) Méthode

PlaySound() private méthode

May be called from a .Net plugin, in order to play a sound from the driver's car of a train
private PlaySound ( int index, double volume, double pitch, bool looped ) : SoundHandleEx
index int The plugin-based of the sound to play
volume double The volume of the sound- A volume of 1.0 represents nominal volume
pitch double The pitch of the sound- A pitch of 1.0 represents nominal pitch
looped bool Whether the sound is looped
Résultat SoundHandleEx
		internal SoundHandleEx PlaySound(int index, double volume, double pitch, bool looped) {
			if (index >= 0 && index < this.Train.Cars[this.Train.DriverCar].Sounds.Plugin.Length && this.Train.Cars[this.Train.DriverCar].Sounds.Plugin[index].Buffer != null) {
				Sounds.SoundBuffer buffer = this.Train.Cars[this.Train.DriverCar].Sounds.Plugin[index].Buffer;
				OpenBveApi.Math.Vector3 position = this.Train.Cars[this.Train.DriverCar].Sounds.Plugin[index].Position;
				Sounds.SoundSource source = Sounds.PlaySound(buffer, pitch, volume, position, this.Train, this.Train.DriverCar, looped);
				if (this.SoundHandlesCount == this.SoundHandles.Length) {
					Array.Resize<SoundHandleEx>(ref this.SoundHandles, this.SoundHandles.Length << 1);
				}
				this.SoundHandles[this.SoundHandlesCount] = new SoundHandleEx(volume, pitch, source);
				this.SoundHandlesCount++;
				return this.SoundHandles[this.SoundHandlesCount - 1];
			} else {
				return null;
			}
		}

Same methods

NetPlugin::PlaySound ( int index, double volume, double pitch, bool looped, int CarIndex ) : SoundHandleEx