summaryrefslogtreecommitdiffstats
path: root/apps/plugins
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-08-04 16:51:50 -0400
committerSolomon Peachy <pizza@shaftnet.org>2019-08-07 09:48:15 -0400
commit2ebb8da275da1aa67d148d8ea4ddc1a3e94bd019 (patch)
tree187cc8a573e1245ae25290b49579ceb30e4a5945 /apps/plugins
parente6b03ffa823aa2385c989fac9662bfd19679c5de (diff)
downloadrockbox-2ebb8da275da1aa67d148d8ea4ddc1a3e94bd019.tar.gz
rockbox-2ebb8da275da1aa67d148d8ea4ddc1a3e94bd019.tar.bz2
rockbox-2ebb8da275da1aa67d148d8ea4ddc1a3e94bd019.zip
Mikmod plugin improvements
- Improved sound quality (use 44.1KHz) - Conventional mixer is now used - Playback is performed in a separate thread - Speech feedback in menus Patch by Igor Poretsky Change-Id: I13baa224cefd67aefe6d62b988971bfbd421757d
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/mikmod/mikmod.c57
-rw-r--r--apps/plugins/mikmod/mikmod_supp.h8
2 files changed, 32 insertions, 33 deletions
diff --git a/apps/plugins/mikmod/mikmod.c b/apps/plugins/mikmod/mikmod.c
index 3302fc306a..688baed56c 100644
--- a/apps/plugins/mikmod/mikmod.c
+++ b/apps/plugins/mikmod/mikmod.c
@@ -8,7 +8,7 @@
#undef SYNC
#ifdef SIMULATOR
#define SYNC
-#elif NUM_CORES > 1
+#else
#define USETHREADS
#endif
@@ -525,10 +525,14 @@ static int settings_menu(void)
{
int selection = 0;
- MENUITEM_STRINGLIST(settings_menu, "Mikmod Settings", NULL, "Panning Separation",
- "Reverberation", "Interpolation", "Reverse Channels", "Surround",
+ MENUITEM_STRINGLIST(settings_menu, "Mikmod Settings", NULL,
+ ID2P(LANG_PANNING_SEPARATION),
+ ID2P(LANG_REVERBERATION),
+ ID2P(LANG_INTERPOLATION),
+ ID2P(LANG_SWAP_CHANNELS),
+ ID2P(LANG_MIKMOD_SURROUND),
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
- "CPU Boost"
+ ID2P(LANG_CPU_BOOST)
#endif
);
@@ -538,36 +542,36 @@ static int settings_menu(void)
switch(selection)
{
case 0:
- rb->set_int("Panning Separation", "", 1,
+ rb->set_int(rb->str(LANG_PANNING_SEPARATION), "", 1,
&(settings.pansep),
NULL, 8, 0, 128, NULL );
applysettings();
break;
case 1:
- rb->set_int("Reverberation", "", 1,
+ rb->set_int(rb->str(LANG_REVERBERATION), "", 1,
&(settings.reverb),
NULL, 1, 0, 15, NULL );
applysettings();
break;
case 2:
- rb->set_bool("Interpolation", &(settings.interp));
+ rb->set_bool(rb->str(LANG_INTERPOLATION), &(settings.interp));
applysettings();
break;
case 3:
- rb->set_bool("Reverse Channels", &(settings.reverse));
+ rb->set_bool(rb->str(LANG_SWAP_CHANNELS), &(settings.reverse));
applysettings();
break;
case 4:
- rb->set_bool("Surround", &(settings.surround));
+ rb->set_bool(rb->str(LANG_MIKMOD_SURROUND), &(settings.surround));
applysettings();
break;
case 5:
- rb->set_bool("CPU Boost", &(settings.boost));
+ rb->set_bool(rb->str(LANG_CPU_BOOST), &(settings.boost));
applysettings();
break;
@@ -587,7 +591,9 @@ static int main_menu(void)
int result;
MENUITEM_STRINGLIST(main_menu,"Mikmod Main Menu",NULL,
- "Settings", "Return", "Quit");
+ ID2P(LANG_SETTINGS),
+ ID2P(LANG_RETURN),
+ ID2P(LANG_MENU_QUIT));
while (1)
{
switch (rb->do_menu(&main_menu,&selection, NULL, false))
@@ -620,8 +626,12 @@ static void thread(void)
while (1)
{
- synthbuf();
- rb->queue_wait_w_tmo(&thread_q, &ev, HZ/20);
+ if (rb->queue_empty(&thread_q))
+ {
+ synthbuf();
+ rb->yield();
+ }
+ else rb->queue_wait(&thread_q, &ev);
switch (ev.id) {
case EV_EXIT:
return;
@@ -660,7 +670,8 @@ static int playfile(char* filename)
{
display = DISPLAY_INFO;
Player_Start(module);
- rb->pcm_play_data(&get_more, NULL, NULL, 0);
+ rb->pcmbuf_fade(false, true);
+ rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
}
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -798,14 +809,7 @@ static int playfile(char* filename)
break;
case ACTION_WPS_PLAY:
- if(!Player_Paused())
- {
- rb->pcm_play_stop();
- }
- else
- {
- rb->pcm_play_data(&get_more, NULL, NULL, 0);
- }
+ rb->mixer_channel_play_pause(PCM_MIXER_CHAN_PLAYBACK, Player_Paused());
Player_TogglePause();
break;
@@ -870,6 +874,7 @@ static int playfile(char* filename)
enum plugin_status plugin_start(const void* parameter)
{
enum plugin_status retval;
+ int orig_samplerate = rb->mixer_get_frequency();
if (parameter == NULL)
{
@@ -879,13 +884,14 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_setfont(FONT_SYSFIXED);
+ rb->talk_force_shutup();
rb->pcm_play_stop();
#if INPUT_SRC_CAPS != 0
/* Select playback */
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif
- rb->pcm_set_frequency(SAMPLE_RATE);
+ rb->mixer_set_frequency(SAMPLE_RATE);
audio_buffer = rb->plugin_get_audio_buffer((size_t *)&audio_buffer_free);
@@ -922,8 +928,9 @@ enum plugin_status plugin_start(const void* parameter)
MikMod_Exit();
- rb->pcm_play_stop();
- rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
+ rb->pcmbuf_fade(false, false);
+ rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
+ rb->mixer_set_frequency(orig_samplerate);
if (retval == PLUGIN_OK)
{
diff --git a/apps/plugins/mikmod/mikmod_supp.h b/apps/plugins/mikmod/mikmod_supp.h
index c76c283b92..29fa7ebf35 100644
--- a/apps/plugins/mikmod/mikmod_supp.h
+++ b/apps/plugins/mikmod/mikmod_supp.h
@@ -64,15 +64,7 @@ int mmsupp_sprintf(char *buf, const char *fmt, ... );
extern const struct plugin_api * rb;
-#ifdef SIMULATOR
-#define SAMPLE_RATE SAMPR_44 /* Simulator requires 44100Hz */
-#else
-#if (HW_SAMPR_CAPS & SAMPR_CAP_22) /* use 22050Hz if we can */
-#define SAMPLE_RATE SAMPR_22 /* 22050 */
-#else
#define SAMPLE_RATE SAMPR_44 /* 44100 */
-#endif
-#endif
#define BUF_SIZE 4096*8
#define NBUF 2