[vala-extra-vapis/wip/espeak: 2/4] espeak: fixed data types and missing struct param
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala-extra-vapis/wip/espeak: 2/4] espeak: fixed data types and missing struct param
- Date: Mon, 29 Jun 2020 07:18:42 +0000 (UTC)
commit ae1aeacacf9d982f8c5becde1820257beb6cbee0
Author: Daniel Brendle <elbren gitlab gnome org>
Date: Tue Jun 23 10:38:36 2020 +0200
espeak: fixed data types and missing struct param
* use unowned string to map const char*
* use uchar for unsigned char
* added missing unique_id field to Espeak.Voice
libespeak.vapi => espeak.vapi | 114 ++++++++++++++++++++++++------------------
1 file changed, 66 insertions(+), 48 deletions(-)
---
diff --git a/libespeak.vapi b/espeak.vapi
similarity index 58%
rename from libespeak.vapi
rename to espeak.vapi
index 1e03edf..339627b 100644
--- a/libespeak.vapi
+++ b/espeak.vapi
@@ -1,6 +1,7 @@
/*
* Bindings for espeak
- * Written by Grindhold
+ * Written by Daniel 'grindhold' Brendle 2020
+ * WTFPL-1.0
*
* Potential dragons. Thoroughly only tested the functions i need myself which are:
* - Espeak.initialize
@@ -9,9 +10,25 @@
* - Espeak.terminate
* - Espeak.set_language_by_name
*/
+/**
+ * Espeak voice synthesis library
+ *
+ * Example:
+ *
+ * {{{
+ * public static void main(string[] argv) {
+ * Espeak.initialize(Espeak.AudioOutput.PLAYBACK, 0, null, 0);
+ * string input = "Hello World";
+ * Espeak.synth(input, input.length+1, 0, Espeak.PositionType.CHARACTER, 0, Espeak.CHARS_AUTO, null,
null);
+ * Espeak.synchronize();
+ * Espeak.terminate();
+ * }
+ * }}}
+ * Compile with: --pkg espeak -X -lespeak
+ */
[CCode (cprefix = "espeak", lower_case_cprefix = "espeak_", cheader_filename = "espeak/speak_lib.h")]
namespace Espeak {
- [CCode (cname="espeak_EVENT_TYPE", cprefix="espeakEVENT_")]
+ [CCode (cname = "espeak_EVENT_TYPE", cprefix = "espeakEVENT_")]
public enum EventType {
LIST_TERMINATED,
WORD,
@@ -24,9 +41,10 @@ namespace Espeak {
SAMPLERATE = 8 // internal use, set sample rate
}
- [CCode (cname="espeak_EVENT")]
+ [CCode (cname = "espeak_EVENT")]
public struct Event {
public EventType type;
+ public uint unique_identifier;
public int text_position;
public int length;
public int audio_position;
@@ -35,19 +53,19 @@ namespace Espeak {
[CCode (cname="id.number")]
public int id_number;
[CCode (cname="id.name")]
- public const string id_name;
+ public unowned string id_name;
[CCode (cname="id.string")]
- public char* id_string;
+ public char id_string[8];
}
- [CCode (cname="espeak_POSITION_TYPE", cprefix="POS_")]
+ [CCode (cname = "espeak_POSITION_TYPE", cprefix = "POS_")]
public enum PositionType {
CHARACTER,
WORD,
SENTENCE
}
- [CCode (cname="espeak_AUDIO_OUTPUT", cprefix="AUDIO_OUTPUT_")]
+ [CCode (cname = "espeak_AUDIO_OUTPUT", cprefix = "AUDIO_OUTPUT_")]
public enum AudioOutput {
PLAYBACK,
RETRIEVAL,
@@ -55,7 +73,7 @@ namespace Espeak {
SYNCH_PLAYBACK
}
- [CCode (cname="espeak_ERROR", cprefix="EE_")]
+ [CCode (cname = "espeak_ERROR", cprefix = "EE_")]
public enum Error {
OK,
INTERNAL_ERROR,
@@ -68,29 +86,29 @@ namespace Espeak {
public const int INITIALIZE_DONT_EXIT;
- [CCode (cname="espeak_Initialize")]
+ [CCode (cname = "espeak_Initialize")]
public int initialize(AudioOutput output, int buflength, string? path, int options);
- [CCode (cname="t_espeak_callback")]
+ [CCode (cname = "t_espeak_callback")]
public delegate int Callback (short* s, int i, Event e);
- [CCode (cname="espeak_SetSynthCallback")]
+ [CCode (cname = "espeak_SetSynthCallback")]
public void set_synth_callback(Callback synth_callback);
public delegate int UriCallback(int i, string s1, string s2);
- [CCode (cname="espeak_SetUriCallback")]
+ [CCode (cname = "espeak_SetUriCallback")]
public void set_uri_callback(UriCallback uri_callback);
- [CCode (cname="espeakCHARS_AUTO")]
+ [CCode (cname = "espeakCHARS_AUTO")]
public const int CHARS_AUTO;
- [CCode (cname="espeakCHARS_UTF8")]
+ [CCode (cname = "espeakCHARS_UTF8")]
public const int CHARS_UTF8;
- [CCode (cname="espeakCHARS_8BIT")]
+ [CCode (cname = "espeakCHARS_8BIT")]
public const int CHARS_8BIT;
- [CCode (cname="espeakCHARS_WCHAR")]
+ [CCode (cname = "espeakCHARS_WCHAR")]
public const int CHARS_WCHAR;
- [CCode (cname="espeakCHARS_16BIT")]
+ [CCode (cname = "espeakCHARS_16BIT")]
public const int CHARS_16BIT;
public const int SSML;
@@ -98,19 +116,19 @@ namespace Espeak {
public const int ENDPAUSE;
public const int KEEP_NAMEDATA;
- [CCode (cname="espeak_Synth")]
- public Error synth(void* text, size_t size, int position, PositionType position_type, uint end_position,
uint flags, out uint unique_identifier, out void* user_data);
+ [CCode (cname = "espeak_Synth")]
+ public Error synth(void* text, size_t size, uint position, PositionType position_type, uint
end_position, uint flags, out uint unique_identifier, out void* user_data);
- [CCode (cname="espeak_SynthMark")]
+ [CCode (cname = "espeak_SynthMark")]
public Error synth_mark(void* text, size_t size, string index_mark, uint end_position, uint flags, uint*
unique_identifier, void* user_data);
- [CCode (cname="espeak_Key")]
+ [CCode (cname = "espeak_Key")]
public Error key(string key_name);
- [CCode (cname="espeak_Char")]
+ [CCode (cname = "espeak_Char")]
public Error @char(int16 character);
- [CCode (cname="espeak_PARAMETER", cprefix="espeak")]
+ [CCode (cname = "espeak_PARAMETER", cprefix = "espeak")]
public enum Parameter {
SILENCE,
RATE,
@@ -127,72 +145,72 @@ namespace Espeak {
EMPHASIS,
LINELENGTH,
VOICETYPE,
- [CCode (cname="N_SPEECHPARAM")]
+ [CCode (cname = "N_SPEECHPARAM")]
N_SPEECH_PARAM
}
- [CCode (cname="espeak_PUNCT_TYPE", cprefix="espeakPUNKT_")]
+ [CCode (cname = "espeak_PUNCT_TYPE", cprefix = "espeakPUNKT_")]
public enum PunctType {
NONE,
ALL,
SOME
}
- [CCode (cname="espeak_SetParameter")]
+ [CCode (cname = "espeak_SetParameter")]
public Error set_parameter(Parameter parameter, int @value, int relative);
- [CCode (cname="espeak_GetParameter")]
+ [CCode (cname = "espeak_GetParameter")]
public Error get_parameter(Parameter parameter, int current);
- [CCode (cname="espeak_SetPunctuationList")]
+ [CCode (cname = "espeak_SetPunctuationList")]
public Error set_punctuation_list(ref int16 punctlist);
- [CCode (cname="espeak_SetPhonemeTrace")]
+ [CCode (cname = "espeak_SetPhonemeTrace")]
public void set_phoneme_trace(int @value, out GLib.FileStream stream);
- [CCode (cname="espeak_TextToPhonemes")]
+ [CCode (cname = "espeak_TextToPhonemes")]
public string text_to_phonemes(void** textptr,int textmode, int phonememode);
- [CCode (cname="espeak_CompileDictionary")]
+ [CCode (cname = "espeak_CompileDictionary")]
public void compile_dictionary(string path, GLib.FileStream log, int flags);
- [CCode (cname="espeak_VOICE")]
+ [CCode (cname = "espeak_VOICE")]
public struct Voice {
- const string name;
- const string languages;
- const string identifier;
- char gender;
- char age;
- char variant;
- char xxl;
+ unowned string name;
+ unowned string languages;
+ unowned string identifier;
+ uchar gender;
+ uchar age;
+ uchar variant;
+ uchar xxl;
int score;
void* spare;
}
- [CCode (cname="espeak_ListVoices")]
+ [CCode (cname = "espeak_ListVoices")]
public Voice** list_voices(ref Voice voice_spec);
- [CCode (cname="espeak_SetVoiceByName")]
+ [CCode (cname = "espeak_SetVoiceByName")]
public Error set_voice_by_name(string name);
- [CCode (cname="espeak_setVoiceByProperties")]
+ [CCode (cname = "espeak_setVoiceByProperties")]
public Error set_voice_by_properties(ref Voice voice_spec);
- [CCode (cname="espeak_GetCurrentVoice")]
+ [CCode (cname = "espeak_GetCurrentVoice")]
public Voice* get_current_voice();
- [CCode (cname="espeak_Cancel")]
+ [CCode (cname = "espeak_Cancel")]
public Error cancel();
- [CCode (cname="espeak_IsPlaying")]
+ [CCode (cname = "espeak_IsPlaying")]
public int is_playing();
- [CCode (cname="espeak_Synchronize")]
+ [CCode (cname = "espeak_Synchronize")]
public Error synchronize();
- [CCode (cname="espeak_Terminate")]
+ [CCode (cname = "espeak_Terminate")]
public Error terminate();
- [CCode (cname="espeak_Info")]
+ [CCode (cname = "espeak_Info")]
public string info(out string path_data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]