steelseries-sonar-sdk 0.2.0 → 0.2.3
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/dist/index.js +874 -0
- package/package.json +9 -3
- package/.gitattributes +0 -8
- package/.github/workflows/tests.yml +0 -18
- package/.vscode/extensions.json +0 -8
- package/.vscode/settings.json +0 -33
- package/_.todo +0 -4
- package/biome.json +0 -62
- package/http/sonar.http +0 -104
- package/src/consts/fetch-options-put.ts +0 -3
- package/src/enums.ts +0 -88
- package/src/exceptions.ts +0 -45
- package/src/functions/audio/get-audio-data-classic.ts +0 -31
- package/src/functions/audio/get-audio-data-stream.ts +0 -37
- package/src/functions/audio/get-audio-mode.ts +0 -11
- package/src/functions/audio/set-audio-mode.ts +0 -12
- package/src/functions/audio/set-channel-mute-classic.ts +0 -35
- package/src/functions/audio/set-channel-mute-streamer.ts +0 -41
- package/src/functions/audio/set-channel-volume-classic.ts +0 -37
- package/src/functions/audio/set-channel-volume-streamer.ts +0 -43
- package/src/functions/chatmix/get-chat-mix-state.ts +0 -20
- package/src/functions/chatmix/set-chat-mix-balance.ts +0 -22
- package/src/functions/converters/convert-channel-to-api.ts +0 -19
- package/src/functions/converters/convert-chat-mix-balance-to-api.ts +0 -6
- package/src/functions/converters/convert-chat-mix-balance-to-user.ts +0 -7
- package/src/functions/converters/convert-profile-channel-to-api.ts +0 -19
- package/src/functions/converters/convert-profile-channel-to-user.ts +0 -19
- package/src/functions/converters/convert-volume-to-api.ts +0 -5
- package/src/functions/converters/convert-volume-to-user.ts +0 -6
- package/src/functions/devices/get-audio-devices.ts +0 -40
- package/src/functions/devices/set-audio-device.ts +0 -19
- package/src/functions/endpoint/get-app-endpoint.ts +0 -73
- package/src/functions/endpoint/get-sonar-endpoint-cached.ts +0 -28
- package/src/functions/endpoint/get-sonar-endpoint.ts +0 -88
- package/src/functions/profile/get-channel-profiles.ts +0 -26
- package/src/functions/profile/get-selected-profiles.ts +0 -17
- package/src/functions/profile/set-selected-profile.ts +0 -17
- package/src/index.ts +0 -41
- package/src/sonar/models/audio-settings/chatmix-data.ts +0 -6
- package/src/sonar/models/audio-settings/enums/audio-mode.ts +0 -4
- package/src/sonar/models/audio-settings/enums/chat-mix-state.ts +0 -6
- package/src/sonar/models/audio-settings/enums/device-data-flow.ts +0 -5
- package/src/sonar/models/audio-settings/enums/device-default-roles.ts +0 -6
- package/src/sonar/models/audio-settings/enums/device-role.ts +0 -9
- package/src/sonar/models/audio-settings/enums/device-state.ts +0 -8
- package/src/sonar/models/audio-settings/enums/sonar-channel.ts +0 -8
- package/src/sonar/models/audio-settings/enums/streaming-path.ts +0 -4
- package/src/sonar/models/audio-settings/volume-info-classic.ts +0 -4
- package/src/sonar/models/audio-settings/volume-info-streamer.ts +0 -10
- package/src/sonar/models/audio-settings/volume-settings-classic.ts +0 -13
- package/src/sonar/models/audio-settings/volume-settings-streamer.ts +0 -13
- package/src/sonar/models/config/config.ts +0 -9
- package/src/sonar/models/config/enums/VirtualAudioDevice.ts +0 -7
- package/src/sonar/models/devices/audio-device.ts +0 -17
- package/src/sonar/models/devices/changed-device.ts +0 -7
- package/src/sonar/requests/audio-devices/change-audio-device.ts +0 -37
- package/src/sonar/requests/audio-devices/request-audio-devices.ts +0 -42
- package/src/sonar/requests/chatmix/change-chat-mix-balance.ts +0 -25
- package/src/sonar/requests/chatmix/request-chat-mix-state.ts +0 -24
- package/src/sonar/requests/mode/change-audio-mode.ts +0 -24
- package/src/sonar/requests/mode/request-audio-mode.ts +0 -24
- package/src/sonar/requests/profiles/change-selected-config.ts +0 -25
- package/src/sonar/requests/profiles/request-configs.ts +0 -24
- package/src/sonar/requests/profiles/request-selected-configs.ts +0 -22
- package/src/sonar/requests/volume-settings/change-volume-level-classic.ts +0 -27
- package/src/sonar/requests/volume-settings/change-volume-level-streamer.ts +0 -29
- package/src/sonar/requests/volume-settings/change-volume-mute-classic.ts +0 -27
- package/src/sonar/requests/volume-settings/change-volume-mute-streamer.ts +0 -29
- package/src/sonar/requests/volume-settings/request-volume-settings-classic.ts +0 -22
- package/src/sonar/requests/volume-settings/request-volume-settings-streamer.ts +0 -22
- package/src/types/audio-device.ts +0 -7
- package/src/types/changed-device.ts +0 -7
- package/src/types/channel-volume-classic.ts +0 -4
- package/src/types/channel-volume-streamer-path.ts +0 -4
- package/src/types/channel-volume-streamer.ts +0 -6
- package/src/types/channel-volumes-classic.ts +0 -8
- package/src/types/channel-volumes-streamer.ts +0 -8
- package/src/types/chat-mix-data.ts +0 -7
- package/src/types/profile-option.ts +0 -9
- package/tests/e2e/audio/get-audio-data-classic.real.test.ts +0 -11
- package/tests/e2e/audio/get-audio-data-stream.real.test.ts +0 -11
- package/tests/e2e/audio/get-audio-mode.real.test.ts +0 -12
- package/tests/e2e/audio/set-audio-mode.real.test.ts +0 -20
- package/tests/e2e/audio/set-channel-mute-classic.real.test.ts +0 -18
- package/tests/e2e/audio/set-channel-mute-streamer.real.test.ts +0 -18
- package/tests/e2e/audio/set-channel-volume-classic.real.test.ts +0 -17
- package/tests/e2e/audio/set-channel-volume-streamer.real.test.ts +0 -22
- package/tests/e2e/chatmix/get-chat-mix-state.real.test.ts +0 -25
- package/tests/e2e/chatmix/set-chat-mix-balance.real.test.ts +0 -25
- package/tests/e2e/devices/get-audio-devices.real.test.ts +0 -29
- package/tests/e2e/devices/set-audio-device.real.test.ts +0 -32
- package/tests/e2e/enpoint/get-app-endpoint.real.test.ts +0 -19
- package/tests/e2e/enpoint/get-sonar-endpoint-cached.real.test.ts +0 -32
- package/tests/e2e/enpoint/get-sonar-endpoint.real.test.ts +0 -21
- package/tests/e2e/profiles/get-channel-profiles.real.test.ts +0 -21
- package/tests/e2e/profiles/get-selected-profiles.real.test.ts +0 -11
- package/tests/e2e/profiles/set-selected-profile.real.test.ts +0 -17
- package/tests/helpers/get-endpoint-e2e.ts +0 -8
- package/tests/unit/audio/get-audio-data-classic.test.ts +0 -57
- package/tests/unit/audio/get-audio-data-stream.test.ts +0 -65
- package/tests/unit/audio/get-audio-mode.test.ts +0 -58
- package/tests/unit/audio/set-audio-mode.test.ts +0 -66
- package/tests/unit/audio/set-channel-mute-classic.test.ts +0 -58
- package/tests/unit/audio/set-channel-mute-streamer.test.ts +0 -64
- package/tests/unit/audio/set-channel-volume-classic.test.ts +0 -58
- package/tests/unit/audio/set-channel-volume-streamer.test.ts +0 -64
- package/tests/unit/chatmix/get-chat-mix-state.test.ts +0 -70
- package/tests/unit/chatmix/set-chat-mix-balance.test.ts +0 -58
- package/tests/unit/devices/get-audio-devices.test.ts +0 -59
- package/tests/unit/devices/set-audio-devices.test.ts +0 -62
- package/tests/unit/endpoint/get-app-endpoint.test.ts +0 -72
- package/tests/unit/endpoint/get-sonar-endpoint-cached.test.ts +0 -93
- package/tests/unit/endpoint/get-sonar-endpoint.test.ts +0 -140
- package/tests/unit/profiles/get-channel-profiles.test.ts +0 -91
- package/tests/unit/profiles/get-selected-profiles.test.ts +0 -64
- package/tests/unit/profiles/set-selected-profile.test.ts +0 -55
- package/tsconfig.build.json +0 -12
- package/tsconfig.json +0 -36
- /package/{src → dist}/consts/fetch-options-put.d.ts +0 -0
- /package/{src → dist}/enums.d.ts +0 -0
- /package/{src → dist}/exceptions.d.ts +0 -0
- /package/{src → dist}/functions/audio/get-audio-data-classic.d.ts +0 -0
- /package/{src → dist}/functions/audio/get-audio-data-stream.d.ts +0 -0
- /package/{src → dist}/functions/audio/get-audio-mode.d.ts +0 -0
- /package/{src → dist}/functions/audio/set-audio-mode.d.ts +0 -0
- /package/{src → dist}/functions/audio/set-channel-mute-classic.d.ts +0 -0
- /package/{src → dist}/functions/audio/set-channel-mute-streamer.d.ts +0 -0
- /package/{src → dist}/functions/audio/set-channel-volume-classic.d.ts +0 -0
- /package/{src → dist}/functions/audio/set-channel-volume-streamer.d.ts +0 -0
- /package/{src → dist}/functions/chatmix/get-chat-mix-state.d.ts +0 -0
- /package/{src → dist}/functions/chatmix/set-chat-mix-balance.d.ts +0 -0
- /package/{src → dist}/functions/converters/convert-channel-to-api.d.ts +0 -0
- /package/{src → dist}/functions/converters/convert-chat-mix-balance-to-api.d.ts +0 -0
- /package/{src → dist}/functions/converters/convert-chat-mix-balance-to-user.d.ts +0 -0
- /package/{src → dist}/functions/converters/convert-profile-channel-to-api.d.ts +0 -0
- /package/{src → dist}/functions/converters/convert-profile-channel-to-user.d.ts +0 -0
- /package/{src → dist}/functions/converters/convert-volume-to-api.d.ts +0 -0
- /package/{src → dist}/functions/converters/convert-volume-to-user.d.ts +0 -0
- /package/{src → dist}/functions/devices/get-audio-devices.d.ts +0 -0
- /package/{src → dist}/functions/devices/set-audio-device.d.ts +0 -0
- /package/{src → dist}/functions/endpoint/get-app-endpoint.d.ts +0 -0
- /package/{src → dist}/functions/endpoint/get-sonar-endpoint-cached.d.ts +0 -0
- /package/{src → dist}/functions/endpoint/get-sonar-endpoint.d.ts +0 -0
- /package/{src → dist}/functions/profile/get-channel-profiles.d.ts +0 -0
- /package/{src → dist}/functions/profile/get-selected-profiles.d.ts +0 -0
- /package/{src → dist}/functions/profile/set-selected-profile.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/chatmix-data.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/enums/audio-mode.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/enums/chat-mix-state.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/enums/device-data-flow.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/enums/device-default-roles.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/enums/device-role.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/enums/device-state.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/enums/sonar-channel.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/enums/streaming-path.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/volume-info-classic.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/volume-info-streamer.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/volume-settings-classic.d.ts +0 -0
- /package/{src → dist}/sonar/models/audio-settings/volume-settings-streamer.d.ts +0 -0
- /package/{src → dist}/sonar/models/config/config.d.ts +0 -0
- /package/{src → dist}/sonar/models/config/enums/VirtualAudioDevice.d.ts +0 -0
- /package/{src → dist}/sonar/models/devices/audio-device.d.ts +0 -0
- /package/{src → dist}/sonar/models/devices/changed-device.d.ts +0 -0
- /package/{src → dist}/sonar/requests/audio-devices/change-audio-device.d.ts +0 -0
- /package/{src → dist}/sonar/requests/audio-devices/request-audio-devices.d.ts +0 -0
- /package/{src → dist}/sonar/requests/chatmix/change-chat-mix-balance.d.ts +0 -0
- /package/{src → dist}/sonar/requests/chatmix/request-chat-mix-state.d.ts +0 -0
- /package/{src → dist}/sonar/requests/mode/change-audio-mode.d.ts +0 -0
- /package/{src → dist}/sonar/requests/mode/request-audio-mode.d.ts +0 -0
- /package/{src → dist}/sonar/requests/profiles/change-selected-config.d.ts +0 -0
- /package/{src → dist}/sonar/requests/profiles/request-configs.d.ts +0 -0
- /package/{src → dist}/sonar/requests/profiles/request-selected-configs.d.ts +0 -0
- /package/{src → dist}/sonar/requests/volume-settings/change-volume-level-classic.d.ts +0 -0
- /package/{src → dist}/sonar/requests/volume-settings/change-volume-level-streamer.d.ts +0 -0
- /package/{src → dist}/sonar/requests/volume-settings/change-volume-mute-classic.d.ts +0 -0
- /package/{src → dist}/sonar/requests/volume-settings/change-volume-mute-streamer.d.ts +0 -0
- /package/{src → dist}/sonar/requests/volume-settings/request-volume-settings-classic.d.ts +0 -0
- /package/{src → dist}/sonar/requests/volume-settings/request-volume-settings-streamer.d.ts +0 -0
- /package/{src → dist}/types/audio-device.d.ts +0 -0
- /package/{src → dist}/types/changed-device.d.ts +0 -0
- /package/{src → dist}/types/channel-volume-classic.d.ts +0 -0
- /package/{src → dist}/types/channel-volume-streamer-path.d.ts +0 -0
- /package/{src → dist}/types/channel-volume-streamer.d.ts +0 -0
- /package/{src → dist}/types/channel-volumes-classic.d.ts +0 -0
- /package/{src → dist}/types/channel-volumes-streamer.d.ts +0 -0
- /package/{src → dist}/types/chat-mix-data.d.ts +0 -0
- /package/{src → dist}/types/profile-option.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "steelseries-sonar-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "An SDK for interacting with the SteelSeries Sonar software.",
|
|
5
5
|
"author": "Harley Torrisi <mail@harleycodes.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
"url": "https://github.com/harley-codes/steelseries-sonar-sdk-js"
|
|
11
11
|
},
|
|
12
12
|
"module": "./src/index.ts",
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
13
20
|
"devDependencies": {
|
|
14
21
|
"@biomejs/biome": "2.3.11",
|
|
15
22
|
"@types/bun": "latest",
|
|
@@ -25,7 +32,6 @@
|
|
|
25
32
|
"test-e2e-endpoint": "bun test ./tests/e2e/**/*.test.ts -t getSonarEndpoint",
|
|
26
33
|
"test-unit": "bun test ./tests/unit/**/*.test.ts",
|
|
27
34
|
"test-all": "bun test-unit && bun test-e2e",
|
|
28
|
-
"package": "bunx tsc --emitDeclarationOnly --outDir dist -p tsconfig.build.json && bun build src/index.ts --outdir dist --target=node"
|
|
29
|
-
"package-minify": "bunx tsc --emitDeclarationOnly --outDir dist -p tsconfig.build.json && bun build src/index.ts --outdir dist --minify --target=node"
|
|
35
|
+
"package": "bunx tsc --emitDeclarationOnly --outDir dist -p tsconfig.build.json && bun build src/index.ts --outdir dist --target=node"
|
|
30
36
|
}
|
|
31
37
|
}
|
package/.gitattributes
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
name: Tests
|
|
2
|
-
on: [push, pull_request]
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
Test:
|
|
6
|
-
runs-on: ubuntu-latest
|
|
7
|
-
steps:
|
|
8
|
-
- uses: actions/checkout@v4
|
|
9
|
-
- uses: oven-sh/setup-bun@v2
|
|
10
|
-
- name: Install Bun
|
|
11
|
-
run: bun install
|
|
12
|
-
- name: Run Tests
|
|
13
|
-
run: bun test --coverage --coverage-reporter=lcov ./tests/unit
|
|
14
|
-
- name: Upload coverage to Codecov
|
|
15
|
-
uses: codecov/codecov-action@v3
|
|
16
|
-
with:
|
|
17
|
-
file: ./coverage/lcov.info
|
|
18
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
package/.vscode/extensions.json
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"editor.tabSize": 4,
|
|
3
|
-
"editor.insertSpaces": false,
|
|
4
|
-
"editor.detectIndentation": false,
|
|
5
|
-
"files.eol": "\n",
|
|
6
|
-
"files.encoding": "utf8",
|
|
7
|
-
"files.trimTrailingWhitespace": true,
|
|
8
|
-
"files.insertFinalNewline": true,
|
|
9
|
-
"editor.formatOnSave": true,
|
|
10
|
-
"editor.defaultFormatter": "biomejs.biome",
|
|
11
|
-
"editor.codeActionsOnSave": {
|
|
12
|
-
"source.fixAll.biome": "explicit",
|
|
13
|
-
"source.organizeImports.biome": "explicit"
|
|
14
|
-
},
|
|
15
|
-
"prettier.enable": false,
|
|
16
|
-
"typescript.preferences.importModuleSpecifier": "non-relative",
|
|
17
|
-
"javascript.preferences.importModuleSpecifier": "non-relative",
|
|
18
|
-
"files.associations": {
|
|
19
|
-
"*.json": "jsonc"
|
|
20
|
-
},
|
|
21
|
-
"search.exclude": {
|
|
22
|
-
"**/.git": true,
|
|
23
|
-
"**/node_modules": true,
|
|
24
|
-
"**/build": true
|
|
25
|
-
},
|
|
26
|
-
"files.exclude": {
|
|
27
|
-
"**/.git": true,
|
|
28
|
-
"**/.DS_Store": true,
|
|
29
|
-
"**/node_modules": true,
|
|
30
|
-
"**/build": true
|
|
31
|
-
},
|
|
32
|
-
"cSpell.words": ["CHATMIX", "Redirections", "steelseries", "Torrisi"]
|
|
33
|
-
}
|
package/_.todo
DELETED
package/biome.json
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
|
|
3
|
-
"vcs": {
|
|
4
|
-
"enabled": true,
|
|
5
|
-
"clientKind": "git",
|
|
6
|
-
"useIgnoreFile": true,
|
|
7
|
-
"defaultBranch": "main"
|
|
8
|
-
},
|
|
9
|
-
"files": {
|
|
10
|
-
"ignoreUnknown": false
|
|
11
|
-
},
|
|
12
|
-
"formatter": {
|
|
13
|
-
"enabled": true,
|
|
14
|
-
"indentStyle": "tab",
|
|
15
|
-
"lineEnding": "lf",
|
|
16
|
-
"lineWidth": 120,
|
|
17
|
-
"bracketSameLine": false
|
|
18
|
-
},
|
|
19
|
-
"linter": {
|
|
20
|
-
"enabled": true,
|
|
21
|
-
"rules": {
|
|
22
|
-
"recommended": true,
|
|
23
|
-
"suspicious": {
|
|
24
|
-
"useIsArray": "error"
|
|
25
|
-
},
|
|
26
|
-
"style": {
|
|
27
|
-
"useConsistentCurlyBraces": "error",
|
|
28
|
-
"useNodejsImportProtocol": "error"
|
|
29
|
-
},
|
|
30
|
-
"correctness": {
|
|
31
|
-
"noUnusedImports": "error",
|
|
32
|
-
"noPrivateImports": "error"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"assist": {
|
|
37
|
-
"enabled": true,
|
|
38
|
-
"actions": {
|
|
39
|
-
"source": {
|
|
40
|
-
"organizeImports": "on",
|
|
41
|
-
"useSortedProperties": "on",
|
|
42
|
-
"useSortedAttributes": "on"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"javascript": {
|
|
47
|
-
"formatter": {
|
|
48
|
-
"quoteStyle": "single",
|
|
49
|
-
"semicolons": "asNeeded",
|
|
50
|
-
"trailingCommas": "none",
|
|
51
|
-
"arrowParentheses": "always",
|
|
52
|
-
"bracketSameLine": false,
|
|
53
|
-
"bracketSpacing": true,
|
|
54
|
-
"expand": "auto"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"json": {
|
|
58
|
-
"formatter": {
|
|
59
|
-
"trailingCommas": "none"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
package/http/sonar.http
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
### VS Code HTTP request to /chatMix
|
|
2
|
-
@SONAR_ADDRESS=http://127.0.0.1:52335
|
|
3
|
-
|
|
4
|
-
############
|
|
5
|
-
# CHANNELS #
|
|
6
|
-
############
|
|
7
|
-
|
|
8
|
-
### -> GET -> Channel Mode
|
|
9
|
-
GET {{SONAR_ADDRESS}}/mode
|
|
10
|
-
|
|
11
|
-
### -> SET -> Channel Mode - Classic
|
|
12
|
-
PUT {{SONAR_ADDRESS}}/mode/classic
|
|
13
|
-
|
|
14
|
-
### -> SET -> Channel Mode - Streamer
|
|
15
|
-
PUT {{SONAR_ADDRESS}}/mode/stream
|
|
16
|
-
|
|
17
|
-
### -> GET -> Volume Settings - Classic
|
|
18
|
-
GET {{SONAR_ADDRESS}}/volumeSettings/classic
|
|
19
|
-
|
|
20
|
-
### -> GET -> Volume Settings - Streamer
|
|
21
|
-
GET {{SONAR_ADDRESS}}/volumeSettings/streamer
|
|
22
|
-
|
|
23
|
-
### -> SET -> Volume Level - Classic - Master - 50%
|
|
24
|
-
PUT {{SONAR_ADDRESS}}/volumeSettings/classic/Master/volume/0.5
|
|
25
|
-
|
|
26
|
-
### -> SET -> Volume Level - Classic - Mute - TRUE
|
|
27
|
-
PUT {{SONAR_ADDRESS}}/volumeSettings/classic/Master/mute/true
|
|
28
|
-
|
|
29
|
-
### -> SET -> Volume Level - Classic - Mute - FALSE
|
|
30
|
-
PUT {{SONAR_ADDRESS}}/volumeSettings/classic/Master/mute/false
|
|
31
|
-
|
|
32
|
-
### -> SET -> Volume Level - Streamer - Monitoring - Master - 50%
|
|
33
|
-
PUT {{SONAR_ADDRESS}}/volumeSettings/streamer/monitoring/master/volume/0.5
|
|
34
|
-
|
|
35
|
-
### -> SET -> Volume Level - Streamer - Streaming - Master - 50%
|
|
36
|
-
PUT {{SONAR_ADDRESS}}/volumeSettings/streamer/streaming/master/volume/0.5
|
|
37
|
-
|
|
38
|
-
### -> SET -> Mute - Master - true
|
|
39
|
-
PUT {{SONAR_ADDRESS}}/volumeSettings/classic/master/mute/false
|
|
40
|
-
|
|
41
|
-
### -> SET -> Mute - Streamer - Streaming - true
|
|
42
|
-
PUT {{SONAR_ADDRESS}}/volumeSettings/streamer/streaming/master/isMuted/false
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
###########
|
|
46
|
-
# CHATMIX #
|
|
47
|
-
###########
|
|
48
|
-
|
|
49
|
-
### -> GET -> ChatMix
|
|
50
|
-
GET {{SONAR_ADDRESS}}/chatMix
|
|
51
|
-
# {
|
|
52
|
-
# "state": "enabled", "finiteWheel", "differentDeviceSelected", "noDeviceSelected"
|
|
53
|
-
# }
|
|
54
|
-
|
|
55
|
-
### -> SET -> ChatMix - 70% Game, 30% Chat
|
|
56
|
-
PUT {{SONAR_ADDRESS}}/chatMix?balance=0.3
|
|
57
|
-
|
|
58
|
-
#############
|
|
59
|
-
# Equalizer #
|
|
60
|
-
#############
|
|
61
|
-
|
|
62
|
-
### -> GET -> EQ Presets - Active
|
|
63
|
-
GET {{SONAR_ADDRESS}}/configs/selected
|
|
64
|
-
|
|
65
|
-
### -> GET -> EQ Presets
|
|
66
|
-
GET {{SONAR_ADDRESS}}/configs
|
|
67
|
-
|
|
68
|
-
### -> GET -> EQ Presets - GAME
|
|
69
|
-
GET {{SONAR_ADDRESS}}/configs?vad=game
|
|
70
|
-
|
|
71
|
-
### -> SET -> EQ Preset - AUX - Music: Bright
|
|
72
|
-
PUT {{SONAR_ADDRESS}}/configs/c75b5225-041c-430a-abda-dd27bbbe9485/select
|
|
73
|
-
|
|
74
|
-
############
|
|
75
|
-
# Hardware #
|
|
76
|
-
############
|
|
77
|
-
|
|
78
|
-
### -> GET -> Audio Devices
|
|
79
|
-
GET {{SONAR_ADDRESS}}/audioDevices
|
|
80
|
-
|
|
81
|
-
### -> GET -> Audio Devices | Assignable
|
|
82
|
-
GET {{SONAR_ADDRESS}}/audioDevices?removeSteelSeriesVAD=true
|
|
83
|
-
|
|
84
|
-
### -> GET -> Device - Active
|
|
85
|
-
GET {{SONAR_ADDRESS}}/classicRedirections
|
|
86
|
-
|
|
87
|
-
### -> SET -> Device - Game - Speakers
|
|
88
|
-
PUT {{SONAR_ADDRESS}}/ClassicRedirections/game/deviceId/{0.0.0.00000000}.{0e5b2eb2-8d10-4e5f-b757-59a3e15def98}
|
|
89
|
-
|
|
90
|
-
### -> SET -> Device - Game - Headset
|
|
91
|
-
PUT {{SONAR_ADDRESS}}/ClassicRedirections/game/deviceId/{0.0.0.00000000}.{a555a65a-c167-480e-8825-220ccbe42b82}
|
|
92
|
-
|
|
93
|
-
### -> SET -> Device - Audio Out - Speakers
|
|
94
|
-
PUT {{SONAR_ADDRESS}}/ClassicRedirections/render/deviceId/{0.0.0.00000000}.{0e5b2eb2-8d10-4e5f-b757-59a3e15def98}
|
|
95
|
-
|
|
96
|
-
### -> SET -> Device - Audio Out - Headset
|
|
97
|
-
PUT {{SONAR_ADDRESS}}/ClassicRedirections/render/deviceId/{0.0.0.00000000}.{a555a65a-c167-480e-8825-220ccbe42b82}
|
|
98
|
-
|
|
99
|
-
###########
|
|
100
|
-
# Devices #
|
|
101
|
-
###########
|
|
102
|
-
|
|
103
|
-
### -> GET -> Audio Devices
|
|
104
|
-
GET {{SONAR_ADDRESS}}/volumeSettings/devices/volumes
|
package/src/enums.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sonar audio mixing channels.
|
|
3
|
-
* @property {@link AudioChannel.Master} - Master volume channel.
|
|
4
|
-
* @property {@link AudioChannel.Game} - Game audio channel.
|
|
5
|
-
* @property {@link AudioChannel.Chat} - Chat audio channel.
|
|
6
|
-
* @property {@link AudioChannel.Media} - Media audio channel.
|
|
7
|
-
* @property {@link AudioChannel.Aux} - Auxiliary audio channel.
|
|
8
|
-
* @property {@link AudioChannel.Mic} - Microphone audio channel.
|
|
9
|
-
*/
|
|
10
|
-
export enum AudioChannel {
|
|
11
|
-
Master = 'master',
|
|
12
|
-
Game = 'game',
|
|
13
|
-
Chat = 'chat',
|
|
14
|
-
Media = 'media',
|
|
15
|
-
Aux = 'aux',
|
|
16
|
-
Mic = 'mic'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// TODO: Sort this channel duplication nonsense out.
|
|
20
|
-
export enum ProfileChannel {
|
|
21
|
-
Game = 'game',
|
|
22
|
-
Chat = 'chat',
|
|
23
|
-
Media = 'media',
|
|
24
|
-
Aux = 'aux',
|
|
25
|
-
Mic = 'mic'
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Sonar device channels.
|
|
30
|
-
* @property {@link DeviceChannel.Output} - All output channels.
|
|
31
|
-
* @property {@link DeviceChannel.Game} - Game output channel.
|
|
32
|
-
* @property {@link DeviceChannel.Chat} - Chat output channel.
|
|
33
|
-
* @property {@link DeviceChannel.Media} - Media output channel.
|
|
34
|
-
* @property {@link DeviceChannel.Aux} - Auxiliary output channel.
|
|
35
|
-
* @property {@link DeviceChannel.Mic} - Microphone input channel.
|
|
36
|
-
*/
|
|
37
|
-
export enum DeviceChannel {
|
|
38
|
-
Output = 'render',
|
|
39
|
-
Game = 'game',
|
|
40
|
-
Chat = 'chat',
|
|
41
|
-
Media = 'media',
|
|
42
|
-
Aux = 'aux',
|
|
43
|
-
Mic = 'mic'
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Sonar Streamer Mode path.
|
|
48
|
-
* @property {@link StreamerPath.Streaming} - What the audience will hear.
|
|
49
|
-
* @property {@link StreamerPath.Monitoring} - What the owner will hear.
|
|
50
|
-
*/
|
|
51
|
-
export enum StreamerPath {
|
|
52
|
-
Streaming = 'streaming',
|
|
53
|
-
Monitoring = 'monitoring'
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Sonar mixing state.
|
|
58
|
-
* @property {@link AudioMode.Classic} - Basic mixing.
|
|
59
|
-
* @property {@link AudioMode.Streamer} - Advanced mixing - has stream/monitor path each channel.
|
|
60
|
-
*/
|
|
61
|
-
export enum AudioMode {
|
|
62
|
-
Classic = 'classic',
|
|
63
|
-
Streamer = 'stream'
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The state of CHATMIX availability.
|
|
68
|
-
* @property {@link ChatMixState.Enabled} - CHATMIX is enabled and available.
|
|
69
|
-
* @property {@link ChatMixState.FiniteWheel} - CHATMIX is available but the user cannot interact with it via software.
|
|
70
|
-
* @property {@link ChatMixState.DifferentDeviceSelected} - CHATMIX is unavailable because a different output device is selected.
|
|
71
|
-
* @property {@link ChatMixState.NoDeviceSelected} - CHATMIX is unavailable because no output device is selected.
|
|
72
|
-
*/
|
|
73
|
-
export enum ChatMixState {
|
|
74
|
-
Enabled = 'enabled',
|
|
75
|
-
FiniteWheel = 'finiteWheel',
|
|
76
|
-
DifferentDeviceSelected = 'differentDeviceSelected',
|
|
77
|
-
NoDeviceSelected = 'noDeviceSelected'
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Type of audio device.
|
|
82
|
-
* @property {@link DeviceFlow.Output} - Device used to render audio (e.g. speakers, headphones).
|
|
83
|
-
* @property {@link DeviceFlow.Input} - Device used to capture audio (e.g. microphones).
|
|
84
|
-
*/
|
|
85
|
-
export enum DeviceFlow {
|
|
86
|
-
Output = 'output',
|
|
87
|
-
Input = 'input'
|
|
88
|
-
}
|
package/src/exceptions.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
type RequestErrorProps = {
|
|
2
|
-
message?: string
|
|
3
|
-
innerException?: Error
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export enum InitializeErrorReason {
|
|
7
|
-
BadConfig = 'Bad Config',
|
|
8
|
-
OSUnsupported = 'OS Unsupported',
|
|
9
|
-
NotEnabled = 'Not Enabled',
|
|
10
|
-
NotRunning = 'Not Running',
|
|
11
|
-
NotReady = 'Not Ready',
|
|
12
|
-
NotResponding = 'Not Responding',
|
|
13
|
-
NotAvailable = 'Not Available'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type InitializeErrorProps = {
|
|
17
|
-
message?: string
|
|
18
|
-
innerException?: Error
|
|
19
|
-
reason: InitializeErrorReason
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Base exception for all handled Sonar related exception. */
|
|
23
|
-
export abstract class SonarException extends Error {
|
|
24
|
-
constructor(message: string, cause?: Error) {
|
|
25
|
-
super(message, { cause })
|
|
26
|
-
super.name = new.target.name
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** Thrown when the server responds in an unexpected way. */
|
|
31
|
-
export class SonarRequestException extends SonarException {
|
|
32
|
-
constructor(error?: RequestErrorProps) {
|
|
33
|
-
super(error?.message ?? 'There was an issue communicating with the Sonar service.', error?.innerException)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Thrown when the server cannot be determined. */
|
|
38
|
-
export class SonarInitializationException extends SonarException {
|
|
39
|
-
public reason: InitializeErrorReason
|
|
40
|
-
constructor(error: InitializeErrorProps) {
|
|
41
|
-
const message = `${error?.message ?? `There was an issue finding the Sonar service: ${error.reason}.`}${error?.innerException ? ' See inner exception.' : ''}`
|
|
42
|
-
super(message, error?.innerException)
|
|
43
|
-
this.reason = error.reason
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { AudioChannel } from '@/enums'
|
|
2
|
-
import { convertVolumeToUser } from '@/functions/converters/convert-volume-to-user'
|
|
3
|
-
import type { VolumeInfoClassic } from '@/sonar/models/audio-settings/volume-info-classic'
|
|
4
|
-
import { requestVolumeSettingsClassic } from '@/sonar/requests/volume-settings/request-volume-settings-classic'
|
|
5
|
-
import type { ChannelVolumeClassic } from '@/types/channel-volume-classic'
|
|
6
|
-
import type { ChannelVolumesClassic } from '@/types/channel-volumes-classic'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Gets audio data for all channels.
|
|
10
|
-
* @param sonarEndpoint Sonar endpoint URL
|
|
11
|
-
* @returns volume in the range of 0 to 100,
|
|
12
|
-
*/
|
|
13
|
-
export async function getAudioDataClassic(sonarEndpoint: string): Promise<ChannelVolumesClassic> {
|
|
14
|
-
const data = await requestVolumeSettingsClassic(sonarEndpoint)
|
|
15
|
-
const volumeData: ChannelVolumesClassic = {
|
|
16
|
-
[AudioChannel.Master]: createResponseVolumeData(data.masters.classic),
|
|
17
|
-
[AudioChannel.Game]: data.devices.game && createResponseVolumeData(data.devices.game.classic),
|
|
18
|
-
[AudioChannel.Chat]: data.devices.chatRender && createResponseVolumeData(data.devices.chatRender.classic),
|
|
19
|
-
[AudioChannel.Media]: data.devices.media && createResponseVolumeData(data.devices.media.classic),
|
|
20
|
-
[AudioChannel.Aux]: data.devices.aux && createResponseVolumeData(data.devices.aux.classic),
|
|
21
|
-
[AudioChannel.Mic]: data.devices.chatCapture && createResponseVolumeData(data.devices.chatCapture.classic)
|
|
22
|
-
}
|
|
23
|
-
return volumeData
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function createResponseVolumeData(volumeData: VolumeInfoClassic): ChannelVolumeClassic {
|
|
27
|
-
return {
|
|
28
|
-
volume: convertVolumeToUser(volumeData.volume),
|
|
29
|
-
isMuted: volumeData.muted
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { AudioChannel, StreamerPath } from '@/enums'
|
|
2
|
-
import { convertVolumeToUser } from '@/functions/converters/convert-volume-to-user'
|
|
3
|
-
import type { VolumeInfoStreamer } from '@/sonar/models/audio-settings/volume-info-streamer'
|
|
4
|
-
import { requestVolumeSettingsStreamer } from '@/sonar/requests/volume-settings/request-volume-settings-streamer'
|
|
5
|
-
import type { ChannelVolumeStreamer } from '@/types/channel-volume-streamer'
|
|
6
|
-
import type { ChannelVolumesStreamer } from '@/types/channel-volumes-streamer'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Gets audio data for all channels.
|
|
10
|
-
* @param sonarEndpoint Sonar endpoint URL
|
|
11
|
-
* @returns volume in the range of 0 to 100,
|
|
12
|
-
*/
|
|
13
|
-
export async function getAudioDataStream(sonarEndpoint: string): Promise<ChannelVolumesStreamer> {
|
|
14
|
-
const data = await requestVolumeSettingsStreamer(sonarEndpoint)
|
|
15
|
-
const volumeData: ChannelVolumesStreamer = {
|
|
16
|
-
[AudioChannel.Master]: createResponseVolumeData(data.masters.stream),
|
|
17
|
-
[AudioChannel.Game]: data.devices.game && createResponseVolumeData(data.devices.game.stream),
|
|
18
|
-
[AudioChannel.Chat]: data.devices.chatRender && createResponseVolumeData(data.devices.chatRender.stream),
|
|
19
|
-
[AudioChannel.Media]: data.devices.media && createResponseVolumeData(data.devices.media.stream),
|
|
20
|
-
[AudioChannel.Aux]: data.devices.aux && createResponseVolumeData(data.devices.aux.stream),
|
|
21
|
-
[AudioChannel.Mic]: data.devices.chatCapture && createResponseVolumeData(data.devices.chatCapture.stream)
|
|
22
|
-
}
|
|
23
|
-
return volumeData
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function createResponseVolumeData(volumeData: VolumeInfoStreamer): ChannelVolumeStreamer {
|
|
27
|
-
return {
|
|
28
|
-
[StreamerPath.Streaming]: {
|
|
29
|
-
volume: convertVolumeToUser(volumeData.streaming.volume),
|
|
30
|
-
isMuted: volumeData.streaming.muted
|
|
31
|
-
},
|
|
32
|
-
[StreamerPath.Monitoring]: {
|
|
33
|
-
volume: convertVolumeToUser(volumeData.monitoring.volume),
|
|
34
|
-
isMuted: volumeData.monitoring.muted
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AudioMode } from '@/enums'
|
|
2
|
-
import { requestAudioMode } from '@/sonar/requests/mode/request-audio-mode'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Gets audio data for all channels.
|
|
6
|
-
* @param sonarEndpoint Sonar endpoint URL
|
|
7
|
-
* @returns classic or streamer mode
|
|
8
|
-
*/
|
|
9
|
-
export async function getAudioMode(sonarEndpoint: string): Promise<AudioMode> {
|
|
10
|
-
return await requestAudioMode(sonarEndpoint)
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AudioMode } from '@/enums'
|
|
2
|
-
import { changeAudioMode } from '@/sonar/requests/mode/change-audio-mode'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Gets audio data for all channels.
|
|
6
|
-
* @param sonarEndpoint Sonar endpoint URL
|
|
7
|
-
* @param audioMode Target audio mode
|
|
8
|
-
* @returns classic or streamer mode
|
|
9
|
-
*/
|
|
10
|
-
export async function setAudioMode(sonarEndpoint: string, audioMode: AudioMode): Promise<AudioMode> {
|
|
11
|
-
return await changeAudioMode(sonarEndpoint, audioMode)
|
|
12
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { AudioChannel } from '@/enums'
|
|
2
|
-
import { SonarRequestException } from '@/exceptions'
|
|
3
|
-
import { convertChannelToApi } from '@/functions/converters/convert-channel-to-api'
|
|
4
|
-
import { convertVolumeToUser } from '@/functions/converters/convert-volume-to-user'
|
|
5
|
-
import { SonarChannel } from '@/sonar/models/audio-settings/enums/sonar-channel'
|
|
6
|
-
import { changeVolumeMuteClassic } from '@/sonar/requests/volume-settings/change-volume-mute-classic'
|
|
7
|
-
import type { ChannelVolumeClassic } from '@/types/channel-volume-classic'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Sets audio data for target channel.
|
|
11
|
-
* @param sonarEndpoint Sonar endpoint URL
|
|
12
|
-
* @param isMuted Will mute if true.
|
|
13
|
-
* @param channel Target audio channel
|
|
14
|
-
*/
|
|
15
|
-
export async function setChannelMuteClassic(
|
|
16
|
-
sonarEndpoint: string,
|
|
17
|
-
isMuted: boolean,
|
|
18
|
-
channel: AudioChannel
|
|
19
|
-
): Promise<ChannelVolumeClassic> {
|
|
20
|
-
const sonarChannel = convertChannelToApi(channel)
|
|
21
|
-
const data = await changeVolumeMuteClassic(sonarEndpoint, isMuted, sonarChannel)
|
|
22
|
-
|
|
23
|
-
const device = sonarChannel === SonarChannel.Master ? data.masters.classic : data.devices[sonarChannel]?.classic
|
|
24
|
-
|
|
25
|
-
if (!device) {
|
|
26
|
-
throw new SonarRequestException({ message: `Missing device data in response.` })
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const result: ChannelVolumeClassic = {
|
|
30
|
-
volume: convertVolumeToUser(device.volume),
|
|
31
|
-
isMuted: device.muted
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return result
|
|
35
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { type AudioChannel, StreamerPath } from '@/enums'
|
|
2
|
-
import { SonarRequestException } from '@/exceptions'
|
|
3
|
-
import { convertChannelToApi } from '@/functions/converters/convert-channel-to-api'
|
|
4
|
-
import { convertVolumeToUser } from '@/functions/converters/convert-volume-to-user'
|
|
5
|
-
import { SonarChannel } from '@/sonar/models/audio-settings/enums/sonar-channel'
|
|
6
|
-
import { StreamingPath } from '@/sonar/models/audio-settings/enums/streaming-path'
|
|
7
|
-
import { changeVolumeMuteStreamer } from '@/sonar/requests/volume-settings/change-volume-mute-streamer'
|
|
8
|
-
import type { ChannelVolumeStreamerPath } from '@/types/channel-volume-streamer-path'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Sets audio data for target channel.
|
|
12
|
-
* @param sonarEndpoint Sonar endpoint URL
|
|
13
|
-
* @param isMuted Will mute if true.
|
|
14
|
-
* @param channel Target audio channel
|
|
15
|
-
* @param path Target streamer path
|
|
16
|
-
*/
|
|
17
|
-
export async function setChannelMuteStreamer(
|
|
18
|
-
sonarEndpoint: string,
|
|
19
|
-
isMuted: boolean,
|
|
20
|
-
channel: AudioChannel,
|
|
21
|
-
path: StreamerPath
|
|
22
|
-
): Promise<ChannelVolumeStreamerPath> {
|
|
23
|
-
const sonarChannel = convertChannelToApi(channel)
|
|
24
|
-
const streamPath = path === StreamerPath.Streaming ? StreamingPath.Streaming : StreamingPath.Monitoring
|
|
25
|
-
const data = await changeVolumeMuteStreamer(sonarEndpoint, isMuted, sonarChannel, streamPath)
|
|
26
|
-
|
|
27
|
-
const device = sonarChannel === SonarChannel.Master ? data.masters.stream : data.devices[sonarChannel]?.stream
|
|
28
|
-
|
|
29
|
-
if (!device) {
|
|
30
|
-
throw new SonarRequestException({ message: `Missing device data in response.` })
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const devicePath = path === StreamerPath.Streaming ? device.streaming : device.monitoring
|
|
34
|
-
|
|
35
|
-
const result: ChannelVolumeStreamerPath = {
|
|
36
|
-
volume: convertVolumeToUser(devicePath.volume),
|
|
37
|
-
isMuted: devicePath.muted
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return result
|
|
41
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { AudioChannel } from '@/enums'
|
|
2
|
-
import { SonarRequestException } from '@/exceptions'
|
|
3
|
-
import { convertChannelToApi } from '@/functions/converters/convert-channel-to-api'
|
|
4
|
-
import { convertVolumeToApi } from '@/functions/converters/convert-volume-to-api'
|
|
5
|
-
import { convertVolumeToUser } from '@/functions/converters/convert-volume-to-user'
|
|
6
|
-
import { SonarChannel } from '@/sonar/models/audio-settings/enums/sonar-channel'
|
|
7
|
-
import { changeVolumeLevelClassic } from '@/sonar/requests/volume-settings/change-volume-level-classic'
|
|
8
|
-
import type { ChannelVolumeClassic } from '@/types/channel-volume-classic'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Sets audio data for target channel.
|
|
12
|
-
* @param sonarEndpoint Sonar endpoint URL
|
|
13
|
-
* @param volumePercent Volume in the range of 0 to 100
|
|
14
|
-
* @param channel Target audio channel
|
|
15
|
-
*/
|
|
16
|
-
export async function setChannelVolumeClassic(
|
|
17
|
-
sonarEndpoint: string,
|
|
18
|
-
volumePercent: number,
|
|
19
|
-
channel: AudioChannel
|
|
20
|
-
): Promise<ChannelVolumeClassic> {
|
|
21
|
-
const sonarChannel = convertChannelToApi(channel)
|
|
22
|
-
const formattedVolume = convertVolumeToApi(volumePercent)
|
|
23
|
-
const data = await changeVolumeLevelClassic(sonarEndpoint, formattedVolume, sonarChannel)
|
|
24
|
-
|
|
25
|
-
const device = sonarChannel === SonarChannel.Master ? data.masters.classic : data.devices[sonarChannel]?.classic
|
|
26
|
-
|
|
27
|
-
if (!device) {
|
|
28
|
-
throw new SonarRequestException({ message: `Missing device data in response.` })
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const result: ChannelVolumeClassic = {
|
|
32
|
-
volume: convertVolumeToUser(device.volume),
|
|
33
|
-
isMuted: device.muted
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return result
|
|
37
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { type AudioChannel, StreamerPath } from '@/enums'
|
|
2
|
-
import { SonarRequestException } from '@/exceptions'
|
|
3
|
-
import { convertChannelToApi } from '@/functions/converters/convert-channel-to-api'
|
|
4
|
-
import { convertVolumeToApi } from '@/functions/converters/convert-volume-to-api'
|
|
5
|
-
import { convertVolumeToUser } from '@/functions/converters/convert-volume-to-user'
|
|
6
|
-
import { SonarChannel } from '@/sonar/models/audio-settings/enums/sonar-channel'
|
|
7
|
-
import { StreamingPath } from '@/sonar/models/audio-settings/enums/streaming-path'
|
|
8
|
-
import { changeVolumeLevelStreamer } from '@/sonar/requests/volume-settings/change-volume-level-streamer'
|
|
9
|
-
import type { ChannelVolumeStreamerPath } from '@/types/channel-volume-streamer-path'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Sets audio data for target channel.
|
|
13
|
-
* @param sonarEndpoint Sonar endpoint URL
|
|
14
|
-
* @param volumePercent Volume in the range of 0 to 100
|
|
15
|
-
* @param channel Target audio channel
|
|
16
|
-
* @param path Target streamer path
|
|
17
|
-
*/
|
|
18
|
-
export async function setChannelVolumeStreamer(
|
|
19
|
-
sonarEndpoint: string,
|
|
20
|
-
volumePercent: number,
|
|
21
|
-
channel: AudioChannel,
|
|
22
|
-
path: StreamerPath
|
|
23
|
-
): Promise<ChannelVolumeStreamerPath> {
|
|
24
|
-
const sonarChannel = convertChannelToApi(channel)
|
|
25
|
-
const formattedVolume = convertVolumeToApi(volumePercent)
|
|
26
|
-
const streamPath = path === StreamerPath.Streaming ? StreamingPath.Streaming : StreamingPath.Monitoring
|
|
27
|
-
const data = await changeVolumeLevelStreamer(sonarEndpoint, formattedVolume, sonarChannel, streamPath)
|
|
28
|
-
|
|
29
|
-
const device = sonarChannel === SonarChannel.Master ? data.masters.stream : data.devices[sonarChannel]?.stream
|
|
30
|
-
|
|
31
|
-
if (!device) {
|
|
32
|
-
throw new SonarRequestException({ message: `Missing device data in response.` })
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const devicePath = path === StreamerPath.Streaming ? device.streaming : device.monitoring
|
|
36
|
-
|
|
37
|
-
const result: ChannelVolumeStreamerPath = {
|
|
38
|
-
volume: convertVolumeToUser(devicePath.volume),
|
|
39
|
-
isMuted: devicePath.muted
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return result
|
|
43
|
-
}
|