I’m using opengl in the SDK for native, I want to use lip sync, how to do it, I tried to add LAppModel.cpp in the run function in the LAppDelegate.cpp The update function in this, the compilation can pass, but the report is wrong when executing.
You can use the API LAppWavFileHandler::Start()
.
I have never used it, but likely you should call this api at starting the motion.
Are you saying that you call this API in the run function, and there seems to be no other steps to update the frame after the call?
I don’t know if it’s right to add these to the run function:
Csm::csmString filePath = “Resources/Haru/sounds/haru_Info_04.wav”;
_wavFileHandler.Start(filePath);
//描画更新
_view->Render();
No, I said you should call this API at STARTING motions. Not needed to call in the run()
function.
Though I checked the source code, already the system has built.
-
Update()
function
CubismNativeSamples/Samples/OpenGL/Demo/proj.linux.cmake/src/LAppModel.cpp at 19c25eadeb8a3b0a2e482317da1f860e11672b27 · Live2D/CubismNativeSamples · GitHub
You are able to refer these codes.
Thank you for your answer, but I still don’t understand how to use this, can you understand in more detail, thank you
Ok, I’ll explain step by step.
-
Call
Start()
Function At Starting Motion
For example, inLAppModel::StartMotion()
, start motions in the official sample. SoLAppWavFileHandler::Start()
also is called inLAppModel::StartMotion()
. -
Call
Update()
Function In Every Game Loop
For example, inLAppModel::Update()
, update the models in the official sample, soLAppWavFileHandler::Update
also is called inLAppModel::Update()
.
IMPORTANT:
The lipsync settings is required in your model. You can refer the model “Haru” in the official sample.
Thanks for the answer, what I want to know is that I have a wav file that needs to be played, and I am able to synchronize the lip sync when the voice is played, not when I perform a certain action and the lip sync is synchronized
Hmm…Likely I can’t help you, sorry.
Hello @fancity123 ,
Thank you for your contact.
This is Live2D Support.
In the Sample project, motion playback triggers audio playback and lip-sync. Please refer to the function in the following link.
In the above function, the following code performs audio playback and lip-sync.
By cutting out this code, audio playback and lip-sync can be performed regardless of motion playback.
Best regards.
@obs
Thank you for your support.
Thank you for your answer, now I need to display my specified expression, please tell me which function should I use, I do not need to respond to mouse events, please tell me to comment out those functions, I want to improve the efficiency of the program, if I do not use the mouse, please tell me which function should I call to realize the change of role
The current SDK sample loops random motion playback, with audio playback and lip-sync tied to each motion.
- audio playback without motion playback 2. it is not done with mouse events.
- it is not done on mouse events.
If this is the case, I think it would be appropriate to loop the audio random playback.
Looping audio playback requires a function to detect when audio playback is complete, but the SDK sample does not have such a function, so it is necessary to create one.
We will need to create an audio playback completion detection function using the current motion playback completion detection function (CubismNativeFramework/src/Motion/ACubismMotion.cpp at 3d9f82a47f3f9c8c89ae692703f2dad79296b61a · Live2D/CubismNativeFramework · GitHub), it would be possible to loop random audio playback.
Best regards.