summaryrefslogtreecommitdiff
path: root/kaldi_io/src/init.c
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2016-02-24 17:00:40 +0800
committerDeterminant <[email protected]>2016-02-24 17:00:40 +0800
commit39b1967870e6fabe6764360bccefad8a2a9db24d (patch)
tree0a60f3e6d5137b6b32f82e496b9701e13e52f9d4 /kaldi_io/src/init.c
parent3f742c01540b8bad940d66331d562082a63d975b (diff)
adjust the code according to the changes made in nerv/wrapped-handleswrapped-handles
Diffstat (limited to 'kaldi_io/src/init.c')
-rw-r--r--kaldi_io/src/init.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/kaldi_io/src/init.c b/kaldi_io/src/init.c
index 529895b..e8b4ea6 100644
--- a/kaldi_io/src/init.c
+++ b/kaldi_io/src/init.c
@@ -1,4 +1,5 @@
-#include "nerv/common.h"
+#include "nerv/lib/common.h"
+#include "nerv/matrix/matrix.h"
#include "cwrapper_kaldi.h"
#include <stdio.h>
@@ -21,12 +22,14 @@ static int feat_repo_destroy(lua_State *L) {
}
static int feat_repo_current_utterance(lua_State *L) {
+ MContext *context;
+ MMATRIX_GET_CONTEXT(L, 3);
KaldiFeatureRepo *repo = luaT_checkudata(L, 1, nerv_kaldi_feat_repo_tname);
int debug;
if (!lua_isboolean(L, 2))
nerv_error(L, "debug flag should be a boolean");
debug = lua_toboolean(L, 2);
- Matrix *utter = kaldi_feature_repo_read_utterance(repo, L, debug);
+ Matrix *utter = kaldi_feature_repo_read_utterance(repo, L, debug, context);
luaT_pushudata(L, utter, nerv_matrix_host_float_tname);
return 1;
}
@@ -72,6 +75,8 @@ static int lookup_feat_repo_destroy(lua_State *L) {
}
static int lookup_feat_repo_read_utterance(lua_State *L) {
+ MContext *context;
+ MMATRIX_GET_CONTEXT(L, 5);
KaldiLookupFeatureRepo *repo = luaT_checkudata(L, 1, nerv_kaldi_lookup_feat_repo_tname);
KaldiFeatureRepo *feat_repo = luaT_checkudata(L, 2, nerv_kaldi_feat_repo_tname);
int nframes, debug;
@@ -81,7 +86,8 @@ static int lookup_feat_repo_read_utterance(lua_State *L) {
if (!lua_isboolean(L, 4))
nerv_error(L, "debug flag should be a boolean");
debug = lua_toboolean(L, 4);
- Matrix *utter = kaldi_lookup_feature_repo_read_utterance(repo, feat_repo, nframes, L, debug);
+ Matrix *utter = kaldi_lookup_feature_repo_read_utterance(repo, feat_repo,
+ nframes, L, debug, context);
luaT_pushudata(L, utter, nerv_matrix_host_float_tname);
return 1;
}
@@ -100,6 +106,8 @@ static int label_repo_new(lua_State *L) {
}
static int label_repo_read_utterance(lua_State *L) {
+ MContext *context;
+ MMATRIX_GET_CONTEXT(L, 5);
KaldiLabelRepo *repo = luaT_checkudata(L, 1, nerv_kaldi_label_repo_tname);
KaldiFeatureRepo *feat_repo = luaT_checkudata(L, 2, nerv_kaldi_feat_repo_tname);
int nframes, debug;
@@ -109,7 +117,8 @@ static int label_repo_read_utterance(lua_State *L) {
if (!lua_isboolean(L, 4))
nerv_error(L, "debug flag should be a boolean");
debug = lua_toboolean(L, 4);
- Matrix *utter = kaldi_label_repo_read_utterance(repo, feat_repo, nframes, L, debug);
+ Matrix *utter = kaldi_label_repo_read_utterance(repo, feat_repo, nframes,
+ L, debug, context);
luaT_pushudata(L, utter, nerv_matrix_host_float_tname);
return 1;
}