2020-10-17 20:12:00 +09:00
|
|
|
<template>
|
2021-11-28 20:07:37 +09:00
|
|
|
<div class="_formRoot">
|
|
|
|
<FormRange v-model="masterVolume" :min="0" :max="1" :step="0.05" :text-converter="(v) => `${Math.floor(v * 100)}%`" class="_formBlock">
|
2022-05-05 22:51:05 +09:00
|
|
|
<template #label>{{ i18n.ts.masterVolume }}</template>
|
2020-11-25 21:31:34 +09:00
|
|
|
</FormRange>
|
|
|
|
|
2021-11-28 20:07:37 +09:00
|
|
|
<FormSection>
|
2022-05-05 22:51:05 +09:00
|
|
|
<template #label>{{ i18n.ts.sounds }}</template>
|
2021-11-28 20:07:37 +09:00
|
|
|
<FormLink v-for="type in Object.keys(sounds)" :key="type" style="margin-bottom: 8px;" @click="edit(type)">
|
2020-11-25 21:31:34 +09:00
|
|
|
{{ $t('_sfx.' + type) }}
|
2022-05-05 22:51:05 +09:00
|
|
|
<template #suffix>{{ sounds[type].type || i18n.ts.none }}</template>
|
2022-12-19 19:01:30 +09:00
|
|
|
<template #suffixIcon><i class="ti ti-chevron-down"></i></template>
|
2021-11-28 20:07:37 +09:00
|
|
|
</FormLink>
|
|
|
|
</FormSection>
|
2020-11-25 21:31:34 +09:00
|
|
|
|
2022-12-20 08:35:49 +09:00
|
|
|
<FormButton danger class="_formBlock" @click="reset()"><i class="ti ti-reload"></i> {{ i18n.ts.default }}</FormButton>
|
2021-11-28 20:07:37 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</template>
|
|
|
|
|
2022-05-05 22:51:05 +09:00
|
|
|
<script lang="ts" setup>
|
2022-06-20 17:38:49 +09:00
|
|
|
import { computed, ref } from 'vue';
|
2021-11-28 20:07:37 +09:00
|
|
|
import FormRange from '@/components/form/range.vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import FormButton from '@/components/MkButton.vue';
|
2021-11-28 20:07:37 +09:00
|
|
|
import FormLink from '@/components/form/link.vue';
|
|
|
|
import FormSection from '@/components/form/section.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as os from '@/os';
|
|
|
|
import { ColdDeviceStorage } from '@/store';
|
|
|
|
import { playFile } from '@/scripts/sound';
|
2022-05-05 22:51:05 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2022-05-05 22:51:05 +09:00
|
|
|
|
|
|
|
const masterVolume = computed({
|
|
|
|
get: () => {
|
|
|
|
return ColdDeviceStorage.get('sound_masterVolume');
|
|
|
|
},
|
|
|
|
set: (value) => {
|
|
|
|
ColdDeviceStorage.set('sound_masterVolume', value);
|
2022-06-20 17:38:49 +09:00
|
|
|
},
|
2022-05-05 22:51:05 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
const volumeIcon = computed(() => masterVolume.value === 0 ? 'fas fa-volume-mute' : 'fas fa-volume-up');
|
|
|
|
|
|
|
|
const sounds = ref({
|
2022-06-20 17:38:49 +09:00
|
|
|
note: ColdDeviceStorage.get('sound_note'),
|
|
|
|
noteMy: ColdDeviceStorage.get('sound_noteMy'),
|
|
|
|
notification: ColdDeviceStorage.get('sound_notification'),
|
|
|
|
chat: ColdDeviceStorage.get('sound_chat'),
|
|
|
|
chatBg: ColdDeviceStorage.get('sound_chatBg'),
|
|
|
|
antenna: ColdDeviceStorage.get('sound_antenna'),
|
|
|
|
channel: ColdDeviceStorage.get('sound_channel'),
|
2022-05-05 22:51:05 +09:00
|
|
|
});
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2020-11-25 21:31:34 +09:00
|
|
|
const soundsTypes = [
|
2020-10-17 20:12:00 +09:00
|
|
|
null,
|
|
|
|
'syuilo/up',
|
|
|
|
'syuilo/down',
|
|
|
|
'syuilo/pope1',
|
|
|
|
'syuilo/pope2',
|
|
|
|
'syuilo/waon',
|
|
|
|
'syuilo/popo',
|
|
|
|
'syuilo/triple',
|
|
|
|
'syuilo/poi1',
|
|
|
|
'syuilo/poi2',
|
|
|
|
'syuilo/pirori',
|
|
|
|
'syuilo/pirori-wet',
|
|
|
|
'syuilo/pirori-square-wet',
|
|
|
|
'syuilo/square-pico',
|
|
|
|
'syuilo/reverved',
|
|
|
|
'syuilo/ryukyu',
|
2020-11-25 21:31:34 +09:00
|
|
|
'syuilo/kick',
|
|
|
|
'syuilo/snare',
|
2021-08-14 18:19:25 +09:00
|
|
|
'syuilo/queue-jammed',
|
2020-10-17 20:12:00 +09:00
|
|
|
'aisha/1',
|
|
|
|
'aisha/2',
|
|
|
|
'aisha/3',
|
2022-12-06 12:34:39 +09:00
|
|
|
'noizenecio/kick_gaba1',
|
2020-10-17 20:12:00 +09:00
|
|
|
'noizenecio/kick_gaba2',
|
2022-12-06 12:34:39 +09:00
|
|
|
'noizenecio/kick_gaba3',
|
|
|
|
'noizenecio/kick_gaba4',
|
|
|
|
'noizenecio/kick_gaba5',
|
|
|
|
'noizenecio/kick_gaba6',
|
|
|
|
'noizenecio/kick_gaba7',
|
2020-10-17 20:12:00 +09:00
|
|
|
];
|
|
|
|
|
2022-05-05 22:51:05 +09:00
|
|
|
async function edit(type) {
|
|
|
|
const { canceled, result } = await os.form(i18n.t('_sfx.' + type), {
|
|
|
|
type: {
|
|
|
|
type: 'enum',
|
|
|
|
enum: soundsTypes.map(x => ({
|
|
|
|
value: x,
|
|
|
|
label: x == null ? i18n.ts.none : x,
|
|
|
|
})),
|
|
|
|
label: i18n.ts.sound,
|
|
|
|
default: sounds.value[type].type,
|
|
|
|
},
|
|
|
|
volume: {
|
|
|
|
type: 'range',
|
2022-08-26 15:39:31 +09:00
|
|
|
min: 0,
|
2022-05-05 22:51:05 +09:00
|
|
|
max: 1,
|
|
|
|
step: 0.05,
|
|
|
|
textConverter: (v) => `${Math.floor(v * 100)}%`,
|
|
|
|
label: i18n.ts.volume,
|
2022-06-20 17:38:49 +09:00
|
|
|
default: sounds.value[type].volume,
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
2022-05-05 22:51:05 +09:00
|
|
|
listen: {
|
|
|
|
type: 'button',
|
|
|
|
content: i18n.ts.listen,
|
|
|
|
action: (_, values) => {
|
|
|
|
playFile(values.type, values.volume);
|
2022-06-20 17:38:49 +09:00
|
|
|
},
|
|
|
|
},
|
2022-05-05 22:51:05 +09:00
|
|
|
});
|
|
|
|
if (canceled) return;
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-05-05 22:51:05 +09:00
|
|
|
const v = {
|
|
|
|
type: result.type,
|
|
|
|
volume: result.volume,
|
|
|
|
};
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-05-05 22:51:05 +09:00
|
|
|
ColdDeviceStorage.set('sound_' + type, v);
|
|
|
|
sounds.value[type] = v;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-05-05 22:51:05 +09:00
|
|
|
function reset() {
|
|
|
|
for (const sound of Object.keys(sounds.value)) {
|
|
|
|
const v = ColdDeviceStorage.default['sound_' + sound];
|
|
|
|
ColdDeviceStorage.set('sound_' + sound, v);
|
|
|
|
sounds.value[sound] = v;
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.sounds,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-music',
|
2020-10-17 20:12:00 +09:00
|
|
|
});
|
|
|
|
</script>
|