win32-loquendo 1.1.2-x86-mingw32 → 1.2.0-x86-mingw32

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWViNGMxNWQ5MzQyMzg5MDM5Y2JkYmQzMzBkMmYzYzIyYzI0NmRhNw==
4
+ ZDk1MDQ3MTJjMDMzNmZkMTZiOWM4M2M5YWFjZGM0YTQxZDIxZjk3NQ==
5
5
  data.tar.gz: !binary |-
6
- NDEyMjhhNTU5OWIxMmE2Yzc0MWI2YzY3ODcxNTk5ZDQ2MGZmOTNiYQ==
6
+ MmI0YjE1MjU0ZmFmYzk3ODkyNWNjOWI3YmZhMjFiMzQwOTIyNmU3OQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWJkMTgyOThhMjJkNjhmMGYzNjM4Y2U0NDhhMmI1ODU1YjJhY2Y2YzQyMzVk
10
- NmIyZjJlNDY0MTU0OWI0ZWIzYjg4M2Y4ZGQ4NGU5NDY3MDI3MGUyYmNlZGQw
11
- ZDdjZWJjNjk0OWYwZTZjYmMyYzc1ZmViYzgwMzFlZThiMjVhZGM=
9
+ ZTNmNWRjNDg5YTliODc0MDY3OTg2NTg1NDc5NGVhMmQ0NTgzMTM0MzE0NGNl
10
+ N2RkMmFlMzM5NzNiZWEyMzI3NTQ5ODJjOTEwYmUyNmI3OTc4ZDA3MzUxZWI2
11
+ OGRkNzczYzQ4YWY2NjQ5NzlmNTdkM2Y0MDA5YzNlZDYxMDExOTI=
12
12
  data.tar.gz: !binary |-
13
- YTA0OTA1N2ZjMjNlNjIzOWQ2YmY1YThiYzUyNGQyYzEwZmQzZWQ4OGUyMzlj
14
- NjgwYmFhNjkyMmJlNGIxZThhMzRkOGI5YjQzZGViYmMyNWQzMjUwNTIyNjM0
15
- ZGZmNjRkNmU0ZWE5MTdiZDBiMjhmMmU1NmIzN2JlYzZiZWJhNWU=
13
+ NDZkMDUwZGU5YjY4ZDk0YjQzYWNhMTM3ZGMzYzZiNGRhNDZhNTcxZDNiMDUz
14
+ MjE0OTllYzA4NGZkODc4MDNmNjk0YmNlMmVjN2E2OGE2NWVjMjcyMGJmNmUz
15
+ YmExZTkzODJkNTI0YzY4YWY0OTk5ZDgwOTI1NDNhNjk5ZjYzYzg=
data/README.md CHANGED
@@ -84,7 +84,8 @@ The command line program is named `say`
84
84
 
85
85
  Usage: say [OPTIONS] [TEXT]
86
86
 
87
- TEXT is the text you want to be spoken
87
+ TEXT is the text you want to be spoken.
88
+ If no text is provided as arguments, text will be fetched from STDIN instead.
88
89
 
89
90
  Options:
90
91
  -c (1|2) audio channels to use
data/bin/say CHANGED
@@ -11,19 +11,22 @@ def usage
11
11
  " -h show this help text",
12
12
  " -l lists the available voices",
13
13
  " -s N sample rate in Hz",
14
- " -v voice is the voice to use for speaking (default: #{Win32::Loquendo::Reader.default_voice})"
14
+ " -v voice is the voice to use for speaking (default: #{Win32::Loquendo::Reader.default_voice})",
15
+ " -V verbose, displays the voice used"
15
16
  exit(1)
16
17
  end
17
18
 
18
19
  def parse_opts
19
- h = {:text=>[], :cmd=>:speak, :channels=>2, :sample_rate=>32000, :file=>nil}
20
+ h = {:text=>[], :cmd=>:speak, :channels=>2, :sample_rate=>32000, :file=>nil, :voice=>Win32::Loquendo::Reader.default_voice}
20
21
  while arg = ARGV.shift
21
22
  case arg
22
23
  when /^-(h|\?)/i then usage
23
24
  when '-l' then h[:cmd] = :list
24
25
  when '-c' then h[:channels] = ARGV.shift.to_i
25
26
  when '-s' then h[:sample_rate] = ARGV.shift.to_i
27
+ when '-f' then h[:file] = ARGV.shift
26
28
  when '-v' then h[:voice] = ARGV.shift
29
+ when '-V' then h[:verbose] = true
27
30
  else
28
31
  h[:text] << arg
29
32
  end
@@ -32,15 +35,27 @@ def parse_opts
32
35
  h
33
36
  end
34
37
 
38
+ def error(msg)
39
+ puts msg
40
+ exit(1)
41
+ end
42
+
35
43
  opts = parse_opts
36
44
  opts[:text] = STDIN if opts[:text].empty?
37
45
 
38
46
  trap(:INT){ exit(1) }
39
47
 
48
+ if opts[:voice]
49
+ v = Win32::Loquendo::Reader.voices.find{|s| s.downcase.index(opts[:voice].downcase) }
50
+ error "No such voice: #{opts[:voice]}" unless v
51
+ opts[:voice] = v
52
+ end
53
+
40
54
  reader = Win32::Loquendo::Reader.new(opts)
41
55
  if opts[:cmd] == :list
42
56
  puts reader.voices.join(", ")
43
57
  else
58
+ puts "Using voice: #{v}" if opts[:verbose]
44
59
  if opts[:file]
45
60
  reader.write(opts[:file], opts[:text])
46
61
  else
@@ -101,6 +101,10 @@ module Win32
101
101
  # @return [Array<String>] a list of the installed voices, that can be
102
102
  # used for speaking.
103
103
  def voices
104
+ self.class.voices
105
+ end
106
+
107
+ def self.voices
104
108
  buff = FFI::MemoryPointer.new(:string, 1024)
105
109
  unless LoqTTS7.ttsQuery(nil, 1, "Id", nil, buff, buff.size, false, false) == 0
106
110
  raise LoquendoException, "Failed to query voices"
@@ -1,5 +1,5 @@
1
1
  module Win32
2
2
  module Loquendo
3
- VERSION = "1.1.2"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-loquendo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Jonas Tingeborn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-06 00:00:00.000000000 Z
11
+ date: 2013-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi