diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-09-20 10:36:25 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-09-20 14:52:30 +0000 |
commit | 5d40d9758500e1215c2eeb326ec06fa95500be67 (patch) | |
tree | e28fb0b66e207204f8c827e3201f13fe6e301c25 | |
parent | e404026308081dd1aef79e891326040747fef9d6 (diff) | |
download | rockbox-5d40d9758500e1215c2eeb326ec06fa95500be67.tar.gz rockbox-5d40d9758500e1215c2eeb326ec06fa95500be67.zip |
voice: rename mp3_play_* functions to voice_play_*
Remove mp3_is_playing() entirely, in favor of pcm_is_playing()
Remove mp3_play_pause() entirely, as it's a dummy/no-op call
Remoce some archos-specific comments
Change-Id: I4e9ff323490a93add00809efd19e0d4e3f198b2d
-rw-r--r-- | apps/plugin.c | 3 | ||||
-rw-r--r-- | apps/plugin.h | 15 | ||||
-rw-r--r-- | apps/plugins/imageviewer/imageviewer.c | 2 | ||||
-rw-r--r-- | apps/talk.c | 66 | ||||
-rw-r--r-- | apps/voice_thread.c | 20 | ||||
-rw-r--r-- | apps/voice_thread.h | 14 | ||||
-rw-r--r-- | docs/PLUGIN_API | 41 |
7 files changed, 46 insertions, 115 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 749132cde8..7ece50bfd3 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -597,9 +597,6 @@ static const struct plugin_api rockbox_api = { | |||
597 | #if defined (HAVE_PITCHCONTROL) | 597 | #if defined (HAVE_PITCHCONTROL) |
598 | sound_set_pitch, | 598 | sound_set_pitch, |
599 | #endif | 599 | #endif |
600 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(HAVE_DISK_STORAGE) | ||
601 | mp3_is_playing, | ||
602 | #endif | ||
603 | &audio_master_sampr_list[0], | 600 | &audio_master_sampr_list[0], |
604 | &hw_freq_sampr[0], | 601 | &hw_freq_sampr[0], |
605 | pcm_apply_settings, | 602 | pcm_apply_settings, |
diff --git a/apps/plugin.h b/apps/plugin.h index fc3da61c57..38d0ee0fff 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -155,12 +155,12 @@ int plugin_open(char *plugin, char *parameter); | |||
155 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 155 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
156 | 156 | ||
157 | /* increase this every time the api struct changes */ | 157 | /* increase this every time the api struct changes */ |
158 | #define PLUGIN_API_VERSION 240 | 158 | #define PLUGIN_API_VERSION 241 |
159 | 159 | ||
160 | /* update this to latest version if a change to the api struct breaks | 160 | /* update this to latest version if a change to the api struct breaks |
161 | backwards compatibility (and please take the opportunity to sort in any | 161 | backwards compatibility (and please take the opportunity to sort in any |
162 | new function which are "waiting" at the end of the function table) */ | 162 | new function which are "waiting" at the end of the function table) */ |
163 | #define PLUGIN_MIN_API_VERSION 239 | 163 | #define PLUGIN_MIN_API_VERSION 241 |
164 | 164 | ||
165 | /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ | 165 | /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ |
166 | 166 | ||
@@ -669,9 +669,6 @@ struct plugin_api { | |||
669 | #if defined (HAVE_PITCHCONTROL) | 669 | #if defined (HAVE_PITCHCONTROL) |
670 | void (*sound_set_pitch)(int32_t pitch); | 670 | void (*sound_set_pitch)(int32_t pitch); |
671 | #endif | 671 | #endif |
672 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(HAVE_DISK_STORAGE) | ||
673 | bool (*mp3_is_playing)(void); | ||
674 | #endif /* PLATFORM_NATIVE */ | ||
675 | const unsigned long *audio_master_sampr_list; | 672 | const unsigned long *audio_master_sampr_list; |
676 | const unsigned long *hw_freq_sampr; | 673 | const unsigned long *hw_freq_sampr; |
677 | void (*pcm_apply_settings)(void); | 674 | void (*pcm_apply_settings)(void); |
@@ -765,6 +762,7 @@ struct plugin_api { | |||
765 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | 762 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
766 | bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename); | 763 | bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename); |
767 | #endif | 764 | #endif |
765 | struct tagcache_stat* (*tagcache_get_stat)(void); | ||
768 | #endif /* HAVE_TAGCACHE */ | 766 | #endif /* HAVE_TAGCACHE */ |
769 | 767 | ||
770 | #ifdef HAVE_ALBUMART | 768 | #ifdef HAVE_ALBUMART |
@@ -920,6 +918,7 @@ struct plugin_api { | |||
920 | void (*led)(bool on); | 918 | void (*led)(bool on); |
921 | 919 | ||
922 | /*plugin*/ | 920 | /*plugin*/ |
921 | int (*plugin_open)(char *path, char *parameter); | ||
923 | void* (*plugin_get_buffer)(size_t *buffer_size); | 922 | void* (*plugin_get_buffer)(size_t *buffer_size); |
924 | void* (*plugin_get_audio_buffer)(size_t *buffer_size); | 923 | void* (*plugin_get_audio_buffer)(size_t *buffer_size); |
925 | void (*plugin_release_audio_buffer)(void); | 924 | void (*plugin_release_audio_buffer)(void); |
@@ -929,14 +928,8 @@ struct plugin_api { | |||
929 | void (*audio_hard_stop)(void); | 928 | void (*audio_hard_stop)(void); |
930 | #endif | 929 | #endif |
931 | 930 | ||
932 | |||
933 | /* new stuff at the end, sort into place next time | 931 | /* new stuff at the end, sort into place next time |
934 | the API gets incompatible */ | 932 | the API gets incompatible */ |
935 | |||
936 | #ifdef HAVE_TAGCACHE | ||
937 | struct tagcache_stat* (*tagcache_get_stat)(void); | ||
938 | #endif | ||
939 | int (*plugin_open)(char *path, char *parameter); | ||
940 | 933 | ||
941 | }; | 934 | }; |
942 | 935 | ||
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c index 4070f4b513..8e23787704 100644 --- a/apps/plugins/imageviewer/imageviewer.c +++ b/apps/plugins/imageviewer/imageviewer.c | |||
@@ -326,7 +326,7 @@ static int show_menu(void) /* return 1 to quit */ | |||
326 | /* slideshow times < 10s keep disk spinning */ | 326 | /* slideshow times < 10s keep disk spinning */ |
327 | rb->storage_spindown(0); | 327 | rb->storage_spindown(0); |
328 | } | 328 | } |
329 | else if (!rb->mp3_is_playing()) | 329 | else if (!rb->pcm_is_playing()) |
330 | { | 330 | { |
331 | /* slideshow times > 10s and not playing: ata_off after load */ | 331 | /* slideshow times > 10s and not playing: ata_off after load */ |
332 | iv_api.immediate_ata_off = true; | 332 | iv_api.immediate_ata_off = true; |
diff --git a/apps/talk.c b/apps/talk.c index 4b65700a5d..5d292b05d1 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -46,25 +46,6 @@ | |||
46 | #include "panic.h" | 46 | #include "panic.h" |
47 | #include "misc.h" /* time_split_units() */ | 47 | #include "misc.h" /* time_split_units() */ |
48 | 48 | ||
49 | /* Memory layout varies between targets because the | ||
50 | Archos (MASCODEC) devices cannot mix voice and audio playback | ||
51 | |||
52 | MASCODEC | MASCODEC | SWCODEC | ||
53 | (playing) | (stopped) | | ||
54 | voicebuf-----------+-----------+------------ | ||
55 | audio | voice | voice | ||
56 | |-----------|------------ | ||
57 | | thumbnail | thumbnail | ||
58 | | |------------ | ||
59 | | | filebuf | ||
60 | | |------------ | ||
61 | | | audio | ||
62 | voicebufend----------+-----------+------------ | ||
63 | |||
64 | SWCODEC allocates dedicated buffers (except voice and thumbnail are together | ||
65 | in the talkbuf), MASCODEC reuses audiobuf. */ | ||
66 | |||
67 | |||
68 | /***************** Constants *****************/ | 49 | /***************** Constants *****************/ |
69 | 50 | ||
70 | #define QUEUE_SIZE 64 /* must be a power of two */ | 51 | #define QUEUE_SIZE 64 /* must be a power of two */ |
@@ -128,7 +109,7 @@ static int queue_write; /* write index of queue, by application */ | |||
128 | static int queue_read; /* read index of queue, by ISR context */ | 109 | static int queue_read; /* read index of queue, by ISR context */ |
129 | static enum talk_status talk_status = TALK_STATUS_OK; | 110 | static enum talk_status talk_status = TALK_STATUS_OK; |
130 | /* protects queue_read, queue_write and thumbnail_buf_used */ | 111 | /* protects queue_read, queue_write and thumbnail_buf_used */ |
131 | static struct mutex queue_mutex SHAREDBSS_ATTR; | 112 | static struct mutex queue_mutex SHAREDBSS_ATTR; |
132 | #define talk_queue_lock() ({ mutex_lock(&queue_mutex); }) | 113 | #define talk_queue_lock() ({ mutex_lock(&queue_mutex); }) |
133 | #define talk_queue_unlock() ({ mutex_unlock(&queue_mutex); }) | 114 | #define talk_queue_unlock() ({ mutex_unlock(&queue_mutex); }) |
134 | static int sent; /* how many bytes handed over to playback, owned by ISR */ | 115 | static int sent; /* how many bytes handed over to playback, owned by ISR */ |
@@ -182,7 +163,7 @@ static inline bool check_audio_status(void) | |||
182 | return true; | 163 | return true; |
183 | } | 164 | } |
184 | 165 | ||
185 | /* ISR (mp3_callback()) must not run during moving of the clip buffer, | 166 | /* ISR (voice_callback()) must not run during moving of the clip buffer, |
186 | * because the MAS may get out-of-sync */ | 167 | * because the MAS may get out-of-sync */ |
187 | static void sync_callback(int handle, bool sync_on) | 168 | static void sync_callback(int handle, bool sync_on) |
188 | { | 169 | { |
@@ -269,13 +250,13 @@ static int open_voicefile(void) | |||
269 | char* p_lang = DEFAULT_VOICE_LANG; /* default */ | 250 | char* p_lang = DEFAULT_VOICE_LANG; /* default */ |
270 | 251 | ||
271 | if ( global_settings.lang_file[0] && | 252 | if ( global_settings.lang_file[0] && |
272 | global_settings.lang_file[0] != 0xff ) | 253 | global_settings.lang_file[0] != 0xff ) |
273 | { /* try to open the voice file of the selected language */ | 254 | { /* try to open the voice file of the selected language */ |
274 | p_lang = (char *)global_settings.lang_file; | 255 | p_lang = (char *)global_settings.lang_file; |
275 | } | 256 | } |
276 | 257 | ||
277 | snprintf(buf, sizeof(buf), LANG_DIR "/%s.voice", p_lang); | 258 | snprintf(buf, sizeof(buf), LANG_DIR "/%s.voice", p_lang); |
278 | 259 | ||
279 | return open(buf, O_RDONLY); | 260 | return open(buf, O_RDONLY); |
280 | } | 261 | } |
281 | 262 | ||
@@ -725,7 +706,7 @@ static void mp3_callback(const void** start, size_t* size) | |||
725 | curr_hd[1] = commit_buffer[2]; | 706 | curr_hd[1] = commit_buffer[2]; |
726 | curr_hd[2] = commit_buffer[3]; | 707 | curr_hd[2] = commit_buffer[3]; |
727 | } | 708 | } |
728 | 709 | ||
729 | talk_queue_unlock(); | 710 | talk_queue_unlock(); |
730 | } | 711 | } |
731 | 712 | ||
@@ -735,7 +716,7 @@ static void mp3_callback(const void** start, size_t* size) | |||
735 | void talk_force_shutup(void) | 716 | void talk_force_shutup(void) |
736 | { | 717 | { |
737 | /* Had nothing to do (was frame boundary or not our clip) */ | 718 | /* Had nothing to do (was frame boundary or not our clip) */ |
738 | mp3_play_stop(); | 719 | voice_play_stop(); |
739 | talk_queue_lock(); | 720 | talk_queue_lock(); |
740 | queue_write = queue_read = 0; /* reset the queue */ | 721 | queue_write = queue_read = 0; /* reset the queue */ |
741 | thumbnail_buf_used = 0; | 722 | thumbnail_buf_used = 0; |
@@ -761,7 +742,7 @@ static void queue_clip(struct queue_entry *clip, bool enqueue) | |||
761 | /* Something is being enqueued, force_enqueue_next override is no | 742 | /* Something is being enqueued, force_enqueue_next override is no |
762 | longer in effect. */ | 743 | longer in effect. */ |
763 | force_enqueue_next = false; | 744 | force_enqueue_next = false; |
764 | 745 | ||
765 | if (!clip->length) | 746 | if (!clip->length) |
766 | return; /* safety check */ | 747 | return; /* safety check */ |
767 | talk_queue_lock(); | 748 | talk_queue_lock(); |
@@ -780,11 +761,10 @@ static void queue_clip(struct queue_entry *clip, bool enqueue) | |||
780 | size_t size; | 761 | size_t size; |
781 | void *buf = commit_transfer(qe, &size); | 762 | void *buf = commit_transfer(qe, &size); |
782 | last_clip = qe; | 763 | last_clip = qe; |
783 | mp3_play_data(buf, size, mp3_callback); | 764 | voice_play_data(buf, size, mp3_callback); |
784 | curr_hd[0] = commit_buffer[1]; | 765 | curr_hd[0] = commit_buffer[1]; |
785 | curr_hd[1] = commit_buffer[2]; | 766 | curr_hd[1] = commit_buffer[2]; |
786 | curr_hd[2] = commit_buffer[3]; | 767 | curr_hd[2] = commit_buffer[3]; |
787 | mp3_play_pause(true); /* kickoff audio */ | ||
788 | } | 768 | } |
789 | 769 | ||
790 | need_shutup = true; | 770 | need_shutup = true; |
@@ -864,7 +844,7 @@ void talk_init(void) | |||
864 | } | 844 | } |
865 | avg_size = total_size / non_empty; | 845 | avg_size = total_size / non_empty; |
866 | max_clips = MIN((int)(MAX_CLIP_BUFFER_SIZE/avg_size) + 1, non_empty); | 846 | max_clips = MIN((int)(MAX_CLIP_BUFFER_SIZE/avg_size) + 1, non_empty); |
867 | /* account for possible thumb clips */ | 847 | /* account for possible thumb clips */ |
868 | total_size += THUMBNAIL_RESERVE; | 848 | total_size += THUMBNAIL_RESERVE; |
869 | max_clips += 16; | 849 | max_clips += 16; |
870 | voicefile_size = total_size; | 850 | voicefile_size = total_size; |
@@ -1156,19 +1136,19 @@ int talk_number(long n, bool enqueue) | |||
1156 | 1136 | ||
1157 | if (!enqueue) | 1137 | if (!enqueue) |
1158 | talk_shutup(); /* cut off all the pending stuff */ | 1138 | talk_shutup(); /* cut off all the pending stuff */ |
1159 | 1139 | ||
1160 | if (n==0) | 1140 | if (n==0) |
1161 | { /* special case */ | 1141 | { /* special case */ |
1162 | talk_id(VOICE_ZERO, true); | 1142 | talk_id(VOICE_ZERO, true); |
1163 | return 0; | 1143 | return 0; |
1164 | } | 1144 | } |
1165 | 1145 | ||
1166 | if (n<0) | 1146 | if (n<0) |
1167 | { | 1147 | { |
1168 | talk_id(VOICE_MINUS, true); | 1148 | talk_id(VOICE_MINUS, true); |
1169 | n = -n; | 1149 | n = -n; |
1170 | } | 1150 | } |
1171 | 1151 | ||
1172 | while (n) | 1152 | while (n) |
1173 | { | 1153 | { |
1174 | int segment = n / mil; /* extract in groups of 3 digits */ | 1154 | int segment = n / mil; /* extract in groups of 3 digits */ |
@@ -1197,7 +1177,7 @@ int talk_number(long n, bool enqueue) | |||
1197 | /* direct indexing */ | 1177 | /* direct indexing */ |
1198 | if (ones) | 1178 | if (ones) |
1199 | talk_id(VOICE_ZERO + ones, true); | 1179 | talk_id(VOICE_ZERO + ones, true); |
1200 | 1180 | ||
1201 | /* add billion, million, thousand */ | 1181 | /* add billion, million, thousand */ |
1202 | if (mil) | 1182 | if (mil) |
1203 | talk_id(VOICE_THOUSAND + level, true); | 1183 | talk_id(VOICE_THOUSAND + level, true); |
@@ -1261,21 +1241,21 @@ int talk_value(long n, int unit, bool enqueue) | |||
1261 | int talk_value_decimal(long n, int unit, int decimals, bool enqueue) | 1241 | int talk_value_decimal(long n, int unit, int decimals, bool enqueue) |
1262 | { | 1242 | { |
1263 | int unit_id; | 1243 | int unit_id; |
1264 | static const int unit_voiced[] = | 1244 | static const int unit_voiced[] = |
1265 | { /* lookup table for the voice ID of the units */ | 1245 | { /* lookup table for the voice ID of the units */ |
1266 | [0 ... UNIT_LAST-1] = -1, /* regular ID, int, signed */ | 1246 | [0 ... UNIT_LAST-1] = -1, /* regular ID, int, signed */ |
1267 | [UNIT_MS] | 1247 | [UNIT_MS] |
1268 | = VOICE_MILLISECONDS, /* here come the "real" units */ | 1248 | = VOICE_MILLISECONDS, /* here come the "real" units */ |
1269 | [UNIT_SEC] | 1249 | [UNIT_SEC] |
1270 | = VOICE_SECONDS, | 1250 | = VOICE_SECONDS, |
1271 | [UNIT_MIN] | 1251 | [UNIT_MIN] |
1272 | = VOICE_MINUTES, | 1252 | = VOICE_MINUTES, |
1273 | [UNIT_HOUR] | 1253 | [UNIT_HOUR] |
1274 | = VOICE_HOURS, | 1254 | = VOICE_HOURS, |
1275 | [UNIT_KHZ] | 1255 | [UNIT_KHZ] |
1276 | = VOICE_KHZ, | 1256 | = VOICE_KHZ, |
1277 | [UNIT_DB] | 1257 | [UNIT_DB] |
1278 | = VOICE_DB, | 1258 | = VOICE_DB, |
1279 | [UNIT_PERCENT] | 1259 | [UNIT_PERCENT] |
1280 | = VOICE_PERCENT, | 1260 | = VOICE_PERCENT, |
1281 | [UNIT_MAH] | 1261 | [UNIT_MAH] |
@@ -1411,7 +1391,7 @@ int talk_time_intervals(long time, int unit_idx, bool enqueue) | |||
1411 | int talk_spell(const char* spell, bool enqueue) | 1391 | int talk_spell(const char* spell, bool enqueue) |
1412 | { | 1392 | { |
1413 | char c; /* currently processed char */ | 1393 | char c; /* currently processed char */ |
1414 | 1394 | ||
1415 | if (talk_temp_disable_count > 0) | 1395 | if (talk_temp_disable_count > 0) |
1416 | return -1; /* talking has been disabled */ | 1396 | return -1; /* talking has been disabled */ |
1417 | if (!check_audio_status()) | 1397 | if (!check_audio_status()) |
@@ -1419,7 +1399,7 @@ int talk_spell(const char* spell, bool enqueue) | |||
1419 | 1399 | ||
1420 | if (!enqueue) | 1400 | if (!enqueue) |
1421 | talk_shutup(); /* cut off all the pending stuff */ | 1401 | talk_shutup(); /* cut off all the pending stuff */ |
1422 | 1402 | ||
1423 | while ((c = *spell++) != '\0') | 1403 | while ((c = *spell++) != '\0') |
1424 | { | 1404 | { |
1425 | /* if this grows into too many cases, I should use a table */ | 1405 | /* if this grows into too many cases, I should use a table */ |
@@ -1434,7 +1414,7 @@ int talk_spell(const char* spell, bool enqueue) | |||
1434 | else if (c == '+') | 1414 | else if (c == '+') |
1435 | talk_id(VOICE_PLUS, true); | 1415 | talk_id(VOICE_PLUS, true); |
1436 | else if (c == '.') | 1416 | else if (c == '.') |
1437 | talk_id(VOICE_DOT, true); | 1417 | talk_id(VOICE_DOT, true); |
1438 | else if (c == ' ') | 1418 | else if (c == ' ') |
1439 | talk_id(VOICE_PAUSE, true); | 1419 | talk_id(VOICE_PAUSE, true); |
1440 | else if (c == '/') | 1420 | else if (c == '/') |
@@ -1448,7 +1428,7 @@ void talk_disable(bool disable) | |||
1448 | { | 1428 | { |
1449 | if (disable) | 1429 | if (disable) |
1450 | talk_temp_disable_count++; | 1430 | talk_temp_disable_count++; |
1451 | else | 1431 | else |
1452 | talk_temp_disable_count--; | 1432 | talk_temp_disable_count--; |
1453 | } | 1433 | } |
1454 | 1434 | ||
diff --git a/apps/voice_thread.c b/apps/voice_thread.c index 325860be27..171902d10f 100644 --- a/apps/voice_thread.c +++ b/apps/voice_thread.c | |||
@@ -121,7 +121,7 @@ enum voice_thread_messages | |||
121 | struct voice_info | 121 | struct voice_info |
122 | { | 122 | { |
123 | /* Callback to get more clips */ | 123 | /* Callback to get more clips */ |
124 | mp3_play_callback_t get_more; | 124 | voice_play_callback_t get_more; |
125 | /* Start of clip */ | 125 | /* Start of clip */ |
126 | const void *start; | 126 | const void *start; |
127 | /* Size of clip */ | 127 | /* Size of clip */ |
@@ -276,8 +276,8 @@ static void voice_buf_commit(int count) | |||
276 | } | 276 | } |
277 | 277 | ||
278 | /* Stop any current clip and start playing a new one */ | 278 | /* Stop any current clip and start playing a new one */ |
279 | void mp3_play_data(const void *start, size_t size, | 279 | void voice_play_data(const void *start, size_t size, |
280 | mp3_play_callback_t get_more) | 280 | voice_play_callback_t get_more) |
281 | { | 281 | { |
282 | if (voice_thread_id && start && size && get_more) | 282 | if (voice_thread_id && start && size && get_more) |
283 | { | 283 | { |
@@ -294,7 +294,7 @@ void mp3_play_data(const void *start, size_t size, | |||
294 | } | 294 | } |
295 | 295 | ||
296 | /* Stop current voice clip from playing */ | 296 | /* Stop current voice clip from playing */ |
297 | void mp3_play_stop(void) | 297 | void voice_play_stop(void) |
298 | { | 298 | { |
299 | if (voice_thread_id != 0) | 299 | if (voice_thread_id != 0) |
300 | { | 300 | { |
@@ -303,18 +303,6 @@ void mp3_play_stop(void) | |||
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | void mp3_play_pause(bool play) | ||
307 | { | ||
308 | /* a dummy */ | ||
309 | (void)play; | ||
310 | } | ||
311 | |||
312 | /* Tell if voice is still in a playing state */ | ||
313 | bool mp3_is_playing(void) | ||
314 | { | ||
315 | return voice_playing; | ||
316 | } | ||
317 | |||
318 | /* This function is meant to be used by the buffer request functions to | 306 | /* This function is meant to be used by the buffer request functions to |
319 | ensure the codec is no longer active */ | 307 | ensure the codec is no longer active */ |
320 | void voice_stop(void) | 308 | void voice_stop(void) |
diff --git a/apps/voice_thread.h b/apps/voice_thread.h index 8a17ee09e3..d662aaee33 100644 --- a/apps/voice_thread.h +++ b/apps/voice_thread.h | |||
@@ -23,16 +23,14 @@ | |||
23 | 23 | ||
24 | #include "config.h" | 24 | #include "config.h" |
25 | 25 | ||
26 | #ifndef MP3_PLAY_CALLBACK_DEFINED | 26 | #ifndef VOICE_PLAY_CALLBACK_DEFINED |
27 | #define MP3_PLAY_CALLBACK_DEFINED | 27 | #define VOICE_PLAY_CALLBACK_DEFINED |
28 | typedef void (*mp3_play_callback_t)(const void **start, size_t *size); | 28 | typedef void (*voice_play_callback_t)(const void **start, size_t *size); |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | void mp3_play_data(const void *start, size_t size, | 31 | void voice_play_data(const void *start, size_t size, |
32 | mp3_play_callback_t get_more); | 32 | voice_play_callback_t get_more); |
33 | void mp3_play_stop(void); | 33 | void voice_play_stop(void); |
34 | void mp3_play_pause(bool play); | ||
35 | bool mp3_is_playing(void); | ||
36 | 34 | ||
37 | void voice_wait(void); | 35 | void voice_wait(void); |
38 | void voice_stop(void); | 36 | void voice_stop(void); |
diff --git a/docs/PLUGIN_API b/docs/PLUGIN_API index 1febe9fdf4..84c203c05a 100644 --- a/docs/PLUGIN_API +++ b/docs/PLUGIN_API | |||
@@ -402,7 +402,7 @@ int count_mp3_frames(int fd, int startpos, int filesize, void (*progressfunc)(in | |||
402 | \description | 402 | \description |
403 | 403 | ||
404 | void cpu_boost(bool on_off) | 404 | void cpu_boost(bool on_off) |
405 | \conditions (!defined(SIMULATOR)) && (defined(HAVE_ADJUSTABLE_CPU_FREQ)) && !defined(CPU_BOOST_LOGGING) | 405 | \conditions (!defined(SIMULATOR)) && (defined(HAVE_ADJUSTABLE_CPU_FREQ)) && !defined(CPU_BOOST_LOGGING) |
406 | \param on_off | 406 | \param on_off |
407 | \description Boosts the CPU if =on_off= is true, otherwise it unboosts the CPU | 407 | \description Boosts the CPU if =on_off= is true, otherwise it unboosts the CPU |
408 | 408 | ||
@@ -1368,31 +1368,6 @@ bool mp3info(struct mp3entry *entry, const char *filename) | |||
1368 | \return FALSE if successfull | 1368 | \return FALSE if successfull |
1369 | \description The given =entry= is filled in with whatever id3 info it could find about the given =filename= | 1369 | \description The given =entry= is filled in with whatever id3 info it could find about the given =filename= |
1370 | 1370 | ||
1371 | bool mp3_is_playing(void) | ||
1372 | \group sound | ||
1373 | \conditions (!defined(SIMULATOR)) | ||
1374 | \return true if an mp3 is playing, else return false | ||
1375 | \description Note: a paused mp3 is considered as a playing mp3 | ||
1376 | |||
1377 | void mp3_play_data(const unsigned char* start, int size, void (*get_more)(unsigned char** start, size_t* size)) | ||
1378 | \group sound | ||
1379 | \conditions (!defined(SIMULATOR)) | ||
1380 | \param start points to the begining of the file to play | ||
1381 | \param size is the size to play | ||
1382 | \param get_more is a callback function | ||
1383 | \description Plays a chunk of an mp3 file | ||
1384 | |||
1385 | void mp3_play_pause(bool play) | ||
1386 | \group sound | ||
1387 | \conditions (!defined(SIMULATOR)) | ||
1388 | \param play | ||
1389 | \description If playback was paused and =play= is TRUE, resume playback. If playback isn't paused and =play= is FALSE, pause playback. | ||
1390 | |||
1391 | void mp3_play_stop(void) | ||
1392 | \group sound | ||
1393 | \conditions (!defined(SIMULATOR)) | ||
1394 | \description Stops playback | ||
1395 | |||
1396 | void mutex_init(struct mutex *m) | 1371 | void mutex_init(struct mutex *m) |
1397 | \group kernel/ system | 1372 | \group kernel/ system |
1398 | \param m | 1373 | \param m |
@@ -1470,7 +1445,7 @@ void pcm_play_data(pcm_more_callback_type get_more, unsigned char* start, size_t | |||
1470 | \param get_more Optional callback | 1445 | \param get_more Optional callback |
1471 | \param start is the address of raw 16-16, interleaved PCM data | 1446 | \param start is the address of raw 16-16, interleaved PCM data |
1472 | \param size is the size of the data to play | 1447 | \param size is the size of the data to play |
1473 | \description May be used without the callback parameter in order to play a single clip. If you wish to play sound continuously, then use the callback instead and return the buffer address and size to be played from that callback. Every time that a buffer is played out, the callback is asked for the next buffer to play but without stopping and starting playback. The callback is called asynchronously in interrupt context so what you may do in there is limited. | 1448 | \description May be used without the callback parameter in order to play a single clip. If you wish to play sound continuously, then use the callback instead and return the buffer address and size to be played from that callback. Every time that a buffer is played out, the callback is asked for the next buffer to play but without stopping and starting playback. The callback is called asynchronously in interrupt context so what you may do in there is limited. |
1474 | 1449 | ||
1475 | void pcm_play_lock(void) | 1450 | void pcm_play_lock(void) |
1476 | \group sound | 1451 | \group sound |
@@ -2031,8 +2006,8 @@ struct gui_syncstatusbar *statusbars | |||
2031 | 2006 | ||
2032 | int strcasecmp(const char *, const char *) | 2007 | int strcasecmp(const char *, const char *) |
2033 | \group strings and memory | 2008 | \group strings and memory |
2034 | \param | 2009 | \param |
2035 | \param | 2010 | \param |
2036 | \return an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2 | 2011 | \return an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2 |
2037 | \description The strcasecmp() function compares the two strings s1 and s2, ignoring the case of the characters | 2012 | \description The strcasecmp() function compares the two strings s1 and s2, ignoring the case of the characters |
2038 | 2013 | ||
@@ -2052,8 +2027,8 @@ char *strchr(const char *s, int c) | |||
2052 | 2027 | ||
2053 | int strcmp(const char *, const char *) | 2028 | int strcmp(const char *, const char *) |
2054 | \group strings and memory | 2029 | \group strings and memory |
2055 | \param | 2030 | \param |
2056 | \param | 2031 | \param |
2057 | \return | 2032 | \return |
2058 | \description strcmp() compares the string a to string b. If a sorts lexicographically after b, strcmp returns a number greater than zero. If the two strings match, strcmp returns zero. If a sorts lexicographically before b, strcmp returns a number less than zero. | 2033 | \description strcmp() compares the string a to string b. If a sorts lexicographically after b, strcmp returns a number greater than zero. If the two strings match, strcmp returns zero. If a sorts lexicographically before b, strcmp returns a number less than zero. |
2059 | 2034 | ||
@@ -2081,8 +2056,8 @@ int strncasecmp(const char *s1, const char *s2, size_t n) | |||
2081 | 2056 | ||
2082 | int strncmp(const char *, const char *, size_t) | 2057 | int strncmp(const char *, const char *, size_t) |
2083 | \group strings and memory | 2058 | \group strings and memory |
2084 | \param | 2059 | \param |
2085 | \param | 2060 | \param |
2086 | \param size_t | 2061 | \param size_t |
2087 | \return | 2062 | \return |
2088 | \description | 2063 | \description |