forked from xiaozhi/xiaozhi-esp32
fit the memory usage for esp32c3
This commit is contained in:
@@ -16,12 +16,16 @@
|
||||
#include "display.h"
|
||||
#include "board.h"
|
||||
#include "ota.h"
|
||||
#include "background_task.h"
|
||||
|
||||
#ifdef CONFIG_USE_AFE_SR
|
||||
#if CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "wake_word_detect.h"
|
||||
#include "audio_processor.h"
|
||||
#endif
|
||||
|
||||
#define SCHEDULE_EVENT (1 << 0)
|
||||
#define AUDIO_INPUT_READY_EVENT (1 << 1)
|
||||
#define AUDIO_OUTPUT_READY_EVENT (1 << 2)
|
||||
|
||||
enum ChatState {
|
||||
kChatStateUnknown,
|
||||
@@ -58,25 +62,22 @@ private:
|
||||
Application();
|
||||
~Application();
|
||||
|
||||
#ifdef CONFIG_USE_AFE_SR
|
||||
#if CONFIG_IDF_TARGET_ESP32S3
|
||||
WakeWordDetect wake_word_detect_;
|
||||
AudioProcessor audio_processor_;
|
||||
#endif
|
||||
Ota ota_;
|
||||
std::mutex mutex_;
|
||||
std::condition_variable_any cv_;
|
||||
std::list<std::function<void()>> main_tasks_;
|
||||
Protocol* protocol_ = nullptr;
|
||||
EventGroupHandle_t event_group_;
|
||||
volatile ChatState chat_state_ = kChatStateUnknown;
|
||||
bool keep_listening_ = false;
|
||||
bool skip_to_end_ = false;
|
||||
bool aborted_ = false;
|
||||
|
||||
// Audio encode / decode
|
||||
TaskHandle_t audio_encode_task_ = nullptr;
|
||||
StaticTask_t audio_encode_task_buffer_;
|
||||
StackType_t* audio_encode_task_stack_ = nullptr;
|
||||
std::list<std::vector<int16_t>> audio_encode_queue_;
|
||||
BackgroundTask background_task_;
|
||||
std::chrono::steady_clock::time_point last_output_time_;
|
||||
std::list<std::string> audio_decode_queue_;
|
||||
|
||||
OpusEncoder opus_encoder_;
|
||||
@@ -88,10 +89,12 @@ private:
|
||||
OpusResampler output_resampler_;
|
||||
|
||||
void MainLoop();
|
||||
void InputAudio();
|
||||
void OutputAudio();
|
||||
void ResetDecoder();
|
||||
void SetDecodeSampleRate(int sample_rate);
|
||||
void CheckNewVersion();
|
||||
|
||||
void AudioEncodeTask();
|
||||
void PlayLocalFile(const char* data, size_t size);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user