rebase: Phase E — VU peaks, frame counters, Audio Auto Haptics
Build now compiles. audio.cpp on top of upstream's state_mgr-based audio_loop adds three additive pieces: 1. VU peak meters for ch0/1 (spk_max) and ch2/3 (hap_max) tracked per-sample in the existing loop; written back to g_peak_spk / g_peak_hap after. Accessors decay 12.5% per read so the OLED VU bars fall back naturally over a few frames. 2. Monotonic byte-flow counters: g_usb_frames++ after tud_audio_read (the OLED Diagnostics screen + web emulator compute USB-aud/s and BT-0x32/s as delta over time). g_bt_packets++ after each 0x36 bt_write. 3. Audio Auto Haptics DSP — 1-pole LP + envelope follower + modulation + soft-clip per loteran/DS5Dongle 5d6bc2f, with our added 4th "Fallback" mode that fires only after the game's native haptic path has been silent for ~1 s (NATIVE_SILENT_TIMEOUT = 100 audio_loop calls). Preserves native HD haptics (Spider-Man Remastered) while filling in for games that send no haptic data (Ghost of Tsushima). Modes: 0=Off, 1=Fallback (default), 2=Mix, 3=Replace. Crucially the state_mgr-based state_set(pkt+13, 63) call is left untouched — that's upstream's correct replacement for our prior state_data restore hack, and it's load-bearing for speaker output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
0593d79f5b
commit
8217d3a414
+12
@@ -5,9 +5,21 @@
|
||||
#ifndef DS5_BRIDGE_AUDIO_H
|
||||
#define DS5_BRIDGE_AUDIO_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
void audio_init();
|
||||
void audio_loop();
|
||||
void core1_entry();
|
||||
void set_headset(bool state);
|
||||
|
||||
// Accessors used by the optional OLED add-on (diag + VU meter screens).
|
||||
uint32_t audio_fifo_drops();
|
||||
uint32_t opus_fifo_drops();
|
||||
uint8_t audio_peak_speaker(); // 0..255, decays on read
|
||||
uint8_t audio_peak_haptic(); // 0..255, decays on read
|
||||
|
||||
// Byte-flow counters for the Diagnostics screen + web emulator.
|
||||
uint32_t audio_usb_frames();
|
||||
uint32_t audio_bt_packets();
|
||||
|
||||
#endif //DS5_BRIDGE_AUDIO_H
|
||||
Reference in New Issue
Block a user