Class: Loquendo

Inherits:
Object
  • Object
show all
Defined in:
lib/loquendo.rb,
lib/loquendo/version.rb

Defined Under Namespace

Classes: CommandNotFound, InvalidVoice

Constant Summary collapse

VALID_VOICES =
[:fernanda, :ludoviko]
VERSION =
'0.0.2'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Loquendo

Returns a new instance of Loquendo.



13
14
15
16
17
18
19
20
# File 'lib/loquendo.rb', line 13

def initialize(opts = {})
  @command_dir = opts[:command_dir] || '/opt/Loquendo/LTTS7/bin'
  @command     = opts[:command]     || 'SaveFile-alaw'
  @sound_dir   = opts[:sound_dir]   || Dir::tmpdir
  @sound_file  = opts[:sound_file]  || 'ltts'
  @voice       = opts[:voice]       || :fernanda
  self.session = opts[:session]     || '/opt/Loquendo/LTTS7/bin/default.session'
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



8
9
10
# File 'lib/loquendo.rb', line 8

def command
  @command
end

#command_dirObject

Returns the value of attribute command_dir.



8
9
10
# File 'lib/loquendo.rb', line 8

def command_dir
  @command_dir
end

#sound_dirObject

Returns the value of attribute sound_dir.



8
9
10
# File 'lib/loquendo.rb', line 8

def sound_dir
  @sound_dir
end

#sound_fileObject

Returns the value of attribute sound_file.



8
9
10
# File 'lib/loquendo.rb', line 8

def sound_file
  @sound_file
end

#voiceObject

Returns the value of attribute voice.



8
9
10
# File 'lib/loquendo.rb', line 8

def voice
  @voice
end

Class Method Details

.convert(string, opts = {}) ⇒ Object



22
23
24
25
# File 'lib/loquendo.rb', line 22

def self.convert(string, opts = {})
  ltts = Loquendo.new(opts)
  ltts.convert(string)
end

.convert_to_file(string, opts = {}) ⇒ Object



27
28
29
30
# File 'lib/loquendo.rb', line 27

def self.convert_to_file(string, opts = {})
  ltts = Loquendo.new(opts)
  ltts.convert_to_file(string)
end

Instance Method Details

#command_pathObject



52
53
54
# File 'lib/loquendo.rb', line 52

def command_path
  command_dir + '/' + command
end

#convert(string) ⇒ Object



40
41
42
43
44
# File 'lib/loquendo.rb', line 40

def convert(string)
  check_for_command
  validate_voice
  _convert(string)
end

#convert_to_file(string) ⇒ Object



46
47
48
49
50
# File 'lib/loquendo.rb', line 46

def convert_to_file(string)
  check_for_command
  validate_voice
  _convert_to_file(string)
end

#sessionObject



32
33
34
# File 'lib/loquendo.rb', line 32

def session
  ENV['LTTS7_DEFAULTSESSION']
end

#session=(default_session) ⇒ Object



36
37
38
# File 'lib/loquendo.rb', line 36

def session=(default_session)
  ENV['LTTS7_DEFAULTSESSION'] = default_session
end

#sound_pathObject



56
57
58
# File 'lib/loquendo.rb', line 56

def sound_path
  sound_dir + '/' + sound_file
end