Ship fix/android-midi-wire-86 - #128
Conversation
The MIDI JNI bridge and lock-free SPSC queue were already implemented (android_midi.cpp) but never called from the audio thread. The FIFO was being filled by the Kotlin MIDI receiver but nobody was draining it — so MIDI events accumulated indefinitely without reaching the Processor. Fix: call pulp::midi::android::drain_into() at the start of each Oboe onAudioReady callback, before the user audio callback. This delivers MIDI events to the per-block MidiBuffer with sample-accurate offsets computed from the event timestamps. Also adds midi_buffer() accessor so the standalone Android adapter can read the buffer and feed it to the Processor. This completes Phase 1 (USB MIDI) of issue #86. BLE MIDI (Phase 2) and virtual ports (Phase 3) already have Kotlin-side support in PulpBluetoothMidi.kt and PulpMidiService.kt — they route through the same nativeOnMidiReceived / nativeOnVirtualMidiReceived JNI entry points and benefit from this fix automatically.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 348b24f9d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #include <pulp/midi/buffer.hpp> | ||
| #include <pulp/midi/android_midi_fifo.hpp> |
There was a problem hiding this comment.
Add MIDI include path for Android audio target
This commit adds #include <pulp/midi/buffer.hpp> and #include <pulp/midi/android_midi_fifo.hpp> in oboe_device.cpp, but the Android wiring for pulp-audio does not add core/midi/include to that target (I checked tools/cmake/PulpAndroid.cmake, where pulp-audio only gets core/platform/include). On Android builds, this will fail at compile time with missing MIDI headers, so the new wiring cannot be built until the include path (or an equivalent transitive dependency) is added.
Useful? React with 👍 / 👎.
1. measure_text uses SkShaper when shaping is enabled (#125 review) - Aligned with fill_text: both now use HarfBuzz for consistent kerning/ligature widths. Fixes draw-vs-measure mismatch for strings like "AV", "ffi". 2. SDF text: UTF-8 bounds checking + missing glyph fallback (#126 review) - Guard multibyte decode against truncated input (no UB on malformed) - Fall back to fill_text() if any glyph is missing from the atlas rather than silently skipping characters 3. Remove duplicate accessibility JNI from gpu_surface_android.cpp (#127 review) - Old code had wrong role mappings (toggle=3, label=2, meter=1) - New code in core/view/platform/android/accessibility_android.cpp uses C++ enum values directly (correct) - Eliminates linker duplicate symbol conflict on Android 4. Add MIDI include path for Android audio target (#128 review) - core/midi/include added to pulp-audio's include directories in PulpAndroid.cmake so oboe_device.cpp can find buffer.hpp and android_midi_fifo.hpp
1. measure_text uses SkShaper when shaping is enabled (#125 review) - Aligned with fill_text: both now use HarfBuzz for consistent kerning/ligature widths. Fixes draw-vs-measure mismatch for strings like "AV", "ffi". 2. SDF text: UTF-8 bounds checking + missing glyph fallback (#126 review) - Guard multibyte decode against truncated input (no UB on malformed) - Fall back to fill_text() if any glyph is missing from the atlas rather than silently skipping characters 3. Remove duplicate accessibility JNI from gpu_surface_android.cpp (#127 review) - Old code had wrong role mappings (toggle=3, label=2, meter=1) - New code in core/view/platform/android/accessibility_android.cpp uses C++ enum values directly (correct) - Eliminates linker duplicate symbol conflict on Android 4. Add MIDI include path for Android audio target (#128 review) - core/midi/include added to pulp-audio's include directories in PulpAndroid.cmake so oboe_device.cpp can find buffer.hpp and android_midi_fifo.hpp
Automated by Shipyard