Add sound effects (#108)

<!--- Provide a general summary of your changes in the Title above -->



## Description
<!--- Describe your changes in detail -->

Adding sound for make the navigation not so borring.

## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->

This
[issue](https://github.com/Polprzewodnikowy/N64FlashcartMenu/issues/89)

## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots
<!-- (if appropriate): -->



https://github.com/Polprzewodnikowy/N64FlashcartMenu/assets/111246491/0f8086f6-16b3-4adb-a925-afbfc9fa6ba9


## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.

<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>

---------

Co-authored-by: Robin Jones <networkfusion@users.noreply.github.com>
This commit is contained in:
Suprapote 2024-06-05 22:04:25 +02:00 committed by GitHub
parent 7fa60f4253
commit 3bc0ac5949
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 125 additions and 7 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
# Ignore generated files in the libdragon FS # Ignore generated files in the libdragon FS
/filesystem/FiraMonoBold.font64 /filesystem/FiraMonoBold.font64
/filesystem/*.wav64
# Ignore external development tools # Ignore external development tools
/tools/* /tools/*

View File

@ -77,17 +77,27 @@ SRCS = \
FONTS = \ FONTS = \
FiraMonoBold.ttf FiraMonoBold.ttf
SOUNDS = \
cursorsound.wav \
back.wav \
enter.wav \
error.wav \
settings.wav
OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS)))) OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS))))
MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS)) MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS))
SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS)) SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS))
DEPS = $(OBJS:.o=.d) DEPS = $(OBJS:.o=.d)
FILESYSTEM = \ FILESYSTEM = \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(FONTS:%.ttf=%.font64))) $(addprefix $(FILESYSTEM_DIR)/, $(notdir $(FONTS:%.ttf=%.font64))) \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(SOUNDS:%.wav=%.wav64)))
$(MINIZ_OBJS): N64_CFLAGS+=-DMINIZ_NO_TIME -fcompare-debug-second $(MINIZ_OBJS): N64_CFLAGS+=-DMINIZ_NO_TIME -fcompare-debug-second
$(SPNG_OBJS): N64_CFLAGS+=-isystem $(SOURCE_DIR)/libs/miniz -DSPNG_USE_MINIZ -fcompare-debug-second $(SPNG_OBJS): N64_CFLAGS+=-isystem $(SOURCE_DIR)/libs/miniz -DSPNG_USE_MINIZ -fcompare-debug-second
$(FILESYSTEM_DIR)/FiraMonoBold.font64: MKFONT_FLAGS+=-c 1 --size 16 -r 20-1FF -r 2026-2026 --ellipsis 2026,1 $(FILESYSTEM_DIR)/FiraMonoBold.font64: MKFONT_FLAGS+=-c 1 --size 16 -r 20-1FF -r 2026-2026 --ellipsis 2026,1
$(FILESYSTEM_DIR)/%.wav64: AUDIOCONV_FLAGS=--wav-compress 1
$(@info $(shell mkdir -p ./$(FILESYSTEM_DIR) &> /dev/null)) $(@info $(shell mkdir -p ./$(FILESYSTEM_DIR) &> /dev/null))
@ -95,6 +105,10 @@ $(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/%.ttf
@echo " [FONT] $@" @echo " [FONT] $@"
@$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<" @$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<"
$(FILESYSTEM_DIR)/%.wav64: $(ASSETS_DIR)/%.wav
@echo " [AUDIO] $@"
@$(N64_AUDIOCONV) $(AUDIOCONV_FLAGS) -o $(FILESYSTEM_DIR) "$<"
$(BUILD_DIR)/$(PROJECT_NAME).dfs: $(FILESYSTEM) $(BUILD_DIR)/$(PROJECT_NAME).dfs: $(FILESYSTEM)
$(BUILD_DIR)/menu/views/credits.o: .FORCE $(BUILD_DIR)/menu/views/credits.o: .FORCE

View File

@ -25,6 +25,7 @@ An open source menu for N64 flashcarts.
* Comprehensive ROM information display. * Comprehensive ROM information display.
* Real Time Clock support. * Real Time Clock support.
* Music playback (MP3). * Music playback (MP3).
* Menu sound effects.
### Video showcase (as of Oct 12 2023) ### Video showcase (as of Oct 12 2023)
@ -160,3 +161,9 @@ Once merged, they can be viewed [here](https://polprzewodnikowy.github.io/N64Fla
- [mini.c](https://github.com/univrsal/mini.c) (BSD 2-Clause License) - [mini.c](https://github.com/univrsal/mini.c) (BSD 2-Clause License)
- [minimp3](https://github.com/lieff/minimp3) (CC0 1.0 Universal) - [minimp3](https://github.com/lieff/minimp3) (CC0 1.0 Universal)
- [miniz](https://github.com/richgel999/miniz) (MIT License) - [miniz](https://github.com/richgel999/miniz) (MIT License)
## Sounds
See [License](https://pixabay.com/en/service/license-summary/) for the following sounds:
- [Cursor sound](https://pixabay.com/en/sound-effects/click-buttons-ui-menu-sounds-effects-button-7-203601/) by Skyscraper_seven (Free to use)
- [Actions (Enter, back) sound](https://pixabay.com/en/sound-effects/menu-button-user-interface-pack-190041/) by Liecio (Free to use)
- [Error sound](https://pixabay.com/en/sound-effects/error-call-to-attention-129258/) by Universfield (Free to use)

BIN
assets/back.wav Normal file

Binary file not shown.

BIN
assets/cursorsound.wav Normal file

Binary file not shown.

BIN
assets/enter.wav Normal file

Binary file not shown.

BIN
assets/error.wav Normal file

Binary file not shown.

BIN
assets/settings.wav Normal file

Binary file not shown.

View File

@ -1,5 +1,6 @@
#include "../components.h" #include "../components.h"
#include "../fonts.h" #include "../fonts.h"
#include "../sound.h"
#include "constants.h" #include "constants.h"
@ -41,6 +42,7 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm)
} else { } else {
cm->hide_pending = true; cm->hide_pending = true;
} }
sound_play_effect(SFX_EXIT);
} else if (menu->actions.enter) { } else if (menu->actions.enter) {
if (cm->list[cm->selected].submenu) { if (cm->list[cm->selected].submenu) {
cm->submenu = cm->list[cm->selected].submenu; cm->submenu = cm->list[cm->selected].submenu;
@ -51,16 +53,19 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm)
cm->list[cm->selected].action(menu, cm->list[cm->selected].arg); cm->list[cm->selected].action(menu, cm->list[cm->selected].arg);
top->hide_pending = true; top->hide_pending = true;
} }
sound_play_effect(SFX_ENTER);
} else if (menu->actions.go_up) { } else if (menu->actions.go_up) {
cm->selected -= 1; cm->selected -= 1;
if (cm->selected < 0) { if (cm->selected < 0) {
cm->selected = 0; cm->selected = 0;
} }
sound_play_effect(SFX_CURSOR);
} else if (menu->actions.go_down) { } else if (menu->actions.go_down) {
cm->selected += 1; cm->selected += 1;
if (cm->selected >= cm->count) { if (cm->selected >= cm->count) {
cm->selected = (cm->count - 1); cm->selected = (cm->count - 1);
} }
sound_play_effect(SFX_CURSOR);
} }
return true; return true;

View File

@ -115,6 +115,10 @@ static void menu_init (boot_params_t *boot_params) {
__boot_tvtype = TV_NTSC; __boot_tvtype = TV_NTSC;
} }
if (menu->settings.sound_enabled) {
sound_init_sfx();
}
display_init(RESOLUTION_640x480, DEPTH_16_BPP, 2, GAMMA_NONE, FILTERS_DISABLED); display_init(RESOLUTION_640x480, DEPTH_16_BPP, 2, GAMMA_NONE, FILTERS_DISABLED);
register_VI_handler(frame_counter_handler); register_VI_handler(frame_counter_handler);

View File

@ -13,10 +13,10 @@ static settings_t init = {
.show_protected_entries = false, .show_protected_entries = false,
.default_directory = "/", .default_directory = "/",
.use_saves_folder = true, .use_saves_folder = true,
.sound_enabled = true,
/* Beta feature flags (should always init to off) */ /* Beta feature flags (should always init to off) */
.bgm_enabled = false, .bgm_enabled = false,
.sound_enabled = false,
.rumble_enabled = false, .rumble_enabled = false,
}; };
@ -39,10 +39,10 @@ void settings_load (settings_t *settings) {
settings->show_protected_entries = mini_get_bool(ini, "menu", "show_protected_entries", init.show_protected_entries); settings->show_protected_entries = mini_get_bool(ini, "menu", "show_protected_entries", init.show_protected_entries);
settings->default_directory = strdup(mini_get_string(ini, "menu", "default_directory", init.default_directory)); settings->default_directory = strdup(mini_get_string(ini, "menu", "default_directory", init.default_directory));
settings->use_saves_folder = mini_get_bool(ini, "menu", "use_saves_folder", init.use_saves_folder); settings->use_saves_folder = mini_get_bool(ini, "menu", "use_saves_folder", init.use_saves_folder);
settings->sound_enabled = mini_get_bool(ini, "menu", "sound_enabled", init.sound_enabled);
/* Beta feature flags, they might not be in the file */ /* Beta feature flags, they might not be in the file */
settings->bgm_enabled = mini_get_bool(ini, "menu_beta_flag", "bgm_enabled", init.bgm_enabled); settings->bgm_enabled = mini_get_bool(ini, "menu_beta_flag", "bgm_enabled", init.bgm_enabled);
settings->sound_enabled = mini_get_bool(ini, "menu_beta_flag", "sound_enabled", init.sound_enabled);
settings->rumble_enabled = mini_get_bool(ini, "menu_beta_flag", "rumble_enabled", init.rumble_enabled); settings->rumble_enabled = mini_get_bool(ini, "menu_beta_flag", "rumble_enabled", init.rumble_enabled);
mini_free(ini); mini_free(ini);
@ -55,10 +55,10 @@ void settings_save (settings_t *settings) {
mini_set_bool(ini, "menu", "show_protected_entries", settings->show_protected_entries); mini_set_bool(ini, "menu", "show_protected_entries", settings->show_protected_entries);
mini_set_string(ini, "menu", "default_directory", settings->default_directory); mini_set_string(ini, "menu", "default_directory", settings->default_directory);
mini_set_bool(ini, "menu", "use_saves_folder", settings->use_saves_folder); mini_set_bool(ini, "menu", "use_saves_folder", settings->use_saves_folder);
mini_set_bool(ini, "menu", "sound_enabled", settings->sound_enabled);
/* Beta feature flags, they should not save until production ready! */ /* Beta feature flags, they should not save until production ready! */
// mini_set_bool(ini, "menu_beta_flag", "bgm_enabled", settings->bgm_enabled); // mini_set_bool(ini, "menu_beta_flag", "bgm_enabled", settings->bgm_enabled);
// mini_set_bool(ini, "menu_beta_flag", "sound_enabled", settings->sound_enabled);
// mini_set_bool(ini, "menu_beta_flag", "rumble_enabled", settings->rumble_enabled); // mini_set_bool(ini, "menu_beta_flag", "rumble_enabled", settings->rumble_enabled);
mini_save(ini, MINI_FLAGS_SKIP_EMPTY_GROUPS); mini_save(ini, MINI_FLAGS_SKIP_EMPTY_GROUPS);

View File

@ -3,14 +3,18 @@
#include <libdragon.h> #include <libdragon.h>
#include "mp3_player.h" #include "mp3_player.h"
#include "sound.h"
#define DEFAULT_FREQUENCY (44100) #define DEFAULT_FREQUENCY (44100)
#define NUM_BUFFERS (4) #define NUM_BUFFERS (4)
#define NUM_CHANNELS (2) #define NUM_CHANNELS (3)
static wav64_t sfx_cursor, sfx_error, sfx_enter, sfx_exit, sfx_setting;
static bool sound_initialized = false; static bool sound_initialized = false;
static bool sfx_enabled = false;
static void sound_reconfigure (int frequency) { static void sound_reconfigure (int frequency) {
@ -35,6 +39,43 @@ void sound_init_mp3_playback (void) {
sound_reconfigure(mp3player_get_samplerate()); sound_reconfigure(mp3player_get_samplerate());
} }
void sound_init_sfx (void) {
mixer_ch_set_vol(SOUND_SFX_CHANNEL, 0.5f, 0.5f);
wav64_open(&sfx_cursor, "rom:/cursorsound.wav64");
wav64_open(&sfx_exit, "rom:/back.wav64");
wav64_open(&sfx_setting, "rom:/settings.wav64");
wav64_open(&sfx_enter, "rom:/enter.wav64");
wav64_open(&sfx_error, "rom:/error.wav64");
sfx_enabled = true;
}
void sound_play_effect(sound_effect_t sfx) {
if(sfx_enabled) {
switch (sfx) {
case SFX_CURSOR:
wav64_play(&sfx_cursor, SOUND_SFX_CHANNEL);
break;
case SFX_EXIT:
wav64_play(&sfx_exit, SOUND_SFX_CHANNEL);
break;
case SFX_SETTING:
wav64_play(&sfx_setting, SOUND_SFX_CHANNEL);
break;
case SFX_ENTER:
wav64_play(&sfx_enter, SOUND_SFX_CHANNEL);
break;
case SFX_ERROR:
wav64_play(&sfx_error, SOUND_SFX_CHANNEL);
break;
default:
break;
}
}
}
void sound_deinit (void) { void sound_deinit (void) {
if (sound_initialized) { if (sound_initialized) {
mixer_close(); mixer_close();

View File

@ -9,12 +9,22 @@
#define SOUND_MP3_PLAYER_CHANNEL (0) #define SOUND_MP3_PLAYER_CHANNEL (0)
#define SOUND_SFX_CHANNEL (2)
typedef enum {
SFX_CURSOR,
SFX_ERROR,
SFX_ENTER,
SFX_EXIT,
SFX_SETTING,
} sound_effect_t;
void sound_init_default (void); void sound_init_default (void);
void sound_init_mp3_playback (void); void sound_init_mp3_playback (void);
void sound_init_sfx (void);
void sound_play_effect(sound_effect_t sfx);
void sound_deinit (void); void sound_deinit (void);
void sound_poll (void); void sound_poll (void);
#endif #endif

View File

@ -6,6 +6,7 @@
#include "../fonts.h" #include "../fonts.h"
#include "utils/fs.h" #include "utils/fs.h"
#include "views.h" #include "views.h"
#include "../sound.h"
static const char *rom_extensions[] = { "z64", "n64", "v64", "rom", NULL }; static const char *rom_extensions[] = { "z64", "n64", "v64", "rom", NULL };
@ -296,16 +297,19 @@ static void process (menu_t *menu) {
if (menu->browser.selected < 0) { if (menu->browser.selected < 0) {
menu->browser.selected = 0; menu->browser.selected = 0;
} }
sound_play_effect(SFX_CURSOR);
} else if (menu->actions.go_down) { } else if (menu->actions.go_down) {
menu->browser.selected += scroll_speed; menu->browser.selected += scroll_speed;
if (menu->browser.selected >= menu->browser.entries) { if (menu->browser.selected >= menu->browser.entries) {
menu->browser.selected = menu->browser.entries - 1; menu->browser.selected = menu->browser.entries - 1;
} }
sound_play_effect(SFX_CURSOR);
} }
menu->browser.entry = &menu->browser.list[menu->browser.selected]; menu->browser.entry = &menu->browser.list[menu->browser.selected];
} }
if (menu->actions.enter && menu->browser.entry) { if (menu->actions.enter && menu->browser.entry) {
sound_play_effect(SFX_ENTER);
switch (menu->browser.entry->type) { switch (menu->browser.entry->type) {
case ENTRY_TYPE_DIR: case ENTRY_TYPE_DIR:
if (push_directory(menu, menu->browser.entry->name)) { if (push_directory(menu, menu->browser.entry->name)) {
@ -340,10 +344,13 @@ static void process (menu_t *menu) {
menu->browser.valid = false; menu->browser.valid = false;
menu_show_error(menu, "Couldn't open last directory"); menu_show_error(menu, "Couldn't open last directory");
} }
sound_play_effect(SFX_EXIT);
} else if (menu->actions.options && menu->browser.entry) { } else if (menu->actions.options && menu->browser.entry) {
component_context_menu_show(&entry_context_menu); component_context_menu_show(&entry_context_menu);
sound_play_effect(SFX_SETTING);
} else if (menu->actions.settings) { } else if (menu->actions.settings) {
component_context_menu_show(&settings_context_menu); component_context_menu_show(&settings_context_menu);
sound_play_effect(SFX_SETTING);
} }
} }

View File

@ -1,5 +1,5 @@
#include "views.h" #include "views.h"
#include "../sound.h"
#ifndef MENU_VERSION #ifndef MENU_VERSION
#define MENU_VERSION "Unknown" #define MENU_VERSION "Unknown"
@ -13,6 +13,7 @@
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }

View File

@ -1,9 +1,11 @@
#include "views.h" #include "views.h"
#include "../sound.h"
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }
@ -48,6 +50,7 @@ void view_error_display (menu_t *menu, surface_t *display) {
} }
void menu_show_error (menu_t *menu, char *error_message) { void menu_show_error (menu_t *menu, char *error_message) {
sound_play_effect(SFX_ERROR);
menu->next_mode = MENU_MODE_ERROR; menu->next_mode = MENU_MODE_ERROR;
menu->error_message = error_message; menu->error_message = error_message;
} }

View File

@ -1,4 +1,5 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "../sound.h"
#include "utils/fs.h" #include "utils/fs.h"
#include "views.h" #include "views.h"
@ -50,6 +51,7 @@ static char *format_file_type (char *name, bool is_directory) {
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }

View File

@ -1,9 +1,11 @@
#include "views.h" #include "views.h"
#include "../sound.h"
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }

View File

@ -1,4 +1,5 @@
#include <stdlib.h> #include <stdlib.h>
#include "../sound.h"
#include "../png_decoder.h" #include "../png_decoder.h"
#include "views.h" #include "views.h"
@ -40,6 +41,7 @@ static void process (menu_t *menu) {
} else { } else {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
} }
sound_play_effect(SFX_EXIT);
} else if (menu->actions.enter && image) { } else if (menu->actions.enter && image) {
if (show_message) { if (show_message) {
show_message = false; show_message = false;
@ -48,6 +50,7 @@ static void process (menu_t *menu) {
} else { } else {
show_message = true; show_message = true;
} }
sound_play_effect(SFX_ENTER);
} }
} }

View File

@ -1,6 +1,7 @@
#include "../cart_load.h" #include "../cart_load.h"
#include "../disk_info.h" #include "../disk_info.h"
#include "boot/boot.h" #include "boot/boot.h"
#include "../sound.h"
#include "views.h" #include "views.h"
@ -34,8 +35,10 @@ static void process (menu_t *menu) {
} else if (menu->actions.options && menu->load.rom_path) { } else if (menu->actions.options && menu->load.rom_path) {
load_pending = true; load_pending = true;
load_rom = true; load_rom = true;
sound_play_effect(SFX_SETTING);
} else if (menu->actions.back) { } else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }

View File

@ -1,6 +1,7 @@
#include "../cart_load.h" #include "../cart_load.h"
#include "boot/boot.h" #include "boot/boot.h"
#include "utils/fs.h" #include "utils/fs.h"
#include "../sound.h"
#include "views.h" #include "views.h"
@ -36,6 +37,7 @@ static void process (menu_t *menu) {
load_pending = true; load_pending = true;
} else if (menu->actions.back) { } else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }

View File

@ -1,6 +1,7 @@
#include "../cart_load.h" #include "../cart_load.h"
#include "../rom_info.h" #include "../rom_info.h"
#include "boot/boot.h" #include "boot/boot.h"
#include "../sound.h"
#include "views.h" #include "views.h"
@ -198,8 +199,10 @@ static void process (menu_t *menu) {
load_pending = true; load_pending = true;
} else if (menu->actions.back) { } else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} else if (menu->actions.options) { } else if (menu->actions.options) {
component_context_menu_show(&options_context_menu); component_context_menu_show(&options_context_menu);
sound_play_effect(SFX_SETTING);
} }
} }

View File

@ -42,11 +42,13 @@ static void process (menu_t *menu) {
menu_show_error(menu, convert_error_message(err)); menu_show_error(menu, convert_error_message(err));
} else if (menu->actions.back) { } else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} else if (menu->actions.enter) { } else if (menu->actions.enter) {
err = mp3player_toggle(); err = mp3player_toggle();
if (err != MP3PLAYER_OK) { if (err != MP3PLAYER_OK) {
menu_show_error(menu, convert_error_message(err)); menu_show_error(menu, convert_error_message(err));
} }
sound_play_effect(SFX_ENTER);
} else if (menu->actions.go_left || menu->actions.go_right) { } else if (menu->actions.go_left || menu->actions.go_right) {
int seconds = menu->actions.go_fast ? SEEK_SECONDS_FAST : SEEK_SECONDS; int seconds = menu->actions.go_fast ? SEEK_SECONDS_FAST : SEEK_SECONDS;
err = mp3player_seek(menu->actions.go_left ? (-seconds) : seconds); err = mp3player_seek(menu->actions.go_left ? (-seconds) : seconds);

View File

@ -1,4 +1,5 @@
#include <time.h> #include <time.h>
#include "../sound.h"
#include "views.h" #include "views.h"
// FIXME: add implementation! // FIXME: add implementation!
@ -18,6 +19,7 @@
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }

View File

@ -1,3 +1,4 @@
#include "../sound.h"
#include "views.h" #include "views.h"
@ -12,6 +13,7 @@ static const char *format_switch (bool state) {
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }

View File

@ -1,5 +1,6 @@
#include <time.h> #include <time.h>
#include "../sound.h"
#include "views.h" #include "views.h"
@ -28,6 +29,7 @@ static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} }
} }

View File

@ -3,6 +3,7 @@
#include "../components/constants.h" #include "../components/constants.h"
#include "../fonts.h" #include "../fonts.h"
#include "../sound.h"
#include "utils/utils.h" #include "utils/utils.h"
#include "views.h" #include "views.h"
@ -55,6 +56,7 @@ static void perform_vertical_scroll (int lines) {
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
} else if (text) { } else if (text) {
if (menu->actions.go_up) { if (menu->actions.go_up) {
perform_vertical_scroll(menu->actions.go_fast ? -10 : -1); perform_vertical_scroll(menu->actions.go_fast ? -10 : -1);