freetts 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org/"
2
+
3
+ gemspec
@@ -1,3 +1,3 @@
1
1
  module FreeTTS
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -9,13 +9,25 @@ module FreeTTS
9
9
  MODIFIABLE_ATTRIBUTES = %w( duration_stretch pitch pitch_range pitch_shift
10
10
  rate volume )
11
11
 
12
+ class << self
13
+ attr_reader :voice_manager
14
+
15
+ def all
16
+ voice_manager.get_voices.map { |voice| voice.get_name }
17
+ end
18
+
19
+ def for_name(voice_name)
20
+ voice = voice_manager.get_voice(voice_name)
21
+ if voice
22
+ voice.allocate
23
+ Voice.new(voice)
24
+ else
25
+ raise "No voice found for name \"#{ voice_name }\""
26
+ end
27
+ end
28
+ end
12
29
 
13
30
  @voice_manager = com.sun.speech.freetts.VoiceManager.get_instance
14
- class << self; attr_reader :voice_manager; end
15
- #class << self
16
- # attr_accessor :voice_manager
17
- # @voice_manager = com.sun.speech.freetts.VoiceManager.get_instance
18
- #end
19
31
 
20
32
  ACCESSIBLE_ATTRIBUTES.each do |attribute|
21
33
  ruby_method = attribute.to_sym
@@ -36,35 +48,5 @@ module FreeTTS
36
48
  def speak(saying)
37
49
  @voice_impl.speak(saying)
38
50
  end
39
-
40
- def method_missing(method, *args, &block)
41
- method = method.to_s
42
- java_method_name = case method
43
- when /\A(.*)=\Z/
44
- "set_#{ $1 }"
45
- when /\A(.*)\Z/
46
- "get_#{ $1 }"
47
- end
48
-
49
- if java_method_name and @voice_impl.respond_to?(java_method_name.to_sym)
50
- return @voice_impl.send(java_method_name.to_sym, *args)
51
- else
52
- error_message = "undefined method #{ method } for #{ self }:Voice"
53
- raise NoMethodError.new(error_message)
54
- end
55
- end
56
-
57
- def self.all
58
- voice_manager.get_voices.map { |voice| voice.get_name }
59
- end
60
-
61
- def self.for_name(voice_name)
62
- if voice = voice_manager.get_voice(voice_name)
63
- voice.allocate
64
- Voice.new(voice)
65
- else
66
- raise "no voice found for name \"#{ voice_name }\""
67
- end
68
- end
69
51
  end
70
52
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: freetts
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Chris kottom
@@ -21,6 +21,7 @@ extra_rdoc_files: []
21
21
  files:
22
22
  - .gitignore
23
23
  - .rvmrc.example
24
+ - Gemfile
24
25
  - README.md
25
26
  - bin/freetts
26
27
  - examples/hello_world.rb