From 97c92555b8a7bf8c53c9f41fd23dcb70b55c7c8a Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Mon, 2 Sep 2013 14:27:24 -0400 Subject: update *encode.sh, add opus support --- www/js/api.js | 19 +++++++- www/js/play.js | 140 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 87 insertions(+), 72 deletions(-) (limited to 'www/js') diff --git a/www/js/api.js b/www/js/api.js index 580de6a..ed5b387 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -39,7 +39,20 @@ window.html5ks.api = { audio.loop = true; } html5ks.elements.audio[channel] = audio; - audio.src = "dump/" + (channel === "music" ? "bgm/" + html5ks.data.music[name] + ".ogg" : html5ks.data.sfx[name]); + + var src = "dump/" + channel === "music" ? html5ks.data.music[name] : html5ks.data.sfx[name]; + if (Modernizr.audio.opus) { + audio.src = src + ".opus"; + } else if (Modernizr.audio.ogg) { + audio.src = src + ".ogg"; + } else if (Modernizr.audio.aac) { + audio.src = src + ".m4a"; + } else if (Modernizr.audio.wav) { + audio.src = src + ".wav"; + } else { + console.error("wtf, no audio formats"); + } + audio.load(); var volume = html5ks.persistent[channel + "Volume"]; audio.volume = fade ? 0 : volume; @@ -90,9 +103,11 @@ window.html5ks.api = { if (Modernizr.video.webm) { video.src = src + "webm"; } else if (Modernizr.video.ogg) { - video.src = src + "ogg"; + video.src = src + "ogv"; } else if (Modernizr.video.h264) { video.src = src + "mp4"; + } else { + console.error("wtf is this, no video formats"); } video.load(); diff --git a/www/js/play.js b/www/js/play.js index 2be38ab..0160980 100644 --- a/www/js/play.js +++ b/www/js/play.js @@ -39,74 +39,74 @@ html5ks.data.music = { "music_menus": "Wiosna" }; html5ks.data.sfx = { - sfx_tcard: "sfx/tcard.ogg", - sfx_4lslogo: "sfx/4lsaudiologo.ogg", - sfx_alarmclock: "sfx/alarm.ogg", - sfx_normalbell: "sfx/carillon.ogg", - sfx_warningbell: "sfx/chaimu.ogg", - sfx_crunchydeath: "sfx/crunch.ogg", - sfx_fireworks: "sfx/fireworks.ogg", - sfx_rain: "sfx/rain.ogg", - sfx_rustling: "sfx/rustling.ogg", - sfx_impact: "sfx/wumph.ogg", - sfx_impact2: "sfx/wumph_2.ogg", - sfx_heartfast: "sfx/heart_single_fast.ogg", - sfx_heartslow: "sfx/heart_single_slow.ogg", - sfx_heartstop: "sfx/heart_stop.ogg", - sfx_emijogging: "sfx/emijogging.ogg", - sfx_emirunning: "sfx/emirunning.ogg", - sfx_emipacing: "sfx/emipacing.ogg", - sfx_emisprinting: "sfx/emisprinting.ogg", - sfx_startpistol: "sfx/startpistol.ogg", - sfx_crowd_indoors: "sfx/crowd_indoors.ogg", - sfx_crowd_outdoors: "sfx/crowd_outdoors.ogg", - sfx_crowd_cheer: "sfx/crowd_cheer.ogg", - sfx_doorknock: "sfx/doorknock.ogg", - sfx_doorknock2: "sfx/doorknock2.ogg", - sfx_doorslam: "sfx/doorslam.ogg", - sfx_doorclose: "sfx/doorclose.ogg", - sfx_cicadas: "sfx/cicadas.ogg", - sfx_scratch: "sfx/scratch.ogg", - sfx_traffic: "sfx/traffic.ogg", - sfx_rumble: "sfx/rumble.ogg", - sfx_skid: "sfx/skid2.ogg", - sfx_gymbounce: "sfx/emibounce.ogg", - sfx_hammer: "sfx/hammer.ogg", - sfx_birdstakeoff: "sfx/birdstakeoff.ogg", - sfx_storebell: "sfx/storebell.ogg", - sfx_thunder: "sfx/thunder.ogg", - sfx_slide: "sfx/slide.ogg", - sfx_slide2: "sfx/slide2.ogg", - sfx_draw: "sfx/sword_draw.ogg", - sfx_shower: "sfx/shower.ogg", - sfx_switch: "sfx/switch.ogg", - sfx_pillow: "sfx/pillow.ogg", - sfx_cellphone: "sfx/cellphone.ogg", - sfx_door_creak: "sfx/door_creak.ogg", - sfx_dooropen: "sfx/dooropen.ogg", - sfx_dropglasses: "sfx/dropglasses.ogg", - sfx_can: "sfx/can.ogg", - sfx_stallbuilding: "sfx/stallbuilding.ogg", - sfx_parkambience: "sfx/parkambience.ogg", - sfx_trainint: "sfx/trainint.ogg", - sfx_footsteps_hard: "sfx/footsteps_hard.ogg", - sfx_footsteps_soft: "sfx/footsteps_soft.ogg", - sfx_paper: "sfx/paper.ogg", - sfx_paperruffling: "sfx/paperruffling.ogg", - sfx_rooftop: "sfx/rooftop.ogg", - sfx_lighter: "sfx/lighter.ogg", - sfx_phone: "sfx/phone.ogg", - sfx_hollowclick: "sfx/hollowclick.ogg", - sfx_businterior: "sfx/businterior.ogg", - sfx_teacup: "sfx/teacup.ogg", - sfx_can_clatter: "sfx/can_clatter.ogg", - sfx_snap: "sfx/snap.ogg", - sfx_billiards_break: "sfx/billiards_break.ogg", - sfx_billiards: "sfx/billiards.ogg", - sfx_lock: "sfx/lock.ogg", - sfx_dropstuff: "sfx/dropstuff.ogg", - sfx_camera: "sfx/camera.ogg", - sfx_time: "sfx/time.ogg", - sfx_flash: "sfx/flash.ogg", - sfx_whiteout: "sfx/whiteout.ogg" + sfx_tcard: "tcard", + sfx_4lslogo: "4lsaudiologo", + sfx_alarmclock: "alarm", + sfx_normalbell: "carillon", + sfx_warningbell: "chaimu", + sfx_crunchydeath: "crunch", + sfx_fireworks: "fireworks", + sfx_rain: "rain", + sfx_rustling: "rustling", + sfx_impact: "wumph", + sfx_impact2: "wumph_2", + sfx_heartfast: "heart_single_fast", + sfx_heartslow: "heart_single_slow", + sfx_heartstop: "heart_stop", + sfx_emijogging: "emijogging", + sfx_emirunning: "emirunning", + sfx_emipacing: "emipacing", + sfx_emisprinting: "emisprinting", + sfx_startpistol: "startpistol", + sfx_crowd_indoors: "crowd_indoors", + sfx_crowd_outdoors: "crowd_outdoors", + sfx_crowd_cheer: "crowd_cheer", + sfx_doorknock: "doorknock", + sfx_doorknock2: "doorknock2", + sfx_doorslam: "doorslam", + sfx_doorclose: "doorclose", + sfx_cicadas: "cicadas", + sfx_scratch: "scratch", + sfx_traffic: "traffic", + sfx_rumble: "rumble", + sfx_skid: "skid2", + sfx_gymbounce: "emibounce", + sfx_hammer: "hammer", + sfx_birdstakeoff: "birdstakeoff", + sfx_storebell: "storebell", + sfx_thunder: "thunder", + sfx_slide: "slide", + sfx_slide2: "slide2", + sfx_draw: "sword_draw", + sfx_shower: "shower", + sfx_switch: "switch", + sfx_pillow: "pillow", + sfx_cellphone: "cellphone", + sfx_door_creak: "door_creak", + sfx_dooropen: "dooropen", + sfx_dropglasses: "dropglasses", + sfx_can: "can", + sfx_stallbuilding: "stallbuilding", + sfx_parkambience: "parkambience", + sfx_trainint: "trainint", + sfx_footsteps_hard: "footsteps_hard", + sfx_footsteps_soft: "footsteps_soft", + sfx_paper: "paper", + sfx_paperruffling: "paperruffling", + sfx_rooftop: "rooftop", + sfx_lighter: "lighter", + sfx_phone: "phone", + sfx_hollowclick: "hollowclick", + sfx_businterior: "businterior", + sfx_teacup: "teacup", + sfx_can_clatter: "can_clatter", + sfx_snap: "snap", + sfx_billiards_break: "billiards_break", + sfx_billiards: "billiards", + sfx_lock: "lock", + sfx_dropstuff: "dropstuff", + sfx_camera: "camera", + sfx_time: "time", + sfx_flash: "flash", + sfx_whiteout: "whiteout" }; -- cgit v1.2.3-70-g09d2