Browse Source

Move the espeak callback APIs to espeak_api.c.

master
Reece H. Dunn 9 years ago
parent
commit
5e42051a30
2 changed files with 22 additions and 18 deletions
  1. 22
    0
      src/libespeak-ng/espeak_api.c
  2. 0
    18
      src/libespeak-ng/speech.c

+ 22
- 0
src/libespeak-ng/espeak_api.c View File

@@ -1,5 +1,7 @@
/* An implementation of the eSpeak API using the espeak-ng API.
*
* Copyright (C) 2005 to 2013 by Jonathan Duddington
* email: [email protected]
* Copyright (C) 2016 Reece H. Dunn
*
* This program is free software; you can redistribute it and/or modify
@@ -32,6 +34,8 @@
#include "synthesize.h"
#include "translate.h"

#include "event.h"

static espeak_ERROR status_to_espeak_error(espeak_ng_STATUS status)
{
switch (status)
@@ -80,6 +84,24 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length
return espeak_ng_GetSampleRate();
}

ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback *SynthCallback)
{
synth_callback = SynthCallback;
#ifdef USE_ASYNC
event_set_callback(synth_callback);
#endif
}

ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char *, const char *))
{
uri_callback = UriCallback;
}

ESPEAK_API void espeak_SetPhonemeCallback(int (*PhonemeCallback)(const char *))
{
phoneme_callback = PhonemeCallback;
}

ESPEAK_API espeak_ERROR espeak_Key(const char *key_name)
{
return status_to_espeak_error(espeak_ng_SpeakKeyName(key_name));

+ 0
- 18
src/libespeak-ng/speech.c View File

@@ -613,24 +613,6 @@ void sync_espeak_SetPunctuationList(const wchar_t *punctlist)

#pragma GCC visibility push(default)

ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback *SynthCallback)
{
synth_callback = SynthCallback;
#ifdef USE_ASYNC
event_set_callback(synth_callback);
#endif
}

ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char *, const char *))
{
uri_callback = UriCallback;
}

ESPEAK_API void espeak_SetPhonemeCallback(int (*PhonemeCallback)(const char *))
{
phoneme_callback = PhonemeCallback;
}

ESPEAK_API espeak_ERROR espeak_Synth(const void *text, size_t size,
unsigned int position,
espeak_POSITION_TYPE position_type,

Loading…
Cancel
Save