public void UpdateState(byte[] data) { BongoData update = new BongoData(data); if (!update.Equals(previousBongo)) { StateUpdate?.Invoke(update); } if (update.micLevel != previousBongo.micLevel) { MicUpdate?.Invoke(update.micLevel); } if (update.botLeft && !previousBongo.botLeft) { BotLeftPressed?.Invoke(); } if (update.botRight && !previousBongo.botRight) { BotRightPressed?.Invoke(); } if (update.topLeft && !previousBongo.topLeft) { TopLeftPressed?.Invoke(); } if (update.topRight && !previousBongo.topRight) { TopRightPressed?.Invoke(); } if (update.start && !previousBongo.start) { StartPressed?.Invoke(); } if (update.micLevel >= micThreshold && previousBongo.micLevel < micThreshold) { MicStarted?.Invoke(); } if (update.botLeft && previousBongo.botLeft) { BotLeftHeld?.Invoke(); } if (update.botRight && previousBongo.botRight) { BotRightHeld?.Invoke(); } if (update.topLeft && previousBongo.topLeft) { TopLeftHeld?.Invoke(); } if (update.topRight && previousBongo.topRight) { TopRightHeld?.Invoke(); } if (update.start && previousBongo.start) { StartHeld?.Invoke(); } if (update.micLevel >= micThreshold && previousBongo.micLevel >= micThreshold) { MicHeld?.Invoke(); } if (!update.botLeft && previousBongo.botLeft) { BotLeftReleased?.Invoke(); } if (!update.botRight && previousBongo.botRight) { BotRightReleased?.Invoke(); } if (!update.topLeft && previousBongo.topLeft) { TopLeftReleased?.Invoke(); } if (!update.topRight && previousBongo.topRight) { TopRightReleased?.Invoke(); } if (!update.start && previousBongo.start) { StartReleased?.Invoke(); } if (update.micLevel < micThreshold && previousBongo.micLevel >= micThreshold) { MicReleased?.Invoke(); } //Console.WriteLine(update.micLevel); previousBongo = update; }
public void OnStartPressed() { StartPressed?.Invoke(this, null); }
public static void OnStartPressed() { StartPressed?.Invoke(null, EventArgs.Empty); }