mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 05:28:36 -07:00
Fix some sound issues
This commit is contained in:
@@ -40,12 +40,15 @@ void tracker_speaker_stop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tracker_speaker_init() {
|
void tracker_speaker_init() {
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(200.0f, 0.01f);
|
furi_hal_speaker_start(200.0f, 0.01f);
|
||||||
|
}
|
||||||
tracker_speaker_stop();
|
tracker_speaker_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void tracker_speaker_deinit() {
|
void tracker_speaker_deinit() {
|
||||||
furi_hal_speaker_stop();
|
furi_hal_speaker_stop();
|
||||||
|
furi_hal_speaker_release();
|
||||||
}
|
}
|
||||||
|
|
||||||
static FuriHalInterruptISR tracker_isr;
|
static FuriHalInterruptISR tracker_isr;
|
||||||
|
|||||||
@@ -85,19 +85,29 @@ int32_t ocarina_app(void* p) {
|
|||||||
if(event.type == InputTypePress) {
|
if(event.type == InputTypePress) {
|
||||||
switch(event.key) {
|
switch(event.key) {
|
||||||
case InputKeyUp:
|
case InputKeyUp:
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(NOTE_UP, volume);
|
furi_hal_speaker_start(NOTE_UP, volume);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case InputKeyDown:
|
case InputKeyDown:
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(NOTE_DOWN, volume);
|
furi_hal_speaker_start(NOTE_DOWN, volume);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case InputKeyLeft:
|
case InputKeyLeft:
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(NOTE_LEFT, volume);
|
furi_hal_speaker_start(NOTE_LEFT, volume);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case InputKeyRight:
|
case InputKeyRight:
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(NOTE_RIGHT, volume);
|
furi_hal_speaker_start(NOTE_RIGHT, volume);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case InputKeyOk:
|
case InputKeyOk:
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(NOTE_OK, volume);
|
furi_hal_speaker_start(NOTE_OK, volume);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case InputKeyBack:
|
case InputKeyBack:
|
||||||
processing = false;
|
processing = false;
|
||||||
@@ -107,6 +117,7 @@ int32_t ocarina_app(void* p) {
|
|||||||
}
|
}
|
||||||
} else if(event.type == InputTypeRelease) {
|
} else if(event.type == InputTypeRelease) {
|
||||||
furi_hal_speaker_stop();
|
furi_hal_speaker_stop();
|
||||||
|
furi_hal_speaker_release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,11 +102,16 @@ static void tama_p1_hal_set_lcd_icon(u8_t icon, bool_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void tama_p1_hal_play_frequency(bool_t en) {
|
static void tama_p1_hal_play_frequency(bool_t en) {
|
||||||
if(en)
|
if(en) {
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(g_ctx->frequency, 0.5f);
|
furi_hal_speaker_start(g_ctx->frequency, 0.5f);
|
||||||
else
|
}
|
||||||
|
} else {
|
||||||
|
if(furi_hal_speaker_is_mine()) {
|
||||||
furi_hal_speaker_stop();
|
furi_hal_speaker_stop();
|
||||||
|
furi_hal_speaker_release();
|
||||||
|
}
|
||||||
|
}
|
||||||
g_ctx->buzzer_on = en;
|
g_ctx->buzzer_on = en;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,11 +114,14 @@ static void decrease_volume(TuningForkState* tuning_fork_state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void play(TuningForkState* tuning_fork_state) {
|
static void play(TuningForkState* tuning_fork_state) {
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(current_tuning_note_freq(tuning_fork_state), tuning_fork_state->volume);
|
furi_hal_speaker_start(current_tuning_note_freq(tuning_fork_state), tuning_fork_state->volume);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void stop() {
|
static void stop() {
|
||||||
furi_hal_speaker_stop();
|
furi_hal_speaker_stop();
|
||||||
|
furi_hal_speaker_release();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void replay(TuningForkState* tuning_fork_state) {
|
static void replay(TuningForkState* tuning_fork_state) {
|
||||||
|
|||||||
@@ -57,12 +57,15 @@ int32_t usb_midi_app(void* p) {
|
|||||||
if(event->type == NoteOn) {
|
if(event->type == NoteOn) {
|
||||||
NoteOnEvent note_on = AsNoteOn(event);
|
NoteOnEvent note_on = AsNoteOn(event);
|
||||||
current_note = note_on.note;
|
current_note = note_on.note;
|
||||||
|
if(furi_hal_speaker_acquire(30)) {
|
||||||
furi_hal_speaker_start(
|
furi_hal_speaker_start(
|
||||||
note_to_frequency(note_on.note), note_on.velocity / 127.0f);
|
note_to_frequency(note_on.note), note_on.velocity / 127.0f);
|
||||||
|
}
|
||||||
} else if(event->type == NoteOff) {
|
} else if(event->type == NoteOff) {
|
||||||
NoteOffEvent note_off = AsNoteOff(event);
|
NoteOffEvent note_off = AsNoteOff(event);
|
||||||
if(note_off.note == current_note) {
|
if(note_off.note == current_note) {
|
||||||
furi_hal_speaker_stop();
|
furi_hal_speaker_stop();
|
||||||
|
furi_hal_speaker_release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user