public static void Set3DAttributes(this AcCarPlayer player, string path, Vector3 forward, Vector3 position, Vector3 up, Vector3 velocity) { var forwardSound = forward.ToSoundVector(); var positionSound = position.ToSoundVector(); var upSound = up.ToSoundVector(); var velocitySound = velocity.ToSoundVector(); player.Set3DAttributes(path, forwardSound, positionSound, upSound, velocitySound); }
public AcCarSound(AcCarPlayer player) { _player = player; var carId = _player.GetSoundbackKeys().Select(x => x.StartsWith("/cars/") ? x.ApartFromFirst("/cars/").Split('/')[0] : null) .NonNull().First(); _prefix = $"/cars/{carId}/"; }
public static void Set3DAttributes(this AcCarPlayer player, string[] path, Vector3 forward, Vector3 position, Vector3 up, Vector3 velocity) { var forwardSound = forward.ToSoundVector(); var positionSound = position.ToSoundVector(); var upSound = up.ToSoundVector(); var velocitySound = velocity.ToSoundVector(); for (var i = 0; i < path.Length; i++) { var p = path[i]; player.Set3DAttributes(p, forwardSound, positionSound, upSound, velocitySound); } }
private static async Task <IAcCarSound> CreateAsyncInner(string carDirectory) { var directory = PluginsManager.Instance.GetPluginDirectory(FmodPluginWrapper.IdValue); if (!Directory.Exists(directory)) { Logging.Warning("Fmod plugin directory not found"); return(null); } if (!_initialized) { _initialized = true; if (File.Exists(Path.Combine(directory, "fmod.dll"))) { Logging.Write("Fmod libraries are in plugin folder"); AcCarPlayer.Initialize(directory); } else { Logging.Write("Fmod libraries not in plugin folder, let’s use AC libs instead"); AcCarPlayer.Initialize(AcRootDirectory.Instance.RequireValue); } foreach (var file in Directory.GetFiles(directory, "Plugin*.dll")) { AcCarPlayer.AddPlugin(file); } } var s = Stopwatch.StartNew(); try { var player = AcCarPlayer.Create(AcRootDirectory.Instance.RequireValue, Path.GetFileName(carDirectory), carDirectory); await player.Initialize(); return(new AcCarSound(player)); } catch (Exception e) { NonfatalError.NotifyBackground("Can’t load soundbank", e); return(null); } finally { Logging.Debug($"Time taken: {s.Elapsed.TotalMilliseconds:F1} ms"); } }