add AudioSprite types

This commit is contained in:
Gyusun Yeom
2017-06-22 18:47:14 +09:00
parent 755b23622a
commit f163b9ae83
4 changed files with 104 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import * as audiosprite from 'audiosprite';
const files = ['file1.mp3', 'file2.mp3'];
const opts = {output: 'result'};
audiosprite(files, opts, (err, obj) => {
if (err) {
return err;
}
return JSON.stringify(obj, null, 2);
});
audiosprite(files, {
path: "aaa",
format: "howler",
export: "ogg,mp3",
minlength: 9999,
vbr: 9,
'vbr:vorbis': 10,
logger: {
debug(a) {
}
}
}, (err, obj) => {
});
+55
View File
@@ -0,0 +1,55 @@
// Type definitions for audiosprite 0.6
// Project: https://github.com/tonistiigi/audiosprite
// Definitions by: Gyusun Yeom <https://github.com/Perlmint>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace audiosprite;
export = audiosprite;
declare function audiosprite(files: string[], callback: (error: Error, obj: audiosprite.Result) => void): void;
declare function audiosprite(files: string[], option: audiosprite.Option, callback: (error: Error, obj: audiosprite.Result) => void): void;
declare namespace audiosprite {
type ExportType = "jukebox" | "howler" | "createjs" | null;
type LogLevel = "debug" | "info" | "notice" | "warning" | "error";
type VBR = -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
type VBR_Vorbis = VBR | 10;
type Channels = 1 | 2;
interface Option {
output?: string;
path?: string;
export?: string;
format?: ExportType;
log?: LogLevel;
autoplay?: string | null;
loop?: string[];
silence?: number;
gap?: number;
minlength?: number;
bitrate?: number;
vbr?: VBR;
'vbr:vorbis'?: VBR_Vorbis;
samplerate?: number;
channels?: Channels;
rawparts?: string;
logger?: Logger;
}
interface Logger {
debug?(...log: any[]): void;
info?(...log: any[]): void;
log?(...log: any[]): void;
}
interface Result {
resources: string[];
spritemap: {
[key: string]: {
start: number;
end: number;
loop: boolean;
}
};
autoplay?: string;
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"audiosprite-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }