Skip to content

feat: mark events through the trait and C ABI (OnMarkCallback, tts_set_on_mark, boundary3) - #28

Merged
willwade merged 5 commits into
mainfrom
mark-callbacks
Aug 20, 2026
Merged

feat: mark events through the trait and C ABI (OnMarkCallback, tts_set_on_mark, boundary3)#28
willwade merged 5 commits into
mainfrom
mark-callbacks

Conversation

@willwade

Copy link
Copy Markdown
Contributor

What

Addresses the Windows team's findings 1 and 2 (plus the floravox-side halves of 3/5/6 via the 0.8.1 dep):

  1. Mark events: TtsEngine::speak/speak_sync/speak_with_options grow Option<OnMarkCallback> (name, start_s, end_s, char_offset). The floravox engine forwards its measured MarkReached events — including char_offset from the <mark> tag position (floravox-core 0.8.1). Other engines accept and ignore (their SSML marks still need the interpolation workaround; floravox does not).
  2. C ABI: tts_set_on_mark(cb(name, char_offset, start_s, end_s, userdata)) — maps to SAPI SPEI_TTS_BOOKMARK. Plus tts_set_on_boundary3 with the estimated flag so hosts can badge measured-timing voices and decide on rescaling. Header declarations added; both wired through tts_speak/tts_speak_sync.

Also rides along on floravox 0.8.1: is_char_table auto-CharFrontend for MMS voices (no more silent letter-spelling), Windows USERPROFILE HOME resolution, kokoro leading-silence trim, and floravox-patch (native duration surgery, in floravox).

Breaking

TtsEngine::speak signature change — engines and callers updated in-tree.

Test plan

  • fmt / clippy -D warnings across feature combinations
  • cargo test green on system,cloud / sherpaonnx / floravox (+speechmarkdown) sets
  • floravox-demo still synthesizes with measured boundaries (kokoro + misaki)
  • live mark-callback E2E once a consumer wires it (SAPI)

…t_on_mark)

- engine trait speak/speak_sync/speak_with_options take
  Option<OnMarkCallback> (name, start_s, end_s, char_offset);
  floravox forwards its measured MarkReached events (char_offset from
  the <mark> tag position — requires floravox-core 0.8.1); other
  engines accept and ignore for now
- C ABI: tts_set_on_mark(name, char_offset, start_s, end_s, userdata)
  and tts_set_on_boundary3 (…, estimated, userdata) for the
  measured-vs-estimated flag; both wired through tts_speak and
  tts_speak_sync; header updated
- floravox engine: deps to 0.8.1 (MarkReached carries char_offset,
  is_char_table auto-CharFrontend, Windows USERPROFILE HOME
  resolution, kokoro leading-silence trim)
- all engines/examples/tests updated for the new signature
@willwade
willwade merged commit cd9043d into main Aug 20, 2026
12 checks passed
@willwade
willwade deleted the mark-callbacks branch August 20, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant