dtmf_dolphin_player.h 871 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "dtmf_dolphin_event.h"
  3. #include "dtmf_dolphin_hal.h"
  4. #include "dtmf_dolphin_tone.h"
  5. #define PERIOD_2_PI 6.2832
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. typedef struct {
  10. size_t half_samples;
  11. size_t sample_count;
  12. float wf1_freq;
  13. float wf2_freq;
  14. uint16_t wf1_period;
  15. uint16_t wf2_period;
  16. uint16_t wf1_pos;
  17. uint16_t wf2_pos;
  18. uint8_t *buffer_buffer;
  19. uint16_t *sample_buffer;
  20. float volume;
  21. bool playing;
  22. FuriMessageQueue* queue;
  23. } DTMFDolphinPlayer;
  24. void dtmf_dolphin_dma_isr(void* ctx);
  25. bool dtmf_dolphin_player_init(void* context);
  26. void dtmf_dolphin_player_clear_samples();
  27. bool dtmf_dolphin_player_generate_waveform(size_t index);
  28. bool dtmf_dolphin_player_play_tones(float *freq);
  29. bool dtmf_dolphin_player_stop_tones();
  30. bool dtmf_dolphin_player_handle_tick();
  31. #ifdef __cplusplus
  32. }
  33. #endif