1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef _LEARN_AUDIO_H_
- #define _LEARN_AUDIO_H_
- #ifdef ENABLE_ENABLE_AMRNB
- #include "wamr.h"
- #endif
- #ifdef ENABLE_ENABLE_SPEEX
- #include "speex.h"
- #endif
- #define MAX_FRAMES_TOTAL (1*60*50) //1分钟最多存的帧数
- #ifdef ENABLE_ENABLE_AMRNB
- #define FRAME_PER_SIZE 32 //压缩后每帧大小
- #define FRAME_ENCODE_TYPE 0x3c
- #endif
- #ifdef ENABLE_ENABLE_SPEEX
- /*
- 编码等级 : 0 | 1 | 2 | 3/4| 5/6 | 7/8 | 9 | 10
- 编码后字节数: 6 | 10 | 15 | 20 | 28 | 38 | 46 | 62
- 压缩率% :1.875|3.125|4.6875|6.25|8.75 |11.875|14.375|19.375
- 比特率bps :2400 |4000 | 6000 |8000|11200|15200 |18400 |24800
- */
- #define FRAME_QULITY 5
- #define FRAME_PER_SIZE 28
- #endif
- typedef enum{
- LEARN_PLY_IDLE,
- LEARN_PLY_BUSY,
- LEARN_PLY_PRE_ERR,
- LEARN_PLY_FAILED,
- LEARN_PLY_DONE
- }LEARN_PLY_ENUM;
- typedef struct{
- unsigned char *pcm;
- unsigned int frameNum;
- unsigned short frameSize;
- unsigned int plyNum;
- #ifdef ENABLE_ENABLE_SPEEX
- void *speexCt;
- SpeexBits bits;
- #endif
- unsigned char playType;//播放类型:0 播放临时录音 1 播放本地录音
- bool stopPlay;//用于停止正在播放的操作
- int fd;//用于播放本地录音文件使用
- }LEARN_REC_DEF;
- bool learnStartRecord(unsigned char charaNum);
- void learnStopRecord(void);
- void learnRecordFree(void);
- void learnRecordBufRelease(void);
- void learnPlayAudio(unsigned char type, const char *fname);
- LEARN_PLY_ENUM learnPlyGetResult(void);
- unsigned char learnGetAudioType(void);
- void learnStopPlaying(void);
- void recordSaveTmpToLocal(char *fileName);
- unsigned char *learnGetTmpAudioBuf(void);
- unsigned int learnGetTmpAudioLength(void);
- unsigned short learnGetRecordMaxVolume(void);
- float learnGetRecordRecSpeed(void);
- //#define SAVE_PCM_SD
- #ifdef SAVE_PCM_SD
- void pcmFileOpen(void);
- void pcmFileClose(void);
- #endif
- #endif
|