Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
AdamMiltonBarker's avatar
AdamMiltonBarker
Honored Guest
8 years ago

Unreal running SAPI on separate thread

Hi guys I am working on a POC for a VR retail store and AI assistant. It is my first time programming for Rift with UE4 and I am having difficulties working out how to run the actor that speaks through SAPI at the begging of the program in a separate thread. Basically what is happening is when the actor loads, SAPI says a few words but it basically freezes the thread, so there is a white screen whilst the speaking happens, and then it loads the rest of the program once the speaking stops. Code can be found below and also a video of it happening.

Would be really cool if someone can point me to docs / examples on how to resolve this or can offer any advice, thanks in advance guys.

https://www.youtube.com/watch?v=tiImtJB7Py4

https://github.com/iotJumpway/Oculus-Examples/blob/master/Rift/vrAIretail/Source/vrAIretail/TOA.hhttps://github.com/iotJumpway/Oculus-Examples/blob/master/Rift/vrAIretail/Source/vrAIretail/TOA.cpp

1 Reply

Replies have been turned off for this discussion
  • I solved the blocking issue very easily in the end :D I wrapped the SAPI code in a function and used the following one liner (Where welcome is the custom SAPI function), now there is an issue where the speech is only coming out of the laptop and not the headset, will update this post once I solve that.

    // Called when the game starts or when spawned
    void ATOA::BeginPlay()
    {
        Super::BeginPlay();
        TFuture<void> A = Async<void>(EAsyncExecution::Thread, welcome);
    }