summaryrefslogtreecommitdiff
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
parente6b03ffa823aa2385c989fac9662bfd19679c5de (diff)
downloadrockbox-2ebb8da275da1aa67d148d8ea4ddc1a3e94bd019.tar.gz
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
-rw-r--r--apps/lang/english.lang114
-rw-r--r--apps/lang/russian.lang100
-rw-r--r--apps/plugins/mikmod/mikmod.c57
-rw-r--r--apps/plugins/mikmod/mikmod_supp.h8
4 files changed, 246 insertions, 33 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 075272ef09..b77ae0afb7 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -15919,3 +15919,117 @@ id: VOICE_BAT_BENCH_KEYS
15919 *: "Failed to gather information" 15919 *: "Failed to gather information"
15920 </voice> 15920 </voice>
15921</phrase> 15921</phrase>
15922<phrase>
15923 id: LANG_SWAP_CHANNELS
15924 desc: in sound_settings
15925 user: core
15926 <source>
15927 *: "Swap Channels"
15928 </source>
15929 <dest>
15930 *: "Swap Channels"
15931 </dest>
15932 <voice>
15933 *: "Swap Channels"
15934 </voice>
15935</phrase>
15936<phrase>
15937 id: LANG_PANNING_SEPARATION
15938 desc: in mikmod settings menu
15939 user: core
15940 <source>
15941 *: none
15942 swcodec: "Panning Separation"
15943 lowmem: none
15944 </source>
15945 <dest>
15946 *: none
15947 swcodec: "Panning Separation"
15948 lowmem: none
15949 </dest>
15950 <voice>
15951 *: none
15952 swcodec: "Panning Separation"
15953 lowmem: none
15954 </voice>
15955</phrase>
15956<phrase>
15957 id: LANG_REVERBERATION
15958 desc: in mikmod settings menu
15959 user: core
15960 <source>
15961 *: none
15962 swcodec: "Reverberation"
15963 lowmem: none
15964 </source>
15965 <dest>
15966 *: none
15967 swcodec: "Reverberation"
15968 lowmem: none
15969 </dest>
15970 <voice>
15971 *: none
15972 swcodec: "Reverberation"
15973 lowmem: none
15974 </voice>
15975</phrase>
15976<phrase>
15977 id: LANG_INTERPOLATION
15978 desc: in mikmod settings menu
15979 user: core
15980 <source>
15981 *: none
15982 swcodec: "Interpolation"
15983 lowmem: none
15984 </source>
15985 <dest>
15986 *: none
15987 swcodec: "Interpolation"
15988 lowmem: none
15989 </dest>
15990 <voice>
15991 *: none
15992 swcodec: "Interpolation"
15993 lowmem: none
15994 </voice>
15995</phrase>
15996<phrase>
15997 id: LANG_MIKMOD_SURROUND
15998 desc: in mikmod settings menu
15999 user: core
16000 <source>
16001 *: none
16002 swcodec: "Surround"
16003 lowmem: none
16004 </source>
16005 <dest>
16006 *: none
16007 swcodec: "Surround"
16008 lowmem: none
16009 </dest>
16010 <voice>
16011 *: none
16012 swcodec: "Surround"
16013 lowmem: none
16014 </voice>
16015</phrase>
16016<phrase>
16017 id: LANG_CPU_BOOST
16018 desc: in mikmod settings menu
16019 user: core
16020 <source>
16021 *: none
16022 swcodec: "CPU Boost"
16023 lowmem: none
16024 </source>
16025 <dest>
16026 *: none
16027 swcodec: "CPU Boost"
16028 lowmem: none
16029 </dest>
16030 <voice>
16031 *: none
16032 swcodec: "CPU Boost"
16033 lowmem: none
16034 </voice>
16035</phrase>
diff --git a/apps/lang/russian.lang b/apps/lang/russian.lang
index 9d289580b5..7b7384a8c7 100644
--- a/apps/lang/russian.lang
+++ b/apps/lang/russian.lang
@@ -13784,3 +13784,103 @@
13784 *: "" 13784 *: ""
13785 </voice> 13785 </voice>
13786</phrase> 13786</phrase>
13787<phrase>
13788 id: LANG_PANNING_SEPARATION
13789 desc: in mikmod settings menu
13790 user: core
13791 <source>
13792 *: none
13793 swcodec: "Panning Separation"
13794 lowmem: none
13795 </source>
13796 <dest>
13797 *: none
13798 swcodec: "Панорама"
13799 lowmem: none
13800 </dest>
13801 <voice>
13802 *: none
13803 swcodec: "Панорама"
13804 lowmem: none
13805 </voice>
13806</phrase>
13807<phrase>
13808 id: LANG_REVERBERATION
13809 desc: in mikmod settings menu
13810 user: core
13811 <source>
13812 *: none
13813 swcodec: "Reverberation"
13814 lowmem: none
13815 </source>
13816 <dest>
13817 *: none
13818 swcodec: "Реверберация"
13819 lowmem: none
13820 </dest>
13821 <voice>
13822 *: none
13823 swcodec: "Реверберация"
13824 lowmem: none
13825 </voice>
13826</phrase>
13827<phrase>
13828 id: LANG_INTERPOLATION
13829 desc: in mikmod settings menu
13830 user: core
13831 <source>
13832 *: none
13833 swcodec: "Interpolation"
13834 lowmem: none
13835 </source>
13836 <dest>
13837 *: none
13838 swcodec: "Интерполяция"
13839 lowmem: none
13840 </dest>
13841 <voice>
13842 *: none
13843 swcodec: "Интерполяция"
13844 lowmem: none
13845 </voice>
13846</phrase>
13847<phrase>
13848 id: LANG_MIKMOD_SURROUND
13849 desc: in mikmod settings menu
13850 user: core
13851 <source>
13852 *: none
13853 swcodec: "Surround"
13854 lowmem: none
13855 </source>
13856 <dest>
13857 *: none
13858 swcodec: "Окружение"
13859 lowmem: none
13860 </dest>
13861 <voice>
13862 *: none
13863 swcodec: "Окружение"
13864 lowmem: none
13865 </voice>
13866</phrase>
13867<phrase>
13868 id: LANG_CPU_BOOST
13869 desc: in mikmod settings menu
13870 user: core
13871 <source>
13872 *: none
13873 swcodec: "CPU Boost"
13874 lowmem: none
13875 </source>
13876 <dest>
13877 *: none
13878 swcodec: "Разгон процессора"
13879 lowmem: none
13880 </dest>
13881 <voice>
13882 *: none
13883 swcodec: "Разгон процессора"
13884 lowmem: none
13885 </voice>
13886</phrase>
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 @@
8#undef SYNC 8#undef SYNC
9#ifdef SIMULATOR 9#ifdef SIMULATOR
10#define SYNC 10#define SYNC
11#elif NUM_CORES > 1 11#else
12#define USETHREADS 12#define USETHREADS
13#endif 13#endif
14 14
@@ -525,10 +525,14 @@ static int settings_menu(void)
525{ 525{
526 int selection = 0; 526 int selection = 0;
527 527
528 MENUITEM_STRINGLIST(settings_menu, "Mikmod Settings", NULL, "Panning Separation", 528 MENUITEM_STRINGLIST(settings_menu, "Mikmod Settings", NULL,
529 "Reverberation", "Interpolation", "Reverse Channels", "Surround", 529 ID2P(LANG_PANNING_SEPARATION),
530 ID2P(LANG_REVERBERATION),
531 ID2P(LANG_INTERPOLATION),
532 ID2P(LANG_SWAP_CHANNELS),
533 ID2P(LANG_MIKMOD_SURROUND),
530#ifdef HAVE_ADJUSTABLE_CPU_FREQ 534#ifdef HAVE_ADJUSTABLE_CPU_FREQ
531 "CPU Boost" 535 ID2P(LANG_CPU_BOOST)
532#endif 536#endif
533 ); 537 );
534 538
@@ -538,36 +542,36 @@ static int settings_menu(void)
538 switch(selection) 542 switch(selection)
539 { 543 {
540 case 0: 544 case 0:
541 rb->set_int("Panning Separation", "", 1, 545 rb->set_int(rb->str(LANG_PANNING_SEPARATION), "", 1,
542 &(settings.pansep), 546 &(settings.pansep),
543 NULL, 8, 0, 128, NULL ); 547 NULL, 8, 0, 128, NULL );
544 applysettings(); 548 applysettings();
545 break; 549 break;
546 550
547 case 1: 551 case 1:
548 rb->set_int("Reverberation", "", 1, 552 rb->set_int(rb->str(LANG_REVERBERATION), "", 1,
549 &(settings.reverb), 553 &(settings.reverb),
550 NULL, 1, 0, 15, NULL ); 554 NULL, 1, 0, 15, NULL );
551 applysettings(); 555 applysettings();
552 break; 556 break;
553 557
554 case 2: 558 case 2:
555 rb->set_bool("Interpolation", &(settings.interp)); 559 rb->set_bool(rb->str(LANG_INTERPOLATION), &(settings.interp));
556 applysettings(); 560 applysettings();
557 break; 561 break;
558 562
559 case 3: 563 case 3:
560 rb->set_bool("Reverse Channels", &(settings.reverse)); 564 rb->set_bool(rb->str(LANG_SWAP_CHANNELS), &(settings.reverse));
561 applysettings(); 565 applysettings();
562 break; 566 break;
563 567
564 case 4: 568 case 4:
565 rb->set_bool("Surround", &(settings.surround)); 569 rb->set_bool(rb->str(LANG_MIKMOD_SURROUND), &(settings.surround));
566 applysettings(); 570 applysettings();
567 break; 571 break;
568 572
569 case 5: 573 case 5:
570 rb->set_bool("CPU Boost", &(settings.boost)); 574 rb->set_bool(rb->str(LANG_CPU_BOOST), &(settings.boost));
571 applysettings(); 575 applysettings();
572 break; 576 break;
573 577
@@ -587,7 +591,9 @@ static int main_menu(void)
587 int result; 591 int result;
588 592
589 MENUITEM_STRINGLIST(main_menu,"Mikmod Main Menu",NULL, 593 MENUITEM_STRINGLIST(main_menu,"Mikmod Main Menu",NULL,
590 "Settings", "Return", "Quit"); 594 ID2P(LANG_SETTINGS),
595 ID2P(LANG_RETURN),
596 ID2P(LANG_MENU_QUIT));
591 while (1) 597 while (1)
592 { 598 {
593 switch (rb->do_menu(&main_menu,&selection, NULL, false)) 599 switch (rb->do_menu(&main_menu,&selection, NULL, false))
@@ -620,8 +626,12 @@ static void thread(void)
620 626
621 while (1) 627 while (1)
622 { 628 {
623 synthbuf(); 629 if (rb->queue_empty(&thread_q))
624 rb->queue_wait_w_tmo(&thread_q, &ev, HZ/20); 630 {
631 synthbuf();
632 rb->yield();
633 }
634 else rb->queue_wait(&thread_q, &ev);
625 switch (ev.id) { 635 switch (ev.id) {
626 case EV_EXIT: 636 case EV_EXIT:
627 return; 637 return;
@@ -660,7 +670,8 @@ static int playfile(char* filename)
660 { 670 {
661 display = DISPLAY_INFO; 671 display = DISPLAY_INFO;
662 Player_Start(module); 672 Player_Start(module);
663 rb->pcm_play_data(&get_more, NULL, NULL, 0); 673 rb->pcmbuf_fade(false, true);
674 rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
664 } 675 }
665 676
666#ifdef HAVE_ADJUSTABLE_CPU_FREQ 677#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -798,14 +809,7 @@ static int playfile(char* filename)
798 break; 809 break;
799 810
800 case ACTION_WPS_PLAY: 811 case ACTION_WPS_PLAY:
801 if(!Player_Paused()) 812 rb->mixer_channel_play_pause(PCM_MIXER_CHAN_PLAYBACK, Player_Paused());
802 {
803 rb->pcm_play_stop();
804 }
805 else
806 {
807 rb->pcm_play_data(&get_more, NULL, NULL, 0);
808 }
809 Player_TogglePause(); 813 Player_TogglePause();
810 break; 814 break;
811 815
@@ -870,6 +874,7 @@ static int playfile(char* filename)
870enum plugin_status plugin_start(const void* parameter) 874enum plugin_status plugin_start(const void* parameter)
871{ 875{
872 enum plugin_status retval; 876 enum plugin_status retval;
877 int orig_samplerate = rb->mixer_get_frequency();
873 878
874 if (parameter == NULL) 879 if (parameter == NULL)
875 { 880 {
@@ -879,13 +884,14 @@ enum plugin_status plugin_start(const void* parameter)
879 884
880 rb->lcd_setfont(FONT_SYSFIXED); 885 rb->lcd_setfont(FONT_SYSFIXED);
881 886
887 rb->talk_force_shutup();
882 rb->pcm_play_stop(); 888 rb->pcm_play_stop();
883#if INPUT_SRC_CAPS != 0 889#if INPUT_SRC_CAPS != 0
884 /* Select playback */ 890 /* Select playback */
885 rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); 891 rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
886 rb->audio_set_output_source(AUDIO_SRC_PLAYBACK); 892 rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
887#endif 893#endif
888 rb->pcm_set_frequency(SAMPLE_RATE); 894 rb->mixer_set_frequency(SAMPLE_RATE);
889 895
890 audio_buffer = rb->plugin_get_audio_buffer((size_t *)&audio_buffer_free); 896 audio_buffer = rb->plugin_get_audio_buffer((size_t *)&audio_buffer_free);
891 897
@@ -922,8 +928,9 @@ enum plugin_status plugin_start(const void* parameter)
922 928
923 MikMod_Exit(); 929 MikMod_Exit();
924 930
925 rb->pcm_play_stop(); 931 rb->pcmbuf_fade(false, false);
926 rb->pcm_set_frequency(HW_SAMPR_DEFAULT); 932 rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
933 rb->mixer_set_frequency(orig_samplerate);
927 934
928 if (retval == PLUGIN_OK) 935 if (retval == PLUGIN_OK)
929 { 936 {
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, ... );
64extern const struct plugin_api * rb; 64extern const struct plugin_api * rb;
65 65
66 66
67#ifdef SIMULATOR
68#define SAMPLE_RATE SAMPR_44 /* Simulator requires 44100Hz */
69#else
70#if (HW_SAMPR_CAPS & SAMPR_CAP_22) /* use 22050Hz if we can */
71#define SAMPLE_RATE SAMPR_22 /* 22050 */
72#else
73#define SAMPLE_RATE SAMPR_44 /* 44100 */ 67#define SAMPLE_RATE SAMPR_44 /* 44100 */
74#endif
75#endif
76 68
77#define BUF_SIZE 4096*8 69#define BUF_SIZE 4096*8
78#define NBUF 2 70#define NBUF 2