rusty-mixer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/index.d.ts +10 -0
- package/index.js +7 -0
- package/index.node +0 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Rusty Mixer
|
|
2
|
+
|
|
3
|
+
A Rust-based library for helpful native audio calls
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
// ESM syntax (Electron with "type": "module" or in a bundler)
|
|
9
|
+
import { getAudioDevices, setDeviceVolume, setGlobalVolume } from "rusty-mixer";
|
|
10
|
+
|
|
11
|
+
// CommonJS (default Electron renderer/main)
|
|
12
|
+
const {
|
|
13
|
+
getAudioDevices,
|
|
14
|
+
setDeviceVolume,
|
|
15
|
+
setGlobalVolume,
|
|
16
|
+
} = require("rusty-mixer");
|
|
17
|
+
|
|
18
|
+
console.log("Getting audio devices...");
|
|
19
|
+
const devices = getAudioDevices();
|
|
20
|
+
console.log(devices);
|
|
21
|
+
|
|
22
|
+
// Specify wasapi device id
|
|
23
|
+
setDeviceVolume("{X}.{X}", 0.5);
|
|
24
|
+
|
|
25
|
+
// Update default device
|
|
26
|
+
setGlobalVolume(0.5);
|
|
27
|
+
```
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface AudioDevice {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
isInput: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getAudioDevices(): AudioDevice[];
|
|
8
|
+
export function setGlobalVolume(volume: number): void;
|
|
9
|
+
export function setDeviceVolume(deviceId: string, volume: number): void;
|
|
10
|
+
export function setDeviceAsDefault(deviceId: string): void;
|
package/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const native = require("./index.node");
|
|
2
|
+
|
|
3
|
+
module.exports = native;
|
|
4
|
+
module.exports.getAudioDevices = native.getAudioDevices;
|
|
5
|
+
module.exports.setGlobalVolume = native.setGlobalVolume;
|
|
6
|
+
module.exports.setDeviceVolume = native.setDeviceVolume;
|
|
7
|
+
module.exports.setDeviceAsDefault = native.setDeviceAsDefault;
|
package/index.node
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rusty-mixer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Windows audio device management via Rust",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.js",
|
|
9
|
+
"index.d.ts",
|
|
10
|
+
"index.node"
|
|
11
|
+
],
|
|
12
|
+
"os": [
|
|
13
|
+
"win32"
|
|
14
|
+
],
|
|
15
|
+
"cpu": [
|
|
16
|
+
"x64"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/oceansam/rusty-mixer.git"
|
|
22
|
+
}
|
|
23
|
+
}
|