Merge pull request #276 from bui/assets-convert-to-ogg

Assets: Convert to ogg
This commit is contained in:
Bui 2020-11-09 09:21:25 +00:00 committed by GitHub
commit 6c7d8803bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
163 changed files with 130 additions and 50 deletions

11
app.py
View File

@ -243,6 +243,7 @@ def route_admin_songs_new_post():
output['category_id'] = int(request.form.get('category_id')) or None
output['type'] = request.form.get('type')
output['music_type'] = request.form.get('music_type')
output['offset'] = float(request.form.get('offset')) or None
output['skin_id'] = int(request.form.get('skin_id')) or None
output['preview'] = float(request.form.get('preview')) or None
@ -303,6 +304,7 @@ def route_admin_songs_id_post(id):
output['category_id'] = int(request.form.get('category_id')) or None
output['type'] = request.form.get('type')
output['music_type'] = request.form.get('music_type')
output['offset'] = float(request.form.get('offset')) or None
output['skin_id'] = int(request.form.get('skin_id')) or None
output['preview'] = float(request.form.get('preview')) or None
@ -351,9 +353,10 @@ def route_api_preview():
abort(400)
song_type = song['type']
prev_path = make_preview(song_id, song_type, song['preview'])
song_ext = song['music_type'] if song['music_type'] else "mp3"
prev_path = make_preview(song_id, song_type, song_ext, song['preview'])
if not prev_path:
return redirect(get_config()['songs_baseurl'] + '%s/main.mp3' % song_id)
return redirect(get_config()['songs_baseurl'] + '%s/main.%s' % (song_id, song_ext))
return redirect(get_config()['songs_baseurl'] + '%s/preview.mp3' % song_id)
@ -606,8 +609,8 @@ def route_api_scores_get():
return jsonify({'status': 'ok', 'scores': scores, 'username': user['username'], 'display_name': user['display_name'], 'don': don})
def make_preview(song_id, song_type, preview):
song_path = 'public/songs/%s/main.mp3' % song_id
def make_preview(song_id, song_type, song_ext, preview):
song_path = 'public/songs/%s/main.%s' % (song_id, song_ext)
prev_path = 'public/songs/%s/preview.mp3' % song_id
if os.path.isfile(song_path) and not os.path.isfile(prev_path):

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -59,12 +59,12 @@ class Account{
this.customdonBodyFill.value = account.don.body_fill
var parent = this.customdonBodyFill.parentNode
parent.insertBefore(document.createTextNode(strings.account.customdon.bodyFill), parent.firstChild)
pageEvents.add(this.customdonBodyFill, "change", this.customdonChange.bind(this))
pageEvents.add(this.customdonBodyFill, ["change", "input"], this.customdonChange.bind(this))
this.customdonFaceFill = this.getElement("customdon-facefill")
this.customdonFaceFill.value = account.don.face_fill
var parent = this.customdonFaceFill.parentNode
parent.insertBefore(document.createTextNode(strings.account.customdon.faceFill), parent.firstChild)
pageEvents.add(this.customdonFaceFill, "change", this.customdonChange.bind(this))
pageEvents.add(this.customdonFaceFill, ["change", "input"], this.customdonChange.bind(this))
this.customdonResetBtn = this.getElement("customdon-reset")
this.customdonResetBtn.value = strings.account.customdon.reset
pageEvents.add(this.customdonResetBtn, ["click", "touchstart"], this.customdonReset.bind(this))
@ -578,8 +578,8 @@ class Account{
}
this.redrawRunning = false
this.customdonCache.clean()
pageEvents.remove(this.customdonBodyFill, "change")
pageEvents.remove(this.customdonFaceFill, "change")
pageEvents.remove(this.customdonBodyFill, ["change", "input"])
pageEvents.remove(this.customdonFaceFill, ["change", "input"])
pageEvents.remove(this.customdonResetBtn, ["click", "touchstart"])
pageEvents.remove(this.accounPassButton, ["click", "touchstart"])
pageEvents.remove(this.accountDelButton, ["click", "touchstart"])

View File

@ -93,37 +93,37 @@ var assets = {
"settings_gamepad.png"
],
"audioSfx": [
"se_pause.wav",
"se_calibration.wav",
"v_results.wav",
"v_sanka.wav",
"v_songsel.wav",
"v_start.wav",
"v_title.wav"
"se_pause.ogg",
"se_calibration.ogg",
"v_results.ogg",
"v_sanka.ogg",
"v_songsel.ogg",
"v_start.ogg",
"v_title.ogg"
],
"audioSfxLR": [
"neiro_1_don.wav",
"neiro_1_ka.wav",
"se_cancel.wav",
"se_don.wav",
"se_ka.wav",
"se_jump.wav",
"se_balloon.wav",
"se_gameclear.wav",
"se_gamefail.wav",
"se_gamefullcombo.wav",
"se_results_countup.wav",
"se_results_crown.wav",
"v_fullcombo.wav",
"v_renda.wav",
"v_results_fullcombo.wav",
"v_results_fullcombo2.wav"
"neiro_1_don.ogg",
"neiro_1_ka.ogg",
"se_cancel.ogg",
"se_don.ogg",
"se_ka.ogg",
"se_jump.ogg",
"se_balloon.ogg",
"se_gameclear.ogg",
"se_gamefail.ogg",
"se_gamefullcombo.ogg",
"se_results_countup.ogg",
"se_results_crown.ogg",
"v_fullcombo.ogg",
"v_renda.ogg",
"v_results_fullcombo.ogg",
"v_results_fullcombo2.ogg"
],
"audioSfxLoud": [
"v_diffsel.wav"
"v_diffsel.ogg"
],
"audioMusic": [
"bgm_songsel.mp3",

View File

@ -48,7 +48,7 @@ class Controller{
comboVoices.forEach(name => {
if (!assets.sounds[name + "_p1"]) {
promises.push(loader.loadSound(name + ".wav", snd.sfxGain).then(sound => {
promises.push(loader.loadSound(name + ".ogg", snd.sfxGain).then(sound => {
assets.sounds[name + "_p1"] = assets.sounds[name].copy(snd.sfxGainL)
assets.sounds[name + "_p2"] = assets.sounds[name].copy(snd.sfxGainR)
}))
@ -246,7 +246,12 @@ class Controller{
var songObj = assets.songs.find(song => song.id === this.selectedSong.folder)
var promises = []
if(songObj.chart && songObj.chart !== "blank"){
promises.push(songObj.chart.read(this.selectedSong.type === "tja" ? "sjis" : undefined).then(data => {
var chart = songObj.chart
if(chart.separateDiff){
var chartDiff = this.selectedSong.difficulty
chart = chart[chartDiff]
}
promises.push(chart.read(this.selectedSong.type === "tja" ? "sjis" : undefined).then(data => {
this.songData = data.replace(/\0/g, "").split("\n")
return Promise.resolve()
}))

View File

@ -19,7 +19,7 @@ class CustomSongs{
this.items = []
this.linkLocalFolder = document.getElementById("link-localfolder")
this.hasLocal = "webkitdirectory" in HTMLInputElement.prototype && !(/Android/.test(navigator.userAgent))
this.hasLocal = "webkitdirectory" in HTMLInputElement.prototype && !(/Android|iPhone|iPad/.test(navigator.userAgent))
if(this.hasLocal){
this.browse = document.getElementById("browse")
pageEvents.add(this.browse, "change", this.browseChange.bind(this))

View File

@ -0,0 +1,46 @@
var Oggmented = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
return (
function(Oggmented) {
Oggmented = Oggmented || {};
(function(b,c){function m(h){delete k[h]}function l(h){if(e)setTimeout(l,0,h);else{var t=k[h];if(t){e=!0;try{var p=t.A,y=t.v;switch(y.length){case 0:p();break;case 1:p(y[0]);break;case 2:p(y[0],y[1]);break;case 3:p(y[0],y[1],y[2]);break;default:p.apply(c,y)}}finally{m(h),e=!1}}}}function q(){r=function(h){process.C(function(){l(h)})}}function u(){if(b.postMessage&&!b.importScripts){var h=!0,t=b.onmessage;b.onmessage=function(){h=!1};b.postMessage("","*");b.onmessage=t;return h}}function w(){function h(p){p.source===
b&&"string"===typeof p.data&&0===p.data.indexOf(t)&&l(+p.data.slice(t.length))}var t="setImmediate$"+Math.random()+"$";b.addEventListener?b.addEventListener("message",h,!1):b.attachEvent("onmessage",h);r=function(p){b.postMessage(t+p,"*")}}function v(){var h=new MessageChannel;h.port1.onmessage=function(t){l(t.data)};r=function(t){h.port2.postMessage(t)}}function A(){var h=f.documentElement;r=function(t){var p=f.createElement("script");p.onreadystatechange=function(){l(t);p.onreadystatechange=null;
h.removeChild(p);p=null};h.appendChild(p)}}function d(){r=function(h){setTimeout(l,0,h)}}if(!b.setImmediate){var g=1,k={},e=!1,f=b.document,r,n=Object.getPrototypeOf&&Object.getPrototypeOf(b);n=n&&n.setTimeout?n:b;"[object process]"==={}.toString.call(b.process)?q():u()?w():b.MessageChannel?v():f&&"onreadystatechange"in f.createElement("script")?A():d();n.setImmediate=function(h){"function"!==typeof h&&(h=new Function(""+h));for(var t=Array(arguments.length-1),p=0;p<t.length;p++)t[p]=arguments[p+
1];k[g]={A:h,v:t};r(g);return g++};n.clearImmediate=m}})("undefined"===typeof self?"undefined"===typeof global?this:global:self);
null;var a;a||(a=typeof Oggmented !== 'undefined' ? Oggmented : {});var x,z;a.ready=new Promise(function(b,c){x=b;z=c});const aa=new (window.AudioContext||window.webkitAudioContext);
a.decodeOggData=(b,c,m)=>{try{var {channels:l,length:q,rate:u}=(g=>{const k=g.byteLength,e=B(k);g=new Int8Array(g);C.set(g,e);D("open_buffer","number",["number","number"],[e,k]);return{channels:ba(),length:ca(),rate:da()}})(b),w=aa.createBuffer(l,q,u),v=B(Uint32Array.BYTES_PER_ELEMENT),A=0}catch(g){return m&&m(g)}const d=()=>{try{const g=Date.now();let k;for(;k=ea(v);){const e=fa(v,"*"),f=new Uint32Array(ha.buffer,e,l);for(let r=0;r<l;r++){const n=new Float32Array(E.buffer,f[r],k);w.getChannelData(r).set(n,
A)}A+=k;if(g+8<Date.now()){setImmediate(d);break}}0===k&&(ia(),F(b),F(v),c&&c(w))}catch(g){return m&&m(g)}};setImmediate(d);return w};var G={},H;for(H in a)a.hasOwnProperty(H)&&(G[H]=a[H]);function ja(b,c){throw c;}var I="";"undefined"!==typeof document&&document.currentScript&&(I=document.currentScript.src);_scriptDir&&(I=_scriptDir);0!==I.indexOf("blob:")?I=I.substr(0,I.lastIndexOf("/")+1):I="";var J=a.printErr||console.warn.bind(console);for(H in G)G.hasOwnProperty(H)&&(a[H]=G[H]);G=null;
a.quit&&(ja=a.quit);var K;a.wasmBinary&&(K=a.wasmBinary);var noExitRuntime;a.noExitRuntime&&(noExitRuntime=a.noExitRuntime);"object"!==typeof WebAssembly&&L("no native wasm support detected");
function fa(b,c){c=c||"i8";"*"===c.charAt(c.length-1)&&(c="i32");switch(c){case "i1":return C[b>>0];case "i8":return C[b>>0];case "i16":return ka[b>>1];case "i32":return M[b>>2];case "i64":return M[b>>2];case "float":return E[b>>2];case "double":return la[b>>3];default:L("invalid type for getValue: "+c)}return null}var N,O=!1;function ma(b){var c=a["_"+b];c||L("Assertion failed: Cannot call unknown function "+(b+", make sure it is exported"));return c}
function D(b,c,m,l){var q={string:function(d){var g=0;if(null!==d&&void 0!==d&&0!==d){var k=(d.length<<2)+1;g=P(k);var e=g,f=Q;if(0<k){k=e+k-1;for(var r=0;r<d.length;++r){var n=d.charCodeAt(r);if(55296<=n&&57343>=n){var h=d.charCodeAt(++r);n=65536+((n&1023)<<10)|h&1023}if(127>=n){if(e>=k)break;f[e++]=n}else{if(2047>=n){if(e+1>=k)break;f[e++]=192|n>>6}else{if(65535>=n){if(e+2>=k)break;f[e++]=224|n>>12}else{if(e+3>=k)break;f[e++]=240|n>>18;f[e++]=128|n>>12&63}f[e++]=128|n>>6&63}f[e++]=128|n&63}}f[e]=
0}}return g},array:function(d){var g=P(d.length);C.set(d,g);return g}},u=ma(b),w=[];b=0;if(l)for(var v=0;v<l.length;v++){var A=q[m[v]];A?(0===b&&(b=na()),w[v]=A(l[v])):w[v]=l[v]}m=u.apply(null,w);m=function(d){if("string"===c)if(d){for(var g=Q,k=d+NaN,e=d;g[e]&&!(e>=k);)++e;if(16<e-d&&g.subarray&&oa)d=oa.decode(g.subarray(d,e));else{for(k="";d<e;){var f=g[d++];if(f&128){var r=g[d++]&63;if(192==(f&224))k+=String.fromCharCode((f&31)<<6|r);else{var n=g[d++]&63;f=224==(f&240)?(f&15)<<12|r<<6|n:(f&7)<<
18|r<<12|n<<6|g[d++]&63;65536>f?k+=String.fromCharCode(f):(f-=65536,k+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else k+=String.fromCharCode(f)}d=k}}else d="";else d="boolean"===c?!!d:d;return d}(m);0!==b&&pa(b);return m}var oa="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0,R,C,Q,ka,M,ha,E,la;
function qa(b){R=b;a.HEAP8=C=new Int8Array(b);a.HEAP16=ka=new Int16Array(b);a.HEAP32=M=new Int32Array(b);a.HEAPU8=Q=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=ha=new Uint32Array(b);a.HEAPF32=E=new Float32Array(b);a.HEAPF64=la=new Float64Array(b)}var ra=a.INITIAL_MEMORY||16777216;a.wasmMemory?N=a.wasmMemory:N=new WebAssembly.Memory({initial:ra/65536,maximum:32768});N&&(R=N.buffer);ra=R.byteLength;qa(R);var S,sa=[],ta=[],ua=[],va=[];function wa(){var b=a.preRun.shift();sa.unshift(b)}
var T=0,U=null,V=null;a.preloadedImages={};a.preloadedAudios={};function L(b){if(a.onAbort)a.onAbort(b);J(b);O=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");z(b);throw b;}function xa(){var b=W;return String.prototype.startsWith?b.startsWith("data:application/octet-stream;base64,"):0===b.indexOf("data:application/octet-stream;base64,")}var W="oggmented-wasm.wasm";if(!xa()){var ya=W;W=a.locateFile?a.locateFile(ya,I):I+ya}
function za(){try{if(K)return new Uint8Array(K);throw"both async and sync fetching of the wasm failed";}catch(b){L(b)}}function Aa(){return K||"function"!==typeof fetch?Promise.resolve().then(za):fetch(W,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+W+"'";return b.arrayBuffer()}).catch(function(){return za()})}
function X(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var m=c.B;"number"===typeof m?void 0===c.u?S.get(m)():S.get(m)(c.u):m(void 0===c.u?null:c.u)}}}ta.push({B:function(){Ba()}});
var Da={b:function(b,c,m){Q.copyWithin(b,c,c+m)},c:function(b){b>>>=0;var c=Q.length;if(2147483648<b)return!1;for(var m=1;4>=m;m*=2){var l=c*(1+.2/m);l=Math.min(l,b+100663296);l=Math.max(16777216,b,l);0<l%65536&&(l+=65536-l%65536);a:{try{N.grow(Math.min(2147483648,l)-R.byteLength+65535>>>16);qa(N.buffer);var q=1;break a}catch(u){}q=void 0}if(q)return!0}return!1},d:function(b){if(!noExitRuntime){if(a.onExit)a.onExit(b);O=!0}ja(b,new Ca(b))},a:N};
(function(){function b(q){a.asm=q.exports;S=a.asm.e;T--;a.monitorRunDependencies&&a.monitorRunDependencies(T);0==T&&(null!==U&&(clearInterval(U),U=null),V&&(q=V,V=null,q()))}function c(q){b(q.instance)}function m(q){return Aa().then(function(u){return WebAssembly.instantiate(u,l)}).then(q,function(u){J("failed to asynchronously prepare wasm: "+u);L(u)})}var l={a:Da};T++;a.monitorRunDependencies&&a.monitorRunDependencies(T);if(a.instantiateWasm)try{return a.instantiateWasm(l,b)}catch(q){return J("Module.instantiateWasm callback failed with error: "+
q),!1}(function(){return K||"function"!==typeof WebAssembly.instantiateStreaming||xa()||"function"!==typeof fetch?m(c):fetch(W,{credentials:"same-origin"}).then(function(q){return WebAssembly.instantiateStreaming(q,l).then(c,function(u){J("wasm streaming compile failed: "+u);J("falling back to ArrayBuffer instantiation");return m(c)})})})().catch(z);return{}})();var Ba=a.___wasm_call_ctors=function(){return(Ba=a.___wasm_call_ctors=a.asm.f).apply(null,arguments)};
a._open_buffer=function(){return(a._open_buffer=a.asm.g).apply(null,arguments)};var ia=a._close_buffer=function(){return(ia=a._close_buffer=a.asm.h).apply(null,arguments)},ca=a._get_length=function(){return(ca=a._get_length=a.asm.i).apply(null,arguments)},ba=a._get_channels=function(){return(ba=a._get_channels=a.asm.j).apply(null,arguments)},da=a._get_rate=function(){return(da=a._get_rate=a.asm.k).apply(null,arguments)};a._get_time=function(){return(a._get_time=a.asm.l).apply(null,arguments)};
a._get_streams=function(){return(a._get_streams=a.asm.m).apply(null,arguments)};
var ea=a._read_float=function(){return(ea=a._read_float=a.asm.n).apply(null,arguments)},F=a._free=function(){return(F=a._free=a.asm.o).apply(null,arguments)},B=a._malloc=function(){return(B=a._malloc=a.asm.p).apply(null,arguments)},na=a.stackSave=function(){return(na=a.stackSave=a.asm.q).apply(null,arguments)},pa=a.stackRestore=function(){return(pa=a.stackRestore=a.asm.r).apply(null,arguments)},P=a.stackAlloc=function(){return(P=a.stackAlloc=a.asm.s).apply(null,arguments)};a.ccall=D;a.getValue=fa;
var Y;function Ca(b){this.name="ExitStatus";this.message="Program terminated with exit("+b+")";this.status=b}V=function Ea(){Y||Z();Y||(V=Ea)};
function Z(){function b(){if(!Y&&(Y=!0,a.calledRun=!0,!O)){X(ta);X(ua);x(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();va.unshift(c)}X(va)}}if(!(0<T)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)wa();X(sa);0<T||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Z;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();noExitRuntime=!0;Z();
return Oggmented.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = Oggmented;
else if (typeof define === 'function' && define['amd'])
define([], function() { return Oggmented; });
else if (typeof exports === 'object')
exports["Oggmented"] = Oggmented;

Binary file not shown.

View File

@ -30,6 +30,10 @@ class Loader{
if(gameConfig.custom_js){
this.addPromise(this.loadScript(gameConfig.custom_js), gameConfig.custom_js)
}
var oggSupport = new Audio().canPlayType("audio/ogg;codecs=vorbis")
if(!oggSupport){
assets.js.push("lib/oggmented-wasm.js")
}
assets.js.forEach(name => {
this.addPromise(this.loadScript("/src/js/" + name), "/src/js/" + name)
})
@ -144,7 +148,8 @@ class Loader{
songs = JSON.parse(songs)
songs.forEach(song => {
var directory = gameConfig.songs_baseurl + song.id + "/"
song.music = new RemoteFile(directory + "main.mp3")
var songExt = song.music_type ? song.music_type : "mp3"
song.music = new RemoteFile(directory + "main." + songExt)
if(song.type === "tja"){
song.chart = new RemoteFile(directory + "main.tja")
}else{
@ -185,6 +190,9 @@ class Loader{
this.addPromise(Promise.all(categoryPromises))
snd.buffer = new SoundBuffer()
if(!oggSupport){
snd.buffer.oggDecoder = snd.buffer.fallbackDecoder
}
snd.musicGain = snd.buffer.createGain()
snd.sfxGain = snd.buffer.createGain()
snd.previewGain = snd.buffer.createGain()

View File

@ -126,7 +126,7 @@ class LoadSong{
}), songObj.music.url)
}
var chart = songObj.chart
if(chart.separateDiff){
if(chart && chart.separateDiff){
var chartDiff = this.selectedSong.difficulty
chart = chart[chartDiff]
}

View File

@ -138,13 +138,9 @@ class SongSelect{
var showCustom = false
if(gameConfig.google_credentials.gdrive_enabled){
if(!(/iPhone|iPad/.test(navigator.userAgent))){
showCustom = true
}
}else{
if("webkitdirectory" in HTMLInputElement.prototype && !(/Android|iPhone|iPad/.test(navigator.userAgent))){
showCustom = true
}
showCustom = true
}else if("webkitdirectory" in HTMLInputElement.prototype && !(/Android|iPhone|iPad/.test(navigator.userAgent))){
showCustom = true
}
if(showCustom){
this.songs.push({

View File

@ -2,13 +2,16 @@
constructor(){
var AudioContext = window.AudioContext || window.webkitAudioContext
this.context = new AudioContext()
this.audioDecoder = this.context.decodeAudioData.bind(this.context)
this.oggDecoder = this.audioDecoder
pageEvents.add(window, ["click", "touchend", "keypress"], this.pageClicked.bind(this))
this.gainList = []
}
load(file, gain){
var decoder = file.name.endsWith(".ogg") ? this.oggDecoder : this.audioDecoder
return file.arrayBuffer().then(response => {
return new Promise((resolve, reject) => {
return this.context.decodeAudioData(response, resolve, reject)
return decoder(response, resolve, reject)
}).catch(error => Promise.reject([error, file.url]))
}).then(buffer => {
return new Sound(gain || {soundBuffer: this}, buffer)
@ -62,6 +65,9 @@
gain.setVolume(gain.defaultVol)
}
}
fallbackDecoder(buffer, resolve, reject){
Oggmented().then(oggmented => oggmented.decodeOggData(buffer, resolve, reject), reject)
}
}
class SoundGain{
constructor(soundBuffer, channel){

View File

@ -78,13 +78,21 @@
</div>
<div class="form-field">
<p><label for="type">Type</label></p>
<p><label for="type">Chart type</label></p>
<select name="type" id="type">
<option value="tja"{% if song.type == 'tja' %} selected{% endif %}>TJA</option>
<option value="osu"{% if song.type == 'osu' %} selected{% endif %}>osu!taiko</option>
</select>
</div>
<div class="form-field">
<p><label for="music_type">Music type</label></p>
<select name="music_type" id="music_type">
<option value="ogg"{% if song.music_type == 'ogg' %} selected{% endif %}>OGG</option>
<option value="mp3"{% if song.music_type == 'mp3' or not song.music_type %} selected{% endif %}>MP3</option>
</select>
</div>
<div class="form-field">
<p><label for="offset">Offset</label></p>
<input type="text" id="offset" value="{{song.offset or '0'}}" name="offset" required>

View File

@ -74,13 +74,21 @@
</div>
<div class="form-field">
<p><label for="type">Type</label></p>
<p><label for="type">Chart type</label></p>
<select name="type" id="type">
<option value="tja">TJA</option>
<option value="osu">osu!taiko</option>
</select>
</div>
<div class="form-field">
<p><label for="music_type">Music type</label></p>
<select name="music_type" id="music_type">
<option value="ogg">OGG</option>
<option value="mp3">MP3</option>
</select>
</div>
<div class="form-field">
<p><label for="offset">Offset</label></p>
<input type="text" id="offset" value="0" name="offset" required>