Skip to content

Commit 81bfeef

Browse files
author
lijiahao
committed
feat: Add audio rumble supported
1 parent 898c274 commit 81bfeef

File tree

11 files changed

+82
-18
lines changed

11 files changed

+82
-18
lines changed

app/background.js

Lines changed: 4 additions & 2 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"name": "xstreaming",
44
"description": "xstreaming",
5-
"version": "1.9.5",
5+
"version": "1.9.6",
66
"author": "Geocld <lijiahao5372@gmail.com>",
77
"main": "app/background.js",
88
"scripts": {
@@ -42,7 +42,7 @@
4242
"uplot": "^1.6.30",
4343
"uuid-1345": "^1.0.2",
4444
"xbox-webapi": "^1.4.1",
45-
"xstreaming-player": "0.2.25",
45+
"xstreaming-player": "0.2.27",
4646
"xvfb-maybe": "^0.2.1"
4747
},
4848
"devDependencies": {

renderer/common/settings.ts

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,6 @@ const getSettingsMetas = (t) => {
216216
'Set the streaming audio bitrate',
217217
)
218218
},
219-
{
220-
name: 'enable_audio_control',
221-
type: 'radio',
222-
title: t('Audio_volume_title'),
223-
description: t('Audio_volume_desc'),
224-
data: [
225-
{value: false, label: t('Disable')},
226-
{value: true, label: t('Enable')},
227-
],
228-
},
229219
{
230220
name: 'performance_style',
231221
type: 'radio',
@@ -350,6 +340,38 @@ const getSettingsMetas = (t) => {
350340
],
351341
},
352342
],
343+
audio: [
344+
{
345+
name: 'enable_audio_control',
346+
type: 'radio',
347+
title: t('Audio_volume_title'),
348+
description: t('Audio_volume_desc'),
349+
data: [
350+
{value: false, label: t('Disable')},
351+
{value: true, label: t('Enable')},
352+
],
353+
},
354+
{
355+
name: 'enable_audio_rumble',
356+
type: 'radio',
357+
title: t('Audio_rumble_title'),
358+
description: t('Audio_rumble_desc'),
359+
data: [
360+
{value: false, label: t('Disable')},
361+
{value: true, label: t('Enable')},
362+
],
363+
},
364+
{
365+
name: 'audio_rumble_threshold',
366+
type: 'slider',
367+
min: 0.01,
368+
max: 0.5,
369+
step: 0.01,
370+
title: t('Audio_rumble_threshold_title'),
371+
description: t('Audio_rumble_threshold_desc'),
372+
data: [],
373+
},
374+
],
353375
xhome: [
354376
{
355377
name: 'power_on',

renderer/context/userContext.defaults.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export const defaultSettings = {
1111
audio_bitrate_mode: "Auto",
1212
audio_bitrate: 20,
1313
enable_audio_control: false,
14+
enable_audio_rumble: false,
15+
audio_rumble_threshold: 0.15,
1416
preferred_game_language: "en-US",
1517
force_region_ip: "",
1618
codec: "",

renderer/pages/[locale]/settings.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ function Settings() {
2626
const router = useRouter();
2727
const { theme } = useTheme();
2828

29+
console.log('locale:', locale)
30+
2931
const [showAlert, setShowAlert] = useState(false);
3032
const [showRestartModal, setShowRestartModal] = useState(false);
3133
const [showUpdateModal, setShowUpdateModal] = useState(false);
@@ -358,6 +360,20 @@ function Settings() {
358360
</Card>
359361
</Tab>
360362

363+
<Tab key="Audio" title={t("Audio")}>
364+
{settings.audio &&
365+
settings.audio.map((item) => {
366+
return (
367+
<SettingItem
368+
key={item.name}
369+
item={item}
370+
onRestartWarn={() => setShowRestartModal(true)}
371+
onClearCache={() => handleClearCache()}
372+
/>
373+
);
374+
})}
375+
</Tab>
376+
361377
<Tab key="XHome" title={t("Xhome")}>
362378
{settings.xhome &&
363379
settings.xhome.map((item) => {

renderer/pages/[locale]/stream.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ function Stream() {
224224
xPlayer.setAudioControl(true)
225225
}
226226

227+
// Set audio runble
228+
if (settings.enable_audio_rumble) {
229+
xPlayer.setAudioRumble(settings.enable_audio_rumble, settings.audio_rumble_threshold)
230+
}
231+
227232
// Set polling rate
228233
if (settings.polling_rate) {
229234
xPlayer.setPollRate(settings.polling_rate)

renderer/public/locales/en/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@
116116
"Audio_volume_title": "Volume Control",
117117
"Audio_volume_desc":
118118
"If the default maximum volume does not meet your expectations, you can choose to amplify the audio source here (Note: excessive volume may affect your hearing!)",
119+
"Audio_rumble_title": "Audio Rumble(Experimental)",
120+
"Audio_rumble_desc": "Enable this option if you want the controller to vibrate when the audio exceeds a certain threshold",
121+
"Audio_rumble_threshold_title": "Audio Rumble Threshold",
122+
"Audio_rumble_threshold_desc": "Combine with audio rumble, the controller will vibrate when the audio exceeds this threshold",
119123
"Polling rate": "Polling rate",
120124
"Modify controller response rate": "Modify controller response rate",
121125
"native_mouse_keyboard_title": "Use Native Keyboard and Mouse (Experimental)",

renderer/public/locales/pt/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@
114114
"Audio_volume_title": "Volume Control",
115115
"Audio_volume_desc":
116116
"If the default maximum volume does not meet your expectations, you can choose to amplify the audio source here (Note: excessive volume may affect your hearing!)",
117+
"Audio_rumble_title": "Audio Rumble(Experimental)",
118+
"Audio_rumble_desc": "Enable this option if you want the controller to vibrate when the audio exceeds a certain threshold",
119+
"Audio_rumble_threshold_title": "Audio Rumble Threshold",
120+
"Audio_rumble_threshold_desc": "Combine with audio rumble, the controller will vibrate when the audio exceeds this threshold",
117121
"Polling rate": "Polling rate",
118122
"Modify controller response rate": "Modify controller response rate",
119123
"native_mouse_keyboard_title": "Use Native Keyboard and Mouse (Experimental)",

renderer/public/locales/zh/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"Language": "语言",
1414
"Streaming": "串流",
1515
"Gamepad": "手柄",
16+
"Audio": "声音",
1617
"Xhome": "主机串流",
1718
"Xcloud": "云游戏",
1819
"Others": "其他",
@@ -101,6 +102,10 @@
101102
"Audio_volume_title": "音量控制",
102103
"Audio_volume_desc":
103104
"如果默认音量最大值达不到预期,可以在此处选择放大音源(注意过大的音量会影响听力!)",
105+
"Audio_rumble_title": "音频振动(实验性)",
106+
"Audio_rumble_desc": "开启后控制器会在音频超过某个阈值时振动",
107+
"Audio_rumble_threshold_title": "音频振动阈值",
108+
"Audio_rumble_threshold_desc": "配合音频振动使用,超过该阈值时控制器会振动",
104109
"Polling rate": "手柄回报率",
105110
"Modify controller response rate": "修改手柄回报率",
106111
"native_mouse_keyboard_title": "使用原生键盘鼠标(实验性)",

renderer/public/locales/zht/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@
101101
"Audio_volume_title": "音量控制",
102102
"Audio_volume_desc":
103103
"如果默认音量最大值达不到预期,可以在此处选择放大音源(注意过大的音量会影响听力!)",
104+
"Audio_rumble_title": "音频振动(实验性)",
105+
"Audio_rumble_desc": "如果希望在音频超过某个阈值时振动,可以开启此选项",
106+
"Audio_rumble_threshold_title": "音频振动阈值",
107+
"Audio_rumble_threshold_desc": "配合音频振动使用,超过该阈值时控制器会振动",
104108
"Polling rate": "手柄回报率",
105109
"Modify controller response rate": "修改手柄回报率",
106110
"native_mouse_keyboard_title": "使用原生鍵盤滑鼠(實驗性)",

0 commit comments

Comments
 (0)