void Start() { _fireLoop = StudioSystem.GetEvent(FireLoop.path); _fireStart = StudioSystem.GetEvent(FireStart.path); _fireExtinguished = StudioSystem.GetEvent(FireExtinguished.path); _buildingDestruction = StudioSystem.GetEvent(BuildingDestruction.path); }
public static EventDescription LoadEvent(string eventPath) { if (eventPath.StartsWith("event:/")) { eventPath = eventPath.Remove(0, 7); } return(StudioSystem.GetEvent("event:/" + eventPath)); }
public static FMOD.Studio.Bus GetBus(string path) { FMOD.Studio.Bus bus; if (StudioSystem.getBus(path, out bus) != FMOD.RESULT.OK) { throw new BusNotFoundException(path); } return(bus); }
public static FMOD.Studio.VCA GetVCA(string path) { FMOD.Studio.VCA vca; if (StudioSystem.getVCA(path, out vca) != FMOD.RESULT.OK) { throw new VCANotFoundException(path); } return(vca); }
public static FMOD.Studio.VCA GetVCA(String path) { FMOD.RESULT result; FMOD.Studio.VCA vca; result = StudioSystem.getVCA(path, out vca); if (result != FMOD.RESULT.OK) { } return(vca); }
public static FMOD.Studio.Bus GetBus(String path) { FMOD.RESULT result; FMOD.Studio.Bus bus; result = StudioSystem.getBus(path, out bus); if (result != FMOD.RESULT.OK) { } return(bus); }
public static FMOD.Studio.VCA GetVCA(String path) { FMOD.RESULT result; FMOD.Studio.VCA vca; result = StudioSystem.getVCA(path, out vca); if (result != FMOD.RESULT.OK) { throw new VCANotFoundException(path); } return vca; }
public static FMOD.Studio.Bus GetBus(String path) { FMOD.RESULT result; FMOD.Studio.Bus bus; result = StudioSystem.getBus(path, out bus); if (result != FMOD.RESULT.OK) { throw new BusNotFoundException(path); } return bus; }
public static void MuteAllEvents(bool muted) { if (HasBanksLoaded) { FMOD.Studio.Bus masterBus; if (StudioSystem.getBus("bus:/", out masterBus) == FMOD.RESULT.OK) { masterBus.setMute(muted); } } }
private static void UnloadAllBanks() { if (StudioSystem.System != null) { StudioSystem.UnloadAllBanks(); } else if (StudioSystem.LoadedBanks.Count != 0) { Logger.LogError("Banks not unloaded!"); } }
public static Bank LoadBank(string bankName) { if (_banks.ContainsKey(bankName)) { return(_banks[bankName]); } Bank newBank = StudioSystem.LoadBank(_bankDirectory + bankName); _banks.Add(bankName, newBank); return(newBank); }
public static bool AddListener(int index) { if (HasListener[index]) { // Listener already registered Debug.LogError(string.Format(("[FMOD] Listener with index {0} already registered."), index)); return(false); } HasListener[index] = true; numListeners = RecalculateTotalListeners(); StudioSystem.setNumListeners(numListeners); return(true); }
public override void Enter() { InitUI(); // You would rather place the following in LoadContent() - it's here more for readability. // Here you load any banks that you're using. This could be a music bank, a SFX bank, etc. // The strings bank isn't actually necessary - however if you want to do string lookups, include it. _banks.Add(StudioSystem.LoadBank("Master.bank")); _banks.Add(StudioSystem.LoadBank("Master.strings.bank")); _banks.Add(StudioSystem.LoadBank("Music.bank")); _banks.Add(StudioSystem.LoadBank("SFX.bank")); _banks.Add(StudioSystem.LoadBank("Vehicles.bank")); _banks.Add(StudioSystem.LoadBank("VO.bank")); _banks.Add(StudioSystem.LoadBank("Dialogue_EN.bank")); // Events are split in the code into descriptions and instances. // You may have multiple instances of one event, but the description for it should only be loaded once. // Here is why you want the strings bank loaded, btw. So much more intuitive than Guids. _engineDescription = StudioSystem.GetEvent("event:/Vehicles/Car Engine"); _musicDescription = StudioSystem.GetEvent("event:/Music/Level 03"); // Loading an event description by Guid. // FMOD Studio will give you a string like below when you select "Copy Guid". It has to be parsed to be used. FMOD.Studio.Util.parseID("{be6203d8-c8d8-41c5-8ce6-bce0de95807b}", out Guid sfxGuid); _bonkDescription = StudioSystem.GetEvent(sfxGuid); // There are three ways to load sample data (any non-streamed sounds): // -From a bank. This will keep ALL the bank's data in memory until unloaded. // -From an event description. This will just keep the event's necessary data in memory until unloaded. // -From an event instance. Same as above, except the data will only be in memory while an instance is. // Assess when you need memory loaded and for how long, then choose which method to use properly. _engineDescription.LoadSampleData(); // The music doesn't need its data pre-loaded, since it'll just play right away, continuously. _engineInstance = _engineDescription.CreateInstance(); _musicInstance = _musicDescription.CreateInstance(); // Sound effects could be played whenever, so you don't want them constantly loading / unloading. _bonkDescription.LoadSampleData(); // If you have any parameters set within FMOD Studio, you can change them within the code. _engineInstance.SetParameterValue("RPM", _rpm); _engineInstance.SetParameterValue("Load", -1f); }
public static bool RemoveListener(int index) { if (index != -1 && HasListener[index]) { HasListener[index] = false; numListeners = RecalculateTotalListeners(); if (StudioSystem.isValid()) { StudioSystem.setNumListeners(Math.Max(numListeners, 1)); return(true); } } if (numListeners <= 0) { Debug.LogWarning("[FMOD] No Listeners currently assigned."); } return(false); }
public static bool RemoveListener(StudioListener listener) { int index = listener.ListenerNumber; // Remove listener if (index != -1) { Listeners[index] = null; // Are there more listeners above the index of the one we are removing? if (numListeners - 1 > index) { // Move any higher index listeners down for (int i = index; i < Listeners.Count; i++) { if (i == Listeners.Count - 1) { Listeners[i] = null; } else { Listeners[i] = Listeners[i + 1]; if (Listeners[i]) { Listeners[i].ListenerNumber = i; } } } } // Decriment numListeners numListeners--; // Always need at least 1 listener, otherwise "[FMOD] assert : assertion: 'numListeners >= 1 && numListeners <= 8' failed" int numListenersClamped = Mathf.Min(Mathf.Max(numListeners, 1), FMOD.CONSTANTS.MAX_LISTENERS); StudioSystem.setNumListeners(numListenersClamped); // Listener attributes will be updated before the next update, due to the Script Execution Order. return(true); } else { return(false); } }
public static int AddListener(StudioListener listener) { // Is the listener already in the list? for (int i = 0; i < Listeners.Count; i++) { if (Listeners[i] != null && listener.gameObject == Listeners[i].gameObject) { Debug.LogWarning(string.Format(("[FMOD] Listener has already been added at index {0}."), i)); return(i); } } // If already at the max numListeners if (numListeners >= FMOD.CONSTANTS.MAX_LISTENERS) { Debug.LogWarning(string.Format(("[FMOD] Max number of listeners reached : {0}."), FMOD.CONSTANTS.MAX_LISTENERS)); //return -1; } // If not already in the list // The next available spot in the list should be at `numListeners` if (Listeners.Count <= numListeners) { Listeners.Add(listener); } else { Listeners[numListeners] = listener; } // Increment `numListeners` numListeners++; // setNumListeners (8 is the most that FMOD supports) int numListenersClamped = Mathf.Min(numListeners, FMOD.CONSTANTS.MAX_LISTENERS); StudioSystem.setNumListeners(numListenersClamped); return(numListeners - 1); }
void Start() { _billyClub = StudioSystem.GetEvent(BillyClub.path); }
void Start() { _goblinLaugh = StudioSystem.GetEvent(GoblinLaugh.path); _goblinLyrics = StudioSystem.GetEvent(GoblinLyrics.path); _goblinDeath = StudioSystem.GetEvent(GoblinDeath.path); }
private static bool LoadAllBanks() { UnloadAllBanks(); return(StudioSystem.LoadAllBanks(true)); }