|
|
@@ -214,16 +214,20 @@ bool dtmf_dolphin_audio_play_tones(
|
|
|
generate_waveform(current_player, 0);
|
|
|
generate_waveform(current_player, current_player->half_buffer_length);
|
|
|
|
|
|
- dtmf_dolphin_speaker_init();
|
|
|
dtmf_dolphin_dma_init((uint32_t)current_player->sample_buffer, current_player->buffer_length);
|
|
|
|
|
|
furi_hal_interrupt_set_isr(
|
|
|
FuriHalInterruptIdDma1Ch1, dtmf_dolphin_audio_dma_isr, current_player->queue);
|
|
|
-
|
|
|
- dtmf_dolphin_dma_start();
|
|
|
- dtmf_dolphin_speaker_start();
|
|
|
- current_player->playing = true;
|
|
|
- return true;
|
|
|
+ if(furi_hal_speaker_acquire(1000)) {
|
|
|
+ dtmf_dolphin_speaker_init();
|
|
|
+ dtmf_dolphin_dma_start();
|
|
|
+ dtmf_dolphin_speaker_start();
|
|
|
+ current_player->playing = true;
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ current_player->playing = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
bool dtmf_dolphin_audio_stop_tones() {
|
|
|
@@ -238,6 +242,7 @@ bool dtmf_dolphin_audio_stop_tones() {
|
|
|
}
|
|
|
dtmf_dolphin_speaker_stop();
|
|
|
dtmf_dolphin_dma_stop();
|
|
|
+ furi_hal_speaker_release();
|
|
|
|
|
|
furi_hal_interrupt_set_isr(FuriHalInterruptIdDma1Ch1, NULL, NULL);
|
|
|
|