mirror of
https://github.com/espressif/esp-sr.git
synced 2025-09-15 15:28:44 +08:00
feat(AFE): modify alloc_from_PSRAM to support flexible memory allocation
This commit is contained in:
parent
66e21f6cc3
commit
cfebc5f31a
@ -142,6 +142,8 @@ static esp_afe_sr_data_t *afe_create_from_config(afe_config_t *afe_config)
|
||||
abort();
|
||||
}
|
||||
afe->agc_mode = afe_config->agc_mode;
|
||||
if (afe->agc_mode > 3) afe->agc_mode = 3;
|
||||
if (afe->agc_mode < 0) afe->agc_mode = 0;
|
||||
} else {
|
||||
afe->wn_nch = 1;
|
||||
afe->enable_wn = 0;
|
||||
@ -290,8 +292,9 @@ static int afe_fetch(esp_afe_sr_data_t *afe, int16_t *out)
|
||||
res = afe->wakenet->detect(afe->model_data, afe->buff_wn);
|
||||
//selector & gainer
|
||||
afe->channel_id = afe->wakenet->get_triggered_channel(afe->model_data);
|
||||
if (res > 0 && afe->agc_mode) {
|
||||
out_gain = afe->wakenet->get_vol_gain(afe->model_data, -5);
|
||||
if (res > 0 && afe->agc_mode>=0) {
|
||||
if (afe->agc_mode == 0) out_gain = 1;
|
||||
else out_gain = afe->wakenet->get_vol_gain(afe->model_data, (afe->agc_mode-6));
|
||||
}
|
||||
|
||||
int shift = afe->audio_chunksize * afe->channel_id;
|
||||
|
||||
@ -37,7 +37,7 @@ typedef struct {
|
||||
int afe_perferred_core;
|
||||
int afe_perferred_priority;
|
||||
int afe_ringbuf_size;
|
||||
bool alloc_from_psram;
|
||||
int alloc_from_psram;
|
||||
int agc_mode;
|
||||
} afe_config_t;
|
||||
|
||||
@ -54,7 +54,7 @@ typedef struct {
|
||||
.afe_perferred_core = 0, \
|
||||
.afe_perferred_priority = 5, \
|
||||
.afe_ringbuf_size = 50, \
|
||||
.alloc_from_psram = true, \
|
||||
.alloc_from_psram = 1, \
|
||||
.agc_mode = 2, \
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user