質問編集履歴

6

画像の添付

2018/07/19 04:42

投稿

kimasa
kimasa

スコア7

test CHANGED
File without changes
test CHANGED
@@ -193,3 +193,7 @@
193
193
  Dllがみつからないということなので、調べると
194
194
 
195
195
  Macでは.soを参照するみたいなのですが、Gitには.dllや.soのファイルは見当たりませんでした。
196
+
197
+
198
+
199
+ ![例外が出ているスクリーンショットになります](1437a1afa0f52f3b20c90637fd7b3cc0.png)

5

修正

2018/07/19 04:42

投稿

kimasa
kimasa

スコア7

test CHANGED
File without changes
test CHANGED
File without changes

4

文の修正

2018/07/18 08:32

投稿

kimasa
kimasa

スコア7

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  {
32
32
 
33
- #region 変数
33
+ region 変数
34
34
 
35
35
 
36
36
 
@@ -42,11 +42,11 @@
42
42
 
43
43
 
44
44
 
45
- #endregion
45
+ endregion
46
46
 
47
47
 
48
48
 
49
- #region メソッド
49
+ region メソッド
50
50
 
51
51
 
52
52
 

3

文の修正

2018/07/18 08:06

投稿

kimasa
kimasa

スコア7

test CHANGED
File without changes
test CHANGED
@@ -170,11 +170,11 @@
170
170
 
171
171
  }
172
172
 
173
- #endregion
173
+ endregion
174
174
 
175
175
 
176
176
 
177
- #region イベント
177
+ region イベント
178
178
 
179
179
 
180
180
 
@@ -182,7 +182,7 @@
182
182
 
183
183
 
184
184
 
185
- #endregion
185
+ endregion
186
186
 
187
187
  }
188
188
 

2

文の修正

2018/07/18 08:05

投稿

kimasa
kimasa

スコア7

test CHANGED
File without changes
test CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
 
82
82
 
83
- this.waveIn.StartRecording();
83
+ this.waveIn.StartRecording(); //ここでSystem.DllNotFoundExceptionがでます
84
84
 
85
85
 
86
86
 
@@ -187,3 +187,9 @@
187
187
  }
188
188
 
189
189
  }
190
+
191
+
192
+
193
+ Dllがみつからないということなので、調べると
194
+
195
+ Macでは.soを参照するみたいなのですが、Gitには.dllや.soのファイルは見当たりませんでした。

1

プログラムの記載

2018/07/18 08:04

投稿

kimasa
kimasa

スコア7

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,189 @@
1
1
  Visual Studio 2017 for Mac を用いてC#を書いています。
2
2
 
3
3
  ストリーミング音声認識をしたく、調べているとここ(http://kmycode.hatenablog.jp/entry/2017/04/11/220108)からサンプルコードを見つけました。Gitはこちらになります。(https://github.com/kmycode/BP_CloudSpeechTest)
4
+
5
+
6
+
7
+ プログラムはこちらになります
8
+
9
+
10
+
11
+ using NAudio.Wave;
12
+
13
+ using System;
14
+
15
+ using System.Collections.Generic;
16
+
17
+ using System.Linq;
18
+
19
+ using System.Text;
20
+
21
+ using System.Threading.Tasks;
22
+
23
+
24
+
25
+ namespace BP_CloudSpeechTest
26
+
27
+ {
28
+
29
+ class RecordModel : IAudioRecorder
30
+
31
+ {
32
+
33
+ #region 変数
34
+
35
+
36
+
37
+ private WaveInEvent waveIn;
38
+
39
+ private bool isStoped = false;
40
+
41
+ private bool isDisposed = false;
42
+
43
+
44
+
45
+ #endregion
46
+
47
+
48
+
49
+ #region メソッド
50
+
51
+
52
+
53
+ public void Start()
54
+
55
+ {
56
+
57
+ if (this.isDisposed)
58
+
59
+ {
60
+
61
+ throw new ObjectDisposedException("RecordModel");
62
+
63
+ }
64
+
65
+ if (this.waveIn != null)
66
+
67
+ {
68
+
69
+ return;
70
+
71
+ }
72
+
73
+
74
+
75
+ this.waveIn = new WaveInEvent();
76
+
77
+ this.waveIn.DataAvailable += this.OnDataAvailable;
78
+
79
+ this.waveIn.WaveFormat = new WaveFormat(16000, 16, 1);
80
+
81
+
82
+
83
+ this.waveIn.StartRecording();
84
+
85
+
86
+
87
+ }
88
+
89
+
90
+
91
+ public void Stop()
92
+
93
+ {
94
+
95
+ if (this.isDisposed)
96
+
97
+ {
98
+
99
+ throw new ObjectDisposedException("RecordModel");
100
+
101
+ }
102
+
103
+ if (this.isStoped)
104
+
105
+ {
106
+
107
+ return;
108
+
109
+ }
110
+
111
+
112
+
113
+ this.waveIn.StopRecording();
114
+
115
+ this.isStoped = true;
116
+
117
+
118
+
119
+ this.waveIn.Dispose();
120
+
121
+
122
+
123
+ this.waveIn = null;
124
+
125
+ }
126
+
127
+
128
+
129
+ public void Dispose()
130
+
131
+ {
132
+
133
+ if (this.isDisposed)
134
+
135
+ {
136
+
137
+ throw new ObjectDisposedException("RecordModel");
138
+
139
+ }
140
+
141
+
142
+
143
+ this.Stop();
144
+
145
+ GC.SuppressFinalize(this);
146
+
147
+ this.isDisposed = true;
148
+
149
+ }
150
+
151
+
152
+
153
+ ~RecordModel()
154
+
155
+ {
156
+
157
+ this.Dispose();
158
+
159
+ }
160
+
161
+
162
+
163
+ private void OnDataAvailable(object sender, WaveInEventArgs e)
164
+
165
+ {
166
+
167
+ if (this.isStoped) return;
168
+
169
+ this.RecordDataAvailabled?.Invoke(this, new RecordDataAvailabledEventArgs(e.Buffer, e.BytesRecorded));
170
+
171
+ }
172
+
173
+ #endregion
174
+
175
+
176
+
177
+ #region イベント
178
+
179
+
180
+
181
+ public event RecordDataAvailabledEventHandler RecordDataAvailabled;
182
+
183
+
184
+
185
+ #endregion
186
+
187
+ }
188
+
189
+ }