Skip to content

Commit

Permalink
Merge branch '30-createjs-support'
Browse files Browse the repository at this point in the history
  • Loading branch information
tonistiigi committed Dec 5, 2014
2 parents 0d248ef + e252e96 commit b818cf1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ info: Options:
--output, -o Name for the output files. [default: "output"]
--path, -u Path for files to be used on final JSON. [default: ""]
--export, -e Limit exported file types. Comma separated extension list. [default: "ogg,m4a,mp3,ac3"]
--format, -f Format of the output JSON file (jukebox, howler). [default: "jukebox"]
--format, -f Format of the output JSON file (jukebox, howler, createjs). [default: "jukebox"]
--log, -l Log level (debug, info, notice, warning, error). [default: "info"]
--autoplay, -a Autoplay sprite name. [default: null]
--loop Loop sprite name, can be passed multiple times. [default: null]
Expand Down
15 changes: 14 additions & 1 deletion audiosprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var optimist = require('optimist')
.options('format', {
alias: 'f'
, 'default': 'jukebox'
, describe: 'Format of the output JSON file (jukebox, howler).'
, describe: 'Format of the output JSON file (jukebox, howler, createjs).'
})
.options('log', {
alias: 'l'
Expand Down Expand Up @@ -379,6 +379,19 @@ function processFiles() {
}
break

case 'createjs':
finalJson.src = json.resources[0];
finalJson.data = {audioSprite: []};
for (var sn in json.spritemap) {
var spriteInfo = json.spritemap[sn]
finalJson.data.audioSprite.push({
id: sn,
startTime: spriteInfo.start * 1000,
duration: (spriteInfo.end - spriteInfo.start) * 1000
});
}
break;

case 'default': // legacy support
default:
finalJson = json
Expand Down

0 comments on commit b818cf1

Please sign in to comment.