From d762e465ec450ce60841761920004d5122006781 Mon Sep 17 00:00:00 2001 From: jedeen Date: Sat, 4 Aug 2018 10:04:26 -0500 Subject: [PATCH] [chore] Remove obsolete code for 0.18.0 release (#1021) * Remove obsolete code for 0.18.0 release * Update changelog --- CHANGELOG.md | 3 +++ sandbox/src/game.ts | 2 +- sandbox/tests/audio/longsound.ts | 2 +- sandbox/tests/audio/setvolume.ts | 2 +- src/engine/Interfaces/IAudio.ts | 12 ------------ src/engine/Resources/Sound/AudioInstance.ts | 13 ------------- src/engine/Resources/Sound/Sound.ts | 13 ------------- 7 files changed, 6 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e65f713a9..acbff5966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Breaking Changes +- `Sound.setVolume()` replaced with `Sound.volume` +- `Sound.setLoop()` replaced with `Sound.loop` + ### Added - Add `Scene.isActorInDrawTree` method to determine if an actor is in the scene's draw tree. diff --git a/sandbox/src/game.ts b/sandbox/src/game.ts index 62236820d..6dbb6a7e7 100644 --- a/sandbox/src/game.ts +++ b/sandbox/src/game.ts @@ -48,7 +48,7 @@ var imageBlocks = new ex.Texture('../images/BlockA0.png'); var spriteFontImage = new ex.Texture('../images/SpriteFont.png'); var jump = new ex.Sound('../sounds/jump.wav', '../sounds/jump.mp3'); -jump.setVolume(0.3); +jump.volume = 0.3; var loader = new ex.Loader(); loader.addResource(heartTex); diff --git a/sandbox/tests/audio/longsound.ts b/sandbox/tests/audio/longsound.ts index a12e37f48..a593d1769 100644 --- a/sandbox/tests/audio/longsound.ts +++ b/sandbox/tests/audio/longsound.ts @@ -18,7 +18,7 @@ game.on('hidden', () => { }); game.start(loader).then(() => { - testSound.setLoop(true); + testSound.loop = true; testSound.play(); setTimeout(() => testSound.play(), 2000); diff --git a/sandbox/tests/audio/setvolume.ts b/sandbox/tests/audio/setvolume.ts index 2912af4f1..7e8f6cba9 100644 --- a/sandbox/tests/audio/setvolume.ts +++ b/sandbox/tests/audio/setvolume.ts @@ -22,7 +22,7 @@ button.on('pointerup', function() { //change volume of the sound after 2000 ms to show that //initial setting worked setTimeout(function() { - testSound.setVolume(1); + testSound.volume = 1; }, 2000); } }); diff --git a/src/engine/Interfaces/IAudio.ts b/src/engine/Interfaces/IAudio.ts index 3fc5bf9d9..b2abecd96 100644 --- a/src/engine/Interfaces/IAudio.ts +++ b/src/engine/Interfaces/IAudio.ts @@ -13,18 +13,6 @@ export interface IAudio { */ volume: number; - /** - * Whether the audio should loop (repeat forever) - * @param loop true to enable loop - */ - setLoop(loop: boolean): void; - - /** - * Sets the volume of the sound clip - * @param volume A volume value between 0-1.0 - */ - setVolume(value: number): void; - /** * Whether or not any audio is playing */ diff --git a/src/engine/Resources/Sound/AudioInstance.ts b/src/engine/Resources/Sound/AudioInstance.ts index 618fa17d4..f84d43398 100644 --- a/src/engine/Resources/Sound/AudioInstance.ts +++ b/src/engine/Resources/Sound/AudioInstance.ts @@ -2,7 +2,6 @@ import { IAudio } from '../../Interfaces/IAudio'; import { Promise } from '../../Promises'; import * as Util from '../../Util/Util'; import { AudioContextFactory } from './AudioContext'; -import { obsolete } from '../../Util/Decorators'; /** * Internal class for producing of AudioInstances @@ -54,18 +53,6 @@ export class AudioInstance implements IAudio { constructor(protected _src: string | AudioBuffer) {} - /** @obsolete will be removed in v0.18, use loop */ - @obsolete({ message: 'will be removed in v0.18, use loop instead' }) - public setLoop(loop: boolean) { - this.loop = loop; - } - - /** @obsolete will be removed in v0.18, use volume */ - @obsolete({ message: 'will be removed in v0.18, use volume instead' }) - public setVolume(volume: number) { - this.volume = volume; - } - public isPlaying() { return this._isPlaying; } diff --git a/src/engine/Resources/Sound/Sound.ts b/src/engine/Resources/Sound/Sound.ts index c7e48c8f8..540e7df50 100644 --- a/src/engine/Resources/Sound/Sound.ts +++ b/src/engine/Resources/Sound/Sound.ts @@ -5,7 +5,6 @@ import { Resource } from '../Resource'; import { AudioInstance, AudioInstanceFactory } from './AudioInstance'; import { AudioContextFactory } from './AudioContext'; import { NativeSoundEvent } from '../../Events/MediaEvents'; -import { obsolete } from '../../Util/Decorators'; import { Promise } from '../../Promises'; import { canPlayFile } from '../../Util/Sound'; @@ -93,18 +92,6 @@ export class Sound extends Resource implements IAudio { } } - /** @obsolete will be removed in v0.18, use loop */ - @obsolete({ message: 'will be removed in v0.18, use loop instead' }) - public setLoop(loop: boolean) { - this.loop = loop; - } - - /** @obsolete will be removed in v0.18, use volume */ - @obsolete({ message: 'will be removed in v0.18, use volume instead' }) - public setVolume(volume: number) { - this.volume = volume; - } - public wireEngine(engine: Engine) { if (engine) { this._engine = engine;