From c3ab2349a1409d5eafb48dbbb2b532c0e46669aa Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 3 Jul 2025 16:46:26 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E6=89=93=E6=96=ADtts=E9=9F=B3?= =?utf8?q?=E9=A2=91=E6=AD=BB=E6=9C=BA=E9=97=AE=E9=A2=98=20=E4=BC=98?= =?utf8?q?=E5=8C=96tts=E9=9F=B3=E9=A2=91=E6=92=AD=E6=94=BE=EF=BC=8C?= =?utf8?q?=E8=BF=98=E9=9C=80=E5=BE=85=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 15 ++++++------- .../nativeui/aivoice/src/AiVoiceView.cpp | 5 +++-- .../peripheral/slip/cat1Service/cat1_ws.cpp | 10 ++++----- .../voice_call_volte_sample_wrapper.cpp | 21 ++++++++++++------- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp index 5d3af13da..c28f2d14e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -749,10 +749,6 @@ namespace OHOS if (slider) { int value = slider->GetValue(); - if (value >= 100 || value <= 0) - { - return; - } if (event.GetRotate() > 0) { value += 20; @@ -769,6 +765,11 @@ namespace OHOS value = 0; } } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "volume:%d", value); + if (value >= 100 || value <= 0) + { + return; + } do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_CHANGE_SYSTEM_VOLUME, (void *)(&value), sizeof(value)); } } @@ -776,18 +777,18 @@ namespace OHOS bool AiVoicePresenter::OnRotate(UIView &view, const RotateEvent &event) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnRotateEnd"); - ChangeVolume(view, event); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnRotateEnd"); return true; } bool AiVoicePresenter::OnRotateEnd(UIView &view, const RotateEvent &event) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnRotateEnd"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnRotateEnd"); // if (view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) // { // ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_VOLUME_VIEW); // } + ChangeVolume(view, event); return true; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp index de29cd93a..2013239e8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp @@ -438,7 +438,8 @@ namespace OHOS aiModelPicker->SetStyle(STYLE_BORDER_RADIUS, 150); aiModelPicker->SetItemHeight(40); aiModelPicker->SetLoopState(true); -#ifndef AI_VOICE_JIUTIAN +#if AI_VOICE_JIUTIAN +#else aiModelPicker->SetRotateFactor(1.0); aiModelPicker->RequestFocus(); #endif @@ -1144,8 +1145,8 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceScrollView[%d] is nullptr", showView); } - Draw(); DestroyTempView(hideView); + Draw(); AiVoiceModel::GetInstance().SetCurView(showView); return; } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp index 318ac829f..00dcfe2f6 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp @@ -1739,7 +1739,7 @@ void uapi_start_tts_single(void) },\ \"payload\": {\ \"voice\":\"xiaoyun\",\ - \"format\":\"pcm\",\ + \"format\":\"mp3\",\ \"sample_rate\":16000,\ \"volume\":50,\ \"speech_rate\":0,\ @@ -1860,7 +1860,7 @@ void bk_websocket_tts(void *data) { while (client_count) { - tts_client = init_websocket_client("ws://118.145.158.207:22080/tts/stream?audio_buffer_size=8192",NULL,0); + tts_client = init_websocket_client("ws://118.145.158.207:22080/tts/stream?audio_buffer_size=576",NULL,0); if (tts_client== NULL) { @@ -1889,7 +1889,7 @@ void bk_websocket_tts(void *data) { // uapi_start_tts_single(); - char* tts_recv_buf=(char *)malloc(1024*8); + char* tts_recv_buf=(char *)malloc(1024*4); set_ai_tts_server_init_flag(1); @@ -1897,8 +1897,8 @@ void bk_websocket_tts(void *data) { { - memset_s(tts_recv_buf,1024*8,0,1024*8); - int len=receive_websocket_message(tts_client,(unsigned char *)tts_recv_buf,1024*8,&type); + memset_s(tts_recv_buf,1024*4,0,1024*4); + int len=receive_websocket_message(tts_client,(unsigned char *)tts_recv_buf,1024*4,&type); // if(type==WS_CONT || if( type==WS_CLOSE || len==-1)//|| type==WS_CONT ) { diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp index 730668c59..3d585076e 100755 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp @@ -1159,7 +1159,7 @@ static int32_t RunVoiceCallVolteAI(VoiceCallVolteContext *context) // 16000 32000 44100 48000 AudioRendererConfig renderConfig = {}; - renderConfig.audioFormat = PCM; + renderConfig.audioFormat = MP3; renderConfig.channelCount = 1; renderConfig.linkDir = AUDIO_DOWN_LINK; renderConfig.sampleRate = 16000; @@ -1372,13 +1372,20 @@ void startAudioCaptureTask(void) -int32_t AIStreamWrite(uint8_t *buf,uint32_t size) +int32_t AIStreamWrite(uint8_t *buf, uint32_t size) { - int32_t ret; - - uint64_t writeLen = 0; - AudioRendererConfig renderConfig; - ret = g_stream_out_downink->StreamWrite(buf,size, writeLen, renderConfig); + int32_t ret = 0; + // 原有流写入逻辑 + if (g_stream_out_downink) + { + uint64_t writeLen = 0; + AudioRendererConfig renderConfig; + ret = g_stream_out_downink->StreamWrite(buf, size, writeLen, renderConfig); + LOS_Msleep(30); + if (ret < 0) { + MEDIA_ERR_LOG("StreamWrite failed"); + } + } return ret; } -- 2.17.1