Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Essem
Sharkey
Commits
4b13179f
Unverified
Commit
4b13179f
authored
1 year ago
by
おさむのひと
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
サウンド再生方法の変更に追従できていなかった所を修正 (#12368)
Co-authored-by:
osamu
<
46447427+sam-osamu@users.noreply.github.com
>
parent
481bca4c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
packages/frontend/src/scripts/sound.ts
+10
-10
10 additions, 10 deletions
packages/frontend/src/scripts/sound.ts
packages/frontend/src/widgets/WidgetJobQueue.vue
+11
-3
11 additions, 3 deletions
packages/frontend/src/widgets/WidgetJobQueue.vue
with
22 additions
and
13 deletions
CHANGELOG.md
+
1
−
0
View file @
4b13179f
...
...
@@ -20,6 +20,7 @@
### Client
-
fix: 「設定のバックアップ」で一部の項目がバックアップに含まれていなかった問題を修正
-
Fix: ウィジェットのジョブキューにて音声の発音方法変更に追従できていなかったのを修正 #12367
### Server
-
Fix: 時間経過により無効化されたアンテナを再有効化したとき、サーバ再起動までその状況が反映されないのを修正 #12303
...
...
This diff is collapsed.
Click to expand it.
packages/frontend/src/scripts/sound.ts
+
10
−
10
View file @
4b13179f
...
...
@@ -61,7 +61,7 @@ export const soundsTypes = [
'
noizenecio/kick_gaba7
'
,
]
as const
;
export
async
function
get
Audio
(
file
:
string
,
useCache
=
true
)
{
export
async
function
load
Audio
(
file
:
string
,
useCache
=
true
)
{
if
(
useCache
&&
cache
.
has
(
file
))
{
return
cache
.
get
(
file
)
!
;
}
...
...
@@ -77,12 +77,6 @@ export async function getAudio(file: string, useCache = true) {
return
audioBuffer
;
}
export
function
setVolume
(
audio
:
HTMLAudioElement
,
volume
:
number
):
HTMLAudioElement
{
const
masterVolume
=
defaultStore
.
state
.
sound_masterVolume
;
audio
.
volume
=
masterVolume
-
((
1
-
volume
)
*
masterVolume
);
return
audio
;
}
export
function
play
(
type
:
'
noteMy
'
|
'
note
'
|
'
antenna
'
|
'
channel
'
|
'
notification
'
)
{
const
sound
=
defaultStore
.
state
[
`sound_
${
type
}
`
];
if
(
_DEV_
)
console
.
log
(
'
play
'
,
type
,
sound
);
...
...
@@ -91,16 +85,22 @@ export function play(type: 'noteMy' | 'note' | 'antenna' | 'channel' | 'notifica
}
export
async
function
playFile
(
file
:
string
,
volume
:
number
)
{
const
buffer
=
await
loadAudio
(
file
);
createSourceNode
(
buffer
,
volume
)?.
start
();
}
export
function
createSourceNode
(
buffer
:
AudioBuffer
,
volume
:
number
)
:
AudioBufferSourceNode
|
null
{
const
masterVolume
=
defaultStore
.
state
.
sound_masterVolume
;
if
(
masterVolume
===
0
||
volume
===
0
)
{
return
;
return
null
;
}
const
gainNode
=
ctx
.
createGain
();
gainNode
.
gain
.
value
=
masterVolume
*
volume
;
const
soundSource
=
ctx
.
createBufferSource
();
soundSource
.
buffer
=
await
getAudio
(
file
)
;
soundSource
.
buffer
=
buffer
;
soundSource
.
connect
(
gainNode
).
connect
(
ctx
.
destination
);
soundSource
.
start
();
return
soundSource
;
}
This diff is collapsed.
Click to expand it.
packages/frontend/src/widgets/WidgetJobQueue.vue
+
11
−
3
View file @
4b13179f
...
...
@@ -99,7 +99,10 @@ const current = reactive({
},
});
const
prev
=
reactive
({}
as
typeof
current
);
const
jammedSound
=
sound
.
setVolume
(
sound
.
getAudio
(
'
syuilo/queue-jammed
'
),
1
);
let
jammedAudioBuffer
:
AudioBuffer
|
null
=
$ref
(
null
);
let
jammedSoundNodePlaying
:
boolean
=
$ref
(
false
);
sound
.
loadAudio
(
'
syuilo/queue-jammed
'
).
then
(
buf
=>
jammedAudioBuffer
=
buf
);
for
(
const
domain
of
[
'
inbox
'
,
'
deliver
'
])
{
prev
[
domain
]
=
deepClone
(
current
[
domain
]);
...
...
@@ -113,8 +116,13 @@ const onStats = (stats) => {
current
[
domain
].
waiting
=
stats
[
domain
].
waiting
;
current
[
domain
].
delayed
=
stats
[
domain
].
delayed
;
if
(
current
[
domain
].
waiting
>
0
&&
widgetProps
.
sound
&&
jammedSound
.
paused
)
{
jammedSound
.
play
();
if
(
current
[
domain
].
waiting
>
0
&&
widgetProps
.
sound
&&
jammedAudioBuffer
&&
!
jammedSoundNodePlaying
)
{
const
soundNode
=
sound
.
createSourceNode
(
jammedAudioBuffer
,
1
);
if
(
soundNode
)
{
jammedSoundNodePlaying
=
true
;
soundNode
.
onended
=
()
=>
jammedSoundNodePlaying
=
false
;
soundNode
.
start
();
}
}
}
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment