xremote_speaker.c 575 B

12345678910111213141516171819202122232425
  1. #include "xremote_speaker.h"
  2. #define NOTE_INPUT 587.33f
  3. void xremote_play_input_sound(void* context) {
  4. XRemote* app = context;
  5. if(app->speaker != 1) {
  6. return;
  7. }
  8. float volume = 1.0f;
  9. if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) {
  10. furi_hal_speaker_start(NOTE_INPUT, volume);
  11. }
  12. }
  13. void xremote_stop_all_sound(void* context) {
  14. XRemote* app = context;
  15. if(app->speaker != 1) {
  16. return;
  17. }
  18. if(furi_hal_speaker_is_mine()) {
  19. furi_hal_speaker_stop();
  20. furi_hal_speaker_release();
  21. }
  22. }