private void PlayLipSync(byte[] audio)
{
-
- Tizen.Log.Error("MYLOG", "Play Lip sync : " + audio.Length);
- if(audio == null)
+ if (audio == null)
{
- Tizen.Log.Error("MYLOG", "audi data is null");
+ Tizen.Log.Error(LogTag, "audi data is null");
+ return;
}
DestroyLipAnimation();
var lipAnimation = CreateLipAnimation(audio, CurrentAudioOptions.SampleRate);
if (lipAnimation != null)
{
- Tizen.Log.Error("MYLOG", "lipAnimation is not null");
ResetLipAnimation(lipAnimation);
PlayLipAnimation();
}
else
{
- Tizen.Log.Error("MYLOG", "lipAnimation is null");
+ Tizen.Log.Error(LogTag, "lipAnimation is null");
}
audioPlayer.Play(audio);
CurrentMotionState = AvatarMotionState.Playing;
using Tizen.NUI;
using Tizen.NUI.Scene3D;
+using static Tizen.AIAvatar.AIAvatar;
+
namespace Tizen.AIAvatar
{
internal class MotionPlayer
/// <summary>
/// Play avatar animation by AnimationInfo
/// </summary>
- /// <param name="index">index of default avatar animations</param>
[EditorBrowsable(EditorBrowsableState.Never)]
internal void PlayAnimation(Animation motionAnimation, int duration = 3000, bool isLooping = false, int loopCount = 1)
{
ResetAnimations();
-
- MotionAnimation = this.motionAnimation;
- MotionAnimation.Play();
+ if (motionAnimation != null)
+ {
+ MotionAnimation = motionAnimation;
+ MotionAnimation?.Play();
+ }
+ else
+ {
+ Tizen.Log.Error(LogTag, "motionAnimation is null");
+ }
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private void PlayAnimation(AnimationInfo animationInfo, int duration = 3000, bool isLooping = false, int loopCount = 1)
{
+ if (animationInfo == null)
+ {
+ Tizen.Log.Error(LogTag, "animationInfo is null");
+ return;
+ }
+ if (animationInfo.MotionData == null)
+ {
+ Tizen.Log.Error(LogTag, "animationInfo.MotionData is null");
+ return;
+ }
var motionAnimation = GenerateMotionDataAnimation(animationInfo.MotionData);
- motionAnimation.Duration = duration;
- motionAnimation.Looping = isLooping;
- motionAnimation.LoopCount = loopCount;
- motionAnimation.BlendPoint = 0.2f;
- motionPlayer.PlayAnimation(motionAnimation);
+ if (motionAnimation != null)
+ {
+ motionAnimation.Duration = duration;
+ motionAnimation.Looping = isLooping;
+ motionAnimation.LoopCount = loopCount;
+ motionAnimation.BlendPoint = 0.2f;
+ motionPlayer.PlayAnimation(motionAnimation);
+ }
+ else
+ {
+ Tizen.Log.Error(LogTag, "motionAnimation is null");
+ }
}
/// <summary>
private void PlayAnimation(MotionData motionData, int duration = 3000, bool isLooping = false, int loopCount = 1)
{
+ if (motionData == null)
+ {
+ Tizen.Log.Error(LogTag, "motionData is null");
+ return;
+ }
var motionAnimation = GenerateMotionDataAnimation(motionData);
- motionAnimation.Duration = duration;
- motionAnimation.Looping = isLooping;
- motionAnimation.LoopCount = loopCount;
- motionAnimation.BlendPoint = 0.2f;
-
- motionPlayer.PlayAnimation(motionAnimation);
+ if (motionAnimation != null)
+ {
+ motionAnimation.Duration = duration;
+ motionAnimation.Looping = isLooping;
+ motionAnimation.LoopCount = loopCount;
+ motionAnimation.BlendPoint = 0.2f;
+ motionPlayer.PlayAnimation(motionAnimation);
+ }
+ else
+ {
+ Tizen.Log.Error(LogTag, "motionAnimation is null");
+ }
}
private void PlayAnimation(int index, int duration = 3000, bool isLooping = false, int loopCount = 1)