liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | #include "ql/ql_audio.h" |
| 2 | #include "mbtk_log.h" |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 3 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 4 | #include "mbtk_audio.h" |
| 5 | |
| 6 | static mbtk_audio_handle record_hdl = NULL; |
zhangzh | 8711cea | 2023-10-20 10:47:43 +0800 | [diff] [blame] | 7 | static mbtk_audio_handle player_hdl = NULL; |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 8 | static _cb_onRecorder record_cb_fun = NULL; |
| 9 | static int Samprate = 8000; |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 10 | #else |
| 11 | |
| 12 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 13 | |
| 14 | /***************************************************************** |
| 15 | * Function: Ql_AudPlayer_Open |
| 16 | * |
| 17 | * Description: |
| 18 | * Open audio play device, and specify the callback function. |
| 19 | * This function can be called twice to play different audio sources. |
| 20 | * |
| 21 | * Parameters: |
| 22 | * device : a string that specifies the PCM device. |
| 23 | * NULL, means the audio will be played on the default PCM device. |
| 24 | * |
| 25 | * If you want to mixedly play audio sources, you can call this |
| 26 | * API twice with specifying different PCM device. |
| 27 | * The string devices available: |
| 28 | * "hw:0,0" (the default play device) |
| 29 | * "hw:0,13" (this device can mix audio and TTS) |
| 30 | * "hw:0,14" |
| 31 | * |
| 32 | * cb_func : callback function for audio player. |
| 33 | * The results of all operations on audio player |
| 34 | * are informed in callback function. |
| 35 | * |
| 36 | * Return: |
| 37 | * pcm device handle on success |
| 38 | * -1 for failure |
| 39 | *****************************************************************/ |
| 40 | int Ql_AudPlayer_Open(char* device, _cb_onPlayer cb_func) |
| 41 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 42 | #ifdef MBTK_PLATFORM_ASR1803 |
zhangzh | 8711cea | 2023-10-20 10:47:43 +0800 | [diff] [blame] | 43 | player_hdl = mbtk_audio_open(MBTK_AUTIO_TYPE_OUT, 1, Samprate, cb_func); |
| 44 | return (int)player_hdl; |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 45 | #else |
| 46 | return 0; |
| 47 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | /*======================================================================== |
| 51 | FUNCTION: Ql_AudPlayer_Play |
| 52 | =========================================================================*/ |
| 53 | /** @brief |
| 54 | This function writes pcm data to pcm device to play. |
| 55 | |
| 56 | @param[in] hdl, the handle returned by Ql_AudPlayer_Open(). |
| 57 | @param[in] pData, pointer to the start address of pcm data. |
| 58 | @param[in] length, the length of pcm data. |
| 59 | |
| 60 | @return |
| 61 | on success, the return value is the number of bytes to play |
| 62 | on failure, the return value is -1; |
| 63 | |
| 64 | @dependencies |
| 65 | Ql_AudPlayer_Open() must be first called successfully. |
| 66 | */ |
| 67 | /*=======================================================================*/ |
| 68 | int Ql_AudPlayer_Play(int hdl, unsigned char* pData, unsigned int length) |
| 69 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 70 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 71 | return mbtk_audio_play_stream((void *)hdl, pData, length); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 72 | #else |
| 73 | return 0; |
| 74 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | /*======================================================================== |
| 78 | FUNCTION: Ql_AudPlayer_PlayFrmFile |
| 79 | =========================================================================*/ |
| 80 | /** @brief |
| 81 | This function plays the pcm data from the specified file. |
| 82 | |
| 83 | @param[in] hdl, the handle returned by Ql_AudPlayer_Open(). |
| 84 | @param[in] fd, a file descriptor that contains pcm data. |
| 85 | Note: |
| 86 | the file offset should be set to the start position of pcm |
| 87 | data region, which means you should move the file offset |
| 88 | skipping the file header (such as wave header, amr header). |
| 89 | @param[in] offset, file offset. Please set it to -1 if no need to use. |
| 90 | |
| 91 | @return |
| 92 | 0 on success |
| 93 | -1 on failure |
| 94 | |
| 95 | @dependencies |
| 96 | Ql_AudPlayer_Open() must be first called successfully. |
| 97 | */ |
| 98 | /*=======================================================================*/ |
zhangzh | 8711cea | 2023-10-20 10:47:43 +0800 | [diff] [blame] | 99 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 100 | int Ql_AudPlayer_PlayFrmFile(int hdl, int fd, int offset) |
| 101 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 102 | #ifdef MBTK_PLATFORM_ASR1803 |
zhangzh | d04babd | 2023-10-24 16:55:57 +0800 | [diff] [blame] | 103 | return mbtk_audio_play_file((void *)hdl, fd, offset); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 104 | #else |
| 105 | return 0; |
| 106 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | // |
| 110 | // Function: Ql_AudPlayer_Pause |
| 111 | // |
| 112 | // Description: |
| 113 | // Pause playing. |
| 114 | // @param hdl: |
| 115 | // Handle received from Ql_AudPlayer_Open(). |
| 116 | int Ql_AudPlayer_Pause(int hdl) |
| 117 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 118 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 119 | return mbtk_audio_pause((void *)hdl); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 120 | #else |
| 121 | return 0; |
| 122 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | // |
| 126 | // Function: Ql_AudPlayer_Resume |
| 127 | // |
| 128 | // Description: |
| 129 | // Resume playing. |
| 130 | // @param hdl: |
| 131 | // Handle received from Ql_AudPlayer_Open(). |
| 132 | int Ql_AudPlayer_Resume(int hdl) |
| 133 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 134 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 135 | return mbtk_audio_resume((void *)hdl); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 136 | #else |
| 137 | return 0; |
| 138 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | // |
| 142 | // Function: Ql_AudPlayer_Stop |
| 143 | // |
| 144 | // Description: |
| 145 | // Stop playing audio |
| 146 | // hdl: |
| 147 | // Handle received from Ql_AudPlayer_Open(). |
| 148 | void Ql_AudPlayer_Stop(int hdl) |
| 149 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 150 | #ifdef MBTK_PLATFORM_ASR1803 |
| 151 | mbtk_audio_stop((void *)hdl); |
| 152 | #else |
| 153 | |
| 154 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | // |
| 158 | // Function: Ql_AudPlayer_Close |
| 159 | // |
| 160 | // Description: |
| 161 | // Close player, and free the resource. |
| 162 | // @param hdl: |
| 163 | // Handle received from Ql_AudPlayer_Open(). |
| 164 | void Ql_AudPlayer_Close(int hdl) |
| 165 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 166 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 167 | mbtk_audio_close((void *)hdl); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 168 | #else |
| 169 | |
| 170 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | |
| 174 | int Ql_AudPlayer_set_LessDataThreshold(int hdl, unsigned short threshSize) |
| 175 | { |
| 176 | |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | int Ql_AudPlayer_get_freeSpace(int hdl) |
| 181 | { |
| 182 | |
| 183 | return 0; |
| 184 | } |
| 185 | |
| 186 | |
| 187 | /***************************************************************** |
| 188 | * Function: Ql_AudRecorder_Open |
| 189 | * |
| 190 | * Description: |
| 191 | * Open audio record device, and specify the callback function. |
| 192 | * |
| 193 | * Parameters: |
| 194 | * device : not used. MUST be NULL. |
| 195 | * |
| 196 | * cb_func : callback function for audio player. |
| 197 | * The results of all operations on audio recorder |
| 198 | * are informed in callback function. |
| 199 | * |
| 200 | * Return: |
| 201 | * pcm device handle |
| 202 | * -1 for failure |
| 203 | *****************************************************************/ |
| 204 | int Ql_AudRecorder_Open(char* device, _cb_onRecorder cb_fun) |
| 205 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 206 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 207 | record_hdl = mbtk_audio_open(MBTK_AUTIO_TYPE_IN, 1, 8000, NULL); |
| 208 | record_cb_fun = cb_fun; |
| 209 | return (int)record_hdl; |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 210 | #else |
| 211 | return 0; |
| 212 | |
| 213 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | // |
| 217 | // Function: Ql_AudRecorder_StartRecord |
| 218 | // |
| 219 | // Description: |
| 220 | // Start to record. |
| 221 | // The record data is output in _cb_onRecorder. |
| 222 | // |
| 223 | // Return: |
| 224 | // 0 on success |
| 225 | // -1 on failure |
| 226 | int Ql_AudRecorder_StartRecord(void) |
| 227 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 228 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 229 | return mbtk_audio_record(record_hdl, record_cb_fun, NULL); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 230 | #else |
| 231 | return 0; |
| 232 | |
| 233 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | // |
| 237 | // Function: Ql_AudRecorder_Pause |
| 238 | // |
| 239 | // Description: |
| 240 | // Pause recording |
| 241 | int Ql_AudRecorder_Pause(void) |
| 242 | { |
| 243 | return 0; |
| 244 | } |
| 245 | |
| 246 | // |
| 247 | // Function: Ql_AudRecorder_Resume |
| 248 | // |
| 249 | // Description: |
| 250 | // Resume recording |
| 251 | int Ql_AudRecorder_Resume(void) |
| 252 | { |
| 253 | return 0; |
| 254 | } |
| 255 | |
| 256 | // |
| 257 | // Function: Ql_AudRecorder_Stop |
| 258 | // |
| 259 | // Description: |
| 260 | // Stop recording |
| 261 | void Ql_AudRecorder_Stop(void) |
| 262 | { |
| 263 | |
| 264 | } |
| 265 | |
| 266 | // |
| 267 | // Function: Ql_AudRecorder_Close |
| 268 | // |
| 269 | // Description: |
| 270 | // Close recorder, and free the resource |
| 271 | void Ql_AudRecorder_Close(void) |
| 272 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 273 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 274 | mbtk_audio_close(record_hdl); |
| 275 | record_hdl = NULL; |
| 276 | record_cb_fun = NULL; |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 277 | #else |
| 278 | |
| 279 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | // |
| 283 | // Function: Ql_clt_set_mixer_value |
| 284 | // |
| 285 | // Description: |
| 286 | // Close recorder, and free the resource |
| 287 | boolean Ql_clt_set_mixer_value(const char *device, int count, const char *value) |
| 288 | { |
| 289 | |
| 290 | return FALSE; |
| 291 | } |
| 292 | |
| 293 | |
| 294 | int Ql_AudTone_Open(char* device, _cb_onPlayer cb)//cb not support now |
| 295 | { |
| 296 | return 0; |
| 297 | } |
| 298 | |
| 299 | int Ql_AudTone_Start(int hdl, struct Ql_TonePara *para) |
| 300 | { |
| 301 | return 0; |
| 302 | } |
| 303 | |
| 304 | void Ql_AudTone_Stop(int hdl) |
| 305 | { |
| 306 | |
| 307 | } |
| 308 | |
| 309 | void Ql_AudTone_Close(int hdl) |
| 310 | { |
| 311 | |
| 312 | } |
| 313 | |
| 314 | |
| 315 | //****************QL Codec API************************// |
| 316 | |
| 317 | // |
| 318 | // Function: Ql_AudCodec_Set_ALC5616_DRCAGC |
| 319 | // |
| 320 | // Description: |
| 321 | // Set ALC5616 DRC/AGC configuration |
| 322 | int Ql_AudCodec_Set_ALC5616_DRCAGC(const char *i2c, struct Ql_ALC5616_DRCAGC *cfg) |
| 323 | { |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | // |
| 328 | // Function: Ql_Update_wav_size |
| 329 | // |
| 330 | // Description: |
| 331 | // update wav format file size in the header |
| 332 | // @param fd: |
| 333 | // wav file discriptor |
| 334 | // @param size: |
| 335 | // wav file size to update |
| 336 | int Ql_Update_wav_size(int fd, int size) |
| 337 | { |
| 338 | return 0; |
| 339 | } |
| 340 | |
| 341 | //add by grady, 2018-5-29 |
| 342 | /* |
| 343 | * describe : this function is use to open pcm device |
| 344 | * paras : |
| 345 | * device : this should be fix to hw:0,0 |
| 346 | * flags ; pcm play flags |
| 347 | * rate: sample rate |
| 348 | * channels : audio channal 1 or 2 |
| 349 | * format: format to play or record, 16bit line,MP3 |
| 350 | * hostless: if there is no file it is true |
| 351 | * return : |
| 352 | * pcm : pcm handle, use can use this handle to read write data |
| 353 | */ |
| 354 | struct pcm *quec_pcm_open(char *device, unsigned flags, unsigned rate, unsigned channels, unsigned format, unsigned hostless) |
| 355 | { |
| 356 | return NULL; |
| 357 | } |
| 358 | |
| 359 | /* |
| 360 | * describe : this function is use to close pcm handle |
| 361 | * paras : |
| 362 | * pcm : pcm handle to close |
| 363 | * return : |
| 364 | */ |
| 365 | int quec_pcm_close(struct pcm *pcm ) |
| 366 | { |
| 367 | return 0; |
| 368 | } |
| 369 | |
| 370 | /* |
| 371 | * describe : this function is use to read pcm buffer |
| 372 | * paras : |
| 373 | * pcm : pcm handle to write date |
| 374 | * buffer: data buffer |
| 375 | * lenth: data length |
| 376 | * return : |
| 377 | */ |
| 378 | int quec_read_pcm(struct pcm *pcm, void * buffer, int length) |
| 379 | { |
| 380 | |
| 381 | return 0; |
| 382 | } |
| 383 | |
| 384 | /* |
| 385 | * describe : this function is use to get pcm buffer lenth |
| 386 | * paras : |
| 387 | * lenth: data length |
| 388 | * return |
| 389 | * buffer length |
| 390 | */ |
| 391 | int quec_get_pem_buffer_len(struct pcm *pcm) |
| 392 | { |
| 393 | |
| 394 | return 0; |
| 395 | } |
| 396 | |
| 397 | void dtmf_cb1(char dtmf) |
| 398 | { |
| 399 | printf("%s:%c\n", __FUNCTION__, dtmf); |
| 400 | } |
| 401 | |
| 402 | /** |
| 403 | * @brief Set RX DSP Gain |
| 404 | * @details |
| 405 | * Gain support [-36,12] dB |
| 406 | * |
| 407 | * @param gain |
| 408 | * DSP gain |
| 409 | */ |
| 410 | |
| 411 | int Ql_Rxgain_Set(int value) |
| 412 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 413 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 414 | printf("Volume is %d \n",value); |
| 415 | int volume =0; |
| 416 | int handler = 0; |
| 417 | |
| 418 | if(value < -36 || value > 12) |
| 419 | { |
| 420 | volume = 0; |
| 421 | } |
| 422 | else |
| 423 | { |
| 424 | volume = value; |
| 425 | } |
| 426 | |
| 427 | mbtk_audio_ubus_client_init(&handler, dtmf_cb1); |
| 428 | mbtk_audio_dsp_set(1, volume); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 429 | return 0; |
| 430 | #else |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 431 | |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 432 | return 0; |
| 433 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 434 | } |
| 435 | |
| 436 | |
| 437 | /** Ql_Playback_Samprate_Set |
| 438 | * @brief Set Playback PCM Samprate |
| 439 | * @details |
| 440 | * 0 for NB 1 for WB |
| 441 | * |
| 442 | * @param samprate |
| 443 | * samprate for PCM playback,default value is PCM NB |
| 444 | */ |
| 445 | int Ql_Playback_Samprate_Set(int samprate) |
| 446 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 447 | #ifdef MBTK_PLATFORM_ASR1803 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 448 | printf("samprate is %d \n",samprate); |
| 449 | if(samprate == 1) |
| 450 | { |
| 451 | Samprate = 16000; |
| 452 | } |
| 453 | else{ |
| 454 | Samprate = 8000; |
| 455 | } |
| 456 | |
| 457 | return 0; |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 458 | #else |
| 459 | |
| 460 | return 0; |
| 461 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 462 | } |
| 463 | |
| 464 | int Ql_Mp3_To_Wav(const char *wavpath, char *mp3path) |
| 465 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 466 | #ifdef MBTK_PLATFORM_ASR1803 |
b.liu | c1064f8 | 2023-10-11 16:47:39 +0800 | [diff] [blame] | 467 | #ifdef MBTK_MP3_SUPPORT |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 468 | return mbtk_audio_mp3_to_wav(wavpath, mp3path); |
b.liu | c1064f8 | 2023-10-11 16:47:39 +0800 | [diff] [blame] | 469 | #else |
| 470 | return 0; |
| 471 | #endif |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 472 | #else |
| 473 | |
| 474 | return 0; |
| 475 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 476 | } |
| 477 | |
| 478 | int Ql_Mp3_To_Play(char *mp3path, int hdl,int sample_rate) |
| 479 | { |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 480 | #ifdef MBTK_PLATFORM_ASR1803 |
b.liu | c1064f8 | 2023-10-11 16:47:39 +0800 | [diff] [blame] | 481 | #ifdef MBTK_MP3_SUPPORT |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 482 | return mbtk_audio_mp3_to_play(mp3path, hdl, sample_rate); |
b.liu | c1064f8 | 2023-10-11 16:47:39 +0800 | [diff] [blame] | 483 | #else |
| 484 | return 0; |
| 485 | #endif |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame^] | 486 | #else |
| 487 | |
| 488 | return 0; |
| 489 | #endif |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | //add by grady, 2018-6-2 |
| 493 | /* |
| 494 | * describe : this function is use to open mixer device |
| 495 | * paras : |
| 496 | * device: mixer device |
| 497 | * return |
| 498 | * mixer handle |
| 499 | */ |
| 500 | struct mixer *quec_mixer_open(const char *device) |
| 501 | { |
| 502 | |
| 503 | return NULL; |
| 504 | } |
| 505 | |
| 506 | /* |
| 507 | * describe : this function is use to close mixer device |
| 508 | * paras : |
| 509 | * mixer: mixer handle |
| 510 | * return |
| 511 | * none |
| 512 | */ |
| 513 | void quec_mixer_close(struct mixer *mixer) |
| 514 | { |
| 515 | |
| 516 | |
| 517 | } |
| 518 | |
| 519 | /* |
| 520 | * describe : this function is use to get mixer devie control |
| 521 | * paras : |
| 522 | * mixer: mixer handle |
| 523 | * name: mixer device |
| 524 | * index: mixer index |
| 525 | * return |
| 526 | * mixer control |
| 527 | */ |
| 528 | struct mixer_ctl *quec_mixer_get_control(struct mixer *mixer, const char *name, unsigned index) |
| 529 | { |
| 530 | |
| 531 | return NULL; |
| 532 | } |
| 533 | |
| 534 | /* |
| 535 | * describe : this function is use to set mulvalues |
| 536 | * paras : |
| 537 | * mixer: mixer handle |
| 538 | * count: count |
| 539 | * argv: data |
| 540 | * return : |
| 541 | * |
| 542 | */ |
| 543 | int quec_mixer_ctl_mulvalues(struct mixer_ctl *ctl, int count, char ** argv) |
| 544 | { |
| 545 | |
| 546 | return 0; |
| 547 | } |
| 548 | |
| 549 | |
| 550 | //end grady |
| 551 | |
| 552 | /***************************************************************** |
| 553 | * Function: Ql_AudPlayer_OpenExt |
| 554 | * |
| 555 | * Description: |
| 556 | * expend function from Ql_AudPlayer_OpenExt |
| 557 | * Open audio play device, and specify the callback function. |
| 558 | * This function can be called twice to play different audio sources. |
| 559 | * |
| 560 | * Parameters: |
| 561 | * device : a string that specifies the PCM device. |
| 562 | * NULL, means the audio will be played on the default PCM device. |
| 563 | * |
| 564 | * If you want to mixedly play audio sources, you can call this |
| 565 | * API twice with specifying different PCM device. |
| 566 | * The string devices available: |
| 567 | * "hw:0,0" (the default play device) |
| 568 | * "hw:0,13" (this device can mix audio and TTS) |
| 569 | * "hw:0,14" |
| 570 | * |
| 571 | * cb_func : callback function for audio player. |
| 572 | * The results of all operations on audio player |
| 573 | * are informed in callback function. |
| 574 | * |
| 575 | * flags : pcm flags, eg: PCM_MMAP, PCM_NMMAP. |
| 576 | * |
| 577 | * channels: pcm sample channels. |
| 578 | * |
| 579 | * rate : pcm sample rate. |
| 580 | * |
| 581 | * format : pcm sample fromat |
| 582 | * |
| 583 | * Return: |
| 584 | * pcm device handle |
| 585 | * NULL, fail |
| 586 | *****************************************************************/ |
| 587 | int Ql_AudPlayer_OpenExt( |
| 588 | char *dev, |
| 589 | _cb_onPlayer cb_fun, |
| 590 | int flags, |
| 591 | int channels, |
| 592 | int rate, |
| 593 | int format) |
| 594 | { |
| 595 | return 0; |
| 596 | } |
| 597 | |
| 598 | /***************************************************************** |
| 599 | * Function: Ql_AudRecorder_Open |
| 600 | * |
| 601 | * Description: |
| 602 | * Open audio record device, and specify the callback function. |
| 603 | * |
| 604 | * Parameters: |
| 605 | * device : not used. MUST be NULL. |
| 606 | * |
| 607 | * cb_func : callback function for audio player. |
| 608 | * The results of all operations on audio recorder |
| 609 | * are informed in callback function. |
| 610 | * |
| 611 | * flags : pcm flags, eg: PCM_MMAP, PCM_NMMAP. |
| 612 | * |
| 613 | * channels: pcm sample channels. |
| 614 | * |
| 615 | * rate : pcm sample rate. |
| 616 | * |
| 617 | * format : pcm sample fromat |
| 618 | * |
| 619 | * Return: |
| 620 | * pcm device handle |
| 621 | * NULL, fail |
| 622 | *****************************************************************/ |
| 623 | int Ql_AudRecorder_OpenExt( |
| 624 | char *dev, |
| 625 | _cb_onRecorder cb_fun, |
| 626 | int flags, |
| 627 | int channels, |
| 628 | int rate, |
| 629 | int format) |
| 630 | { |
| 631 | |
| 632 | |
| 633 | return 0; |
| 634 | } |
| 635 | |
| 636 | /* |
| 637 | * Function: uac enable |
| 638 | * |
| 639 | * Description: |
| 640 | * uac enable |
| 641 | * |
| 642 | * Parameters: |
| 643 | * none |
| 644 | * Return: |
| 645 | * TURE or FALSE |
| 646 | */ |
| 647 | int ql_uac_enable(void) |
| 648 | { |
| 649 | |
| 650 | return 0; |
| 651 | } |
| 652 | |
| 653 | /* |
| 654 | * Function: uac disable |
| 655 | * |
| 656 | * Description: |
| 657 | * uac disable |
| 658 | * |
| 659 | * Parameters: |
| 660 | * none |
| 661 | * Return: |
| 662 | * TURE or FALSE |
| 663 | */ |
| 664 | int ql_uac_disable(void) |
| 665 | { |
| 666 | |
| 667 | return 0; |
zhangzh | 8711cea | 2023-10-20 10:47:43 +0800 | [diff] [blame] | 668 | } |