blob: d95ca9e41e8e51f64a00ef9cfd81c8f9e6b62ecc [file] [log] [blame]
luojiana6a47a92024-05-23 13:42:21 +08001
liubin281ac462023-07-19 14:22:54 +08002#include "ql/ql_audio.h"
3#include "mbtk_log.h"
luojiana6a47a92024-05-23 13:42:21 +08004#include "mbtk_audio2.h"
liubin281ac462023-07-19 14:22:54 +08005
b.liuc181beb2024-03-07 18:34:21 +08006typedef enum {
7 AUDIO_PLAY_STATE_STOP,
8 AUDIO_PLAY_STATE_RUNNING,
9 AUDIO_PLAY_STATE_PAUSE
10} audio_play_state_enum;
b.liu5fa9e772023-11-23 18:00:55 +080011
b.liuc181beb2024-03-07 18:34:21 +080012#define AUDIO_HANDLE 1
13#define WAV_PLAY_BUFF 1024
14
luojian82fd38a2024-07-25 14:20:51 +080015#ifdef MBTK_AF_SUPPORT
luojianfee10dc2024-07-25 11:34:35 +080016static mbtk_audio_handle player_hdl = NULL;
luojiande236232024-07-27 10:51:57 +080017static int player_hdl_1 = AUDIO_HANDLE;
luojianfee10dc2024-07-25 11:34:35 +080018static _cb_onRecorder record_cb_fun = NULL;
19static int Samprate = 8000;
luojian82fd38a2024-07-25 14:20:51 +080020#endif
luojianfee10dc2024-07-25 11:34:35 +080021
b.liuc181beb2024-03-07 18:34:21 +080022static int sample_rate = 8000;
23static int play_handle = AUDIO_HANDLE;
24static _cb_onPlayer play_cb_func = NULL;
25static _cb_onRecorder recorder_cb_fun = NULL;
26static int is_running = 0;
27static audio_play_state_enum play_state = AUDIO_PLAY_STATE_STOP;
28static int play_exit = 1;
29
30static void recorder_cb_func(void *data, uint32 data_len)
31{
32 if(recorder_cb_fun) {
33 recorder_cb_fun(AUD_RECORDER_START, (unsigned char*)data, data_len);
34 }
35}
36
37static int play_stream(unsigned char* pData, unsigned int length)
38{
39 int rc, len, frames = 0;
40 int result = 0;
41
42 play_state = AUDIO_PLAY_STATE_RUNNING;
43 play_exit = 0;
44 int data_send = 0;
45
luojiana6a47a92024-05-23 13:42:21 +080046 if (mbtk_audio_pcm_play_start()) {
47 printf("%s: error opening output device.", __FUNCTION__);
48 return -1;
49 }
50
b.liuc181beb2024-03-07 18:34:21 +080051 if(pData && length > 0) {
52 while (play_state != AUDIO_PLAY_STATE_STOP) {
53 if(play_state == AUDIO_PLAY_STATE_RUNNING) {
54 if (data_send >= length) {
55 LOGE("%s: Read pcm stream end.", __FUNCTION__);
56 break;
57 }
58
59 if(length - data_send > WAV_PLAY_BUFF) {
60 len = WAV_PLAY_BUFF;
61 } else {
62 len = length - data_send;
63 }
64
65 if((rc = mbtk_audio_pcm_play_data_send(pData + data_send, len)) != len) {
66 LOGE("Send data %d/%d", rc, len);
67 result = -1;
68 goto thread_end;
69 }
70
71 data_send += len;
72
73 LOGD("%s: No.%d frame playback", __FUNCTION__, ++frames);
74 } else {
75 usleep(200000);
76 }
77 }
78 } else {
79 result = -1;
80 }
81
82 play_state = AUDIO_PLAY_STATE_STOP;
83
luojian21604d92024-06-25 14:11:25 +080084
b.liuc181beb2024-03-07 18:34:21 +080085thread_end:
86 mbtk_audio_pcm_play_stop();
87 play_exit = 1;
88 LOGD("%s: finished pcm playback.", __FUNCTION__);
89 return result;
90}
91
92static int play_by_fd(int fd, int offset)
93{
94 int rc, len, frames = 0;
95 int result = 0;
96 char buf[WAV_PLAY_BUFF];
97
98 play_state = AUDIO_PLAY_STATE_RUNNING;
luojian21604d92024-06-25 14:11:25 +080099 if(play_cb_func)
100 play_cb_func(play_handle , AUDIO_PLAY_STATE_RUNNING);
b.liuc181beb2024-03-07 18:34:21 +0800101 play_exit = 0;
102 if(fd > 0) {
103 if(offset > 0) {
104 lseek(fd, offset, SEEK_SET);
105 }
luojiana6a47a92024-05-23 13:42:21 +0800106
107 if (mbtk_audio_pcm_play_start()) {
108 printf("%s: error opening output device.", __FUNCTION__);
109 return -1;
110 }
111
112
b.liuc181beb2024-03-07 18:34:21 +0800113 while (play_state != AUDIO_PLAY_STATE_STOP) {
114 if(play_state == AUDIO_PLAY_STATE_RUNNING) {
115 memset(buf, 0x00, sizeof(buf));
116 len = read(fd, buf, WAV_PLAY_BUFF);
117 if (len == -1) {
118 LOGE("%s: error reading from file", __FUNCTION__);
119 result = -1;
120 goto thread_end;
121 }
122
123 if (len == 0) {
124 /* reached EOF */
125 LOGE("%s: Read wav file end.", __FUNCTION__);
126 break;
127 }
128
129 if((rc = mbtk_audio_pcm_play_data_send(buf, len)) < len) {
130 LOGE("Send data %d/%d", rc, len);
131 result = -1;
132 goto thread_end;
133 }
134
135 LOGD("%s: No.%d frame playback", __FUNCTION__, ++frames);
136 } else {
137 usleep(200000);
138 }
139 }
140 } else {
141 result = -1;
142 }
143
144 play_state = AUDIO_PLAY_STATE_STOP;
luojian21604d92024-06-25 14:11:25 +0800145 if(play_cb_func)
146 play_cb_func(play_handle , AUDIO_PLAY_STATE_STOP);
b.liuc181beb2024-03-07 18:34:21 +0800147
148thread_end:
149 mbtk_audio_pcm_play_stop();
150 play_exit = 1;
151 LOGD("%s: finished pcm playback.", __FUNCTION__);
152 return result;
153}
liubin281ac462023-07-19 14:22:54 +0800154
155/*****************************************************************
156* Function: Ql_AudPlayer_Open
157*
158* Description:
159* Open audio play device, and specify the callback function.
160* This function can be called twice to play different audio sources.
161*
162* Parameters:
163* device : a string that specifies the PCM device.
164* NULL, means the audio will be played on the default PCM device.
165*
166* If you want to mixedly play audio sources, you can call this
167* API twice with specifying different PCM device.
168* The string devices available:
169* "hw:0,0" (the default play device)
170* "hw:0,13" (this device can mix audio and TTS)
171* "hw:0,14"
172*
173* cb_func : callback function for audio player.
174* The results of all operations on audio player
175* are informed in callback function.
176*
177* Return:
178* pcm device handle on success
179* -1 for failure
180*****************************************************************/
181int Ql_AudPlayer_Open(char* device, _cb_onPlayer cb_func)
182{
luojianfee10dc2024-07-25 11:34:35 +0800183#ifdef MBTK_AF_SUPPORT
184 player_hdl = mbtk_audio_open_new(MBTK_AUTIO_TYPE_OUT, 1, Samprate, cb_func);
luojiande236232024-07-27 10:51:57 +0800185 if(player_hdl == NULL)
186 {
187 return -1;
188 }
189 else
190 {
191 return player_hdl_1 = AUDIO_HANDLE;
192 }
luojianfee10dc2024-07-25 11:34:35 +0800193#else
b.liuc181beb2024-03-07 18:34:21 +0800194 if(is_running || mbtk_audio_pcm_init()) {
195 return -1;
196 } else {
197 play_cb_func = cb_func;
198 is_running = 1;
199 return play_handle;
200 }
luojianfee10dc2024-07-25 11:34:35 +0800201#endif
liubin281ac462023-07-19 14:22:54 +0800202}
203
204/*========================================================================
205 FUNCTION: Ql_AudPlayer_Play
206=========================================================================*/
207/** @brief
208 This function writes pcm data to pcm device to play.
209
210 @param[in] hdl, the handle returned by Ql_AudPlayer_Open().
211 @param[in] pData, pointer to the start address of pcm data.
212 @param[in] length, the length of pcm data.
213
214 @return
215 on success, the return value is the number of bytes to play
216 on failure, the return value is -1;
217
218 @dependencies
219 Ql_AudPlayer_Open() must be first called successfully.
220*/
221/*=======================================================================*/
222int Ql_AudPlayer_Play(int hdl, unsigned char* pData, unsigned int length)
223{
luojianfee10dc2024-07-25 11:34:35 +0800224#ifdef MBTK_AF_SUPPORT
luojiande236232024-07-27 10:51:57 +0800225 if(hdl != player_hdl_1 || player_hdl == NULL){
226 LOGE("Handle error : %d", hdl);
227 return -1;
228 }
229 return mbtk_audio_play_stream_new((void *)player_hdl, pData, length,50);
luojianfee10dc2024-07-25 11:34:35 +0800230
231#else
b.liuc181beb2024-03-07 18:34:21 +0800232 if(!is_running || hdl != play_handle) {
233 LOGE("Handle error : %d", hdl);
234 return -1;
235 }
236
237 return play_stream(pData, length);
luojianfee10dc2024-07-25 11:34:35 +0800238#endif
liubin281ac462023-07-19 14:22:54 +0800239}
240
241/*========================================================================
242 FUNCTION: Ql_AudPlayer_PlayFrmFile
243=========================================================================*/
244/** @brief
245 This function plays the pcm data from the specified file.
246
247 @param[in] hdl, the handle returned by Ql_AudPlayer_Open().
248 @param[in] fd, a file descriptor that contains pcm data.
249 Note:
250 the file offset should be set to the start position of pcm
251 data region, which means you should move the file offset
252 skipping the file header (such as wave header, amr header).
253 @param[in] offset, file offset. Please set it to -1 if no need to use.
254
255 @return
256 0 on success
257 -1 on failure
258
259 @dependencies
260 Ql_AudPlayer_Open() must be first called successfully.
261*/
262/*=======================================================================*/
zhangzh8711cea2023-10-20 10:47:43 +0800263
liubin281ac462023-07-19 14:22:54 +0800264int Ql_AudPlayer_PlayFrmFile(int hdl, int fd, int offset)
265{
luojianfee10dc2024-07-25 11:34:35 +0800266#ifdef MBTK_AF_SUPPORT
luojiande236232024-07-27 10:51:57 +0800267 if(hdl != player_hdl_1 || player_hdl == NULL){
268 LOGE("Handle error : %d", hdl);
269 return -1;
270 }
271
272 return mbtk_audio_play_file_new((void *)player_hdl, fd, offset);
luojianfee10dc2024-07-25 11:34:35 +0800273
274#else
b.liuc181beb2024-03-07 18:34:21 +0800275 if(!is_running || hdl != play_handle) {
276 LOGE("Handle error : %d", hdl);
277 return -1;
278 }
279
280 return play_by_fd(fd, offset);
luojianfee10dc2024-07-25 11:34:35 +0800281#endif
liubin281ac462023-07-19 14:22:54 +0800282}
283
284//
285// Function: Ql_AudPlayer_Pause
286//
287// Description:
288// Pause playing.
289// @param hdl:
290// Handle received from Ql_AudPlayer_Open().
291int Ql_AudPlayer_Pause(int hdl)
292{
b.liuc181beb2024-03-07 18:34:21 +0800293 if(!is_running || hdl != play_handle) {
294 LOGE("Handle error : %d", hdl);
295 return -1;
296 }
297
298 play_state = AUDIO_PLAY_STATE_PAUSE;
299
300 while(!play_exit) {
301 usleep(10000);
302 }
303
b.liu5fa9e772023-11-23 18:00:55 +0800304 return 0;
liubin281ac462023-07-19 14:22:54 +0800305}
306
307//
308// Function: Ql_AudPlayer_Resume
309//
310// Description:
311// Resume playing.
312// @param hdl:
313// Handle received from Ql_AudPlayer_Open().
314int Ql_AudPlayer_Resume(int hdl)
315{
b.liuc181beb2024-03-07 18:34:21 +0800316 if(!is_running || hdl != play_handle) {
317 LOGE("Handle error : %d", hdl);
318 return -1;
319 }
320
321 play_state = AUDIO_PLAY_STATE_RUNNING;
322
323 while(!play_exit) {
324 usleep(10000);
325 }
b.liu5fa9e772023-11-23 18:00:55 +0800326 return 0;
liubin281ac462023-07-19 14:22:54 +0800327}
328
329//
330// Function: Ql_AudPlayer_Stop
331//
332// Description:
333// Stop playing audio
334// hdl:
335// Handle received from Ql_AudPlayer_Open().
336void Ql_AudPlayer_Stop(int hdl)
337{
b.liuc181beb2024-03-07 18:34:21 +0800338 if(!is_running || hdl != play_handle) {
339 LOGE("Handle error : %d", hdl);
340 return;
341 }
b.liu5fa9e772023-11-23 18:00:55 +0800342
b.liuc181beb2024-03-07 18:34:21 +0800343 play_state = AUDIO_PLAY_STATE_STOP;
344
345 while(!play_exit) {
346 usleep(10000);
347 }
liubin281ac462023-07-19 14:22:54 +0800348}
349
350//
351// Function: Ql_AudPlayer_Close
352//
353// Description:
354// Close player, and free the resource.
355// @param hdl:
356// Handle received from Ql_AudPlayer_Open().
357void Ql_AudPlayer_Close(int hdl)
358{
luojiana567faa2024-07-25 11:45:02 +0800359#ifdef MBTK_AF_SUPPORT
luojiande236232024-07-27 10:51:57 +0800360 if(hdl != player_hdl_1 || player_hdl == NULL){
361 LOGE("Handle error : %d", hdl);
362 return -1;
363 }
luojianfee10dc2024-07-25 11:34:35 +0800364
luojiande236232024-07-27 10:51:57 +0800365 mbtk_audio_close_new((void *)player_hdl);
366 player_hdl_1 = 0;
luojianfee10dc2024-07-25 11:34:35 +0800367
luojiana567faa2024-07-25 11:45:02 +0800368#else
b.liuc181beb2024-03-07 18:34:21 +0800369 if(!is_running || hdl != play_handle) {
370 LOGE("Handle error : %d", hdl);
371 return;
372 }
373 play_state = AUDIO_PLAY_STATE_STOP;
b.liu5fa9e772023-11-23 18:00:55 +0800374
b.liuc181beb2024-03-07 18:34:21 +0800375 while(!play_exit) {
376 usleep(10000);
377 }
378
379 is_running = 0;
380 mbtk_audio_pcm_deinit();
luojianfee10dc2024-07-25 11:34:35 +0800381#endif
liubin281ac462023-07-19 14:22:54 +0800382}
383
384
385int Ql_AudPlayer_set_LessDataThreshold(int hdl, unsigned short threshSize)
386{
387
388 return 0;
389}
390
391int Ql_AudPlayer_get_freeSpace(int hdl)
392{
393
394 return 0;
395}
396
397
398/*****************************************************************
399* Function: Ql_AudRecorder_Open
400*
401* Description:
402* Open audio record device, and specify the callback function.
403*
404* Parameters:
405* device : not used. MUST be NULL.
406*
407* cb_func : callback function for audio player.
408* The results of all operations on audio recorder
409* are informed in callback function.
410*
411* Return:
412* pcm device handle
413* -1 for failure
414*****************************************************************/
415int Ql_AudRecorder_Open(char* device, _cb_onRecorder cb_fun)
416{
b.liuc181beb2024-03-07 18:34:21 +0800417 if(is_running || mbtk_audio_pcm_init()) {
418 return -1;
419 } else {
420 is_running = 1;
421 recorder_cb_fun = cb_fun;
422 return play_handle;
423 }
liubin281ac462023-07-19 14:22:54 +0800424}
425
426//
427// Function: Ql_AudRecorder_StartRecord
428//
429// Description:
430// Start to record.
431// The record data is output in _cb_onRecorder.
432//
433// Return:
434// 0 on success
435// -1 on failure
436int Ql_AudRecorder_StartRecord(void)
437{
b.liuc181beb2024-03-07 18:34:21 +0800438 if(!is_running) {
439 LOGE("No open device.");
440 return -1;
441 }
b.liu5fa9e772023-11-23 18:00:55 +0800442
b.liuc181beb2024-03-07 18:34:21 +0800443 return mbtk_audio_pcm_recorder_start(recorder_cb_func);
liubin281ac462023-07-19 14:22:54 +0800444}
445
446//
447// Function: Ql_AudRecorder_Pause
448//
449// Description:
450// Pause recording
451int Ql_AudRecorder_Pause(void)
452{
b.liuc181beb2024-03-07 18:34:21 +0800453 if(!is_running) {
454 LOGE("No open device.");
455 return -1;
456 }
457
458 return mbtk_audio_pcm_recorder_pause();
liubin281ac462023-07-19 14:22:54 +0800459}
460
461//
462// Function: Ql_AudRecorder_Resume
463//
464// Description:
465// Resume recording
466int Ql_AudRecorder_Resume(void)
467{
b.liuc181beb2024-03-07 18:34:21 +0800468 if(!is_running) {
469 LOGE("No open device.");
470 return -1;
471 }
472
473 return mbtk_audio_pcm_recorder_resume();
liubin281ac462023-07-19 14:22:54 +0800474}
475
476//
477// Function: Ql_AudRecorder_Stop
478//
479// Description:
480// Stop recording
481void Ql_AudRecorder_Stop(void)
482{
b.liuc181beb2024-03-07 18:34:21 +0800483 if(!is_running) {
484 LOGE("No open device.");
485 return;
486 }
liubin281ac462023-07-19 14:22:54 +0800487
b.liuc181beb2024-03-07 18:34:21 +0800488 mbtk_audio_pcm_recorder_stop();
liubin281ac462023-07-19 14:22:54 +0800489}
490
491//
492// Function: Ql_AudRecorder_Close
493//
494// Description:
495// Close recorder, and free the resource
496void Ql_AudRecorder_Close(void)
497{
b.liuc181beb2024-03-07 18:34:21 +0800498 if(!is_running) {
499 LOGE("No open device.");
500 return;
501 }
b.liu5fa9e772023-11-23 18:00:55 +0800502
b.liuc181beb2024-03-07 18:34:21 +0800503 is_running = 0;
504 mbtk_audio_pcm_deinit();
liubin281ac462023-07-19 14:22:54 +0800505}
506
507//
508// Function: Ql_clt_set_mixer_value
509//
510// Description:
511// Close recorder, and free the resource
512boolean Ql_clt_set_mixer_value(const char *device, int count, const char *value)
513{
514
515 return FALSE;
516}
517
518
519int Ql_AudTone_Open(char* device, _cb_onPlayer cb)//cb not support now
520{
521 return 0;
522}
523
524int Ql_AudTone_Start(int hdl, struct Ql_TonePara *para)
525{
526 return 0;
527}
528
529void Ql_AudTone_Stop(int hdl)
530{
531
532}
533
534void Ql_AudTone_Close(int hdl)
535{
536
537}
538
539
540//****************QL Codec API************************//
541
542//
543// Function: Ql_AudCodec_Set_ALC5616_DRCAGC
544//
545// Description:
546// Set ALC5616 DRC/AGC configuration
547int Ql_AudCodec_Set_ALC5616_DRCAGC(const char *i2c, struct Ql_ALC5616_DRCAGC *cfg)
548{
549 return 0;
550}
551
552//
553// Function: Ql_Update_wav_size
554//
555// Description:
556// update wav format file size in the header
557// @param fd:
558// wav file discriptor
559// @param size:
560// wav file size to update
561int Ql_Update_wav_size(int fd, int size)
562{
563 return 0;
564}
565
566//add by grady, 2018-5-29
567/*
568 * describe : this function is use to open pcm device
569 * paras :
570 * device : this should be fix to hw:0,0
571 * flags ; pcm play flags
572 * rate: sample rate
573 * channels : audio channal 1 or 2
574 * format: format to play or record, 16bit line,MP3
575 * hostless: if there is no file it is true
576 * return :
577 * pcm : pcm handle, use can use this handle to read write data
578 */
579struct pcm *quec_pcm_open(char *device, unsigned flags, unsigned rate, unsigned channels, unsigned format, unsigned hostless)
580{
581 return NULL;
582}
583
584/*
585 * describe : this function is use to close pcm handle
586 * paras :
587 * pcm : pcm handle to close
588 * return :
589 */
590int quec_pcm_close(struct pcm *pcm )
591{
592 return 0;
593}
594
595/*
596 * describe : this function is use to read pcm buffer
597 * paras :
598 * pcm : pcm handle to write date
599 * buffer: data buffer
600 * lenth: data length
601 * return :
602 */
603int quec_read_pcm(struct pcm *pcm, void * buffer, int length)
604{
605
606 return 0;
607}
608
609/*
610 * describe : this function is use to get pcm buffer lenth
611 * paras :
612 * lenth: data length
613 * return
614 * buffer length
615 */
616int quec_get_pem_buffer_len(struct pcm *pcm)
617{
618
619 return 0;
620}
621
622void dtmf_cb1(char dtmf)
623{
624 printf("%s:%c\n", __FUNCTION__, dtmf);
625}
626
627/**
628 * @brief Set RX DSP Gain
629 * @details
630 * Gain support [-36,12] dB
631 *
632 * @param gain
633 * DSP gain
634 */
635
636int Ql_Rxgain_Set(int value)
637{
luojianfee10dc2024-07-25 11:34:35 +0800638#ifdef MBTK_AF_SUPPORT
639 int volume =0;
luojiande236232024-07-27 10:51:57 +0800640 if(value < -36 || value > 13)
luojianfee10dc2024-07-25 11:34:35 +0800641 {
642 volume = 0;
643 }
644 else
645 {
646 volume = value;
647 }
648
649 if(player_hdl==NULL)
650 return 0;
651
652 char databuf[1025]={0};
653 memcpy(databuf, " ", 1024);
654
655 mbtk_audio_play_stream_new(player_hdl, databuf, 1024, volume);
656 return 0;
657#else
luojiana6a47a92024-05-23 13:42:21 +0800658 mbtk_dsp_gain_set(1, value);
b.liu5fa9e772023-11-23 18:00:55 +0800659 return 0;
luojianfee10dc2024-07-25 11:34:35 +0800660#endif
661 return 0;
liubin281ac462023-07-19 14:22:54 +0800662}
663
664
665/** Ql_Playback_Samprate_Set
666 * @brief Set Playback PCM Samprate
667 * @details
668 * 0 for NB 1 for WB
669 *
670 * @param samprate
671 * samprate for PCM playback,default value is PCM NB
672 */
673int Ql_Playback_Samprate_Set(int samprate)
674{
675 printf("samprate is %d \n",samprate);
676 if(samprate == 1)
677 {
b.liuc181beb2024-03-07 18:34:21 +0800678 sample_rate = 16000;
luojiana6a47a92024-05-23 13:42:21 +0800679 mbtk_audio_pcm_sample_rate_set(MBTK_AUDIO_SAMPLE_RATE_16000);
liubin281ac462023-07-19 14:22:54 +0800680 }
681 else{
luojiana6a47a92024-05-23 13:42:21 +0800682 mbtk_audio_pcm_sample_rate_set(MBTK_AUDIO_SAMPLE_RATE_8000);
b.liuc181beb2024-03-07 18:34:21 +0800683 sample_rate = 8000;
liubin281ac462023-07-19 14:22:54 +0800684 }
685
686 return 0;
687}
688
689int Ql_Mp3_To_Wav(const char *wavpath, char *mp3path)
690{
b.liuc1064f82023-10-11 16:47:39 +0800691 return 0;
liubin281ac462023-07-19 14:22:54 +0800692}
693
694int Ql_Mp3_To_Play(char *mp3path, int hdl,int sample_rate)
695{
b.liuc1064f82023-10-11 16:47:39 +0800696 return 0;
liubin281ac462023-07-19 14:22:54 +0800697}
698
699//add by grady, 2018-6-2
700/*
701 * describe : this function is use to open mixer device
702 * paras :
703 * device: mixer device
704 * return
705 * mixer handle
706 */
707struct mixer *quec_mixer_open(const char *device)
708{
709
710 return NULL;
711}
712
713/*
714 * describe : this function is use to close mixer device
715 * paras :
716 * mixer: mixer handle
717 * return
718 * none
719 */
720void quec_mixer_close(struct mixer *mixer)
721{
722
723
724}
725
726/*
727 * describe : this function is use to get mixer devie control
728 * paras :
729 * mixer: mixer handle
730 * name: mixer device
731 * index: mixer index
732 * return
733 * mixer control
734 */
735struct mixer_ctl *quec_mixer_get_control(struct mixer *mixer, const char *name, unsigned index)
736{
737
738 return NULL;
739}
740
741/*
742 * describe : this function is use to set mulvalues
743 * paras :
744 * mixer: mixer handle
745 * count: count
746 * argv: data
747 * return :
748 *
749 */
750int quec_mixer_ctl_mulvalues(struct mixer_ctl *ctl, int count, char ** argv)
751{
752
753 return 0;
754}
755
756
757//end grady
758
759/*****************************************************************
760* Function: Ql_AudPlayer_OpenExt
761*
762* Description:
763* expend function from Ql_AudPlayer_OpenExt
764* Open audio play device, and specify the callback function.
765* This function can be called twice to play different audio sources.
766*
767* Parameters:
768* device : a string that specifies the PCM device.
769* NULL, means the audio will be played on the default PCM device.
770*
771* If you want to mixedly play audio sources, you can call this
772* API twice with specifying different PCM device.
773* The string devices available:
774* "hw:0,0" (the default play device)
775* "hw:0,13" (this device can mix audio and TTS)
776* "hw:0,14"
777*
778* cb_func : callback function for audio player.
779* The results of all operations on audio player
780* are informed in callback function.
781*
782* flags : pcm flags, eg: PCM_MMAP, PCM_NMMAP.
783*
784* channels: pcm sample channels.
785*
786* rate : pcm sample rate.
787*
788* format : pcm sample fromat
789*
790* Return:
791* pcm device handle
792* NULL, fail
793*****************************************************************/
794int Ql_AudPlayer_OpenExt(
795 char *dev,
796 _cb_onPlayer cb_fun,
797 int flags,
798 int channels,
799 int rate,
800 int format)
801{
802 return 0;
803}
804
805/*****************************************************************
806* Function: Ql_AudRecorder_Open
807*
808* Description:
809* Open audio record device, and specify the callback function.
810*
811* Parameters:
812* device : not used. MUST be NULL.
813*
814* cb_func : callback function for audio player.
815* The results of all operations on audio recorder
816* are informed in callback function.
817*
818* flags : pcm flags, eg: PCM_MMAP, PCM_NMMAP.
819*
820* channels: pcm sample channels.
821*
822* rate : pcm sample rate.
823*
824* format : pcm sample fromat
825*
826* Return:
827* pcm device handle
828* NULL, fail
829*****************************************************************/
830int Ql_AudRecorder_OpenExt(
831 char *dev,
832 _cb_onRecorder cb_fun,
833 int flags,
834 int channels,
835 int rate,
836 int format)
837{
838
839
840 return 0;
841}
842
843/*
844* Function: uac enable
845*
846* Description:
847* uac enable
848*
849* Parameters:
850* none
851* Return:
852* TURE or FALSE
853*/
854int ql_uac_enable(void)
855{
856
857 return 0;
858}
859
860/*
861* Function: uac disable
862*
863* Description:
864* uac disable
865*
866* Parameters:
867* none
868* Return:
869* TURE or FALSE
870*/
871int ql_uac_disable(void)
872{
873
874 return 0;
luojiana6a47a92024-05-23 13:42:21 +0800875}