mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-01 14:30:37 +00:00
[1.25.15] Callback in AUDIO_OUTPUT_PLAYBACK mode gives a zero-terminated list of events.
espeak_SetSynthCallback() can be called either before or after espeak_Initialize(). git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@31 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+11
-4
@@ -74,13 +74,16 @@ static void* polling_thread(void*);
|
||||
|
||||
//>
|
||||
//<event_init
|
||||
void event_init(t_espeak_callback* SynthCallback)
|
||||
|
||||
void event_set_callback(t_espeak_callback* SynthCallback)
|
||||
{
|
||||
my_callback = SynthCallback;
|
||||
}
|
||||
|
||||
void event_init(void)
|
||||
{
|
||||
ENTER("event_init");
|
||||
|
||||
my_callback = SynthCallback;
|
||||
SHOW("event_init > my_callback=0x%x\n", my_callback);
|
||||
|
||||
my_event_is_running=0;
|
||||
|
||||
// security
|
||||
@@ -193,6 +196,10 @@ ENTER("event_notify");
|
||||
|
||||
static unsigned int a_old_uid = 0;
|
||||
|
||||
espeak_EVENT events[2];
|
||||
memcpy(&events[0],event,sizeof(espeak_EVENT)); // the event parameter in the callback function should be an array of eventd
|
||||
events[1].type = espeakEVENT_LIST_TERMINATED; // ... terminated by an event type=0
|
||||
|
||||
if (event && my_callback)
|
||||
{
|
||||
event_display(event);
|
||||
|
||||
+2
-1
@@ -27,7 +27,8 @@ Note: the timeout is checked against the real progress of the audio stream, whic
|
||||
// First function to be called.
|
||||
// the callback will be called when the event actually occurs.
|
||||
// The callback is detailled in speak_lib.h .
|
||||
void event_init(t_espeak_callback* cb);
|
||||
void event_init(void);
|
||||
void event_set_callback(t_espeak_callback* cb);
|
||||
|
||||
// Clear any pending event.
|
||||
//
|
||||
|
||||
+4
-1
@@ -225,7 +225,7 @@ static void select_output(espeak_AUDIO_OUTPUT output_type)
|
||||
wave_init();
|
||||
wave_set_callback_is_output_enabled( fifo_is_command_enabled);
|
||||
my_audio = wave_open("alsa");
|
||||
event_init(synth_callback);
|
||||
event_init();
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -624,6 +624,9 @@ ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback)
|
||||
{//======================================================================
|
||||
ENTER("espeak_SetSynthCallback");
|
||||
synth_callback = SynthCallback;
|
||||
#ifdef USE_ASYNC
|
||||
event_set_callback(synth_callback);
|
||||
#endif
|
||||
}
|
||||
|
||||
ESPEAK_API void espeak_SetUriCallback(int (* UriCallback)(int, const char*, const char *))
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.25.14 31.May.07";
|
||||
const char *version_string = "1.25.15 01.Jun.07";
|
||||
const int version_phdata = 0x012514;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
@@ -343,7 +343,7 @@ Translator *SelectTranslator(const char *name)
|
||||
case L('i','s'): // Icelandic
|
||||
{
|
||||
static int stress_amps_is[] = {16,16, 20,20, 20,24, 24,22 };
|
||||
static int stress_lengths_is[8] = {180,155, 200,200, 0,0, 240,250};
|
||||
static int stress_lengths_is[8] = {180,160, 200,200, 0,0, 240,250};
|
||||
static const wchar_t is_lettergroup_B[] = {'c','f','h','k','p','t','x',0xfe,0}; // voiceless conants, including 'þ' ?? 's'
|
||||
|
||||
tr = new Translator();
|
||||
|
||||
Reference in New Issue
Block a user