From: xue <2144439972@qq.com> Date: Tue, 14 Oct 2025 08:57:20 +0000 (+0800) Subject: 增加文本入队处理,实现音频与文本同步 X-Git-Tag: V1.0.9_20251128_194606_LN~254 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=c1e9d2578c7521b3b034b3159f147e8a557fe64a;p=mirrors%2FFD230.git 增加文本入队处理,实现音频与文本同步 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h index f12354b28..dbf889890 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h @@ -121,6 +121,8 @@ namespace OHOS int16_t prevSubView_{0}; // 网络状态变化标志(-1 未初始化,0 无网络,1 有网络) int8_t lastNetworkOnline_{-1}; + // 防止GoBackToPreviousView循环跳转的标志位 + bool isGoingBack_{false}; UIImageView *curFace{nullptr}; DialVideoView *videoPlayer_ = nullptr; UILiteSurfaceView *surfaceView_ = nullptr; diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h index fefbc18df..7ae09a379 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include "AppViewIDs.h" // #include "UiConfig.h" @@ -219,8 +221,18 @@ namespace OHOS // 恢复视频帧率 void HighFrequence(); + // 音频播放开始处理函数 + void HandleAudioPlaybackStart(); // 音频播放结束处理函数 void HandleAudioPlaybackEnd(); + // NPC表情变化处理函数 + void HandleNpcEmotionChange(const char* emotion); + + // 音频文本队列操作函数 + void EnqueueAudioText(const std::string& text); + void DequeueAndPushAudioText(); + bool HasAudioTextInQueue(); + void ClearAudioTextQueue(); // 对话状态显示相关函数 void SetCurrentExpression(const std::string& expression); @@ -242,6 +254,10 @@ namespace OHOS std::vector m_reminders; uint32_t m_nextReminderId; std::string m_currentTimeStr; + // 音频播放文本队列存储 + std::queue m_audioTextQueue; // 音频文本队列 + std::mutex m_textQueueMutex; // 文本队列互斥锁 + bool m_hasTextProcessing; // 是否有文本正在处理中 // OTA升级状态 int m_otaStatus; diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp index e96726dab..30f7f15fe 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp @@ -254,8 +254,8 @@ namespace OHOS void ThunderBirdDialogueView::AudioPlaybackEnd() { if(!TextLabel || !TextLabel_Y) return; - TextLabel->SetText(""); - TextLabel_Y->SetText(""); + //TextLabel->SetText("还有什么想聊的吗?"); + //TextLabel_Y->SetText("还有什么想聊的吗?"); if(speakAnimator) {speakAnimator->Stop();} } }