async void SendGameEvent() { // the keyboard can only process one event at a time, and returns when it's ready. // for this reason we'll use this as the inner loop. while (_recording) { sampleAggregator.GetFFTResults(fftResults); // take the first X samples since we get frequency ranges beyond our hearing. //float[] fftResults2 = new float[fftSize / 4]; //Array.Copy(fftResults, 0, fftResults2, 0, fftSize / 4); // we have way too many samples to fit on the keyboard, so bin them in to 23 values List <float> binList = binner.GetBinned(fftResults); // scale the values to bytes before sending them to the keyboard List <byte> scaledList = binList.Select(x => (byte)(x * byte.MaxValue)).ToList(); GamesenseEvent gameEvent = new GamesenseEvent(sseUri, scaledList); await gameEvent.SendEvent(); } }
async void SendGameEvent() { // the keyboard can only process one event at a time, and returns when it's ready. // for this reason we'll use this as the inner loop. while (_recording) { sampleAggregator.GetFFTResults(fftResults); // take the first X samples since we get frequency ranges beyond our hearing. //float[] fftResults2 = new float[fftSize / 4]; //Array.Copy(fftResults, 0, fftResults2, 0, fftSize / 4); // we have way too many samples to fit on the keyboard, so bin them in to 23 values List<float> binList = binner.GetBinned(fftResults); // scale the values to bytes before sending them to the keyboard List<byte> scaledList = binList.Select(x => (byte)(x * byte.MaxValue)).ToList(); GamesenseEvent gameEvent = new GamesenseEvent(sseUri, scaledList); await gameEvent.SendEvent(); } }