Skip to content

Commit

Permalink
Prebuild for node. Add stopStream method.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamitzor committed Jan 1, 2024
1 parent 90a6eac commit 1925e64
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export declare class RtAudio {
) => void
closeStream: () => void
startStream: () => void
stopStream: () => void
abortStream: () => void
getDevices: () => DeviceInfo[]
getDefaultInputDevice: () => number
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"scripts": {
"build:debug": "cmake-js --debug",
"build": "cmake-js rebuild",
"install": "prebuild-install -t 4 -r napi || cmake-js rebuild",
"prebuild-release-napi": "prebuild --backend cmake-js -t 4 -r napi --include-regex '\\.(node|dll|so)$' --verbose",
"install": "prebuild-install || cmake-js rebuild",
"prebuild-release-node": "prebuild --backend cmake-js -t 14.0.0 -t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -r node --include-regex '\\.(node|dll|so)$' --verbose",
"prebuild-release-electron": "prebuild --backend cmake-js -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 14.0.2 -t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 -t 25.0.0 -t 26.0.0 -t 27.0.0 -t 28.0.0 -r electron --include-regex '\\.(node|dll|so)$' --verbose"
},
"dependencies": {
Expand Down
8 changes: 6 additions & 2 deletions src/node_rtaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Napi::Object NodeRtAudio::Init(Napi::Env env, Napi::Object exports)
InstanceMethod<&NodeRtAudio::openStream>("openStream", static_cast<napi_property_attributes>(napi_default)),
InstanceMethod<&NodeRtAudio::closeStream>("closeStream", static_cast<napi_property_attributes>(napi_default)),
InstanceMethod<&NodeRtAudio::startStream>("startStream", static_cast<napi_property_attributes>(napi_default)),
InstanceMethod<&NodeRtAudio::stopStream>("stopStream", static_cast<napi_property_attributes>(napi_default)),
InstanceMethod<&NodeRtAudio::abortStream>("abortStream", static_cast<napi_property_attributes>(napi_default)),
InstanceMethod<&NodeRtAudio::getDevices>("getDevices", static_cast<napi_property_attributes>(napi_default)),
InstanceMethod<&NodeRtAudio::getDefaultInputDevice>("getDefaultInputDevice", static_cast<napi_property_attributes>(napi_default)),
Expand Down Expand Up @@ -345,8 +346,6 @@ Napi::Value NodeRtAudio::openStream(const Napi::CallbackInfo &info)
void NodeRtAudio::closeStream(const Napi::CallbackInfo &info)
{
jsRef.Unref();

RtAudio::abortStream();
RtAudio::closeStream();
}

Expand All @@ -355,6 +354,11 @@ void NodeRtAudio::startStream(const Napi::CallbackInfo &info)
RtAudio::startStream();
}

void NodeRtAudio::stopStream(const Napi::CallbackInfo &info)
{
RtAudio::stopStream();
}

void NodeRtAudio::abortStream(const Napi::CallbackInfo &info)
{
RtAudio::abortStream();
Expand Down
1 change: 1 addition & 0 deletions src/node_rtaudio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class NodeRtAudio : public RtAudio, public Napi::ObjectWrap<NodeRtAudio>
Napi::Value openStream(const Napi::CallbackInfo &info);
void closeStream(const Napi::CallbackInfo &info);
void startStream(const Napi::CallbackInfo &info);
void stopStream(const Napi::CallbackInfo &info);
void abortStream(const Napi::CallbackInfo &info);
Napi::Value getDevices(const Napi::CallbackInfo &info);
Napi::Value getDefaultInputDevice(const Napi::CallbackInfo &info);
Expand Down

0 comments on commit 1925e64

Please sign in to comment.