Update music player
This commit is contained in:
@@ -24,6 +24,10 @@ Board::Board() {
|
||||
settings.SetString("uuid", uuid_);
|
||||
}
|
||||
ESP_LOGI(TAG, "UUID=%s SKU=%s", uuid_.c_str(), BOARD_NAME);
|
||||
|
||||
// 初始化音乐播放器
|
||||
music_ = new Esp32Music();
|
||||
ESP_LOGI(TAG, "Music player initialized for all boards");
|
||||
}
|
||||
|
||||
Board::~Board() {
|
||||
|
||||
@@ -759,9 +759,14 @@ void Esp32Music::PlayAudioStream() {
|
||||
auto& app = Application::GetInstance();
|
||||
DeviceState current_state = app.GetDeviceState();
|
||||
|
||||
// 等小智把话说完了,变成聆听状态之后,马上转成待机状态,进入音乐播放
|
||||
// 状态转换:说话中-》聆听中-》待机状态-》播放音乐
|
||||
if (current_state == kDeviceStateListening || current_state == kDeviceStateSpeaking) {
|
||||
if (current_state == kDeviceStateSpeaking) {
|
||||
ESP_LOGI(TAG, "Device is in speaking state, switching to listening state for music playback");
|
||||
}
|
||||
if (current_state == kDeviceStateListening) {
|
||||
ESP_LOGI(TAG, "Device is in listening state, switching to idle state for music playback");
|
||||
}
|
||||
// 切换状态
|
||||
app.ToggleChatState(); // 变成待机状态
|
||||
vTaskDelay(pdMS_TO_TICKS(300));
|
||||
|
||||
Reference in New Issue
Block a user