OpenBve.SoundManager.LoadSound C# (CSharp) Méthode

LoadSound() static private méthode

static private LoadSound ( string FileName, double Radius ) : int
FileName string
Radius double
Résultat int
		internal static int LoadSound(string FileName, double Radius) {
			if (OpenAlContext != ContextHandle.Zero) {
				int i;
				for (i = 0; i < SoundBuffers.Length; i++) {
					if (SoundBuffers[i] != null && string.Compare(SoundBuffers[i].FileName, FileName, StringComparison.OrdinalIgnoreCase) == 0 & SoundBuffers[i].Radius == Radius) {
						return i;
					}
				}
				if (!FileName.EndsWith(".wav", StringComparison.OrdinalIgnoreCase)) {
					Interface.AddMessage(Interface.MessageType.Warning, false, "The file extension is not recognized - will be assumed to be a .wav file: " + FileName);
				}
				for (i = 0; i < SoundBuffers.Length; i++) {
					if (SoundBuffers[i] == null) break;
				}
				if (i == SoundBuffers.Length) {
					Array.Resize<SoundBuffer>(ref SoundBuffers, SoundBuffers.Length << 1);
				}
				SoundBuffers[i] = new SoundBuffer();
				SoundBuffers[i].FileName = FileName;
				SoundBuffers[i].OpenAlBufferIndex = new OpenAlIndex(0, false);
				SoundBuffers[i].Radius = (float)Radius;
				return i;
			} else {
				return -1;
			}
		}