Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!-- Virtual Directory Setup
assign virtualDirPath below a value like '/{path}'
Add below to your app code and then prepend routes with virtualDirPath
var virtualDirPath = process.env.virtualDirPath || ''; -->
@jhiswin
jhiswin / resample_oac.js
Created November 8, 2015 08:06
native audio resampler use OfflineAudioContext
function supportedSampleRates() {
return [4000, 8000, 16000, 32000, 44100, 48000, 96000].filter(supportsSampleRate);
}
function supportsSampleRate(sampleRate) {
try {
var l = new OfflineAudioContext(1, sampleRate, sampleRate);
return true;
}
catch(e){
@jhiswin
jhiswin / swiffy_utilities.js
Last active January 3, 2019 07:11
utilities for swiffy runtime, so it's easier to manipulate
// TODO make this not an ugly hack, assumes a lot of things
// TODO add a LoadMovie to load movie in-place, need to retrieve bgcolor and frameSize and set them
// for swiffy v7.4
// loadMovie only works if ends in lowercase .swf, looks for .swf.json
function lcase_swf(path) {
var path = path[path.length - 4] === '.' ? path.slice(0, -4) : path;
return path + '.swf';
}
@jhiswin
jhiswin / runtime_audioapi.js
Created November 6, 2015 05:19
hack swiffy 7.4 to use Web Audio API to play, so sounds play on iOS/Android
//stage.Ga.O.s
//stage.Td
(function() {
/*
Copyright 2015 Google Inc.
Swiffy runtime version 7.4.0
In addition to the Google Terms of Service (http://www.google.com/accounts/TOS),
@jhiswin
jhiswin / swiffy_runtime_mod.js
Created October 27, 2015 12:23
hack swiffy runtime to work around Chrome data-uri bug by converting to blob
(function() {
/*
Copyright 2015 Google Inc.
Swiffy runtime version v7.3.1
In addition to the Google Terms of Service (http://www.google.com/accounts/TOS),
Google grants you and the Google Swiffy end users a personal, worldwide,
royalty-free, non-assignable and non-exclusive license to use the Google Swiffy
runtime to host it for Google Swiffy end users and to use it in connection with
@jhiswin
jhiswin / convert and export audio.jsfl
Created October 25, 2015 11:51
Batch convert Flash project to other format (HTML5 canvas) and export audio
// export audio because HTML5 canvas projects mangles published audio files
// TODO find way to click ok buttons, so it is fully automatic
var inFolder = fl.browseForFolderURL("Select a folder with Flash files.");
var imageFileURLBase = inFolder + '/sounds';
fl.trace(inFolder);
var files = FLfile.listFolder(inFolder + "/*.fla", "files");