updated .gitignore, cleared unwanted files and folders, added close stream functionality
This commit is contained in:
parent
d32989cc81
commit
f2f1f091bf
92 changed files with 95 additions and 14610 deletions
36
test/deviceSwitch.js
Normal file
36
test/deviceSwitch.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
const nodeAudio = require('bindings')('nodeaudio.node');
|
||||
|
||||
let inputDevice;
|
||||
let outputDevice;
|
||||
|
||||
const setStreams = () => {
|
||||
|
||||
const defaultInput = nodeAudio.GetDefaultInputDevice();
|
||||
const defaultOutput = nodeAudio.GetDefaultOutputDevice();
|
||||
console.log(`Input: ${defaultInput}, Output: ${defaultOutput}`);
|
||||
|
||||
if (inputDevice !== defaultInput) {
|
||||
inputDevice = defaultInput;
|
||||
nodeAudio.CloseInputStream(inputDevice);
|
||||
nodeAudio.OpenInputStream(inputDevice);
|
||||
}
|
||||
|
||||
if (outputDevice !== defaultOutput) {
|
||||
outputDevice = defaultOutput;
|
||||
nodeAudio.CloseOutputStream(outputDevice);
|
||||
nodeAudio.OpenOutputStream(outputDevice);
|
||||
}
|
||||
}
|
||||
|
||||
function x() {
|
||||
console.log("emitting");
|
||||
}
|
||||
|
||||
nodeAudio.Initialize(x);
|
||||
|
||||
const id = setInterval(setStreams, 3000);
|
||||
|
||||
setTimeout(() => {
|
||||
clearInterval(id);
|
||||
nodeAudio.Terminate();
|
||||
}, 11000);
|
||||
Loading…
Reference in a new issue