@@ 3,6 3,7 @@
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <pthread.h>
#include "HsFFI.h"
#include <espeak-ng/espeak_ng.h>
@@ 55,9 56,20 @@ int read_mono(SNDFILE *fd, SF_INFO *info, short *out) {
return i;
}
+pthread_mutex_t marker_mutex = PTHREAD_MUTEX_INITIALIZER;
+int paragraph_no, section_no;
+int tablerow, tablecol, tableno, in_table;
int capture_marks(short *wav, int numsamples, espeak_EVENT *events) {
while (events->type != 0) {
- if (events->type == espeakEVENT_MARK) printf("%s:\n", events->id.name);
+ if (events->type == espeakEVENT_MARK) {
+ pthread_mutex_lock(&marker_mutex);
+ in_table = 0;
+ if (sscanf(events->id.name, "-rhaps-paragraph%i", ¶graph_no) == 1) {}
+ else if (sscanf(events->id.name, "-rhaps-section%i", §ion_no) == 1) {}
+ else if (sscanf(events->id.name, "-rhaps-tablecell%i:%ix%i",
+ &tableno, &tablerow, &tablecol) == 3) {in_table = 1;}
+ pthread_mutex_unlock(&marker_mutex);
+ }
events++;
}
return 0;