komagata-win32-aques_talk 0.4.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Masaki Komagata
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,27 @@
1
+ = win32-aques_talk
2
+
3
+ Win32 AquesTalk ruby bindings.
4
+
5
+ == Installation
6
+
7
+ $ sudo gem install komagata-win32-aques_talk -s http://gems.github.com
8
+
9
+ == Usage
10
+
11
+ require "aques_talk"
12
+ AquesTalk.play_sync("����͂Ă��Ƃł��ˁH") # Shift_JIS only
13
+
14
+ == Note on Patches/Pull Requests
15
+
16
+ * Fork the project.
17
+ * Make your feature addition or bug fix.
18
+ * Add tests for it. This is important so I don't break it in a
19
+ future version unintentionally.
20
+ * Commit, do not mess with rakefile, version, or history.
21
+ (if you want to have your own version, that is fine but
22
+ bump version in a commit by itself I can ignore when I pull)
23
+ * Send me a pull request. Bonus points for topic branches.
24
+
25
+ == Copyright
26
+
27
+ Copyright (c) 2009 Masaki Komagata. See LICENSE for details.
@@ -0,0 +1,14 @@
1
+ require "ffi"
2
+
3
+ module AquesTalk
4
+ module AquesTalk
5
+ extend FFI::Library
6
+ ffi_lib File.join(File.dirname(__FILE__), "..", "..", "vendor", "aques_talk", "lib", "AquesTalk.dll")
7
+
8
+ # unsigned char * AquesTalk_Synthe(const char *koe, int iSpeed, int *size)
9
+ attach_function :synthe, :AquesTalk_Synthe, [:string, :int, :pointer], :string
10
+
11
+ # void AquesTalk_FreeWave (unsigned char *wav)
12
+ attach_function :free_wave, :AquesTalk_FreeWave, [:string], :void
13
+ end
14
+ end
@@ -0,0 +1,26 @@
1
+ require "ffi"
2
+
3
+ module AquesTalk
4
+ module AquesTalkDa
5
+ extend FFI::Library
6
+ ffi_lib File.join(File.dirname(__FILE__), "..", "..", "vendor", "aques_talk", "lib", "AquesTalkDa.dll")
7
+
8
+ # int AquesTalkDa_PlaySync(const char *koe, int iSpeed=100)
9
+ attach_function :play_sync, :AquesTalkDa_PlaySync, [:string, :int], :int
10
+
11
+ # H_AQTKDA AquesTalkDa_Create()
12
+ attach_function :create, :AquesTalkDa_Create, [], :pointer
13
+
14
+ # void AquesTalkDa_Release(H_AQTKDA hMe)
15
+ attach_function :release, :AquesTalkDa_Release, [:pointer], :void
16
+
17
+ # int AquesTalkDa_Play(H_AQTKDA hMe, const char *koe, int iSpeed=100, HWND hWnd=0, unsigned long msg=0, unsigned long dwUser=0)
18
+ attach_function :play, :AquesTalkDa_Play, [:pointer, :string, :int, :pointer, :long, :long], :int
19
+
20
+ # void AquesTalkDa_Stop(H_AQTKDA hMe)
21
+ attach_function :stop, :AquesTalkDa_Stop, [:pointer], :void
22
+
23
+ # int AquesTalkDa_IsPlay(H_AQTKDA hMe)
24
+ attach_function :is_play, :AquesTalkDa_IsPlay, [:pointer], :int
25
+ end
26
+ end
data/lib/aques_talk.rb ADDED
@@ -0,0 +1,50 @@
1
+ require "ffi"
2
+ require "aques_talk/aques_talk"
3
+ require "aques_talk/aques_talk_da"
4
+
5
+
6
+ module AquesTalk
7
+ class << self
8
+ # Create wave data from string.
9
+ # == Arguments
10
+ # * <tt>message</tt> - Hiragana string.
11
+ # * <tt>speed</tt> - talk speed.
12
+ # == Retrun
13
+ # * <tt>[res, size_p]</tt> - resutls array.
14
+ # == Original C function signature
15
+ # unsigned char * AquesTalk_Synthe(const char *koe, int iSpeed, int *size)
16
+ def synthe(message, speed = 100)
17
+ size_p = FFI::MemoryPointer.new(:int)
18
+ res = AquesTalk.synthe(message, speed, size_p)
19
+ [res, size_p]
20
+ end
21
+
22
+ def free_wave(wav)
23
+ AquesTalk.free_wave(wav)
24
+ end
25
+
26
+ def play_sync(message, speed = 100)
27
+ AquesTalkDa.play_sync(message, speed)
28
+ end
29
+
30
+ def create
31
+ AquesTalkDa.create
32
+ end
33
+
34
+ def release(h_me)
35
+ AquesTalkDa.release(h_me)
36
+ end
37
+
38
+ def play(h_me, message, speed = 100, h_wnd = nil, msg = 0, dw_user = 0)
39
+ AquesTalkDa.play(h_me, message, speed, h_wnd, msg, dw_user)
40
+ end
41
+
42
+ def stop(h_me)
43
+ AquesTalkDa.stop(h_me)
44
+ end
45
+
46
+ def is_play(h_me)
47
+ AquesTalkDa.is_play(h_me)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,82 @@
1
+ require 'test_helper'
2
+
3
+ class AquesTalkTest < Test::Unit::TestCase
4
+ context "synthe method" do
5
+ should "return not nil when given hiragana" do
6
+ res, size = AquesTalk.synthe("�����Ă��Ƃł��ˁH", 70)
7
+ assert_not_nil res
8
+ end
9
+
10
+ should "return nil when given english" do
11
+ res, size = AquesTalk.synthe("foo", 70)
12
+ assert_nil res
13
+ end
14
+ end
15
+
16
+ context "free_wave method" do
17
+ should "return nil when given valid data" do
18
+ res, size = AquesTalk.synthe("�����Ă��Ƃł��ˁH", 70)
19
+ assert_nil AquesTalk.free_wave(res)
20
+ end
21
+
22
+ should "return nil when given invalid data" do
23
+ res, size = AquesTalk.synthe("bar", 70)
24
+ assert_nil AquesTalk.free_wave(res)
25
+ end
26
+ end
27
+
28
+ context "play_sync method" do
29
+ should "return 0 when given valid message" do
30
+ assert_equal 0, AquesTalk.play_sync("�����Ă��Ƃł����H", 70)
31
+ end
32
+
33
+ should "return not 0 when given invalid message" do
34
+ assert_not_equal 0, AquesTalk.play_sync("bar", 70)
35
+ end
36
+ end
37
+
38
+ should "create method return not nil" do
39
+ assert_not_nil AquesTalk.create
40
+ end
41
+
42
+ should "release method return nil" do
43
+ h_me = AquesTalk.create
44
+ assert_nil AquesTalk.release(h_me)
45
+ end
46
+
47
+ context "play method" do
48
+ should "return 0 when given valid arguments" do
49
+ h_me = AquesTalk.create
50
+ assert_equal 0, AquesTalk.play(h_me, "�����Ă��Ƃł����H")
51
+ end
52
+
53
+ should "return not 0 when given invalid arguments" do
54
+ h_me = AquesTalk.create
55
+ assert_not_equal 0, AquesTalk.play(h_me, "foo")
56
+ end
57
+ end
58
+
59
+ should "stop method return nil" do
60
+ h_me = AquesTalk.create
61
+ AquesTalk.play(h_me, "�����Ă��Ƃł����H")
62
+ sleep 1
63
+ assert_nil AquesTalk.stop(h_me)
64
+ end
65
+
66
+ context "is_play method" do
67
+ should "return 1 when playing" do
68
+ h_me = AquesTalk.create
69
+ AquesTalk.play(h_me, "�����Ă��Ƃł����H")
70
+ sleep 1
71
+ assert_equal 1, AquesTalk.is_play(h_me)
72
+ end
73
+
74
+ should "return 0 when not playing" do
75
+ h_me = AquesTalk.create
76
+ AquesTalk.play(h_me, "�����Ă��Ƃł����H")
77
+ sleep 1
78
+ AquesTalk.stop(h_me)
79
+ assert_equal 0, AquesTalk.is_play(h_me)
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'aques_talk'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,76 @@
1
+ //////////////////////////////////////////////////////////////////////////////
2
+ AquesTalk �K�������������C�u���� Win��
3
+ �@�@�@�@�@�@�@�@�@�@�v���O�����g�p�����_�� 2009/06/09
4
+ //////////////////////////////////////////////////////////////////////////////
5
+
6
+ ������ЃA�N�G�X�g�i�ȉ��u���Ёv)�́A�{�_�񏑂ƂƂ��ɒ񋟂���\�t�g�E�F�A�E�v��
7
+ �O���� �i�ȉ��u�{�\�t�g�E�F�A�v�j���Ɛ�I�Ɏg�p���錠�������L�����Ɋ�Â�����
8
+ ���A�l�܂��͖@�l���킸�{�\�t�g�E�F�A���g�p���郆�[�U�[�i�ȉ��u���[�U�[�v�j
9
+ ���A���L�����ɓ��ӂ����������̂Ƃ��܂��B
10
+
11
+
12
+ ����`
13
+ �p�b�P�[�W
14
+ �{�\�t�g�E�F�A���ЂƂ‚̃t�@�C���Ɉ��k�����t�@�C���ŁA���Ђ���z�z���ꂽ���́A
15
+ ����т���Ɠ���̕������������܂��B
16
+
17
+ �c�k�k
18
+ �{�\�t�g�E�F�A�Ɋ܂܂��_�C�i�~�b�N���C�u�����t�@�C���������܂��B
19
+
20
+ �g�p
21
+ �{�\�t�g�E�F�A���A���ځA�܂��͊ԐڂɎ��s���邱�Ƃ������܂��B
22
+
23
+
24
+ ���g�p��
25
+ ���[�U�[�́A�{�_��Ɋ�Â��A�{�\�t�g�E�F�A��Windows�v���b�g�t�H�[����ł̂ݖ���
26
+ �Ŏg�p���邱�Ƃ��ł��܂��B
27
+ �{�\�t�g�E�F�A�A����т��̕������ɂ‚��Ă̒��쌠�́A���ЂɋA�����A�����͒���
28
+ ���@�Ȃ�тɂ��̑��̊֘A���ēK�p�������E�@���̋K��ɂ���ĕی삳��Ă��܂��B
29
+ ���[�U�[�́A�{�\�t�g�E�F�A�̔�Ɛ�I�Ȏg�p���݂̂��擾���A�{�\�t�g�E�F�A�̒���
30
+ ���A���L�����̑������Ȃ錠�����擾������̂ł͂���܂���B
31
+
32
+ ���T�[�o�[���ł̎g�p
33
+ �T�[�o�[���ŁA�{�\�t�g�E�F�A�Ő����������������𕡐��̐l�ɗ��p������Ƃ��́A
34
+ �uAquesTalk�v�ɂ�鍇�������ł��邱�Ƃ����̗��p�҂��킩��悤�ɒ񎦂��Ă��������B
35
+
36
+ �������E�Ĕz�z
37
+ ���[�U�[�́A�{�\�t�g�E�F�A�̃p�b�P�[�W���l���p�A���p���p���킸�����A�Ĕz�z
38
+ ���邱�Ƃ��ł��܂��B
39
+ �u�c�k�k�̍Ĕz�z�v�̋K��������A���Ђ���z�z���ꂽ���̂ƈقȂ�p�b�P�[�W�╔��
40
+ �I�Ȕz�z�͂ł��܂���B
41
+
42
+ ���c�k�k�̍Ĕz�z
43
+ ���[�U�[�́A���̂��ׂĂ̏����𖞂����ꍇ�Ɍ���A�c�k�k�𑼂̃v���O����(�ȉ��A��
44
+ ���I�\�t�g�E�F�A�j�ɑg�ݍ���Ŕz�z���邱�Ƃ��ł��܂��B�Ȃ��A�c�k�k�t�@�C���P��
45
+ �ł̍Ĕz�z�͋�������Ă���܂���B
46
+
47
+ -�{�g�p�����_�񏑃t�@�C���̕������c�k�k�Ɠ����f�B���N�g���ɏ�ɕۑ�����Ă��邱
48
+ ��
49
+
50
+ -�c�k�k�̒��쌠�����ЂɋA�����邱�Ƃ��A���̓񎟓I�\�t�g�E�F�A�̃��[�U�[���킩��
51
+ �悤�ɖ��L���邱��
52
+
53
+ - ���̉����� �uAquesTalk�v�ɂ�鍇�������ł��邱�Ƃ��A���̓񎟓I�\�t�g�E�F�A��
54
+ �����𒮎悷�闘�p�҂��킩��悤�ɂ��邱��
55
+
56
+
57
+ ������
58
+ ���[�U�[�́A�{�\�t�g�E�F�A�����ς��邱�Ƃ͂ł��܂���B�܂��A���ς��ꂽ���̂̎g
59
+ �p�A�Ĕz�z�͂ł��܂���B
60
+ ���ςɂ̓t�@�C�����̕ύX���܂܂�܂��B
61
+
62
+
63
+ ���Ɛ�
64
+ ���Ђ́A�{�\�t�g�E�F�A�̃T�|�[�g�A�y�����r�܂��͂��̑��̕s���ɂ‚��ďC�����s��
65
+ �`�����邢�͑�֕i����������`�����̑����Q�������܂ވ�؂����r�S�ېӔC�𕉂���
66
+ ����B�܂��A���Ђ́A�{�\�t�g�E�F�A�Ɋւ��Ĉ�� �̓���ۏ؁A���\�ۏ؋y�ё�O�Ҍ�
67
+ ���̔�N�Q���ۏ؂�v���܂���B
68
+
69
+ ���Ђ́A�{�\�t�g�E�F�A�̎g�p�A�����A�Ȃ�тɔz�z�ɂ�萶�������Q�A�܂��͑�O��
70
+ �ɒ��ڂ܂��͊ԐړI�ɐ��������Q�ɂ‚��Ă��A�@����̍����̔@�����킸�A�����Ȃ�
71
+ �ӔC������Ȃ����̂Ƃ��A��؂̕ۏ؁A�������s��Ȃ����̂Ƃ��܂��B
72
+
73
+ ���Ђ́A���ǂ̂��߂ɖ{�\�t�g�E�F�A�̕ύX��\���Ȃ��ɍs�����Ƃ�����܂��B
74
+ �{�_��ɒ�߂��Ă��Ȃ������ɂ‚��ẮA���쌠�@�y�ъ֘A�@�K�ɏ]�����̂Ƃ��܂��B
75
+
76
+ �ȏ�
Binary file
@@ -0,0 +1,53 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{win32-aques_talk}
8
+ s.version = "0.4.0"
9
+ s.platform = Gem::Platform.new(["x86", "mswin32", "60"])
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Masaki Komagata"]
13
+ s.date = %q{2009-09-12}
14
+ s.description = %q{Win32 AquesTalk ruby bindings.}
15
+ s.email = %q{komagata@gmail.com}
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ "lib/aques_talk.rb",
22
+ "lib/aques_talk/aques_talk.rb",
23
+ "lib/aques_talk/aques_talk_da.rb",
24
+ "test/aques_talk_test.rb",
25
+ "test/test_helper.rb",
26
+ "vendor/aques_talk/lib/AqLicense.txt",
27
+ "vendor/aques_talk/lib/AquesTalk.dll",
28
+ "vendor/aques_talk/lib/AquesTalkDa.dll",
29
+ "win32-aques_talk.gemspec"
30
+ ]
31
+ s.homepage = %q{http://github.com/komagata/win32-aques_talk}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.5}
35
+ s.summary = %q{Win32 AquesTalk ruby bindings.}
36
+ s.test_files = [
37
+ "test/aques_talk_test.rb",
38
+ "test/test_helper.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
47
+ else
48
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
49
+ end
50
+ else
51
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
52
+ end
53
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: komagata-win32-aques_talk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: x86-mswin32-60
6
+ authors:
7
+ - Masaki Komagata
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-12 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thoughtbot-shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: Win32 AquesTalk ruby bindings.
26
+ email: komagata@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - lib/aques_talk.rb
36
+ - lib/aques_talk/aques_talk.rb
37
+ - lib/aques_talk/aques_talk_da.rb
38
+ - test/aques_talk_test.rb
39
+ - test/test_helper.rb
40
+ - vendor/aques_talk/lib/AqLicense.txt
41
+ - vendor/aques_talk/lib/AquesTalk.dll
42
+ - vendor/aques_talk/lib/AquesTalkDa.dll
43
+ - win32-aques_talk.gemspec
44
+ - LICENSE
45
+ - README.rdoc
46
+ has_rdoc: false
47
+ homepage: http://github.com/komagata/win32-aques_talk
48
+ post_install_message:
49
+ rdoc_options:
50
+ - --charset=UTF-8
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.2.0
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: Win32 AquesTalk ruby bindings.
72
+ test_files:
73
+ - test/aques_talk_test.rb
74
+ - test/test_helper.rb