Skip to content

Commit 881f577

Browse files
committed
Speech: Handle empty string correctly.
1 parent b65e345 commit 881f577

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

source/microbit/modspeech.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,20 @@ typedef struct _speech_iterator_t {
7070
/** This iterator assumes that the speech renderer can generate samples
7171
* at least as fast as we can consume them */
7272
static mp_obj_t next(mp_obj_t iter) {
73-
// May need to wait for reciter to do its job before renderer generate samples.
74-
if (!rendering) {
75-
return ((speech_iterator_t *)iter)->empty;
76-
}
7773
if (exhausted) {
7874
return MP_OBJ_STOP_ITERATION;
7975
}
8076
if (last_frame) {
8177
exhausted = true;
8278
last_frame = false;
8379
}
84-
buf_start_pos += 32;
85-
return buf;
80+
// May need to wait for reciter to do its job before renderer generate samples.
81+
if (rendering) {
82+
buf_start_pos += 32;
83+
return buf;
84+
} else {
85+
return ((speech_iterator_t *)iter)->empty;
86+
}
8687
}
8788

8889
const mp_obj_type_t speech_iterator_type = {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy