win32-sapi 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.1.5 - 10-Aug-2009
2
+ * Changed license to Artistic 2.0.
3
+ * Some gemspec updates, including license and description.
4
+ * Changed test and example file names.
5
+ * Added some class level comments within the source file.
6
+
1
7
  == 0.1.4 - 29-Jul-2007
2
8
  * Added a Rakefile with tasks for installation and testing.
3
9
  * Removed the install.rb file. The Rakefile now handles installation.
data/MANIFEST CHANGED
@@ -3,6 +3,6 @@
3
3
  * MANIFEST
4
4
  * Rakefile
5
5
  * win32-sapi.gemspec
6
- * examples/sapi5_test.rb
6
+ * examples/example_sapi5.rb
7
7
  * lib/win32/sapi5.rb
8
- * test/tc_sapi5.rb
8
+ * test/test_win32_sapi5.rb
data/README CHANGED
@@ -1,15 +1,18 @@
1
1
  == Description
2
- This is a Ruby interface to the Microsoft Speech API, 5.1
2
+ This is a Ruby interface to the Microsoft Speech API, 5.x.
3
3
 
4
4
  == Prerequisites
5
- The Microsoft Speech API 5.1. It can be downloaded for free from
5
+ The Microsoft Speech API 5.x. It can be downloaded for free from
6
6
  http://www.microsoft.com/speech.
7
7
 
8
8
  Ruby 1.8.2 or later.
9
9
 
10
10
  == Installation
11
- rake test (optional)
12
- rake install (non-gem) or rake install_gem (gem)
11
+ === Gem Installation
12
+ gem install win32-sapi
13
+
14
+ === Local Installation
15
+ rake install
13
16
 
14
17
  == Synopsis
15
18
  require 'win32/sapi5'
@@ -20,17 +23,17 @@
20
23
 
21
24
  == Constants
22
25
  SAPI5::VERSION
23
- The current version of this package.
26
+ The current version of this library.
24
27
 
25
28
  == Notes
26
- This module is a simple interface to the Microsoft Speech API 5.1. There
29
+ This module is a simple interface to the Microsoft Speech API 5.x. There
27
30
  are interfaces to all of the Automation classes that this API consists of.
28
31
  Each class is a subclass of the SAPI5 class, which is in turn a subclass
29
32
  of WIN32OLE. With your object you can then call the available methods for
30
33
  that particular Automation class.
31
34
 
32
35
  This documentation won't offer the complete documentation for every method.
33
- Instead, download the Microsoft Speech API 5.1 documentation (a .chm file)
36
+ Instead, download the Microsoft Speech API 5.x documentation (a .chm file)
34
37
  and read the part that covers 'Automation'.
35
38
 
36
39
  == Known Bugs
@@ -42,16 +45,16 @@ SAPI5::VERSION
42
45
  library is based.
43
46
 
44
47
  == Support
45
- The Microsoft SAPI 5.1 SDK is supported on news://microsoft.public.speech_tech.sdk
48
+ The Microsoft SAPI 5.x SDK is supported on news://microsoft.public.speech_tech.sdk
46
49
 
47
50
  == Future Plans
48
51
  Suggestions welcome.
49
52
 
50
53
  == License
51
- Ruby's
54
+ Artistic 2.0
52
55
 
53
56
  == Copyright
54
- (C) 2003-2007 Daniel J. Berger
57
+ (C) 2003-2009 Daniel J. Berger
55
58
  All Rights Reserved
56
59
 
57
60
  == Warranty
@@ -60,10 +63,5 @@ SAPI5::VERSION
60
63
  warranties of merchantability and fitness for a particular purpose.
61
64
 
62
65
  == Author(s)
63
- Daniel J. Berger
64
- djberg96 at gmail dot com
65
- imperator on IRC (irc.freenode.net)
66
-
67
- Park Heesob
68
- phasis at nownuri dot net
69
- phasis68 on IRC (irc.freenode.net)
66
+ Daniel J. Berger
67
+ Park Heesob
data/Rakefile CHANGED
@@ -1,22 +1,26 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
3
 
4
- desc "Install the win32-sapi package (non-gem)"
4
+ desc 'Install the win32-sapi library (non-gem)'
5
5
  task :install do
6
6
  dest = File.join(Config::CONFIG['sitelibdir'], 'win32')
7
7
  Dir.mkdir(dest) unless File.exists? dest
8
8
  cp 'lib/win32/sapi5.rb', dest, :verbose => true
9
9
  end
10
10
 
11
- desc "Install the win32-sapi package as a gem"
11
+ desc 'Install the win32-sapi library as a gem'
12
12
  task :install_gem do
13
13
  ruby 'win32-sapi.gemspec'
14
14
  file = Dir["*.gem"].first
15
15
  sh "gem install #{file}"
16
16
  end
17
17
 
18
+ desc 'Run the example program'
19
+ task :example do
20
+ ruby '-Ilib examples/example_sapi5.rb'
21
+ end
22
+
18
23
  Rake::TestTask.new do |t|
19
- t.libs << 'lib'
20
24
  t.warning = true
21
- t.test_files = FileList['test/tc*']
25
+ t.verbose = true
22
26
  end
@@ -0,0 +1,13 @@
1
+ #######################################################################
2
+ # example_sapi5.rb
3
+ #
4
+ # This is a simple demonstration of the win32-sapi library. You can
5
+ # run this code via the 'rake example' task.
6
+ #
7
+ # Modify as you see fit.
8
+ #######################################################################
9
+ require 'win32/sapi5'
10
+ include Win32
11
+
12
+ v = SpVoice.new
13
+ v.Speak('Shall we play a game?')
data/lib/win32/sapi5.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "win32ole"
1
+ require 'win32ole'
2
2
 
3
3
  # The Win32 module serves as a namespace only.
4
4
  module Win32
@@ -8,122 +8,189 @@ module Win32
8
8
  # registry. Look in HKLM\Software\Classes\CLSID.
9
9
  #++
10
10
 
11
- # An abstract base class for the SAPI automation classes
11
+ # An abstract base class for the SAPI automation classes. You should not
12
+ # Win32::SAPI5 directly.
13
+ #
12
14
  class SAPI5 < WIN32OLE
13
- VERSION = '0.1.4'
15
+ # The version of the win32-sapi library.
16
+ VERSION = '0.1.5'
14
17
  end
15
18
 
19
+ # The SpAudioFormat automation object represents an audio format.
20
+ #
16
21
  class SpAudioFormat < SAPI5
17
22
  def initialize
18
23
  super("{9EF96870-E160-4792-820D-48CF0649E4EC}")
19
24
  end
20
25
  end
21
26
 
27
+ # The SpCustomStream automation object supports the use of existing IStream
28
+ # objects in SAPI.
29
+ #
22
30
  class SpCustomStream < SAPI5
23
31
  def initialize
24
32
  super("{8DBEF13F-1948-4aa8-8CF0-048EEBED95D8}")
25
33
  end
26
34
  end
27
35
 
36
+ # The SpFileStream automation object enables data streams to be read and
37
+ # written as files.
38
+ #
28
39
  class SpFileStream < SAPI5
29
40
  def initialize
30
41
  super("{947812B3-2AE1-4644-BA86-9E90DED7EC91}")
31
42
  end
32
43
  end
33
44
 
45
+ # The SpInProcRecoContext automation object defines a recognition context.
46
+ # A recognition context is the primary means by which an application
47
+ # interacts with SAPI for speech recognition.
48
+ #
34
49
  class SpInProcRecoContext < SAPI5
35
50
  def initialize
36
51
  super("{73AD6842-ACE0-45E8-A4DD-8795881A2C2A}")
37
52
  end
38
53
  end
39
54
 
55
+ # The SpInProcRecognizer automation object represents a speech recognition
56
+ # engine.
57
+ #
40
58
  class SpInProcRecognizer < SAPI5
41
59
  def initialize
42
60
  super("{41B89B6B-9399-11D2-9623-00C04F8EE628}")
43
61
  end
44
62
  end
45
63
 
64
+ # The SpLexicon automation object provides access to lexicons. Lexicons
65
+ # contain information about words that can be recognized or spoken.
66
+ #
46
67
  class SpLexicon < SAPI5
47
68
  def initialize
48
69
  super("{0655E396-25D0-11D3-9C26-00C04F8EF87C}")
49
70
  end
50
71
  end
51
72
 
73
+ # The SpMemoryStream automation object supports audio stream operations in
74
+ # memory.
75
+ #
52
76
  class SpMemoryStream < SAPI5
53
77
  def initialize
54
78
  super("{5FB7EF7D-DFF4-468a-B6B7-2FCBD188F994}")
55
79
  end
56
80
  end
57
81
 
82
+ # The SpMMAudioIn automation object supports audio implementation for
83
+ # the standard Windows wave-in multimedia layer.
84
+ #
58
85
  class SpMMAudioIn < SAPI5
59
86
  def initialize
60
87
  super("{CF3D2E50-53F2-11D2-960C-00C04F8EE628}")
61
88
  end
62
89
  end
63
90
 
91
+ # The SpMMAudioIn automation object supports audio implementation for
92
+ # the standard Windows wave-out multimedia layer.
93
+ #
64
94
  class SpMMAudioOut < SAPI5
65
95
  def initialize
66
96
  super("{A8C680EB-3D32-11D2-9EE7-00C04F797396}")
67
97
  end
68
98
  end
69
99
 
100
+ # The SpObjectToken automation object represents an available resource
101
+ # of a type used by SAPI.
102
+ #
70
103
  class SpObjectToken < SAPI5
71
104
  def initialize
72
105
  super("{EF411752-3736-4CB4-9C8C-8EF4CCB58EFE}")
73
106
  end
74
107
  end
75
108
 
109
+ # The SpObjectTokenCategory automation object represents a class of object
110
+ # tokens. Object tokens are associated with specific folders in the Speech
111
+ # configuration database, and these folders are organized into categories,
112
+ # such as Recognizers, AudioInputs and Voices. An SpObjectTokenCategory
113
+ # object represents a single category of object tokens, and provides access
114
+ # to all the tokens within that category.
115
+ #
76
116
  class SpObjectTokenCategory < SAPI5
77
117
  def initialize
78
118
  super("{A910187F-0C7A-45AC-92CC-59EDAFB77B53}")
79
119
  end
80
120
  end
81
121
 
122
+ # The SpPhoneConverter automation object supports conversion between
123
+ # phoneme symbols and phoneme IDs.
124
+ #
82
125
  class SpPhoneConverter < SAPI5
83
126
  def initialize
84
127
  super("{9185F743-1143-4C28-86B5-BFF14F20E5C8}")
85
128
  end
86
129
  end
87
130
 
131
+ # The SpPhraseInfoBuilder automation object provides the ability to
132
+ # rebuild phrase information from audio data saved to memory.
133
+ #
88
134
  class SpPhraseInfoBuilder < SAPI5
89
135
  def initialize
90
136
  super("{C23FC28D-C55F-4720-8B32-91F73C2BD5D1}")
91
137
  end
92
138
  end
93
139
 
140
+ # The SpSharedRecoContext automation object defines a recognition context.
141
+ #
94
142
  class SpSharedRecoContext < SAPI5
95
143
  def initialize
96
144
  super("{47206204-5ECA-11D2-960F-00C04F8EE628}")
97
145
  end
98
146
  end
99
147
 
148
+ # The SpSharedRecognizer automation object represents a speech recognition
149
+ # engine.
150
+ #
100
151
  class SpSharedRecognizer < SAPI5
101
152
  def initialize
102
153
  super("{3BEE4890-4FE9-4A37-8C1E-5E7E12791C1F}")
103
154
  end
104
155
  end
105
156
 
157
+ # The SpTextSelectionInformation automation object provides access to the
158
+ # text selection information pertaining to a word sequence buffer.
159
+ #
106
160
  class SpTextSelectionInformation < SAPI5
107
161
  def initialize
108
162
  super("{0F92030A-CBFD-4AB8-A164-FF5985547FF6}")
109
163
  end
110
164
  end
111
165
 
166
+ # The SpUnCompressedLexicon automation object provides access to lexicons,
167
+ # which contain information about words that can be recognized or spoken.
168
+ #
112
169
  class SpUnCompressedLexicon < SAPI5
113
170
  def initialize
114
171
  super("{C9E37C15-DF92-4727-85D6-72E5EEB6995A}")
115
172
  end
116
173
  end
117
174
 
175
+ # The SpVoice object brings the text-to-speech (TTS) engine capabilities
176
+ # to applications using SAPI automation. An application can create numerous
177
+ # SpVoice objects, each independent of and capable of interacting with the
178
+ # others. An SpVoice object, usually referred to simply as a voice, is
179
+ # created with default property settings so that it is ready to speak
180
+ # immediately.
181
+ #
118
182
  class SpVoice < SAPI5
119
183
  def initialize
120
184
  super("{96749377-3391-11D2-9EE3-00C04F797396}")
121
185
  end
122
186
  end
123
187
 
188
+ # The SpWaveFormatEx automation object represents the format of
189
+ # waveform-audio data.
190
+ #
124
191
  class SpWaveFormatEx < SAPI5
125
192
  def initialize
126
193
  super("{C79A574C-63BE-44b9-801F-283F87F898BE}")
127
194
  end
128
195
  end
129
- end
196
+ end
@@ -1,5 +1,5 @@
1
1
  #############################################################################
2
- # tc_sapi5.rb
2
+ # test_win32_sapi5.rb
3
3
  #
4
4
  # Test suite for the sapi5 class. For now, we're simply going to test that
5
5
  # the constructors work without incident. There are simply too many methods
@@ -10,8 +10,8 @@
10
10
  #
11
11
  # You should run this test case via the 'rake test' Rake task.
12
12
  #############################################################################
13
- require "win32/sapi5"
14
- require "test/unit"
13
+ require 'win32/sapi5'
14
+ require 'test/unit'
15
15
  include Win32
16
16
 
17
17
  class TC_Win32_SAPI5 < Test::Unit::TestCase
@@ -19,7 +19,7 @@ class TC_Win32_SAPI5 < Test::Unit::TestCase
19
19
  end
20
20
 
21
21
  def test_version
22
- assert_equal("0.1.4", SAPI5::VERSION)
22
+ assert_equal('0.1.5', SAPI5::VERSION)
23
23
  end
24
24
 
25
25
  def test_SpAudioFormat
data/win32-sapi.gemspec CHANGED
@@ -1,23 +1,25 @@
1
- require "rubygems"
1
+ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |gem|
4
- gem.name = "win32-sapi"
5
- gem.version = "0.1.4"
6
- gem.author = "Daniel J. Berger"
7
- gem.email = "djberg96@gmail.com"
8
- gem.homepage = "http://www.rubyforge.org/projects/win32utils"
9
- gem.platform = Gem::Platform::RUBY
10
- gem.summary = "An interface to the MS SAPI (Sound API) library."
11
- gem.description = "An interface to the MS SAPI (Sound API) library."
12
- gem.test_file = "test/tc_sapi5.rb"
13
- gem.has_rdoc = true
14
- gem.files = Dir['lib/win32/*.rb'] + Dir['[A-Z]*'] + Dir['test/*']
15
- gem.files.reject! { |fn| fn.include? "CVS" }
16
- gem.require_path = "lib"
17
- gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
4
+ gem.name = 'win32-sapi'
5
+ gem.version = '0.1.5'
6
+ gem.author = 'Daniel J. Berger'
7
+ gem.license = 'Artistic 2.0'
8
+ gem.email = 'djberg96@gmail.com'
9
+ gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
10
+ gem.platform = Gem::Platform::RUBY
11
+ gem.summary = 'An interface to the MS SAPI (Sound API) library.'
12
+ gem.test_file = 'test/test_win32_sapi5.rb'
13
+ gem.has_rdoc = true
14
+ gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
15
+
16
+ gem.rubyforge_project = 'win32utils'
17
+ gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
18
+
19
+ gem.description = <<-EOF
20
+ The win32-sapi library provides an interface to the MS Windows sound
21
+ interface, otherwise known as SAPI, using OLE.
22
+ EOF
18
23
  end
19
24
 
20
- if $0 == __FILE__
21
- Gem.manage_gems
22
- Gem::Builder.new(spec).build
23
- end
25
+ Gem::Builder.new(spec).build
metadata CHANGED
@@ -1,59 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: win32-sapi
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.1.4
7
- date: 2007-07-30 00:00:00 -06:00
8
- summary: An interface to the MS SAPI (Sound API) library.
9
- require_paths:
10
- - lib
11
- email: djberg96@gmail.com
12
- homepage: http://www.rubyforge.org/projects/win32utils
13
- rubyforge_project:
14
- description: An interface to the MS SAPI (Sound API) library.
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.1.5
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Daniel J. Berger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-10 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: " The win32-sapi library provides an interface to the MS Windows sound\n interface, otherwise known as SAPI, using OLE.\n"
17
+ email: djberg96@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - CHANGES
25
+ - MANIFEST
31
26
  files:
32
- - lib/win32/sapi5.rb
33
27
  - CHANGES
34
- - CVS
35
- - examples
36
- - lib
28
+ - examples/example_sapi5.rb
29
+ - lib/win32/sapi5.rb
37
30
  - MANIFEST
38
31
  - Rakefile
39
32
  - README
40
- - test
33
+ - test/test_win32_sapi5.rb
41
34
  - win32-sapi.gemspec
42
- - test/CVS
43
- - test/tc_sapi5.rb
44
- test_files:
45
- - test/tc_sapi5.rb
35
+ has_rdoc: true
36
+ homepage: http://www.rubyforge.org/projects/win32utils
37
+ licenses:
38
+ - Artistic 2.0
39
+ post_install_message:
46
40
  rdoc_options: []
47
41
 
48
- extra_rdoc_files:
49
- - README
50
- - CHANGES
51
- - MANIFEST
52
- executables: []
53
-
54
- extensions: []
55
-
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
56
  requirements: []
57
57
 
58
- dependencies: []
59
-
58
+ rubyforge_project: win32utils
59
+ rubygems_version: 1.3.5
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: An interface to the MS SAPI (Sound API) library.
63
+ test_files:
64
+ - test/test_win32_sapi5.rb