summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-02-03 20:12:50 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2019-07-20 08:48:35 +0200
commit55eb1c54ebe33faa8b1eb8c527d5644961ca78dc (patch)
tree81b5a4f89cfc867bc73901c7cccffc89baf3c3ff /apps/plugins
parent9c17734394177791d1101e31aed7537c81e610b6 (diff)
downloadrockbox-55eb1c54ebe33faa8b1eb8c527d5644961ca78dc.tar.gz
rockbox-55eb1c54ebe33faa8b1eb8c527d5644961ca78dc.zip
FS#7704 - Talk support for plugins
Original patch by Mario Lang Heavily updated by Igor Poretsky Further updated by myself This patch breaks binary API compatibility by placing the new functions where they make the most logical sense. IMO this is the better approach to take given the scope of the changes needed for talk support. Since binary API is changing, the patch also moves some other functions around to more logical locations. As well as voice support in plugins, this patch voice-enables several simple plugins. There will be follow-up patches for many plugins that build on this one. Change-Id: I18070c06e77e8a3c016c2eb6b6c5dbe6633b9b54
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/dice.c16
-rw-r--r--apps/plugins/fireworks.c52
-rw-r--r--apps/plugins/lib/playback_control.c16
-rw-r--r--apps/plugins/wavrecord.c22
-rw-r--r--apps/plugins/wormlet.c58
5 files changed, 83 insertions, 81 deletions
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c
index 098dd27c8b..622c58d71d 100644
--- a/apps/plugins/dice.c
+++ b/apps/plugins/dice.c
@@ -51,14 +51,14 @@ static struct dices dice;
51static int sides_index; 51static int sides_index;
52 52
53static struct opt_items nb_sides_option[8] = { 53static struct opt_items nb_sides_option[8] = {
54 { "3", -1 }, 54 { "3", TALK_ID(3, UNIT_INT) },
55 { "4", -1 }, 55 { "4", TALK_ID(4, UNIT_INT) },
56 { "6", -1 }, 56 { "6", TALK_ID(6, UNIT_INT) },
57 { "8", -1 }, 57 { "8", TALK_ID(8, UNIT_INT) },
58 { "10", -1 }, 58 { "10", TALK_ID(10, UNIT_INT) },
59 { "12", -1 }, 59 { "12", TALK_ID(12, UNIT_INT) },
60 { "20", -1 }, 60 { "20", TALK_ID(20, UNIT_INT) },
61 { "100", -1 } 61 { "100", TALK_ID(100, UNIT_INT) }
62}; 62};
63static int nb_sides_values[] = { 3, 4, 6, 8, 10, 12, 20, 100 }; 63static int nb_sides_values[] = { 3, 4, 6, 8, 10, 12, 20, 100 };
64static char *sides_conf[] = {"3", "4", "6", "8", "10", "12", "20", "100" }; 64static char *sides_conf[] = {"3", "4", "6", "8", "10", "12", "20", "100" };
diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c
index 54efaba6ca..d6ca6618cb 100644
--- a/apps/plugins/fireworks.c
+++ b/apps/plugins/fireworks.c
@@ -113,35 +113,35 @@ LCD_RGBPACK(19,10,26) };
113#endif 113#endif
114 114
115static const struct opt_items autofire_delay_settings[15] = { 115static const struct opt_items autofire_delay_settings[15] = {
116 { "Off", -1 }, 116 { STR(LANG_OFF) },
117 { "50ms", -1 }, 117 { "50ms", TALK_ID(50, UNIT_MS) },
118 { "100ms", -1 }, 118 { "100ms", TALK_ID(100, UNIT_MS) },
119 { "200ms", -1 }, 119 { "200ms", TALK_ID(200, UNIT_MS) },
120 { "300ms", -1 }, 120 { "300ms", TALK_ID(300, UNIT_MS) },
121 { "400ms", -1 }, 121 { "400ms", TALK_ID(400, UNIT_MS) },
122 { "500ms", -1 }, 122 { "500ms", TALK_ID(500, UNIT_MS) },
123 { "600ms", -1 }, 123 { "600ms", TALK_ID(600, UNIT_MS) },
124 { "700ms", -1 }, 124 { "700ms", TALK_ID(700, UNIT_MS) },
125 { "800ms", -1 }, 125 { "800ms", TALK_ID(800, UNIT_MS) },
126 { "900ms", -1 }, 126 { "900ms", TALK_ID(900, UNIT_MS) },
127 { "1s", -1 }, 127 { "1s", TALK_ID(1, UNIT_SEC) },
128 { "2s", -1 }, 128 { "2s", TALK_ID(2, UNIT_SEC) },
129 { "3s", -1 }, 129 { "3s", TALK_ID(3, UNIT_SEC) },
130 { "4s", -1 } 130 { "4s", TALK_ID(4, UNIT_SEC) }
131}; 131};
132 132
133int autofire_delay_values[15] = { 133int autofire_delay_values[15] = {
134 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400 }; 134 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400 };
135 135
136static const struct opt_items particle_settings[8] = { 136static const struct opt_items particle_settings[8] = {
137 { "5", -1 }, 137 { "5", TALK_ID(5, UNIT_INT) },
138 { "10", -1 }, 138 { "10", TALK_ID(10, UNIT_INT) },
139 { "15", -1 }, 139 { "15", TALK_ID(15, UNIT_INT) },
140 { "20", -1 }, 140 { "20", TALK_ID(20, UNIT_INT) },
141 { "25", -1 }, 141 { "25", TALK_ID(25, UNIT_INT) },
142 { "30", -1 }, 142 { "30", TALK_ID(30, UNIT_INT) },
143 { "35", -1 }, 143 { "35", TALK_ID(35, UNIT_INT) },
144 { "40", -1 }, 144 { "40", TALK_ID(40, UNIT_INT) },
145}; 145};
146 146
147int particle_values[8] = { 147int particle_values[8] = {
@@ -163,7 +163,7 @@ int particle_life_values[9] = {
163 20, 30, 40, 50, 60, 70, 80, 90, 100 }; 163 20, 30, 40, 50, 60, 70, 80, 90, 100 };
164 164
165static const struct opt_items gravity_settings[4] = { 165static const struct opt_items gravity_settings[4] = {
166 { "Off", -1 }, 166 { STR(LANG_OFF) },
167 { "Weak", -1 }, 167 { "Weak", -1 },
168 { "Moderate", -1 }, 168 { "Moderate", -1 },
169 { "Strong", -1 }, 169 { "Strong", -1 },
@@ -185,8 +185,8 @@ int rocket_values[4] = {
185#else 185#else
186 186
187static const struct opt_items rocket_settings[2] = { 187static const struct opt_items rocket_settings[2] = {
188 { "No", -1 }, 188 { STR(LANG_SET_BOOL_NO) },
189 { "Yes", -1 }, 189 { STR(LANG_SET_BOOL_YES) },
190}; 190};
191int rocket_values[4] = { 191int rocket_values[4] = {
192 1, 0 }; 192 1, 0 };
diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c
index 1be234f70f..363033b1f2 100644
--- a/apps/plugins/lib/playback_control.c
+++ b/apps/plugins/lib/playback_control.c
@@ -90,21 +90,21 @@ static bool repeat_mode(void)
90 90
91 return false; 91 return false;
92} 92}
93MENUITEM_FUNCTION(prevtrack_item, 0, "Previous Track", 93MENUITEM_FUNCTION(prevtrack_item, 0, ID2P(LANG_PREVTRACK),
94 prevtrack, NULL, NULL, Icon_NOICON); 94 prevtrack, NULL, NULL, Icon_NOICON);
95MENUITEM_FUNCTION(playpause_item, 0, "Pause / Play", 95MENUITEM_FUNCTION(playpause_item, 0, ID2P(LANG_PLAYPAUSE),
96 play, NULL, NULL, Icon_NOICON); 96 play, NULL, NULL, Icon_NOICON);
97MENUITEM_FUNCTION(stop_item, 0, "Stop Playback", 97MENUITEM_FUNCTION(stop_item, 0, ID2P(LANG_STOP_PLAYBACK),
98 stop, NULL, NULL, Icon_NOICON); 98 stop, NULL, NULL, Icon_NOICON);
99MENUITEM_FUNCTION(nexttrack_item, 0, "Next Track", 99MENUITEM_FUNCTION(nexttrack_item, 0, ID2P(LANG_NEXTTRACK),
100 nexttrack, NULL, NULL, Icon_NOICON); 100 nexttrack, NULL, NULL, Icon_NOICON);
101MENUITEM_FUNCTION(volume_item, 0, "Change Volume", 101MENUITEM_FUNCTION(volume_item, 0, ID2P(LANG_CHANGE_VOLUME),
102 volume, NULL, NULL, Icon_NOICON); 102 volume, NULL, NULL, Icon_NOICON);
103MENUITEM_FUNCTION(shuffle_item, 0, "Enable/Disable Shuffle", 103MENUITEM_FUNCTION(shuffle_item, 0, ID2P(LANG_CHANGE_SHUFFLE_MODE),
104 shuffle, NULL, NULL, Icon_NOICON); 104 shuffle, NULL, NULL, Icon_NOICON);
105MENUITEM_FUNCTION(repeat_mode_item, 0, "Change Repeat Mode", 105MENUITEM_FUNCTION(repeat_mode_item, 0, ID2P(LANG_CHANGE_REPEAT_MODE),
106 repeat_mode, NULL, NULL, Icon_NOICON); 106 repeat_mode, NULL, NULL, Icon_NOICON);
107MAKE_MENU(playback_control_menu, "Playback Control", NULL, Icon_NOICON, 107MAKE_MENU(playback_control_menu, ID2P(LANG_PLAYBACK_CONTROL), NULL, Icon_NOICON,
108 &prevtrack_item, &playpause_item, &stop_item, &nexttrack_item, 108 &prevtrack_item, &playpause_item, &stop_item, &nexttrack_item,
109 &volume_item, &shuffle_item, &repeat_mode_item); 109 &volume_item, &shuffle_item, &repeat_mode_item);
110 110
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c
index f7467b5b5e..23751be041 100644
--- a/apps/plugins/wavrecord.c
+++ b/apps/plugins/wavrecord.c
@@ -3685,19 +3685,19 @@ static int recording_menu(void)
3685 bool done = false; 3685 bool done = false;
3686 3686
3687 static const struct opt_items freqs[9] = { 3687 static const struct opt_items freqs[9] = {
3688 { "8000Hz", -1 }, 3688 { "8000Hz", TALK_ID(8, UNIT_KHZ) },
3689 { "11025Hz", -1 }, 3689 { "11025Hz", TALK_ID(11, UNIT_KHZ) },
3690 { "12000Hz", -1 }, 3690 { "12000Hz", TALK_ID(12, UNIT_KHZ) },
3691 { "16000Hz", -1 }, 3691 { "16000Hz", TALK_ID(16, UNIT_KHZ) },
3692 { "22050Hz", -1 }, 3692 { "22050Hz", TALK_ID(22, UNIT_KHZ) },
3693 { "24000Hz", -1 }, 3693 { "24000Hz", TALK_ID(24, UNIT_KHZ) },
3694 { "32000Hz", -1 }, 3694 { "32000Hz", TALK_ID(32, UNIT_KHZ) },
3695 { "44100Hz", -1 }, 3695 { "44100Hz", TALK_ID(44, UNIT_KHZ) },
3696 { "48000Hz", -1 }, 3696 { "48000Hz", TALK_ID(48, UNIT_KHZ) },
3697 }; 3697 };
3698 static const struct opt_items chans[2] = { 3698 static const struct opt_items chans[2] = {
3699 { "Mono", -1 }, 3699 { STR(LANG_CHANNEL_MONO) },
3700 { "Stereo", -1 }, 3700 { STR(LANG_CHANNEL_STEREO) },
3701 }; 3701 };
3702 static const struct opt_items srcs[WAV_NUM_SRC] = { 3702 static const struct opt_items srcs[WAV_NUM_SRC] = {
3703 { "Line In", -1 }, 3703 { "Line In", -1 },
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c
index 8c12862bdb..9adfc97b81 100644
--- a/apps/plugins/wormlet.c
+++ b/apps/plugins/wormlet.c
@@ -2499,39 +2499,41 @@ enum plugin_status plugin_start(const void* parameter)
2499 /* Setup screen */ 2499 /* Setup screen */
2500 2500
2501 static const struct opt_items noyes[2] = { 2501 static const struct opt_items noyes[2] = {
2502 { "No", -1 }, 2502 { STR(LANG_SET_BOOL_NO) },
2503 { "Yes", -1 }, 2503 { STR(LANG_SET_BOOL_YES) },
2504 }; 2504 };
2505 2505
2506 static const struct opt_items remoteonly_option[1] = { 2506 static const struct opt_items remoteonly_option[1] = {
2507 { "Remote Control", -1 } 2507 { STR(LANG_REMOTE_CONTROL) }
2508 }; 2508 };
2509 2509
2510 static const struct opt_items key24_option[2] = { 2510 static const struct opt_items key24_option[2] = {
2511 { "4 Key Control", -1 }, 2511 { STR(LANG_4_KEY_CONTROL) },
2512 { "2 Key Control", -1 } 2512 { STR(LANG_2_KEY_CONTROL) }
2513 }; 2513 };
2514 2514
2515#ifdef REMOTE 2515#ifdef REMOTE
2516 static const struct opt_items remote_option[2] = { 2516 static const struct opt_items remote_option[2] = {
2517 { "Remote Control", -1 }, 2517 { STR(LANG_REMOTE_CONTROL) },
2518 { "No Rem. Control", -1 } 2518 { STR(LANG_NO_REM_CONTROL) }
2519 }; 2519 };
2520#else 2520#else
2521 static const struct opt_items key2_option[1] = { 2521 static const struct opt_items key2_option[1] = {
2522 { "2 Key Control", -1 } 2522 { STR(LANG_2_KEY_CONTROL) }
2523 }; 2523 };
2524#endif 2524#endif
2525 2525
2526 static const struct opt_items nokey_option[1] = { 2526 static const struct opt_items nokey_option[1] = {
2527 { "Out of Control", -1 } 2527 { STR(LANG_OUT_OF_CONTROL) }
2528 }; 2528 };
2529 2529
2530 MENUITEM_STRINGLIST(menu, "Wormlet Menu", NULL, "Play Wormlet!", 2530 MENUITEM_STRINGLIST(menu, "Wormlet Menu", NULL,
2531 "Number of Worms", "Number of Players", "Control Style", 2531 ID2P(LANG_PLAY_WORMLET), ID2P(LANG_NUMBER_OF_WORMS),
2532 "Worm Growth Per Food","Worm Speed","Arghs Per Food", 2532 ID2P(LANG_NUMBER_OF_PLAYERS), ID2P(LANG_CONTROL_STYLE),
2533 "Argh Size","Food Size","Revert to Default Settings", 2533 ID2P(LANG_WORM_GROWTH_PER_FOOD), ID2P(LANG_WORM_SPEED),
2534 "Playback Control", "Quit"); 2534 ID2P(LANG_ARGHS_PER_FOOD), ID2P(LANG_ARGH_SIZE),
2535 ID2P(LANG_FOOD_SIZE), ID2P(LANG_REVERT_TO_DEFAULT_SETTINGS),
2536 ID2P(LANG_PLAYBACK_CONTROL), ID2P(LANG_MENU_QUIT));
2535 2537
2536 rb->button_clear_queue(); 2538 rb->button_clear_queue();
2537 2539
@@ -2543,7 +2545,7 @@ enum plugin_status plugin_start(const void* parameter)
2543 launch_wormlet(); 2545 launch_wormlet();
2544 break; 2546 break;
2545 case 1: 2547 case 1:
2546 rb->set_int("Number of Worms", "", UNIT_INT, &worm_count, NULL, 2548 rb->set_int(rb->str(LANG_NUMBER_OF_WORMS), "", UNIT_INT, &worm_count, NULL,
2547 1, 1, 3, NULL); 2549 1, 1, 3, NULL);
2548 if (worm_count < players) { 2550 if (worm_count < players) {
2549 worm_count = players; 2551 worm_count = players;
@@ -2551,10 +2553,10 @@ enum plugin_status plugin_start(const void* parameter)
2551 break; 2553 break;
2552 case 2: 2554 case 2:
2553#ifdef MULTIPLAYER 2555#ifdef MULTIPLAYER
2554 rb->set_int("Number of Players", "", UNIT_INT, &players, NULL, 2556 rb->set_int(rb->str(LANG_NUMBER_OF_PLAYERS), "", UNIT_INT, &players, NULL,
2555 1, 0, 4, NULL); 2557 1, 0, 4, NULL);
2556#else 2558#else
2557 rb->set_int("Number of Players", "", UNIT_INT, &players, NULL, 2559 rb->set_int(rb->str(LANG_NUMBER_OF_PLAYERS), "", UNIT_INT, &players, NULL,
2558 1, 0, 2, NULL); 2560 1, 0, 2, NULL);
2559#endif 2561#endif
2560 if (players > worm_count) { 2562 if (players > worm_count) {
@@ -2567,53 +2569,53 @@ enum plugin_status plugin_start(const void* parameter)
2567 case 3: 2569 case 3:
2568 switch(players) { 2570 switch(players) {
2569 case 0: 2571 case 0:
2570 rb->set_option("Control Style",&use_remote,INT, 2572 rb->set_option(rb->str(LANG_CONTROL_STYLE),&use_remote,INT,
2571 nokey_option, 1, NULL); 2573 nokey_option, 1, NULL);
2572 break; 2574 break;
2573 case 1: 2575 case 1:
2574 rb->set_option("Control Style",&use_remote,INT, 2576 rb->set_option(rb->str(LANG_CONTROL_STYLE),&use_remote,INT,
2575 key24_option, 2, NULL); 2577 key24_option, 2, NULL);
2576 break; 2578 break;
2577 case 2: 2579 case 2:
2578#ifdef REMOTE 2580#ifdef REMOTE
2579 rb->set_option("Control Style",&use_remote,INT, 2581 rb->set_option(rb->str(LANG_CONTROL_STYLE),&use_remote,INT,
2580 remote_option, 2, NULL); 2582 remote_option, 2, NULL);
2581#else 2583#else
2582 rb->set_option("Control Style",&use_remote,INT, 2584 rb->set_option(rb->str(LANG_CONTROL_STYLE),&use_remote,INT,
2583 key2_option, 1, NULL); 2585 key2_option, 1, NULL);
2584#endif 2586#endif
2585 break; 2587 break;
2586 case 3: 2588 case 3:
2587 rb->set_option("Control Style",&use_remote,INT, 2589 rb->set_option(rb->str(LANG_CONTROL_STYLE),&use_remote,INT,
2588 remoteonly_option, 1, NULL); 2590 remoteonly_option, 1, NULL);
2589 break; 2591 break;
2590 } 2592 }
2591 break; 2593 break;
2592 case 4: 2594 case 4:
2593 rb->set_int("Worm Growth Per Food", "", UNIT_INT, &worm_food, 2595 rb->set_int(rb->str(LANG_WORM_GROWTH_PER_FOOD), "", UNIT_INT, &worm_food,
2594 NULL, 1, 0, 15, NULL); 2596 NULL, 1, 0, 15, NULL);
2595 break; 2597 break;
2596 case 5: 2598 case 5:
2597 new_setting = 20 - speed; 2599 new_setting = 20 - speed;
2598 rb->set_int("Worm Speed", "", UNIT_INT, &new_setting, 2600 rb->set_int(rb->str(LANG_WORM_SPEED), "", UNIT_INT, &new_setting,
2599 NULL, 1, 0, 20, NULL); 2601 NULL, 1, 0, 20, NULL);
2600 speed = 20 - new_setting; 2602 speed = 20 - new_setting;
2601 break; 2603 break;
2602 case 6: 2604 case 6:
2603 rb->set_int("Arghs Per Food", "", UNIT_INT, &arghs_per_food, 2605 rb->set_int(rb->str(LANG_ARGHS_PER_FOOD), "", UNIT_INT, &arghs_per_food,
2604 NULL, 1, 0, 8, NULL); 2606 NULL, 1, 0, 8, NULL);
2605 break; 2607 break;
2606 case 7: 2608 case 7:
2607 rb->set_int("Argh Size", "", UNIT_INT, &argh_size, 2609 rb->set_int(rb->str(LANG_ARGH_SIZE), "", UNIT_INT, &argh_size,
2608 NULL, 1, 2, 10, NULL); 2610 NULL, 1, 2, 10, NULL);
2609 break; 2611 break;
2610 case 8: 2612 case 8:
2611 rb->set_int("Food Size", "", UNIT_INT, &food_size, 2613 rb->set_int(rb->str(LANG_FOOD_SIZE), "", UNIT_INT, &food_size,
2612 NULL, 1, 2, 10, NULL); 2614 NULL, 1, 2, 10, NULL);
2613 break; 2615 break;
2614 case 9: 2616 case 9:
2615 new_setting = 0; 2617 new_setting = 0;
2616 rb->set_option("Reset Settings?", &new_setting, INT, noyes , 2, NULL); 2618 rb->set_option(rb->str(LANG_RESET), &new_setting, INT, noyes , 2, NULL);
2617 if (new_setting == 1) 2619 if (new_setting == 1)
2618 default_settings(); 2620 default_settings();
2619 break; 2621 break;