wsbc.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "include.h"
  2. #include "wsbc.h"
  3. #define WSBC_BUF_SIZE 2500
  4. #define WSBC_PKT_LEN 40
  5. #define WSBC_MAX_FRAME_SIZE 20*16
  6. #if WARNING_WSBC_EN
  7. AT(.wsbc_buf.dec.cb)
  8. static u8 wsbc_mem[WSBC_BUF_SIZE];
  9. bool wsbc_play_init(u8 *header, u16 *sample_rate, u8 *frame_size)
  10. {
  11. u8 *buf = header;
  12. int err;
  13. if(buf[0] != 0x7a) {
  14. return false;
  15. }
  16. *sample_rate = GET_LE16(&buf[2]);
  17. *frame_size = buf[1];
  18. void *handle = wsbc_dec_init(header, *sample_rate, 1, &err, (void *)wsbc_mem, WSBC_BUF_SIZE);
  19. printf("wsbc_init: %d, %x, spr=%d\n", err, handle, *sample_rate);
  20. if(err != 0 || handle == NULL) {
  21. return false;
  22. }
  23. return true;
  24. }
  25. //测试全部wsbc提示音
  26. void wsbc_play_test(void)
  27. {
  28. // bt_audio_bypass();
  29. // warning_play((u8 *)RES_BUF_EN_POWERON_SBC, RES_LEN_EN_POWERON_SBC);
  30. // warning_play((u8 *)RES_BUF_EN_POWEROFF_SBC, RES_LEN_EN_POWEROFF_SBC);
  31. // warning_play((u8 *)RES_BUF_EN_CONNECTED_SBC, RES_LEN_EN_CONNECTED_SBC);
  32. // warning_play((u8 *)RES_BUF_EN_DISCONNECT_SBC, RES_LEN_EN_DISCONNECT_SBC);
  33. // bt_audio_enable();
  34. }
  35. #endif