void ApplyExtensionSettings() { RESULT result = RESULT.OK; FMOD.ADVANCEDSETTINGS advancedSettings = new FMOD.ADVANCEDSETTINGS(); result = RuntimeManager.LowlevelSystem.getAdvancedSettings(ref advancedSettings); CheckResult(result, "FMOD.GetAdvancedSettings"); advancedSettings.geometryMaxFadeTime = Settings.Instance.GeometryMaxFadeTime; result = RuntimeManager.LowlevelSystem.setAdvancedSettings(ref advancedSettings); CheckResult(result, "FMOD.SetAdvancedSettings"); }
private void Init() { UnityUtil.Log("FMOD_StudioSystem: Initialize"); if (FMOD_StudioSystem.isInitialized) { return; } UnityEngine.Object.DontDestroyOnLoad(base.gameObject); UnityUtil.Log("FMOD_StudioSystem: System_Create"); FMOD_StudioSystem.ERRCHECK(FMOD.Studio.System.create(out this.system)); FMOD.Studio.INITFLAGS iNITFLAGS = FMOD.Studio.INITFLAGS.NORMAL; FMOD.System system; FMOD_StudioSystem.ERRCHECK(this.system.getLowLevelSystem(out system)); FMOD.ADVANCEDSETTINGS aDVANCEDSETTINGS = default(FMOD.ADVANCEDSETTINGS); aDVANCEDSETTINGS.randomSeed = (uint)DateTime.Now.Ticks; FMOD_StudioSystem.ERRCHECK(system.setAdvancedSettings(ref aDVANCEDSETTINGS)); UnityUtil.Log("FMOD_StudioSystem: system.init"); RESULT rESULT = this.system.initialize(1024, iNITFLAGS, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); if (rESULT == RESULT.ERR_HEADER_MISMATCH) { UnityUtil.LogError("Version mismatch between C# script and FMOD binary, restart Unity and reimport the integration package to resolve this issue."); } else { FMOD_StudioSystem.ERRCHECK(rESULT); } FMOD_StudioSystem.ERRCHECK(this.system.flushCommands()); rESULT = this.system.update(); if (rESULT == RESULT.ERR_NET_SOCKET_ERROR) { UnityUtil.LogWarning("LiveUpdate disabled: socket in already in use"); iNITFLAGS &= ~FMOD.Studio.INITFLAGS.LIVEUPDATE; FMOD_StudioSystem.ERRCHECK(this.system.release()); FMOD_StudioSystem.ERRCHECK(FMOD.Studio.System.create(out this.system)); FMOD_StudioSystem.ERRCHECK(this.system.getLowLevelSystem(out system)); aDVANCEDSETTINGS = default(FMOD.ADVANCEDSETTINGS); aDVANCEDSETTINGS.randomSeed = (uint)DateTime.Now.Ticks; FMOD_StudioSystem.ERRCHECK(system.setAdvancedSettings(ref aDVANCEDSETTINGS)); rESULT = this.system.initialize(1024, iNITFLAGS, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); FMOD_StudioSystem.ERRCHECK(rESULT); } FMOD_StudioSystem.isInitialized = true; }
private void OutputSetInfo() { UnityEngine.Debug.Log("<color=yellow>------------------------- SettingInfo -------------------------</color>"); FMOD.System system = null; this.ERRCHECK(FMOD_StudioSystem.instance.System.getLowLevelSystem(out system)); FMOD.ADVANCEDSETTINGS aDVANCEDSETTINGS = default(FMOD.ADVANCEDSETTINGS); int num; SPEAKERMODE sPEAKERMODE; int num2; this.ERRCHECK(system.getSoftwareFormat(out num, out sPEAKERMODE, out num2)); int num3; this.ERRCHECK(system.getSoftwareChannels(out num3)); this.ERRCHECK(system.getAdvancedSettings(ref aDVANCEDSETTINGS)); UnityEngine.Debug.Log(string.Concat(new object[] { "sample rate: ", num, " mode:", sPEAKERMODE, " numraw:", num2, " channels:", num3 })); UnityEngine.Debug.Log(string.Concat(new object[] { "set cbSize: ", aDVANCEDSETTINGS.cbSize, " maxMPEG:", aDVANCEDSETTINGS.maxMPEGCodecs, " stackStream:", aDVANCEDSETTINGS.stackSizeStream, " stackMix:", aDVANCEDSETTINGS.stackSizeMixer, " stackNonBlock:", aDVANCEDSETTINGS.stackSizeNonBlocking, " sample:", aDVANCEDSETTINGS.resamplerMethod })); }
public RESULT getAdvancedSettings (ref ADVANCEDSETTINGS settings) { settings.cbSize = Marshal.SizeOf(settings); return FMOD_System_GetAdvancedSettings(rawPtr, ref settings); }
void Init() { FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: Initialize"); if (isInitialized) { return; } DontDestroyOnLoad(gameObject); FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: System_Create"); ERRCHECK(FMOD.Studio.System.create(out system)); FMOD.Studio.INITFLAGS flags = FMOD.Studio.INITFLAGS.NORMAL; FMOD.System sys; ERRCHECK(system.getLowLevelSystem(out sys)); FMOD.ADVANCEDSETTINGS advancedSettings = new FMOD.ADVANCEDSETTINGS(); advancedSettings.randomSeed = (uint) DateTime.Now.Ticks; #if FMOD_LIVEUPDATE flags |= FMOD.Studio.INITFLAGS.LIVEUPDATE; // Unity 5 liveupdate workaround if (Application.unityVersion.StartsWith("5")) { FMOD.Studio.UnityUtil.LogWarning("FMOD_StudioSystem: detected Unity 5, running on port 9265"); advancedSettings.profilePort = 9265; } #endif ERRCHECK(sys.setAdvancedSettings(ref advancedSettings)); #if FMOD_DEBUG FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG, FMOD.DEBUG_MODE.FILE, null, "fmod.log"); #endif FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: system.init"); FMOD.RESULT result = FMOD.RESULT.OK; result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); if (result == FMOD.RESULT.ERR_HEADER_MISMATCH) { FMOD.Studio.UnityUtil.LogError("Version mismatch between C# script and FMOD binary, restart Unity and reimport the integration package to resolve this issue."); } else { ERRCHECK(result); } // Dummy flush and update to get network state ERRCHECK(system.flushCommands()); result = system.update(); // Restart without liveupdate if there was a socket error if (result == FMOD.RESULT.ERR_NET_SOCKET_ERROR) { FMOD.Studio.UnityUtil.LogWarning("LiveUpdate disabled: socket in already in use"); flags &= ~FMOD.Studio.INITFLAGS.LIVEUPDATE; ERRCHECK(system.release()); ERRCHECK(FMOD.Studio.System.create(out system)); ERRCHECK(system.getLowLevelSystem(out sys)); advancedSettings = new FMOD.ADVANCEDSETTINGS(); advancedSettings.randomSeed = (uint) DateTime.Now.Ticks; ERRCHECK(sys.setAdvancedSettings(ref advancedSettings)); result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); ERRCHECK(result); } #if UNITY_EDITOR && FMOD_DEBUG var fileStream = new FileStream("fmod.log",FileMode.Open, FileAccess.Read, FileShare.ReadWrite); logReader = new StreamReader(fileStream); #endif isInitialized = true; }
public RESULT setAdvancedSettings(ref ADVANCEDSETTINGS settings) { settings.cbSize = Marshal.SizeOf(settings); return(System.FMOD5_System_SetAdvancedSettings(this.rawPtr, ref settings)); }
private static extern RESULT FMOD5_System_GetAdvancedSettings(IntPtr system, ref ADVANCEDSETTINGS settings);
void Init() { FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: Initialize"); if (isInitialized) { return; } DontDestroyOnLoad(gameObject); FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: System_Create"); ERRCHECK(FMOD.Studio.System.create(out system)); FMOD.Studio.INITFLAGS flags = FMOD.Studio.INITFLAGS.NORMAL; #if FMOD_LIVEUPDATE flags |= FMOD.Studio.INITFLAGS.LIVEUPDATE; // Unity 5 liveupdate workaround if (Application.unityVersion.StartsWith("5")) { FMOD.Studio.UnityUtil.LogWarning("FMOD_StudioSystem: detected Unity 5, running on port 9265"); FMOD.System sys; ERRCHECK(system.getLowLevelSystem(out sys)); FMOD.ADVANCEDSETTINGS advancedSettings = new FMOD.ADVANCEDSETTINGS(); advancedSettings.profilePort = 9265; ERRCHECK(sys.setAdvancedSettings(ref advancedSettings)); } #endif int outputRate = 48000; #if true //UNITY_ANDROID && !UNITY_EDITOR // Force the system sample rate to the output rate to allow for the fast mixer if (FMOD.VERSION.number >= 0x00010500) { FMOD.System sys; ERRCHECK(system.getLowLevelSystem(out sys)); { System.Text.StringBuilder str = new System.Text.StringBuilder(); FMOD.GUID guid; FMOD.SPEAKERMODE speakermode; int speakermodechannels; ERRCHECK(sys.getDriverInfo(0, str, str.Capacity, out guid, out outputRate, out speakermode, out speakermodechannels)); } ERRCHECK(sys.setSoftwareFormat(outputRate, FMOD.SPEAKERMODE.DEFAULT, 0)); } #endif FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: system.init"); FMOD.RESULT result = FMOD.RESULT.OK; result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); if (result == FMOD.RESULT.ERR_HEADER_MISMATCH) { FMOD.Studio.UnityUtil.LogError("Version mismatch between C# script and FMOD binary, restart Unity and reimport the integration package to resolve this issue."); } else { ERRCHECK(result); } // Dummy flush and update to get network state ERRCHECK(system.flushCommands()); result = system.update(); // Restart without liveupdate if there was a socket error if (result == FMOD.RESULT.ERR_NET_SOCKET_ERROR) { FMOD.Studio.UnityUtil.LogWarning("LiveUpdate disabled: socket in already in use"); flags &= ~FMOD.Studio.INITFLAGS.LIVEUPDATE; ERRCHECK(system.release()); ERRCHECK(FMOD.Studio.System.create(out system)); FMOD.System sys; ERRCHECK(system.getLowLevelSystem(out sys)); ERRCHECK(sys.setSoftwareFormat(outputRate, FMOD.SPEAKERMODE.DEFAULT, 0)); result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); ERRCHECK(result); } isInitialized = true; }
FMOD.RESULT Initialize() { #if UNITY_EDITOR #if UNITY_2017_2_OR_NEWER EditorApplication.playModeStateChanged += HandlePlayModeStateChange; #elif UNITY_2017_1_OR_NEWER EditorApplication.playmodeStateChanged += HandleOnPlayModeChanged; #endif // UNITY_2017_2_OR_NEWER #endif // UNITY_EDITOR FMOD.RESULT result = FMOD.RESULT.OK; FMOD.RESULT initResult = FMOD.RESULT.OK; Settings fmodSettings = Settings.Instance; fmodPlatform = RuntimeUtils.GetCurrentPlatform(); int sampleRate = fmodSettings.GetSampleRate(fmodPlatform); int realChannels = Math.Min(fmodSettings.GetRealChannels(fmodPlatform), 256); // Prior to 1.08.10 we didn't clamp this properly in the settings screen int virtualChannels = fmodSettings.GetVirtualChannels(fmodPlatform); FMOD.SPEAKERMODE speakerMode = (FMOD.SPEAKERMODE)fmodSettings.GetSpeakerMode(fmodPlatform); FMOD.OUTPUTTYPE outputType = FMOD.OUTPUTTYPE.AUTODETECT; FMOD.ADVANCEDSETTINGS advancedSettings = new FMOD.ADVANCEDSETTINGS(); advancedSettings.randomSeed = (uint)DateTime.Now.Ticks; #if UNITY_EDITOR || UNITY_STANDALONE advancedSettings.maxVorbisCodecs = realChannels; #elif UNITY_XBOXONE advancedSettings.maxXMACodecs = realChannels; #elif UNITY_PS4 advancedSettings.maxAT9Codecs = realChannels; #else advancedSettings.maxFADPCMCodecs = realChannels; #endif SetThreadAffinity(); #if UNITY_EDITOR || ((UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && DEVELOPMENT_BUILD) result = FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG, FMOD.DEBUG_MODE.FILE, null, RuntimeUtils.LogFileName); if (result == FMOD.RESULT.ERR_FILE_NOTFOUND) { UnityEngine.Debug.LogWarningFormat("FMOD Studio: Cannot open FMOD debug log file '{0}', logs will be missing for this session.", System.IO.Path.Combine(Application.dataPath, RuntimeUtils.LogFileName)); } else { CheckInitResult(result, "FMOD.Debug.Initialize"); } #endif FMOD.Studio.INITFLAGS studioInitFlags = FMOD.Studio.INITFLAGS.NORMAL | FMOD.Studio.INITFLAGS.DEFERRED_CALLBACKS; if (fmodSettings.IsLiveUpdateEnabled(fmodPlatform)) { studioInitFlags |= FMOD.Studio.INITFLAGS.LIVEUPDATE; #if UNITY_5_0 || UNITY_5_1 // These versions of Unity shipped with FMOD4 profiling enabled consuming our port number. UnityEngine.Debug.LogWarning("FMOD Studio: Live Update port in-use by Unity, switching to port 9265"); advancedSettings.profilePort = 9265; #endif } retry: result = FMOD.Studio.System.create(out studioSystem); CheckInitResult(result, "FMOD.Studio.System.create"); result = studioSystem.getLowLevelSystem(out lowlevelSystem); CheckInitResult(result, "FMOD.Studio.System.getLowLevelSystem"); result = lowlevelSystem.setOutput(outputType); CheckInitResult(result, "FMOD.System.setOutput"); result = lowlevelSystem.setSoftwareChannels(realChannels); CheckInitResult(result, "FMOD.System.setSoftwareChannels"); result = lowlevelSystem.setSoftwareFormat(sampleRate, speakerMode, 0); CheckInitResult(result, "FMOD.System.setSoftwareFormat"); result = lowlevelSystem.setAdvancedSettings(ref advancedSettings); CheckInitResult(result, "FMOD.System.setAdvancedSettings"); result = studioSystem.initialize(virtualChannels, studioInitFlags, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); if (result != FMOD.RESULT.OK && initResult == FMOD.RESULT.OK) { initResult = result; // Save this to throw at the end (we'll attempt NO SOUND to shield ourselves from unexpected device failures) outputType = FMOD.OUTPUTTYPE.NOSOUND; UnityEngine.Debug.LogErrorFormat("FMOD Studio: Studio::System::initialize returned {0}, defaulting to no-sound mode.", result.ToString()); goto retry; } CheckInitResult(result, "Studio::System::initialize"); // Test network functionality triggered during System::update if ((studioInitFlags & FMOD.Studio.INITFLAGS.LIVEUPDATE) != 0) { studioSystem.flushCommands(); // Any error will be returned through Studio.System.update result = studioSystem.update(); if (result == FMOD.RESULT.ERR_NET_SOCKET_ERROR) { studioInitFlags &= ~FMOD.Studio.INITFLAGS.LIVEUPDATE; UnityEngine.Debug.LogWarning("FMOD Studio: Cannot open network port for Live Update (in-use), restarting with Live Update disabled."); result = studioSystem.release(); CheckInitResult(result, "FMOD.Studio.System.Release"); goto retry; } } LoadPlugins(fmodSettings); LoadBanks(fmodSettings); return(initResult); }
void Init() { FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: Initialize"); if (isInitialized) { return; } DontDestroyOnLoad(gameObject); FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: System_Create"); ERRCHECK(FMOD.Studio.System.create(out system)); FMOD.Studio.INITFLAGS flags = FMOD.Studio.INITFLAGS.NORMAL; FMOD.System sys; ERRCHECK(system.getLowLevelSystem(out sys)); FMOD.ADVANCEDSETTINGS advancedSettings = new FMOD.ADVANCEDSETTINGS(); advancedSettings.randomSeed = (uint)DateTime.Now.Ticks; #if FMOD_LIVEUPDATE flags |= FMOD.Studio.INITFLAGS.LIVEUPDATE; // Unity 5 liveupdate workaround if (Application.unityVersion.StartsWith("5")) { FMOD.Studio.UnityUtil.LogWarning("FMOD_StudioSystem: detected Unity 5, running on port 9265"); advancedSettings.profilePort = 9265; } #endif ERRCHECK(sys.setAdvancedSettings(ref advancedSettings)); #if FMOD_DEBUG FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG, FMOD.DEBUG_MODE.FILE, null, "fmod.log"); #endif FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: system.init"); FMOD.RESULT result = FMOD.RESULT.OK; result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); if (result == FMOD.RESULT.ERR_HEADER_MISMATCH) { FMOD.Studio.UnityUtil.LogError("Version mismatch between C# script and FMOD binary, restart Unity and reimport the integration package to resolve this issue."); } else { ERRCHECK(result); } // Dummy flush and update to get network state ERRCHECK(system.flushCommands()); result = system.update(); // Restart without liveupdate if there was a socket error if (result == FMOD.RESULT.ERR_NET_SOCKET_ERROR) { FMOD.Studio.UnityUtil.LogWarning("LiveUpdate disabled: socket in already in use"); flags &= ~FMOD.Studio.INITFLAGS.LIVEUPDATE; ERRCHECK(system.release()); ERRCHECK(FMOD.Studio.System.create(out system)); ERRCHECK(system.getLowLevelSystem(out sys)); advancedSettings = new FMOD.ADVANCEDSETTINGS(); advancedSettings.randomSeed = (uint)DateTime.Now.Ticks; ERRCHECK(sys.setAdvancedSettings(ref advancedSettings)); result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); ERRCHECK(result); } #if UNITY_EDITOR && FMOD_DEBUG var fileStream = new FileStream("fmod.log", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); logReader = new StreamReader(fileStream); #endif isInitialized = true; }
void Init() { FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: Initialize"); if (isInitialized) { return; } DontDestroyOnLoad(gameObject); FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: System_Create"); ERRCHECK(FMOD.Studio.System.create(out system)); FMOD.Studio.INITFLAGS flags = FMOD.Studio.INITFLAGS.NORMAL; #if FMOD_LIVEUPDATE flags |= FMOD.Studio.INITFLAGS.LIVEUPDATE; // Unity 5 liveupdate workaround if (Application.unityVersion.StartsWith("5")) { FMOD.Studio.UnityUtil.LogWarning("FMOD_StudioSystem: detected Unity 5, running on port 9265"); FMOD.System sys; ERRCHECK(system.getLowLevelSystem(out sys)); FMOD.ADVANCEDSETTINGS advancedSettings = new FMOD.ADVANCEDSETTINGS(); advancedSettings.profilePort = 9265; ERRCHECK(sys.setAdvancedSettings(ref advancedSettings)); } #endif #if FMOD_DEBUG #if UNITY_XBOXONE // Can't go managed -> native -> managed apparently so log to a file FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG, FMOD.DEBUG_MODE.FILE, null, "fmod.log"); #else FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG, FMOD.DEBUG_MODE.CALLBACK, LogCallback, null); #endif #endif FMOD.Studio.UnityUtil.Log("FMOD_StudioSystem: system.init"); FMOD.RESULT result = FMOD.RESULT.OK; result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); if (result == FMOD.RESULT.ERR_HEADER_MISMATCH) { FMOD.Studio.UnityUtil.LogError("Version mismatch between C# script and FMOD binary, restart Unity and reimport the integration package to resolve this issue."); } else { ERRCHECK(result); } // Dummy flush and update to get network state ERRCHECK(system.flushCommands()); result = system.update(); // Restart without liveupdate if there was a socket error if (result == FMOD.RESULT.ERR_NET_SOCKET_ERROR) { FMOD.Studio.UnityUtil.LogWarning("LiveUpdate disabled: socket in already in use"); flags &= ~FMOD.Studio.INITFLAGS.LIVEUPDATE; ERRCHECK(system.release()); ERRCHECK(FMOD.Studio.System.create(out system)); FMOD.System sys; ERRCHECK(system.getLowLevelSystem(out sys)); result = system.initialize(1024, flags, FMOD.INITFLAGS.NORMAL, global::System.IntPtr.Zero); ERRCHECK(result); } isInitialized = true; }
private void Init() { UnityUtil.Log("FMOD_StudioSystem: Initialize"); if (this.isInitialized) { return; } UnityEngine.Object.DontDestroyOnLoad(base.gameObject); this.LiveUpdateEnabled = false; string[] commandLineArgs = Environment.GetCommandLineArgs(); for (int i = 0; i < commandLineArgs.Length; i++) { string a = commandLineArgs[i]; if (a == "-FMODLiveUpdate") { this.LiveUpdateEnabled = true; break; } } UnityUtil.Log("FMOD_StudioSystem: System_Create"); FMOD_StudioSystem.ERRCHECK(FMOD.Studio.System.create(out this.system)); FMOD.Studio.INITFLAGS iNITFLAGS = FMOD.Studio.INITFLAGS.NORMAL; FMOD.ADVANCEDSETTINGS aDVANCEDSETTINGS = default(FMOD.ADVANCEDSETTINGS); if (this.LiveUpdateEnabled) { iNITFLAGS |= FMOD.Studio.INITFLAGS.LIVEUPDATE; if (Application.unityVersion.StartsWith("5")) { UnityUtil.LogWarning("FMOD_StudioSystem: detected Unity 5, running on port 9265"); aDVANCEDSETTINGS.profilePort = 9265; } } int @int = PlayerPrefs.GetInt("VoiceCount", 128); FMOD.System system; FMOD_StudioSystem.ERRCHECK(this.system.getLowLevelSystem(out system)); FMOD_StudioSystem.ERRCHECK(system.setSoftwareChannels(@int)); aDVANCEDSETTINGS.maxVorbisCodecs = @int; FMOD_StudioSystem.ERRCHECK(system.setAdvancedSettings(ref aDVANCEDSETTINGS)); int num = 48000; StringBuilder name = new StringBuilder(); Guid guid; SPEAKERMODE sPEAKERMODE; int num2; FMOD_StudioSystem.ERRCHECK(system.getDriverInfo(0, name, 0, out guid, out num, out sPEAKERMODE, out num2)); if (num > 48000) { uint bufferlength = 0u; int num3 = 0; FMOD_StudioSystem.ERRCHECK(system.getDSPBufferSize(out bufferlength, out num3)); FMOD_StudioSystem.ERRCHECK(system.setDSPBufferSize(bufferlength, num3 * 2)); } num = Math.Min(num, 48000); FMOD_StudioSystem.ERRCHECK(system.setSoftwareFormat(num, SPEAKERMODE._5POINT1, 0)); UnityUtil.Log("FMOD_StudioSystem: system.init"); RESULT rESULT = this.system.initialize(1024, iNITFLAGS, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); if (rESULT == RESULT.ERR_NET_SOCKET_ERROR) { UnityUtil.LogError("Unable to initalize with LiveUpdate: socket is already in use"); } else if (rESULT == RESULT.ERR_HEADER_MISMATCH) { UnityUtil.LogError("Version mismatch between C# script and FMOD binary, restart Unity and reimport the integration package to resolve this issue."); } else { FMOD_StudioSystem.ERRCHECK(rESULT); } this.isInitialized = true; }
private RESULT Initialize() { initializedSuccessfully = false; RESULT rESULT = RESULT.OK; RESULT rESULT2 = RESULT.OK; Settings settings = Settings.Instance; fmodPlatform = RuntimeUtils.GetCurrentPlatform(); int sampleRate = settings.GetSampleRate(fmodPlatform); int num = Math.Min(settings.GetRealChannels(fmodPlatform), 256); int virtualChannels = settings.GetVirtualChannels(fmodPlatform); SPEAKERMODE speakerMode = (SPEAKERMODE)settings.GetSpeakerMode(fmodPlatform); OUTPUTTYPE output = OUTPUTTYPE.AUTODETECT; FMOD.ADVANCEDSETTINGS settings2 = default(FMOD.ADVANCEDSETTINGS); settings2.randomSeed = (uint)DateTime.Now.Ticks; settings2.maxVorbisCodecs = num; FMOD.Studio.INITFLAGS iNITFLAGS = FMOD.Studio.INITFLAGS.DEFERRED_CALLBACKS; if (settings.IsLiveUpdateEnabled(fmodPlatform)) { iNITFLAGS |= FMOD.Studio.INITFLAGS.LIVEUPDATE; } while (true) { rESULT = FMOD.Studio.System.create(out studioSystem); CheckInitResult(rESULT, "FMOD.Studio.System.create"); rESULT = studioSystem.getLowLevelSystem(out lowlevelSystem); CheckInitResult(rESULT, "FMOD.Studio.System.getLowLevelSystem"); rESULT = lowlevelSystem.setOutput(output); CheckInitResult(rESULT, "FMOD.System.setOutput"); rESULT = lowlevelSystem.setSoftwareChannels(num); CheckInitResult(rESULT, "FMOD.System.setSoftwareChannels"); rESULT = lowlevelSystem.setSoftwareFormat(sampleRate, speakerMode, 0); CheckInitResult(rESULT, "FMOD.System.setSoftwareFormat"); rESULT = lowlevelSystem.setAdvancedSettings(ref settings2); CheckInitResult(rESULT, "FMOD.System.setAdvancedSettings"); rESULT = studioSystem.initialize(virtualChannels, iNITFLAGS, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); if (rESULT != 0 && rESULT2 == RESULT.OK) { rESULT2 = rESULT; output = OUTPUTTYPE.NOSOUND; Debug.LogWarningFormat("FMOD Studio: Studio::System::initialize returned {0}, defaulting to no-sound mode.", rESULT.ToString()); } else { CheckInitResult(rESULT, "Studio::System::initialize"); if ((iNITFLAGS & FMOD.Studio.INITFLAGS.LIVEUPDATE) == FMOD.Studio.INITFLAGS.NORMAL) { break; } studioSystem.flushCommands(); rESULT = studioSystem.update(); if (rESULT != RESULT.ERR_NET_SOCKET_ERROR) { break; } iNITFLAGS = (FMOD.Studio.INITFLAGS)((int)iNITFLAGS & -2); Debug.LogWarning("FMOD Studio: Cannot open network port for Live Update (in-use), restarting with Live Update disabled."); rESULT = studioSystem.release(); CheckInitResult(rESULT, "FMOD.Studio.System.Release"); } } LoadPlugins(settings); LoadBanks(settings); initializedSuccessfully = (rESULT == RESULT.OK); return(rESULT2); }
public RESULT getAdvancedSettings (ref ADVANCEDSETTINGS settings) { return FMOD_System_GetAdvancedSettings(rawPtr, ref settings); }
public RESULT setAdvancedSettings(ref ADVANCEDSETTINGS settings) { return FMOD_System_SetAdvancedSettings(systemraw, ref settings); }
public RESULT setAdvancedSettings(ref ADVANCEDSETTINGS settings) { settings.cbSize = Marshal.SizeOf(settings); return System.FMOD5_System_SetAdvancedSettings(this.rawPtr, ref settings); }
private static extern RESULT FMOD_System_SetAdvancedSettings(IntPtr system, ref ADVANCEDSETTINGS settings);
public RESULT setAdvancedSettings(ref ADVANCEDSETTINGS settings) { settings.cbSize = Marshal.SizeOf(settings); return(FMOD5_System_SetAdvancedSettings(handle, ref settings)); }