Skip to content

Commit

Permalink
Update to the latest extension-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtimebuddy committed Jan 19, 2024
1 parent cd064ae commit 67114f0
Show file tree
Hide file tree
Showing 20 changed files with 2,102 additions and 808 deletions.
2,805 changes: 2,046 additions & 759 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
},
"homepage": "https://github.com/pixijs/sound#readme",
"devDependencies": {
"@pixi/extension-scripts": "^1.8.1",
"@pixi/extension-scripts": "^2.0.0",
"copyfiles": "^2.4.1",
"mkdirp": "^1.0.4",
"pixi.js": "^8.0.0-rc"
"pixi.js": "^8.0.0-X"
},
"peerDependencies": {
"pixi.js": "^8.0.0"
"pixi.js": "^8.0.0-X"
}
}
10 changes: 6 additions & 4 deletions src/Sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ class Sound
speed: 1,
complete: null,
loaded: null,
loop: false, ...options };
loop: false, ...options
};

Object.freeze(options);

Expand Down Expand Up @@ -555,7 +556,8 @@ class Sound
volume: 1,
speed: 1,
muted: false,
loop: false, ...(options || {}) };
loop: false, ...(options || {})
};

// A sprite is specified, add the options
if (options.sprite)
Expand Down Expand Up @@ -806,9 +808,9 @@ class Sound

export { Sound };
export type {
CompleteCallback,
LoadedCallback,
Options,
PlayOptions,
LoadedCallback,
CompleteCallback,
SoundSpriteDataMap
};
4 changes: 2 additions & 2 deletions src/SoundLibrary.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Filter } from './filters/Filter';
import { HTMLAudioContext } from './htmlaudio/HTMLAudioContext';
import { IMediaContext } from './interfaces/IMediaContext';
import { IMediaInstance } from './interfaces/IMediaInstance';
import { CompleteCallback, Options, PlayOptions, Sound } from './Sound';
import { HTMLAudioContext } from './htmlaudio/HTMLAudioContext';
import { WebAudioContext } from './webaudio/WebAudioContext';

type SoundSourceMap = Record<string, Options | string | ArrayBuffer | AudioBuffer | HTMLAudioElement>;
Expand Down Expand Up @@ -553,4 +553,4 @@ class SoundLibrary
}

export { SoundLibrary };
export type { SoundSourceMap, SoundMap };
export type { SoundMap, SoundSourceMap };
5 changes: 3 additions & 2 deletions src/SoundSprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ class SoundSprite
speed: this.speed || this.parent.speed,
end: this.end,
start: this.start,
loop: this.loop });
loop: this.loop
});
}

/** Destroy and don't use after this */
Expand All @@ -106,5 +107,5 @@ class SoundSprite
}
}

export type { SoundSprites, SoundSpriteData };
export type { SoundSpriteData, SoundSprites };
export { SoundSprite };
11 changes: 6 additions & 5 deletions src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {
sound,
Filterable,
filters,
htmlaudio,
Sound,
sound,
soundAsset,
SoundLibrary,
SoundSprite,
filters,
htmlaudio,
utils,
soundAsset,
webaudio } from './index';
webaudio
} from './index';

Object.defineProperties(sound,
{
Expand Down
8 changes: 4 additions & 4 deletions src/filters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
* ];
* @namespace filters
*/
export * from './Filter';
export * from './EqualizerFilter';
export * from './DistortionFilter';
export * from './StereoFilter';
export * from './ReverbFilter';
export * from './EqualizerFilter';
export * from './Filter';
export * from './MonoFilter';
export * from './ReverbFilter';
export * from './StereoFilter';
export * from './StreamFilter';
export * from './TelephoneFilter';
2 changes: 1 addition & 1 deletion src/htmlaudio/HTMLAudioInstance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventEmitter, Ticker } from 'pixi.js';
import { PlayOptions } from '../Sound';
import { Filter } from '../filters/Filter';
import { IMediaInstance } from '../interfaces/IMediaInstance';
import { PlayOptions } from '../Sound';
import { HTMLAudioMedia } from './HTMLAudioMedia';

let id = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/htmlaudio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
* Classes supporting non-WebAudio based browsers.
* @namespace htmlaudio
*/
export * from './HTMLAudioMedia';
export * from './HTMLAudioInstance';
export * from './HTMLAudioContext';
export * from './HTMLAudioInstance';
export * from './HTMLAudioMedia';
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import * as filters from './filters';
import * as htmlaudio from './htmlaudio';
import { setInstance } from './instance';
import { SoundLibrary } from './SoundLibrary';
import * as htmlaudio from './htmlaudio';
import * as filters from './filters';
import * as webaudio from './webaudio';
import * as utils from './utils';
import * as webaudio from './webaudio';

const sound = setInstance(new SoundLibrary());

export * from './Filterable';
export * from './filters/Filter';
export * from './interfaces';
export * from './Sound';
export * from './soundAsset';
export * from './SoundLibrary';
export * from './Filterable';
export * from './interfaces';
export * from './filters/Filter';
export * from './SoundSprite';
export {
sound,
htmlaudio,
filters,
webaudio,
htmlaudio,
sound,
utils,
webaudio,
};
2 changes: 1 addition & 1 deletion src/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ function getInstance(): SoundLibrary
return instance;
}

export { instance, setInstance, getInstance };
export { getInstance, instance, setInstance };
4 changes: 2 additions & 2 deletions src/soundAsset.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AssetExtension, ExtensionType, LoaderParser, LoaderParserPriority, ResolvedAsset, extensions, path } from 'pixi.js';
import { Options, Sound } from './Sound';
import { AssetExtension, extensions, ExtensionType, LoaderParser, LoaderParserPriority, path, ResolvedAsset } from 'pixi.js';
import { getInstance } from './instance';
import { Options, Sound } from './Sound';
import { extensions as exts, mimes, supported } from './utils/supported';

/** Get the alias for the sound */
Expand Down
2 changes: 1 addition & 1 deletion src/utils/playOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ function playOnce(url: string, callback?: (err?: Error) => void): string
return alias;
}

export { playOnce, PLAY_ID };
export { PLAY_ID, playOnce };
3 changes: 2 additions & 1 deletion src/utils/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function render(sound: Sound, options?: RenderOptions): TextureSource
options = {
width: 512,
height: 128,
fill: 'black', ...(options || {}) };
fill: 'black', ...(options || {})
};

canvas.width = options.width;
canvas.height = options.height;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/sineTone.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Sound } from '../Sound';
import { WebAudioMedia } from '../webaudio/WebAudioMedia';
import { WebAudioContext } from '../webaudio/WebAudioContext';
import { WebAudioMedia } from '../webaudio/WebAudioMedia';

/**
* Create a new sound for a sine wave-based tone. **Only supported with WebAudio**
Expand Down Expand Up @@ -39,7 +39,7 @@ function sineTone(hertz = 200, seconds = 1): Sound
// fill the buffer
for (let i = 0; i < fArray.length; i++)
{
const time = i / buffer.sampleRate;
const time = i / buffer.sampleRate;
const angle = hertz * time * Math.PI;

fArray[i] = Math.sin(angle) * amplitude;
Expand Down
7 changes: 4 additions & 3 deletions src/utils/supported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function validateFormats(typeOverrides?: Record<string, string>): void
m4a: 'audio/mp4',
oga: 'audio/ogg',
opus: 'audio/ogg; codecs="opus"',
caf: 'audio/x-caf; codecs="opus"', ...(typeOverrides || {}) };
caf: 'audio/x-caf; codecs="opus"', ...(typeOverrides || {})
};
const audio = document.createElement('audio');
const formats: ExtensionMap = {};
const no = /^no$/;
Expand All @@ -77,8 +78,8 @@ function validateFormats(typeOverrides?: Record<string, string>): void
validateFormats();

export {
validateFormats,
supported,
extensions,
mimes,
supported,
validateFormats,
};
2 changes: 1 addition & 1 deletion src/webaudio/WebAudioInstance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventEmitter, Ticker } from 'pixi.js';
import { PlayOptions } from '../Sound';
import { Filter } from '../filters/Filter';
import { IMediaInstance } from '../interfaces';
import { PlayOptions } from '../Sound';
import { WebAudioMedia } from './WebAudioMedia';
import { WebAudioUtils } from './WebAudioUtils';

Expand Down
4 changes: 2 additions & 2 deletions src/webaudio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Classes supporting non-WebAudio based browsers.
* @namespace webaudio
*/
export * from './WebAudioMedia';
export * from './WebAudioContext';
export * from './WebAudioInstance';
export * from './WebAudioMedia';
export * from './WebAudioNodes';
export * from './WebAudioContext';
export * from './WebAudioUtils';
4 changes: 2 additions & 2 deletions test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import { Assets } from 'pixi.js';
import { sound, Sound, utils, webaudio, htmlaudio, filters, SoundLibrary, IMediaInstance } from '../src';
import { filters, htmlaudio, IMediaInstance, Sound, sound, SoundLibrary, utils, webaudio } from '../src';
import { dataUrlMp3, dataUrlOgg } from './resources/dataUrlResources';
import path from 'path';

declare global
{
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@pixi/extension-scripts/lib/configs/tsconfig.json",
"extends": "@pixi/extension-scripts/tsconfig",
"compilerOptions": {
"strict": false,
"noImplicitThis": true,
Expand All @@ -10,7 +10,8 @@
"preserveConstEnums": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true
"noUncheckedIndexedAccess": true,
"skipLibCheck": true
},
"include": [
"src/**/*"
Expand Down

0 comments on commit 67114f0

Please sign in to comment.