Skip to content

Commit

Permalink
fix node-addaon-api for vad (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored May 28, 2024
1 parent 50a2eaa commit b4f1006
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/node-addon/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION"

# SHERPA_ONNX_VERSION=1.0.27
# SHERPA_ONNX_VERSION=1.0.28

if [ -z $owner ]; then
owner=k2-fsa
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-addon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION"
# SHERPA_ONNX_VERSION=1.0.27
# SHERPA_ONNX_VERSION=1.0.28
src_dir=.github/scripts/node-addon
sed -i.bak s/SHERPA_ONNX_VERSION/$SHERPA_ONNX_VERSION/g $src_dir/package.json
Expand Down
4 changes: 2 additions & 2 deletions scripts/node-addon-api/src/vad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ static Napi::Float32Array CircularBufferGetWrapper(
return float32Array;
} else {
// don't use external buffer
Napi::ArrayBuffer arrayBuffer = Napi::ArrayBuffer::New(
env, const_cast<float *>(data), sizeof(float) * n);
Napi::ArrayBuffer arrayBuffer =
Napi::ArrayBuffer::New(env, sizeof(float) * n);

Napi::Float32Array float32Array =
Napi::Float32Array::New(env, n, arrayBuffer, 0);
Expand Down
2 changes: 1 addition & 1 deletion scripts/node-addon-api/src/wave-writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static Napi::Boolean WriteWaveWrapper(const Napi::CallbackInfo &info) {

if (info.Length() != 2) {
std::ostringstream os;
os << "Expect only 2 argument2. Given: " << info.Length();
os << "Expect only 2 arguments. Given: " << info.Length();

Napi::TypeError::New(env, os.str()).ThrowAsJavaScriptException();

Expand Down

0 comments on commit b4f1006

Please sign in to comment.