[Stk] STK dll for Unreal Engine - threading quesiton
rob at ccrma.Stanford.EDU
rob at ccrma.Stanford.EDU
Fri Sep 6 20:22:29 PDT 2019
Hi all,
In a similar thread to the STK => C# posts from July, I'm rolling a
Windows STK dll for use in the Unreal Engine. My C++ is rusty these days
but I've got it started. Any suggestions from the STK brain-trust would
be great.
So far I've made a simple STK Windows dll and a small test console app
that will run it. Works. Can compile in Visual Studio, 64bit, Asio.
My main question is how should I be approaching threading with STK as a
dll and passing in control data for this kind of project? I don't think
I've got it right in my head quite yet. I shouldn't be thinking about
using SKINI or passing messages in over ports right? I'm generating all
the control data I need in Unreal and should just be passing that in
directly through noteOn/Off functions with frequency, bowPressure and
amplitude as my data?
For example, in my test app, I include my dll and call my "initSTK"
function, which is just a tweaked version of one of the STK example
scripts, on a separate thread like:
std::thread initThread(initSTK);
That function just instantiates an array of four Bowed strings using the
Voicer, opens and starts my audio stream.
Then I have simple noteOn() noteOff() functions which take frequency,
string number(1-4) and amplitude as parameters. Works in my test app,
like a terrible C++Sound.
Within Unreal, I wrote an interface for my dll and can load it
successfully (meaning the Unreal project will compile and sees the DLL).
However as expected, when I try to call my init function (without any
special threading) it locks up Unreal.
Before I start down the path of how to properly implement multi-threaded
audio processes in dll's within Unreal Engine does this seem like the
right way I should be approaching this? Is there a way within my STK dll
to call that init function in a separate thread or do I need some kind
of call-back here looking for my control data? I haven't built anything
worthwhile in C++ in a while now.
thanks all, any thoughts would be super helpful.
Go Cardinal!
rob
More information about the Stk
mailing list