diff --git a/app.vue b/app.vue index 19a71a9..bd42654 100644 --- a/app.vue +++ b/app.vue @@ -30,6 +30,8 @@ useHead({ ], }); +defaultAlertAudioSource().value = `${useRuntimeConfig().app.baseURL}alert.mp3`; + onMounted(async () => { try { // スリープを無効化 diff --git a/components/settings.vue b/components/settings.vue index bc3b8eb..fd7543a 100644 --- a/components/settings.vue +++ b/components/settings.vue @@ -85,7 +85,7 @@ const removeAudio = (fileName: string, sourceState: globalThis.Ref, stor // メモリ上の音源/名前を元に戻す fileNameState.value = 'デフォルトの音声'; - sourceState.value = "/alert.mp3"; + sourceState.value = defaultAlertAudioSource().value; } const onAlertAudioChange = async (e: Event) => { diff --git a/composables/states.ts b/composables/states.ts index 03bd0a4..6e60efe 100644 --- a/composables/states.ts +++ b/composables/states.ts @@ -11,12 +11,16 @@ export const time = () => useState('time', () => dayjs().toDate()); // 現在のセンサー情報のソース export const sensorSource = () => useState('sensorSource', () => "rpi"); + +// alert.mp3のソース +export const defaultAlertAudioSource = () => useState('defaultAlertAudioSource', () => '/alert.mp3'); + // タイマーの音声のソース -export const timerAlertSource = () => useState('timerSource', () => "/alert.mp3"); +export const timerAlertSource = () => useState('timerSource', () => defaultAlertAudioSource().value); // チャイムの音声ソース -export const chimeSource = () => useState('chimeSource', () => "/alert.mp3"); +export const chimeSource = () => useState('chimeSource', () => defaultAlertAudioSource().value); // 予鈴の音声ソース -export const preChimeSource = () => useState('preChimeSource', () => "/alert.mp3"); +export const preChimeSource = () => useState('preChimeSource', () => defaultAlertAudioSource().value); // タイマーのインターバル export const interval = () => useState('interval', () => null);