|
@ -28,6 +28,7 @@ void MainControlService::initialize() { |
|
|
GET_TO_SERVICE(m_wakeupProcesser); |
|
|
GET_TO_SERVICE(m_wakeupProcesser); |
|
|
GET_TO_SERVICE(m_audioRecoderService); |
|
|
GET_TO_SERVICE(m_audioRecoderService); |
|
|
GET_TO_SERVICE(m_audioLoggingService); |
|
|
GET_TO_SERVICE(m_audioLoggingService); |
|
|
|
|
|
GET_TO_SERVICE(m_smartSoundboxPlayer); |
|
|
|
|
|
|
|
|
// 监听从webservice来的websocket消息
|
|
|
// 监听从webservice来的websocket消息
|
|
|
m_zwebService->startWork([this](const json& command, json& receipt) { |
|
|
m_zwebService->startWork([this](const json& command, json& receipt) { |
|
@ -40,16 +41,20 @@ void MainControlService::initialize() { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
m_beforeWakeupVoiceProcesser->setAmplifyDB(20); |
|
|
|
|
|
|
|
|
|
|
|
m_wakeupProcesser->onWakeupSignal.connect([this](float wakeup_score) { |
|
|
|
|
|
logger->info("onWakeupSignal wakeup_score {}", wakeup_score); |
|
|
|
|
|
m_smartSoundboxPlayer->triggerWakeup(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
m_audioRecoderService->onRecordData.connect([this](shared_ptr<AudioClip> audioClip) { |
|
|
m_audioRecoderService->onRecordData.connect([this](shared_ptr<AudioClip> audioClip) { |
|
|
if (!audioClip) { |
|
|
if (!audioClip) { |
|
|
logger->error("onRecordData audioClip is null"); |
|
|
logger->error("onRecordData audioClip is null"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
logger->info("onRecordData {}", audioClip->size()); |
|
|
|
|
|
|
|
|
|
|
|
// 1. 保存此阶段语音到文件中
|
|
|
// 1. 保存此阶段语音到文件中
|
|
|
m_audioLoggingService->loggerMICVoice(audioClip); |
|
|
m_audioLoggingService->loggerMICVoice(audioClip); |
|
|
|
|
|
|
|
|
// voice -> before wakeup
|
|
|
// voice -> before wakeup
|
|
|
m_beforeWakeupVoiceProcesser->writeVoice(audioClip); |
|
|
m_beforeWakeupVoiceProcesser->writeVoice(audioClip); |
|
|
}); |
|
|
}); |
|
@ -60,7 +65,9 @@ void MainControlService::initialize() { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
m_audioLoggingService->loggerBeforeWakeupVoice(audioClip); |
|
|
m_audioLoggingService->loggerBeforeWakeupVoice(audioClip); |
|
|
logger->info("onAfterProcessVoice {}", audioClip->size()); |
|
|
|
|
|
|
|
|
// voice -> wakeup
|
|
|
|
|
|
// logger->info("before wakeup voice processer process voice size {}", audioClip->size());
|
|
|
|
|
|
m_wakeupProcesser->processVoice(audioClip->data(), audioClip->size()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
m_audioRecoderService->startRecord(); |
|
|
m_audioRecoderService->startRecord(); |
|
|