public void Update() { if (song != null) { memblock m = song.getLastNextResult(); //current memblock FFTransform FFT = new FFTransform(song.getStereoObject(m), 5); //creates FFT using 5 samples per second DFTransform.DFTChannelResult Results; if (m.nBytes > 0) //if memblock is not empty { do //has another memblock { Results = FFT.next().stereo; int x = (int)Results.freq; Console.WriteLine(x); if (x < 1 || x > 20000) { break; } int i = (int)Math.Log(x, 1.3); double y = Math.Abs(Results.dbmag); points[i] = new Vector2(800 + 10 * i, 640 - (int)(y)); }while (FFT.hasNext()); } } }
public FFTransform FFT(memblock m) { global::System.IntPtr cPtr = libwavPINVOKE.Wave_FFT(swigCPtr, memblock.getCPtr(m)); FFTransform ret = (cPtr == global::System.IntPtr.Zero) ? null : new FFTransform(cPtr, false); if (libwavPINVOKE.SWIGPendingException.Pending) { throw libwavPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public void Update() { if (song != null) { memblock m = song.getLastNextResult();//current memblock FFTransform FFT = new FFTransform(song.getStereoObject(m), 5);//creates FFT using 5 samples per second DFTransform.DFTChannelResult Results; if (m.nBytes > 0)//if memblock is not empty { do//has another memblock { Results = FFT.next().stereo; int x = (int)Results.freq; Console.WriteLine(x); if (x < 1 || x > 20000) break; int i = (int)Math.Log(x, 1.3); double y = Math.Abs(Results.dbmag); points[i] = new Vector2(800 + 10 * i, 640 - (int)(y)); } while (FFT.hasNext()); } } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FFTransform obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }