123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef __PLY_REC_H_
- #define __PLY_REC_H_
- #include "main.h"
- #include "datatype.h"
- #define PCM_FRAME_BYTE_SIZE 320 //8K 采样时20ms得到的一帧pcm语音数据字节大小
- //#define RECORD_TO_FLASH //录制数据保存在FLASH中
- #define RECORD_TO_RAM //录制数据保存在RAM中
- #if defined RECORD_TO_FLASH && defined RECORD_TO_RAM
- #error "can not define both at the same time"
- #elif defined RECORD_TO_FLASH
- #elif defined RECORD_TO_RAM
- #else
- #error "need to define type"
- #endif
- //#ifndef (RECORD_TO_FLASH & RECORD_TO_RAM)
- //#error "need to define RECORD_TO_RAM or RECORD_TO_FLASH"
- //#endif
- typedef struct{
- T_UINT8 type;
- T_UINT32 framelen;
- T_UINT32 framenum;
- }FINI_DEF;
- #define RECORD_TIME_LIMIT 30 //the max time to record limited
- #define FRAMES_BY_TIME_TO_RECORD (RECORD_TIME_LIMIT*1000/20) //the numbers of frames we need to record by spicified time:RECORD_TIME_LIMIT
- #define THE_MAX_BYTE_PER_FRAME_AFTER_ENCODE 32 //the max size of one frame that after encode
- #define MAX_FRAMS_PCM_DATA FRAMES_BY_TIME_TO_RECORD*THE_MAX_BYTE_PER_FRAME_AFTER_ENCODE
- #define MAX_FRAMS_FILE_DATA (sizeof(FINI_DEF)+MAX_FRAMS_PCM_DATA) //the max size of encode file that we encode
- const unsigned char amr_file_header[6];
- #define AMR_FILE_HEADER_LEN sizeof(amr_file_header)
- #define AMR_FILE_SIZE_MAX (AMR_FILE_HEADER_LEN+MAX_FRAMS_PCM_DATA)
- #if defined RECORD_TO_RAM
- typedef struct{
- FINI_DEF head;
- unsigned char pcm[AMR_FILE_HEADER_LEN+MAX_FRAMS_PCM_DATA];
- }SAVE_RAM_DEF;
- extern SAVE_RAM_DEF ramsave;
- #endif
- PT_THREAD (ptPlayerTask(pt_timer_t *ptPool, struct pt *pt));
- PT_THREAD (ptRecorderTask(pt_timer_t *ptPool, struct pt *pt));
- void RecCloseNowApi(void);
- void PlyCloseNowApi(void);
- void RecOpenNowApi(void);
- void PlyOpenNowApi(void);
- T_BOOL isPlayerIsOff(void);
- T_BOOL isRecordIsOff(void);
- void setAudioChannelAndVol(void);
- void setPlayBuf(unsigned char flag);
- PT_THREAD (ptQueueRecordReadTask(pt_timer_t *ptPool, struct pt *pt));
- void ClearRecBuffer(void);
- void playToneNow(T_UINT16 lf,T_UINT16 hf,T_UINT8 time);
- #endif
|