Added deprecation notice and WIP SFX stuff I never finished.
This commit is contained in:
parent
02d5e089fe
commit
c439369947
7 changed files with 80 additions and 2 deletions
2
LICENCE
2
LICENCE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2019-2024, flashwave <me@flash.moe>
|
||||
Copyright (c) 2019-2025, flashwave <me@flash.moe>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# Hanyuu
|
||||
|
||||
Hanyuu is the identity and authorisation server for Flashii.
|
||||
Hanyuu *was* the identity and authorisation server for Flashii.
|
||||
Its functionality has been absorbed by the main [Misuzu](https://patchii.net/flashii/misuzu) codebase.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include loading.jsx
|
||||
#include sfx.js
|
||||
#include app/info.jsx
|
||||
#include app/scope.jsx
|
||||
#include header/header.js
|
||||
|
|
76
assets/oauth2.js/sfx.js
Normal file
76
assets/oauth2.js/sfx.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
const HanyuuOAuth2Sfx = (() => {
|
||||
const sfxPath = document.createElement('audio').canPlayType('audio/ogg;codecs=opus') !== ''
|
||||
? '/static/hanyuu.opus'
|
||||
: '/static/hanyuu.caf';
|
||||
|
||||
const sfxList = {
|
||||
'signal-search': [0.549, 2.424],
|
||||
'menu-open': [2.606, 1.469],
|
||||
'menu-close': [4.076, 1.127],
|
||||
'menu-error': [5.203, .192],
|
||||
'type': [5.332, .125],
|
||||
'tiny-click': [5.457, .053],
|
||||
'invalid': [5.510, .232],
|
||||
'settings-menu': [5.742, .429],
|
||||
'settings-open': [6.171, .196],
|
||||
'settings-close': [6.367, .232],
|
||||
'option-up': [6.599, .097],
|
||||
'option-down': [6.696, .093],
|
||||
};
|
||||
|
||||
const audioCtx = (() => {
|
||||
const audioCtxObj = window.AudioContext || window.webkitAudioContext;
|
||||
try {
|
||||
return new audioCtxObj({ latencyHint: 'playback' });
|
||||
} catch(ex) {
|
||||
return new audioCtxObj;
|
||||
}
|
||||
})();
|
||||
|
||||
let sndSpriteBuffer;
|
||||
const playSound = async (name, loop) => {
|
||||
if(audioCtx.state !== 'running')
|
||||
await audioCtx.resume();
|
||||
|
||||
if(sndSpriteBuffer === undefined)
|
||||
sndSpriteBuffer = await audioCtx.decodeAudioData(
|
||||
(await $x.get(sfxPath, { type: 'arraybuffer' })).body()
|
||||
);
|
||||
|
||||
const sfx = sfxList[name];
|
||||
if(!Array.isArray(sfx))
|
||||
throw 'sound does not exist';
|
||||
|
||||
const source = new AudioBufferSourceNode(audioCtx, {
|
||||
buffer: sndSpriteBuffer,
|
||||
});
|
||||
source.connect(audioCtx.destination);
|
||||
|
||||
if(loop) {
|
||||
source.loop = true;
|
||||
source.loopStart = sfx[0];
|
||||
source.loopEnd = sfx[1];
|
||||
source.start();
|
||||
} else
|
||||
source.start(0, sfx[0], sfx[1]);
|
||||
|
||||
return source;
|
||||
};
|
||||
|
||||
const playOnce = async name => {
|
||||
// might want to add like random pitch or something later
|
||||
await playSound(name);
|
||||
};
|
||||
|
||||
const playLoop = async name => {
|
||||
const source = await playSound(name, true);
|
||||
const stop = () => { source.stop(); };
|
||||
|
||||
return { stop };
|
||||
};
|
||||
|
||||
return {
|
||||
playOnce,
|
||||
playLoop,
|
||||
};
|
||||
})();
|
BIN
public/static/hanyuu.caf
Normal file
BIN
public/static/hanyuu.caf
Normal file
Binary file not shown.
BIN
public/static/hanyuu.opus
Normal file
BIN
public/static/hanyuu.opus
Normal file
Binary file not shown.
Reference in a new issue