'/* Copyright (C) 2010, 2011  Olga Yakovleva <yakovleva.o.v@gmail.com> */

'/* This program is free software: you can redistribute it and/or modify */
'/* it under the terms of the GNU General Public License as published by */
'/* the Free Software Foundation, either version 3 of the License, or */
'/* (at your option) any later version. */

'/* This program is distributed in the hope that it will be useful, */
'/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
'/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
'/* GNU General Public License for more details. */

'/* You should have received a copy of the GNU General Public License */
'/* along with this program.  If not, see <http://www.gnu.org/licenses/>. */
' *** adapted headers for FreeBasic by electrik

#ifndef RHVOICE_bi
#define RHVOICE_bi

extern "c" lib "rhvoice"
  type RHVoice_message_s as any
  type as RHVoice_message_s ptr RHVoice_message

  enum RHVoice_init_option
    RHVoice_preload_voices=1
  end enum

  enum RHVoice_message_type
    RHVoice_message_text
    RHVoice_message_ssml
    RHVoice_message_characters
  end enum

  enum RHVoice_event_type
    RHVoice_event_word_start
    RHVoice_event_word_end
    RHVoice_event_sentence_start
    RHVoice_event_sentence_end
    RHVoice_event_mark
    RHVoice_event_play
  end enum


union id_
      as const zstring ptr name         '/* For marks and audio elements */
      as integer number               '/* For words and sentences */
end union

  type  RHVoice_event
    as RHVoice_message message
    as RHVoice_event_type type
    as integer text_position          '/* in unicode characters */
    as integer text_length            '/* in unicode characters */
    as integer audio_position
    union 
id as id_
    end union
  end type

  type RHVoice_callback as function (byval samples as const short ptr,byval num_samples as integer,byval events as const RHVoice_event ptr,byval num_events as integer,byval message as RHVoice_message) as integer

  enum RHVoice_position_type
    RHVoice_position_word
    RHVoice_position_sentence
    RHVoice_position_mark
  end enum

    union id2
      as integer number
      as const zstring ptr name
    end union

  type RHVoice_position
    as RHVoice_position_type ptype
union
id as id2
end union
  end type

  enum RHVoice_punctuation_mode
    RHVoice_punctuation_none
    RHVoice_punctuation_all
    RHVoice_punctuation_some
  end enum 

  enum RHVoice_voice_gender
    RHVoice_voice_gender_unknown
    RHVoice_voice_gender_male
    RHVoice_voice_gender_female
  end enum

  '/* This mode applies to reading by characters. */
  enum RHVoice_capitals_mode
    RHVoice_capitals_off
    RHVoice_capitals_pitch
    RHVoice_capitals_sound
  end enum

  '/* Under Windows we assume that the paths are in UTF-8 */
  '/* This function returns sample rate on success and 0 on error */
declare function RHVoice_initialize(byval data_path as const zstring ptr,byval callback as RHVoice_callback ptr,byval cfg_path as const zstring ptr,byval options as uinteger) as integer
declare sub RHVoice_terminate()

  '/* The following three functions accept only valid unicode strings */
  declare function RHVoice_new_message_utf8(byval text as const any ptr,byval length as integer,byval mtype as RHVoice_message_type) as RHVoice_message
  declare function RHVoice_new_message_utf16(byval text as const any ptr,byval length as integer,byval mtype as RHVoice_message_type) as RHVoice_message
  declare function RHVoice_new_message_utf32(byval text as const any ptr,byval length as integer,byval mtype as RHVoice_message_type) as RHVoice_message

  declare sub RHVoice_delete_message(byval message as RHVoice_message)
  declare function RHVoice_speak(byval message as RHVoice_message) as integer
  declare function RHVoice_get_xml_base(byval message as RHVoice_message) as const zstring ptr
  declare function RHVoice_set_position(byval message as RHVoice_message,byval position as const RHVoice_position ptr) as integer
  declare function RHVoice_get_word_count(byval message as RHVoice_message) as integer
  declare function RHVoice_get_sentence_count(byval message as RHVoice_message) as integer
  declare sub  RHVoice_set_rate(byval rate as single)
  declare function RHVoice_get_rate() as single
  declare sub RHVoice_set_pitch(byval pitch as single)
  declare function RHVoice_get_pitch() as single
  declare sub RHVoice_set_volume(byval volume as single)
  declare function RHVoice_get_volume() as single
  declare function RHVoice_get_min_rate() as single
  declare function RHVoice_get_default_rate() as single
  declare function RHVoice_get_max_rate() as single
  declare function RHVoice_get_min_pitch() as single
  declare function RHVoice_get_default_pitch() as single
  declare function RHVoice_get_max_pitch() as single
  declare function RHVoice_get_default_volume() as single
  declare function RHVoice_get_max_volume() as single

  declare sub RHVoice_set_variant(byval variant as integer)
  declare function RHVoice_get_variant() as integer
  declare function RHVoice_get_variant_count() as integer
  declare function RHVoice_get_variant_name(byval variant as integer) as const zstring ptr
  declare function RHVoice_find_variant(byval name as const zstring ptr) as integer

  declare function RHVoice_get_voice_count() as integer
  declare function RHVoice_get_voice_name(byval id as integer) as const zstring ptr
  declare function RHVoice_get_voice_gender(byval id as integer) as RHVoice_voice_gender
  declare function RHVoice_find_voice(byval name as const zstring ptr) as integer
  declare sub RHVoice_set_voice(byval id as integer)
  declare function RHVoice_get_voice() as integer

  declare sub RHVoice_set_punctuation_mode(byval mode as RHVoice_punctuation_mode)
  declare function RHVoice_get_punctuation_mode() as RHVoice_punctuation_mode
  declare sub RHVoice_set_punctuation_list(byval list as const zstring ptr)

  declare sub RHVoice_set_capitals_mode(mode as RHVoice_capitals_mode)
  declare function RHVoice_get_capitals_mode() as RHVoice_capitals_mode

  declare sub RHVoice_set_user_data(byval message as RHVoice_message,byval data as any ptr)
  declare function RHVoice_get_user_data(byval message as RHVoice_message) as any ptr

  declare sub RHVoice_set_message_rate(byval message as RHVoice_message,byval rate as single)
  declare sub RHVoice_set_message_pitch(byval message as RHVoice_message,byval pitch as single)
  declare sub RHVoice_set_message_volume(byval message as RHVoice_message,byval volume as single)

  declare function RHVoice_get_version() as const zstring ptr
end extern
#endif
