@@ -69,8 +69,13 @@ class llm_audio : public StackFlow {
6969
7070 void hw_cap ()
7171 {
72+ #if defined(CONFIG_AX_620E_MSP_ENABLED) || defined(CONFIG_AX_620Q_MSP_ENABLED)
7273 ax_cap_start (cap_config.card , cap_config.device , cap_config.volume , cap_config.channel , cap_config.rate ,
7374 cap_config.bit , llm_audio::on_cap_sample);
75+ #else
76+ alsa_cap_start (cap_config.card , cap_config.device , cap_config.volume , cap_config.channel , cap_config.rate ,
77+ cap_config.bit , llm_audio::on_cap_sample);
78+ #endif
7479 }
7580
7681 void _play (const std::string &audio_data)
@@ -143,13 +148,17 @@ class llm_audio : public StackFlow {
143148 nlohmann::json error_body;
144149 std::string base_model_path;
145150 std::string base_model_config_path;
151+ #if defined(CONFIG_AX_620E_MSP_ENABLED) || defined(CONFIG_AX_620Q_MSP_ENABLED)
146152 std::list<std::string> config_file_paths;
147153 if (access (" /sys/devices/platform/soc/4851000.i2c/i2c-1/1-0043" , F_OK) == 0 ) {
148154 config_file_paths = get_config_file_paths (base_model_path, base_model_config_path, " audio_kit" );
149155 } else {
150156 config_file_paths = get_config_file_paths (base_model_path, base_model_config_path, " audio" );
151157 }
152-
158+ #else
159+ std::list<std::string> config_file_paths =
160+ get_config_file_paths (base_model_path, base_model_config_path, " audio" );
161+ #endif
153162 try {
154163 config_body = nlohmann::json::parse (data);
155164 for (auto file_name : config_file_paths) {
@@ -201,6 +210,7 @@ class llm_audio : public StackFlow {
201210 CONFIG_AUTO_SET (file_body[" play_param" ], stVqeAttr.stAgcCfg .enAgcMode );
202211 CONFIG_AUTO_SET (file_body[" play_param" ], stVqeAttr.stAgcCfg .s16TargetLevel );
203212 CONFIG_AUTO_SET (file_body[" play_param" ], stVqeAttr.stAgcCfg .s16Gain );
213+ #if defined(CONFIG_AX_620E_MSP_ENABLED) || defined(CONFIG_AX_620Q_MSP_ENABLED)
204214 CONFIG_AUTO_SET (file_body[" play_param" ], stHpfAttr.bEnable );
205215 CONFIG_AUTO_SET (file_body[" play_param" ], stHpfAttr.s32GainDb );
206216 CONFIG_AUTO_SET (file_body[" play_param" ], stHpfAttr.s32Freq );
@@ -215,6 +225,7 @@ class llm_audio : public StackFlow {
215225 CONFIG_AUTO_SET (file_body[" play_param" ], stEqAttr.s32GainDb [3 ]);
216226 CONFIG_AUTO_SET (file_body[" play_param" ], stEqAttr.s32GainDb [4 ]);
217227 CONFIG_AUTO_SET (file_body[" play_param" ], stEqAttr.s32Samplerate );
228+ #endif
218229 CONFIG_AUTO_SET (file_body[" play_param" ], gResample );
219230 CONFIG_AUTO_SET (file_body[" play_param" ], enInSampleRate);
220231 CONFIG_AUTO_SET (file_body[" play_param" ], gInstant );
@@ -247,7 +258,17 @@ class llm_audio : public StackFlow {
247258 CONFIG_AUTO_SET (file_body[" cap_param" ], aistAttr.enBitwidth );
248259 CONFIG_AUTO_SET (file_body[" cap_param" ], aistAttr.enLinkMode );
249260 CONFIG_AUTO_SET (file_body[" cap_param" ], aistAttr.enSamplerate );
250- CONFIG_AUTO_SET (file_body[" cap_param" ], aistAttr.enLayoutMode );
261+ // CONFIG_AUTO_SET(file_body["cap_param"], aistAttr.enLayoutMode);
262+ if (config_body.contains (" aistAttr.enLayoutMode" ))
263+ mode_config_.aistAttr .enLayoutMode = config_body[" aistAttr.enLayoutMode" ];
264+ else if (file_body[" cap_param" ].contains (" aistAttr.enLayoutMode" )) {
265+ mode_config_.aistAttr .enLayoutMode = file_body[" cap_param" ][" aistAttr.enLayoutMode" ];
266+ if (access (" /sys/devices/platform/soc/4851000.i2c/i2c-1/1-0043" , F_OK) == 0 ) {
267+ if (mode_config_.aistAttr .enLayoutMode == AX_AI_REF_MIC) {
268+ mode_config_.aistAttr .enLayoutMode = AX_AI_MIC_REF;
269+ }
270+ }
271+ }
251272 CONFIG_AUTO_SET (file_body[" cap_param" ], aistAttr.U32Depth );
252273 CONFIG_AUTO_SET (file_body[" cap_param" ], aistAttr.u32PeriodSize );
253274 CONFIG_AUTO_SET (file_body[" cap_param" ], aistAttr.u32PeriodCount );
@@ -261,6 +282,7 @@ class llm_audio : public StackFlow {
261282 CONFIG_AUTO_SET (file_body[" cap_param" ], aistVqeAttr.stAgcCfg .s16TargetLevel );
262283 CONFIG_AUTO_SET (file_body[" cap_param" ], aistVqeAttr.stAgcCfg .s16Gain );
263284 CONFIG_AUTO_SET (file_body[" cap_param" ], aistVqeAttr.stAecCfg .enAecMode );
285+ #if defined(CONFIG_AX_620E_MSP_ENABLED) || defined(CONFIG_AX_620Q_MSP_ENABLED)
264286 CONFIG_AUTO_SET (file_body[" cap_param" ], stHpfAttr.bEnable );
265287 CONFIG_AUTO_SET (file_body[" cap_param" ], stHpfAttr.s32GainDb );
266288 CONFIG_AUTO_SET (file_body[" cap_param" ], stHpfAttr.s32Samplerate );
@@ -276,6 +298,7 @@ class llm_audio : public StackFlow {
276298 CONFIG_AUTO_SET (file_body[" cap_param" ], stEqAttr.s32GainDb [3 ]);
277299 CONFIG_AUTO_SET (file_body[" cap_param" ], stEqAttr.s32GainDb [4 ]);
278300 CONFIG_AUTO_SET (file_body[" cap_param" ], stEqAttr.s32Samplerate );
301+ #endif
279302 CONFIG_AUTO_SET (file_body[" cap_param" ], gResample );
280303 CONFIG_AUTO_SET (file_body[" cap_param" ], enOutSampleRate);
281304 CONFIG_AUTO_SET (file_body[" cap_param" ], gDbDetection );
0 commit comments