I've written a Rust binding to speech-dispatcher, but one notable
missing feature is notification callbacks. I've defined my
callback like so:
unsafe extern "C" fn cb(msg_id: u64, client_id: u64, state: u32) {
println!("Here, {}, {}, {}", msg_id, client_id, state);
...
}
I'm noticing an off-by-1 bug with the state parameter, though. In particular, when speaking starts, I get 0, and when it ends, I get 1. The begin and end state enum values are 1 and 2, respectively, and if I add 1 to the state parameter, they seem to match up.
This seems like a fairly major bug to go unspotted, so I'm wondering if I'm missing something here? I don't want to just start manipulating callback values since I might be misunderstanding something.
Also, is there some way to match individual messages with the msg_id parameter in the callback? Say I speak "Hello world" and "Goodbye". How would I match up individual notifications to these utterances such that I can return the msg_id to the caller somehow, and they can track when that given utterance finishes?
Thanks.