(SOLVED) Running MusePlayer through UE4 doesn't work


#1

Hello!

I am currently trying to get MusePlayer to run through Unreal Engine 4 C++ using FPlatformProcess::CreateProc, but I can’t get it to work properly. CreateProc will open MusePlayer.exe and my current program will create a .csv file in a given directory. However, the data from the Muse isn’t making it to the .csv file that I am creating.

This is what the line of code that opens MusePlayer looks like:
ProcHandle = FPlatformProcess::CreateProc(*Command, *Parms, true, false, false, nullptr, 0, nullptr, nullptr);

Command and Parms are pointers to TCHAR*, or character arrays. More information on the function can be found here:
http://api.unrealengine.com/INT/API/Runtime/Core/GenericPlatform/FGenericPlatformProcess/CreateProc/index.html

The contents of Command are “muse-player”, and the contents of Parms are “-l 7000 -C C:/Users/kat109020/Desktop/BatTest2.csv -s 5001”. When I run the program with the function call as it is, MusePlayer will open but it will just be a blank command line box with nothing in it. When I close MusePlayer and check the .csv file that my program created, it will also be blank.

However, when I enter the same command into a Windows command terminal (full command: “muse-player -l 7000 -C C:/Users/kat109020/Desktop/BatTest2.csv -s 5001”) , it looks like this:

In the terminal, the data from the Muse is successfully streamed into the .csv file on my desktop and it is not blank.

I am working in UE4.15, and I am not currently using libmuse in my project. Do I need libmuse in order to get MusePlayer to work properly from Unreal? Is there something wrong with my code, or is there something else that I need to check with MusePlayer?

I appreciate any responses to my question, as I urgently need a solution to my problem. :slight_smile:


#2

I have fixed my own problem and got MusePlayer to open within my Unreal project! All I had to do was switch one boolean to false and another to true (typical…). The line of code that I posted in my question now looks like this:

ProcHandle = FPlatformProcess::CreateProc(*Command, *Parms, false, true, false, nullptr, 0, nullptr, nullptr);

The first boolean was causing MusePlayer to launch detached from Unreal, which explains the lack of visual feedback on MusePlayer’s terminal, and it now streams data properly. The second bool allows you to launch the process that you are creating on the task bar; this is optional, but in my specific case the consumer does not need to see a command terminal for MusePlayer.