Page 2 of 2

Re: Writing a latent function.

Posted: Sat Sep 30, 2017 9:40 pm
by Hanfling
atrey65789 wrote:Do I call RegisterNames() in the native functions I am importing?
You need to call it once so your the names get initialized, you just need to make sure this gets called at least once (before you use any name, like when doing your event* call). Classic place these were called are inside UEngine and subclasses Init() method, for dx they also put it into other places like DeusExPlayer. So i think just calling it off the constructor of your class you add should work fine.

Re: Writing a latent function.

Posted: Sun Oct 01, 2017 4:34 am
by Hanfling
You don't have do copy each individual include file you need into src, just add the relative paths to the dirs they reside as include paths to the project.

Also you should use relative paths to libs like Core.lib, WinMM.lib should be in VC library dir anyway, etc.

You could use SampleNativePackage project files out of ut/rune pubsrc as a template to properly set it up.

Also you can create a file named as the C++ name of the class, e.g. Inc\AUnrealMidi.h which gets autoincluded in the class definition to put the declaration for the ctor and poll exec in.

Re: Writing a latent function.

Posted: Sun Oct 01, 2017 5:33 am
by Hanfling
Did a bit of experimenting around, cleaned up the stit and added some define to test just basic ue polling code, etc.

http://coding.hanfling.de/UnrealMIDI.zip

Turns out, the reason why the polling exec was never called is because you didn't set up your project correctly and in particular used an struct alignment of 8 instead of 4 and thus due to changed alignment LatentAction was apparently never written to right place and hence having no effect.

Re: Writing a latent function.

Posted: Mon Oct 02, 2017 5:43 pm
by atrey65789
This looks great, I am studying the heck out of this and noting your revisions. Did this compile for you? I am getting 3 errors all regarding redefinitions, but looking over everything, all the error-related functions are only defined once. They include the function you made that calls RegisterNames() (It says it already has a body), The poll function (MidiPoll) and MidiPollTemp, where I cannot find anywhere but the error brings me to the IMPLEMENT_FUNCTION line for MidiPoll.

Thank you very much so far, I am impressed as heck about your proficiency of C++


And I saw what you were saying about each individual header being in my source, I did that because I couldn't get the paths of them to work, wierd stuff. I swear I was putting in the correct path for an hour, so I did this to save me a headache.

Re: Writing a latent function.

Posted: Tue Oct 03, 2017 4:21 pm
by atrey65789
I got it to compile, but still isn't calling the Poll function... question, I have a callback function that actually detects the midi signal and message, that sort of acts as a poll function, as it waits for detection of what it is looking for. I tried using it to call eventMidiMessage and got this error: 'AUnrealMIDI::eventMidiMessage' : illegal call of non-static member function.

It also tells me to look at its declaration, in a sense that I am giving it incorrect parameters, but it has two parameters (both being strings) which is what I give it.

Maybe there is a way to get it to work?

Re: Writing a latent function.

Posted: Fri Oct 06, 2017 2:07 pm
by atrey65789
Got the poll function to work, almost there thanks to your help... The function in-game waits patiently for detection before it moves on with the rest of the state... Now all I need to figure out is why the callback function isn't detecting midi input.

Edit: I found the issue to that too, fixed that.. very close.

Last Edit: fixed the final issue which was the engine only accepting one midi input due to not closing the midi port at the end of the function. Everything works the way I need it to to advance with what I want to do.


Hanfling, what can I say, you went above and beyond by helping me for a month with this and I appreciate every single bit of it.

Re: Writing a latent function.

Posted: Fri Nov 24, 2023 7:49 am
by Gaskoin
I am aware that using these nuances effectively requires experience. This also holds true in a variety of ways. I therefore turn to the experts at sop services in order to receive an essay that is produced in a high-quality manner. I only place an order, and one of the greatest professionals with excellent writing skills https://www.sopservices.net/ and a degree in the related topic responds to me personally, addressing my SoP.