That’s actually similar to what we did, except we used Boost threads instead of QThreads. Basically in bwdinit() we spawn a boost thread which runs an infinite loop which listens for speech input. After it hears an accepted command, it sets a flag in our component telling it what it heard. Then in our handleEvent() method, we handle animateBeginEvents by checking the flags to see if it heard anything and, if so, we move the camera.
We thought about creating our own speechEvent class to handle events, but that turned out to be more difficult than moving the camera on animateBeginEvents, although it would have been much more elegant, IMO. We also had difficulty sending events from the separate thread, but we could modify data elements without any issues, which is one of the reasons why we chose to do it this way.
Jeremy
Thank you! We created a component and were able to spawn our own thread in the bwdInit() method following the example of SensableEmulation/OmniDriverEmu.cpp. We haven’t implemented the speechEvent yet, but this is a big step towards that.
Jeremy
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.