Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Change(s)

<!-- ✏️ Describe *what* was changed in this PR. Be as clear and specific as possible. -->
<!-- 📝 Note: Please try to use bullet points and/or numbered list.
<!-- 📝 Note: Please try to use bullet points and/or numbered list.

**Example**

Expand Down
11 changes: 4 additions & 7 deletions src/services/web-audio-api.service.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
AUDIO_SOUND,
AUDIO_VOLUME,
CLIENT_ERROR_MESSAGE,
} from '../utils/constants.js';
import { DEFAULT_SETTINGS } from '../stores/settings.js';
import { AUDIO_SOUND, CLIENT_ERROR_MESSAGE } from '../utils/constants.js';

class WebAudioApiService {
/** @type {AudioContext | undefined} */
Expand Down Expand Up @@ -59,7 +56,7 @@ class WebAudioApiService {
* @param {number} volume
* @returns {GainNode}
*/
#createGain(volume = AUDIO_VOLUME.ONE_HUNDRED_PERCENT) {
#createGain(volume = DEFAULT_SETTINGS.audioVolume) {
const gainNode = /** @type {GainNode} */ (this.#audioContext?.createGain());
gainNode.gain.value = Math.min(Math.max(volume / 100, 0), 1);
const destination = /** @type {AudioDestinationNode} */ (
Expand All @@ -74,7 +71,7 @@ class WebAudioApiService {
* @param {number} volume
* @returns {Promise<void>}
*/
async playSound(id, volume = AUDIO_VOLUME.ONE_HUNDRED_PERCENT) {
async playSound(id, volume = DEFAULT_SETTINGS.audioVolume) {
if (!this.#audioContext) {
console.error(
`${CLIENT_ERROR_MESSAGE.PLAY_SOUND_FAILED} AudioContext unavailable.`
Expand Down
Loading