speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is there an off-by-1 bug in notification callbacks?


From: Nolan Darilek
Subject: Is there an off-by-1 bug in notification callbacks?
Date: Wed, 19 Aug 2020 10:05:22 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]