public setMeteringEnabled ( bool inputEnabled, bool outputEnabled ) : RESULT | ||
inputEnabled | bool | |
outputEnabled | bool | |
Résultat | RESULT |
void DrawDebugOverlay(int windowID) { if (lastDebugUpdate + 0.25f < Time.unscaledTime) { if (initException != null) { lastDebugText = initException.Message; } else { if (!mixerHead.hasHandle()) { FMOD.ChannelGroup master; lowlevelSystem.getMasterChannelGroup(out master); master.getDSP(0, out mixerHead); mixerHead.setMeteringEnabled(false, true); } StringBuilder debug = new StringBuilder(); FMOD.Studio.CPU_USAGE cpuUsage; studioSystem.getCPUUsage(out cpuUsage); debug.AppendFormat("CPU: dsp = {0:F1}%, studio = {1:F1}%\n", cpuUsage.dspusage, cpuUsage.studiousage); int currentAlloc, maxAlloc; FMOD.Memory.GetStats(out currentAlloc, out maxAlloc); debug.AppendFormat("MEMORY: cur = {0}MB, max = {1}MB\n", currentAlloc >> 20, maxAlloc >> 20); int realchannels, channels; lowlevelSystem.getChannelsPlaying(out channels, out realchannels); debug.AppendFormat("CHANNELS: real = {0}, total = {1}\n", realchannels, channels); FMOD.DSP_METERING_INFO outputMetering; mixerHead.getMeteringInfo(IntPtr.Zero, out outputMetering); float rms = 0; for (int i = 0; i < outputMetering.numchannels; i++) { rms += outputMetering.rmslevel[i] * outputMetering.rmslevel[i]; } rms = Mathf.Sqrt(rms / (float)outputMetering.numchannels); float db = rms > 0 ? 20.0f * Mathf.Log10(rms * Mathf.Sqrt(2.0f)) : -80.0f; if (db > 10.0f) { db = 10.0f; } debug.AppendFormat("VOLUME: RMS = {0:f2}db\n", db); lastDebugText = debug.ToString(); lastDebugUpdate = Time.unscaledTime; } } GUI.Label(new Rect(10, 20, 290, 100), lastDebugText); GUI.DragWindow(); }
void Start() { CubeData.globalColor = Color.red; dsps = new List <FMOD.DSP>(); singleton = this; playerState = FMODUnity.RuntimeManager.CreateInstance(PlayerStateEvent); lowlevelSystem = FMODUnity.RuntimeManager.LowlevelSystem; if (!masterDSP.hasHandle()) { FMOD.ChannelGroup master; lowlevelSystem.getMasterChannelGroup(out master); master.getDSP(0, out masterDSP); masterDSP.setMeteringEnabled(false, true); } setupLeapMotion(); currentTime = Time.Start; }