private void timer_Tick(object sender, System.EventArgs e) { int channelsplayingA = 0; int channelsplayingB = 0; if (channelA != null) { systemA.getChannelsPlaying(ref channelsplayingA); } if (channelB != null) { systemB.getChannelsPlaying(ref channelsplayingB); } statusBar.Text = "Channels Playing on A: " + channelsplayingA + " Channels Playing on B: " + channelsplayingB; if (systemA != null) { systemA.update(); } if (systemB != null) { systemB.update(); } }
protected override void OnPaint(PaintEventArgs e) { FMOD.RESULT result; int channels = 0; /* * Draw the sound sources */ for (int count = 0; count < NUMCHANNELS; count++) { mSoundSource[count].Draw(e.Graphics); } /* * Draw the listener */ mListener.Draw(e.Graphics); /* * Print some information */ Font font = new Font("Arial", 12); Brush brush = new SolidBrush(Color.Black); result = system.getChannelsPlaying(ref channels); ERRCHECK(result); e.Graphics.DrawString("Channels Playing: " + channels, font, brush, 0, 0); e.Graphics.DrawString("Real Channels: " + NUMREALCHANNELS + " (RED)", font, brush, 0, 15); e.Graphics.DrawString("Virtual Channels: " + (NUMCHANNELS - NUMREALCHANNELS) + " (BLUE)", font, brush, 0, 30); }
public override void Tick(float fElapsedTime) { base.Tick(fElapsedTime); if (FModSystem != null) { FModSystem.getChannelsPlaying(ref channelsplaying); FModSystem.update(); } }
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(); }
private void timer_Tick(object sender, System.EventArgs e) { int channelsplaying = 0; if (system != null) { system.getChannelsPlaying(ref channelsplaying); system.update(); } statusBar.Text = "Channels Playing " + channelsplaying; }
private void timer_Tick(object sender, System.EventArgs e) { FMOD.RESULT result; uint ms = 0; uint lenms = 0; bool paused = false; bool playing = false; int channelsplaying = 0; if (channel != null) { FMOD.Sound currentsound = null; result = channel.isPlaying(ref playing); if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE) && (result != FMOD.RESULT.ERR_CHANNEL_STOLEN)) { ERRCHECK(result); } result = channel.getPaused(ref paused); if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE) && (result != FMOD.RESULT.ERR_CHANNEL_STOLEN)) { ERRCHECK(result); } result = channel.getPosition(ref ms, FMOD.TIMEUNIT.MS); if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE) && (result != FMOD.RESULT.ERR_CHANNEL_STOLEN)) { ERRCHECK(result); } channel.getCurrentSound(ref currentsound); if (currentsound != null) { result = currentsound.getLength(ref lenms, FMOD.TIMEUNIT.MS); if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE) && (result != FMOD.RESULT.ERR_CHANNEL_STOLEN)) { ERRCHECK(result); } } system.getChannelsPlaying(ref channelsplaying); } statusBar.Text = "Time " + (ms / 1000 / 60) + ":" + (ms / 1000 % 60) + ":" + (ms / 10 % 100) + "/" + (lenms / 1000 / 60) + ":" + (lenms / 1000 % 60) + ":" + (lenms / 10 % 100) + " " + (paused ? "Paused " : playing ? "Playing" : "Stopped") + " Channels Playing " + channelsplaying; if (system != null) { system.update(); } }
private void timer_Tick(object sender, System.EventArgs e) { int channelsplaying = 0; float pan = 0.0f; if (channel != null) { channel.getPan(ref pan); } if (system != null) { system.getChannelsPlaying(ref channelsplaying); system.update(); } statusBar.Text = "Channels Playing " + channelsplaying + " : Pan = " + pan; }