Compare commits

...

1 Commits

Author SHA1 Message Date
Florian Rival
d87259a2aa Add an empty sound manager doing nothing for debugging 2020-12-03 19:54:59 +01:00
3 changed files with 91 additions and 2 deletions

View File

@@ -663,8 +663,9 @@ void ExporterHelper::AddLibsInclude(bool pixiRenderers,
"pixi-renderers/spriteruntimeobject-pixi-renderer.js");
InsertUnique(includesFiles,
"pixi-renderers/loadingscreen-pixi-renderer.js");
InsertUnique(includesFiles, "howler-sound-manager/howler.min.js");
InsertUnique(includesFiles, "howler-sound-manager/howler-sound-manager.js");
InsertUnique(includesFiles, "empty-sound-manager/empty-sound-manager.js");
// InsertUnique(includesFiles, "howler-sound-manager/howler.min.js");
// InsertUnique(includesFiles, "howler-sound-manager/howler-sound-manager.js");
InsertUnique(includesFiles,
"fontfaceobserver-font-manager/fontfaceobserver.js");
InsertUnique(

View File

@@ -0,0 +1,87 @@
// @ts-check
/*
* GDevelop JS Platform
* Copyright 2013-present Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
/**
* EmptySoundManager does not play any sound or music.
*
* @memberof gdjs
* @class EmptySoundManager
*/
gdjs.EmptySoundManager = function (resources) {
this._globalVolume = 100;
this._resources = resources;
};
gdjs.SoundManager = gdjs.EmptySoundManager; //Register the class to let the engine use it.
/**
* Update the resources data of the game. Useful for hot-reloading, should not be used otherwise.
*
* @param {ResourceData[]} resources The resources data of the game.
*/
gdjs.EmptySoundManager.prototype.setResources = function (resources) {
this._resources = resources;
};
gdjs.EmptySoundManager.prototype.playSound = function (
soundName,
loop,
volume,
pitch
) {};
gdjs.EmptySoundManager.prototype.playSoundOnChannel = function (
soundName,
channel,
loop,
volume,
pitch
) {
return null;
};
gdjs.EmptySoundManager.prototype.getSoundOnChannel = function (channel) {
return null;
};
gdjs.EmptySoundManager.prototype.playMusic = function (
soundName,
loop,
volume,
pitch
) {};
gdjs.EmptySoundManager.prototype.playMusicOnChannel = function (
soundName,
channel,
loop,
volume,
pitch
) {};
gdjs.EmptySoundManager.prototype.getMusicOnChannel = function (channel) {
return null;
};
gdjs.EmptySoundManager.prototype.setGlobalVolume = function (volume) {
this._globalVolume = volume;
if (this._globalVolume > 100) this._globalVolume = 100;
if (this._globalVolume < 0) this._globalVolume = 0;
};
gdjs.EmptySoundManager.prototype.getGlobalVolume = function () {
return this._globalVolume;
};
gdjs.EmptySoundManager.prototype.clearAll = function () {};
gdjs.EmptySoundManager.prototype.preloadAudio = function (
onProgress,
onComplete
) {
onComplete(this._resources.length);
};

View File

@@ -94,6 +94,7 @@ const getAllDevelopmentWatchPaths = (): Promise<DevelopmentWatchPaths> => {
'events-tools',
'fontfaceobserver-font-manager',
'howler-sound-manager',
'empty-sound-manager',
'libs',
'pixi-renderers',
'websocket-debugger-client',