Switched to howler.js for the sound system implementation of HTML5 games

Refactored gdjs.SoundManager
This commit is contained in:
Florian Rival
2015-05-01 17:14:53 +12:00
parent e857f38fdc
commit 3ae4f1ba73
7 changed files with 520 additions and 293 deletions

View File

@@ -300,6 +300,7 @@ bool Exporter::ExportEventsCode(gd::Project & project, std::string outputDir, st
//First, do not forget common includes ( They must be included before events generated code files ).
InsertUnique(includesFiles, "libs/pixi.js");
InsertUnique(includesFiles, "libs/jshashtable.js");
InsertUnique(includesFiles, "libs/howler.min.js");
InsertUnique(includesFiles, "gd.js");
InsertUnique(includesFiles, "libs/hshg.js");
InsertUnique(includesFiles, "commontools.js");

4
GDJS/Runtime/libs/howler.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -5,319 +5,180 @@
*/
/**
* A wrapper around an Audio object.
* A thin wrapper around a Howl object.
* gdjs.Sound just adds `paused`, `stopped` and `canBeDestroyed` methods.
*
* See https://github.com/goldfire/howler.js/tree/2.0 for the full documentation.
*
* @namespace gdjs
* @class Sound
* @private
*/
gdjs.Sound = function(soundFile) {
this.audio = new Audio(soundFile || "");
this._volume = 100;
this._requestedCurrentTime = null; //Can be set to the requested playing offset, when the audio is not ready yet. See below:
gdjs.Sound = function(o) {
Howl.call(this, o);
this._paused = false;
this._stopped = true;
this._canBeDestroyed = false;
//Extra work when the audio is ready:
//Setting its playing offset to the request one, if any.
var that = this;
this.audio.addEventListener("canplay", function() {
if ( that._requestedCurrentTime != null ) { //The sound must start playing at the request offset.
that.audio.currentTime = that._requestedCurrentTime;
that._requestedCurrentTime = null;
//Add custom events listener to keep
//track of the sound status.
var that = this;
this.on('end', function() {
if (!that.loop()) {
that._canBeDestroyed = true;
that._paused = false;
that._stopped = true;
}
});
});
this.on('play', function() {
that._paused = false;
that._stopped = false;
});
this.on('pause', function() {
that._paused = true;
that._stopped = false;
});
};
gdjs.Sound.prototype = Object.create(Howl.prototype);
gdjs.Sound.prototype.setSrc = function(soundFile) {
if (!gdjs.SoundManager.canUseOgg &&
(soundFile.length >= 4 && soundFile.substr(soundFile.length-4, 4).toLowerCase() === ".ogg")) {
soundFile = soundFile.substr(0, soundFile.length-4)+".mp3";
}
this.audio.src = soundFile;
}
gdjs.Sound.prototype.setVolume = function(volume, globalVolume) {
if ( volume < 0 ) volume = 0;
if ( volume > 100 ) volume = 100;
if ( globalVolume < 0 ) globalVolume = 0;
if ( globalVolume > 100 ) globalVolume = 100;
this._volume = volume;
this.updateVolume(globalVolume);
gdjs.Sound.prototype.paused = function() {
return this._paused;
};
gdjs.Sound.prototype.updateVolume = function(globalVolume) {
if ( globalVolume < 0 ) globalVolume = 0;
this.audio.volume = this._volume/100*globalVolume/100;
gdjs.Sound.prototype.stopped = function() {
return this._stopped;
};
gdjs.Sound.prototype.getVolume = function() {
return this._volume;
};
gdjs.Sound.prototype.hasEnded = function() {
return !this.audio.loop && this.audio.currentTime == this.audio.duration;
};
gdjs.Sound.prototype.play = function() {
this.audio.play();
};
gdjs.Sound.prototype.pause = function() {
this.audio.pause();
};
gdjs.Sound.prototype.stop = function() {
if ( this.audio.readyState == 4 ) this.audio.currentTime = 0;
this.audio.pause();
this._paused = false;
this._stopped = true;
Howl.prototype.stop.call(this);
};
gdjs.Sound.prototype.isPlaying = function() {
return this.audio && !this.audio.paused;
};
gdjs.Sound.prototype.isPaused = function() {
return this.audio && this.audio.paused && this.audio.readyState == 4 && this.audio.currentTime !== 0;
};
gdjs.Sound.prototype.isStopped = function() {
return !this.audio || (this.audio.paused && (this.audio.readyState != 4 || this.audio.currentTime === 0));
};
gdjs.Sound.prototype.getPlayingOffset = function() {
return this.audio.readyState == 4 ? this.audio.currentTime : 0;
};
gdjs.Sound.prototype.setPlayingOffset = function(playingOffset) {
if ( this.audio.readyState == 4 )
this.audio.currentTime = playingOffset;
else
this._requestedCurrentTime = playingOffset;
gdjs.Sound.prototype.canBeDestroyed = function() {
return this._canBeDestroyed;
};
/**
* SoundManager is used to manage the sounds and musics of a RuntimeScene.
*
* It is basically a container to associate channels to sounds and keep a list
* of all sounds being played.
*
* @namespace gdjs
* @class SoundManager
* @constructor
*/
gdjs.SoundManager = function()
{
this._sounds = [];
this._musics = [];
this._sounds = {};
this._musics = {};
this._freeSounds = []; //Sounds without an assigned channel.
this._freeMusics = []; //Musics without an assigned channel.
this._globalVolume = 100;
//Check if ogg is supported. If not, fallback to mp3.
try {
gdjs.SoundManager.canUseOgg = !!(new Audio().canPlayType('audio/ogg; codecs="vorbis"'));
}
catch (e) {}
};
gdjs.SoundManager.canUseOgg = false; //Static boolean to know if we can play ogg files or not.
gdjs.SoundManager.prototype._getRecyledResource = function(arr) {
/**
* Ensure rate is in a range valid for Howler.js
* @method clampRate
* @return The clamped rate
*/
gdjs.SoundManager.clampRate = function(rate) {
if (rate > 4.0) return 4.0;
if (rate < 0.5) return 0.5;
return rate;
};
/**
* Store the sound in the specified array, put it at the first index that
* is free, or add it at the end if no element is free
* ("free" means that the gdjs.Sound can be destroyed).
*
* @param {Array} arr The array containing the sounds.
* @param {gdjs.Sound} arr The gdjs.Sound to add.
* @method _storeSoundInArray
* @return The gdjs.Sound that have been added (i.e: the second parameter).
* @private
*/
gdjs.SoundManager.prototype._storeSoundInArray = function(arr, sound) {
//Try to recycle an old sound.
var index = null;
for(var i = 0, len = arr.length;i<len;++i) {
if (arr[i] !== null && arr[i].hasEnded() ) {
return arr[i];
if (arr[i] !== null && arr[i].canBeDestroyed() ) {
arr[index] = sound;
return sound;
}
}
theSound = new gdjs.Sound();
arr.push(theSound);
return theSound;
arr.push(sound);
return sound;
};
gdjs.SoundManager.prototype.playSound = function(soundFile, loop, volume, pitch) {
var theSound = this._getRecyledResource(this._freeSounds);
var sound = new gdjs.Sound({
src: [soundFile], //TODO: ogg, mp3...
loop: loop,
volume: volume/100,
rate: gdjs.SoundManager.clampRate(pitch)
});
theSound.setSrc(soundFile);
theSound.audio.loop = loop;
theSound.setVolume(volume, this._globalVolume);
theSound.audio.play();
this._storeSoundInArray(this._freeSounds, sound).play();
};
gdjs.SoundManager.prototype.playSoundOnChannel = function(soundFile, channel, loop, volume, pitch) {
if ( this._sounds[channel] === null || this._sounds[channel] === undefined ) {
this._sounds[channel] = new gdjs.Sound();
var oldSound = this._sounds[channel];
if (oldSound) {
oldSound.stop();
}
var theSound = this._sounds[channel];
var sound = new gdjs.Sound({
src: [soundFile], //TODO: ogg, mp3...
loop: loop,
volume: volume/100,
rate: gdjs.SoundManager.clampRate(pitch)
});
theSound.stop();
theSound.setSrc(soundFile);
theSound.audio.loop = loop;
theSound.setVolume(volume, this._globalVolume);
theSound.audio.play();
sound.play();
this._sounds[channel] = sound;
};
gdjs.SoundManager.prototype.stopSoundOnChannel = function(channel) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) theSound.stop();
};
gdjs.SoundManager.prototype.pauseSoundOnChannel = function(channel) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) theSound.pause();
};
gdjs.SoundManager.prototype.continueSoundOnChannel = function(channel) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) theSound.play();
};
gdjs.SoundManager.prototype.isSoundOnChannelPlaying = function(channel) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) return theSound.isPlaying();
return false;
};
gdjs.SoundManager.prototype.isSoundOnChannelPaused = function(channel) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) return theSound.isPaused();
return false;
};
gdjs.SoundManager.prototype.isSoundOnChannelStopped = function(channel) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) return theSound.isStopped();
return true;
};
gdjs.SoundManager.prototype.getSoundOnChannelVolume = function(channel) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) return theSound.getVolume();
return 0;
};
gdjs.SoundManager.prototype.setSoundOnChannelVolume = function(channel, volume) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) theSound.setVolume(volume, this._globalVolume);
};
gdjs.SoundManager.prototype.getSoundOnChannelPlayingOffset = function(channel) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) return theSound.getPlayingOffset();
return 0;
};
gdjs.SoundManager.prototype.setSoundOnChannelPlayingOffset = function(channel, playingOffset) {
var theSound = this._sounds[channel];
if ( theSound !== null && theSound !== undefined ) theSound.setPlayingOffset(playingOffset);
gdjs.SoundManager.prototype.getSoundOnChannel = function(channel) {
return this._sounds[channel];
};
gdjs.SoundManager.prototype.playMusic = function(soundFile, loop, volume, pitch) {
var theMusic = this._getRecyledResource(this._freeMusics);
var sound = new gdjs.Sound({
src: [soundFile], //TODO: ogg, mp3...
loop: loop,
volume: volume/100,
rate: gdjs.SoundManager.clampRate(pitch)
});
theMusic.setSrc(soundFile);
theMusic.audio.loop = loop;
theMusic.setVolume(volume, this._globalVolume);
theMusic.audio.play();
this._storeSoundInArray(this._freeMusics, sound).play();
};
gdjs.SoundManager.prototype.playMusicOnChannel = function(soundFile, channel, loop, volume, pitch) {
if ( this._musics[channel] === null || this._musics[channel] === undefined ) {
this._musics[channel] = new gdjs.Sound();
var oldMusic = this._musics[channel];
if (oldMusic) {
oldMusic.stop();
}
var theMusic = this._musics[channel];
var music = new gdjs.Sound({
src: [soundFile], //TODO: ogg, mp3...
loop: loop,
volume: volume/100,
rate: gdjs.SoundManager.clampRate(pitch)
});
theMusic.stop();
theMusic.setSrc(soundFile);
theMusic.audio.loop = loop;
theMusic.setVolume(volume, this._globalVolume);
theMusic.audio.play();
music.play();
this._musics[channel] = music;
};
gdjs.SoundManager.prototype.stopMusicOnChannel = function(channel) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) theMusic.stop();
};
gdjs.SoundManager.prototype.pauseMusicOnChannel = function(channel) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) theMusic.pause();
};
gdjs.SoundManager.prototype.continueMusicOnChannel = function(channel) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) theMusic.play();
};
gdjs.SoundManager.prototype.isMusicOnChannelPlaying = function(channel) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) return theMusic.isPlaying();
return false;
};
gdjs.SoundManager.prototype.isMusicOnChannelPaused = function(channel) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) return theMusic.isPaused();
return false;
};
gdjs.SoundManager.prototype.isMusicOnChannelStopped = function(channel) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) return theMusic.isStopped();
return true;
};
gdjs.SoundManager.prototype.getMusicOnChannelVolume = function(channel) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) return theMusic.getVolume();
return 0;
};
gdjs.SoundManager.prototype.setMusicOnChannelVolume = function(channel, volume) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) theMusic.setVolume(volume, this._globalVolume);
};
gdjs.SoundManager.prototype.getMusicOnChannelPlayingOffset = function(channel) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) return theMusic.getPlayingOffset();
return 0;
};
gdjs.SoundManager.prototype.setMusicOnChannelPlayingOffset = function(channel, playingOffset) {
var theMusic = this._musics[channel];
if ( theMusic !== null && theMusic !== undefined ) theMusic.setPlayingOffset(playingOffset);
gdjs.SoundManager.prototype.getMusicOnChannel = function(channel) {
return this._musics[channel];
};
gdjs.SoundManager.prototype.setGlobalVolume = function(volume) {
this._globalVolume = volume;
//Update the volumes of sounds.
for(var i = 0, len = this._freeSounds.length;i<len;++i) {
if ( this._freeSounds[i] !== null && this._freeSounds[i] !== undefined ) {
this._freeSounds[i].updateVolume(this._globalVolume);
}
}
for(var i = 0, len = this._freeMusics.length;i<len;++i) {
if ( this._freeMusics[i] !== null && this._freeMusics[i] !== undefined ) {
this._freeMusics[i].updateVolume(this._globalVolume);
}
}
for(var i = 0, len = this._sounds.length;i<len;++i) {
if ( this._sounds[i] !== null && this._sounds[i] !== undefined ) {
this._sounds[i].updateVolume(this._globalVolume);
}
}
for(var i = 0, len = this._musics.length;i<len;++i) {
if ( this._musics[i] !== null && this._musics[i] !== undefined ) {
this._musics[i].updateVolume(this._globalVolume);
}
}
Howler.volume(volume/100);
};
gdjs.SoundManager.prototype.getGlobalVolume = function() {
return this._globalVolume;
return Howler.volume()*100;
};

View File

@@ -14,6 +14,16 @@
*/
gdjs.evtTools.sound = gdjs.evtTools.sound || {};
gdjs.evtTools.sound.getGlobalVolume = function(runtimeScene) {
return runtimeScene.getSoundManager().getGlobalVolume();
};
gdjs.evtTools.sound.setGlobalVolume = function(runtimeScene, globalVolume) {
runtimeScene.getSoundManager().setGlobalVolume(globalVolume);
};
//Sounds:
gdjs.evtTools.sound.playSound = function(runtimeScene, soundFile, loop, volume, pitch) {
runtimeScene.getSoundManager().playSound(soundFile, loop, volume, pitch);
};
@@ -23,29 +33,57 @@ gdjs.evtTools.sound.playSoundOnChannel = function(runtimeScene, soundFile, chann
};
gdjs.evtTools.sound.stopSoundOnChannel = function(runtimeScene, channel) {
runtimeScene.getSoundManager().stopSoundOnChannel(channel);
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
sound && sound.stop();
};
gdjs.evtTools.sound.pauseSoundOnChannel = function(runtimeScene, channel) {
runtimeScene.getSoundManager().pauseSoundOnChannel(channel);
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
sound && sound.pause();
};
gdjs.evtTools.sound.continueSoundOnChannel = function(runtimeScene, channel) {
runtimeScene.getSoundManager().continueSoundOnChannel(channel);
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
sound && sound.play();
};
gdjs.evtTools.sound.isSoundOnChannelPlaying = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().isSoundOnChannelPlaying(channel);
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
return sound ? sound.playing() : false;
};
gdjs.evtTools.sound.isSoundOnChannelPaused = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().isSoundOnChannelPaused(channel);
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
return sound ? sound.paused() : false;
};
gdjs.evtTools.sound.isSoundOnChannelStopped = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().isSoundOnChannelStopped(channel);
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
return sound ? sound.stopped() : true;
};
gdjs.evtTools.sound.getSoundOnChannelVolume = function(runtimeScene, channel) {
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
return sound ? sound.volume() * 100 : 100;
};
gdjs.evtTools.sound.setSoundOnChannelVolume = function(runtimeScene, channel, volume) {
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
sound && sound.volume(volume / 100);
};
gdjs.evtTools.sound.getSoundOnChannelPlayingOffset = function(runtimeScene, channel) {
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
return sound ? sound.seek() : 0;
};
gdjs.evtTools.sound.setSoundOnChannelPlayingOffset = function(runtimeScene, channel, playingOffset) {
var sound = runtimeScene.getSoundManager().getSoundOnChannel(channel);
sound && sound.seek(playingOffset);
};
//Musics:
gdjs.evtTools.sound.playMusic = function(runtimeScene, soundFile, loop, volume, pitch) {
runtimeScene.getSoundManager().playMusic(soundFile, loop, volume, pitch);
};
@@ -55,65 +93,51 @@ gdjs.evtTools.sound.playMusicOnChannel = function(runtimeScene, soundFile, chann
};
gdjs.evtTools.sound.stopMusicOnChannel = function(runtimeScene, channel) {
runtimeScene.getSoundManager().stopMusicOnChannel(channel);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
music && music.stop();
};
gdjs.evtTools.sound.pauseMusicOnChannel = function(runtimeScene, channel) {
runtimeScene.getSoundManager().pauseMusicOnChannel(channel);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
music && music.pause();
};
gdjs.evtTools.sound.continueMusicOnChannel = function(runtimeScene, channel) {
runtimeScene.getSoundManager().continueMusicOnChannel(channel);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
music && music.play();
};
gdjs.evtTools.sound.isMusicOnChannelPlaying = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().isMusicOnChannelPlaying(channel);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
return music ? music.playing() : false;
};
gdjs.evtTools.sound.isMusicOnChannelPaused = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().isMusicOnChannelPaused(channel);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
return music ? music.paused() : false;
};
gdjs.evtTools.sound.isMusicOnChannelStopped = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().isMusicOnChannelStopped(channel);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
return music ? music.stopped() : true;
};
gdjs.evtTools.sound.getMusicOnChannelVolume = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().getMusicOnChannelVolume(channel);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
return music ? music.volume() * 100 : 100;
};
gdjs.evtTools.sound.setMusicOnChannelVolume = function(runtimeScene, channel, volume) {
runtimeScene.getSoundManager().setMusicOnChannelVolume(channel, volume);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
music && music.volume(volume / 100);
};
gdjs.evtTools.sound.getMusicOnChannelPlayingOffset = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().getMusicOnChannelPlayingOffset(channel);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
return music ? music.seek() : 0;
};
gdjs.evtTools.sound.setMusicOnChannelPlayingOffset = function(runtimeScene, channel, playingOffset) {
runtimeScene.getSoundManager().setMusicOnChannelPlayingOffset(channel, playingOffset);
};
gdjs.evtTools.sound.getSoundOnChannelVolume = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().getSoundOnChannelVolume(channel);
};
gdjs.evtTools.sound.setSoundOnChannelVolume = function(runtimeScene, channel, volume) {
runtimeScene.getSoundManager().setSoundOnChannelVolume(channel, volume);
};
gdjs.evtTools.sound.getSoundOnChannelPlayingOffset = function(runtimeScene, channel) {
return runtimeScene.getSoundManager().getSoundOnChannelPlayingOffset(channel);
};
gdjs.evtTools.sound.setSoundOnChannelPlayingOffset = function(runtimeScene, channel, playingOffset) {
runtimeScene.getSoundManager().setSoundOnChannelPlayingOffset(channel, playingOffset);
};
gdjs.evtTools.sound.getGlobalVolume = function(runtimeScene) {
return runtimeScene.getSoundManager().getGlobalVolume();
};
gdjs.evtTools.sound.setGlobalVolume = function(runtimeScene, globalVolume) {
runtimeScene.getSoundManager().setGlobalVolume(globalVolume);
var music = runtimeScene.getSoundManager().getMusicOnChannel(channel);
music && music.seek(playingOffset);
};

View File

@@ -0,0 +1,337 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<project firstLayout="">
<gdVersion build="80" major="3" minor="6" revision="0" />
<properties linuxExecutableFilename="" macExecutableFilename="" useExternalSourceFiles="false" winExecutableFilename="" winExecutableIconFile="">
<name>Project</name>
<author></author>
<windowWidth>800</windowWidth>
<windowHeight>600</windowHeight>
<latestCompilationDirectory></latestCompilationDirectory>
<maxFPS>60</maxFPS>
<minFPS>10</minFPS>
<verticalSync>false</verticalSync>
<extensions>
<extension name="BuiltinObject" />
<extension name="BuiltinAudio" />
<extension name="BuiltinVariables" />
<extension name="BuiltinTime" />
<extension name="BuiltinMouse" />
<extension name="BuiltinKeyboard" />
<extension name="BuiltinJoystick" />
<extension name="BuiltinCamera" />
<extension name="BuiltinWindow" />
<extension name="BuiltinFile" />
<extension name="BuiltinNetwork" />
<extension name="BuiltinScene" />
<extension name="BuiltinAdvanced" />
<extension name="Sprite" />
<extension name="BuiltinCommonInstructions" />
<extension name="BuiltinCommonConversions" />
<extension name="BuiltinStringInstructions" />
<extension name="BuiltinMathematicalTools" />
<extension name="BuiltinExternalLayouts" />
</extensions>
<platforms>
<platform name="GDevelop JS platform" />
<platform name="GDevelop C++ platform" />
</platforms>
<currentPlatform>GDevelop JS platform</currentPlatform>
</properties>
<resources>
<resources />
<resourceFolders />
</resources>
<objects />
<objectsGroups />
<variables />
<layouts>
<layout b="209" disableInputWhenNotFocused="true" mangledName="New_32scene" name="New scene" oglFOV="90.000000" oglZFar="500.000000" oglZNear="1.000000" r="209" standardSortMethod="true" stopSoundsOnStartup="true" title="" v="209">
<uiSettings associatedLayout="" grid="false" gridB="255" gridG="180" gridHeight="32" gridOffsetX="0" gridOffsetY="0" gridR="158" gridWidth="32" snap="true" windowMask="false" zoomFactor="1.000000" />
<objectsGroups />
<variables />
<instances />
<objects />
<events>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions>
<condition>
<type inverted="false" value="DepartScene" />
<parameters>
<parameter></parameter>
</parameters>
<subConditions />
</condition>
</conditions>
<actions>
<action>
<type inverted="false" value="PlaySoundCanal" />
<parameters>
<parameter></parameter>
<parameter>coin.wav</parameter>
<parameter>0</parameter>
<parameter>yes</parameter>
<parameter></parameter>
<parameter>0.5</parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions />
<actions>
<action>
<type inverted="false" value="ModVolumeSoundCanal" />
<parameters>
<parameter></parameter>
<parameter>0</parameter>
<parameter>=</parameter>
<parameter>100*sin(TimeFromStart()*10)</parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions>
<condition>
<type inverted="false" value="KeyPressed" />
<parameters>
<parameter></parameter>
<parameter>Space</parameter>
</parameters>
<subConditions />
</condition>
</conditions>
<actions>
<action>
<type inverted="false" value="PauseSoundCanal" />
<parameters>
<parameter></parameter>
<parameter>0</parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions>
<condition>
<type inverted="true" value="KeyPressed" />
<parameters>
<parameter></parameter>
<parameter>Space</parameter>
</parameters>
<subConditions />
</condition>
<condition>
<type inverted="false" value="BuiltinCommonInstructions::Once" />
<parameters />
<subConditions />
</condition>
</conditions>
<actions>
<action>
<type inverted="false" value="RePlaySoundCanal" />
<parameters>
<parameter></parameter>
<parameter>0</parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions>
<condition>
<type inverted="false" value="KeyPressed" />
<parameters>
<parameter></parameter>
<parameter>Up</parameter>
</parameters>
<subConditions />
</condition>
</conditions>
<actions>
<action>
<type inverted="false" value="ModGlobalVolume" />
<parameters>
<parameter></parameter>
<parameter>+</parameter>
<parameter>20*TimeDelta()</parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions>
<condition>
<type inverted="false" value="KeyPressed" />
<parameters>
<parameter></parameter>
<parameter>Down</parameter>
</parameters>
<subConditions />
</condition>
</conditions>
<actions>
<action>
<type inverted="false" value="ModGlobalVolume" />
<parameters>
<parameter></parameter>
<parameter>-</parameter>
<parameter>20*TimeDelta()</parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions>
<condition>
<type inverted="false" value="KeyPressed" />
<parameters>
<parameter></parameter>
<parameter>m</parameter>
</parameters>
<subConditions />
</condition>
<condition>
<type inverted="false" value="BuiltinCommonInstructions::Once" />
<parameters />
<subConditions />
</condition>
</conditions>
<actions>
<action>
<type inverted="false" value="PlayMusic" />
<parameters>
<parameter></parameter>
<parameter>orchestral.ogg</parameter>
<parameter></parameter>
<parameter></parameter>
<parameter></parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions>
<condition>
<type inverted="false" value="KeyPressed" />
<parameters>
<parameter></parameter>
<parameter>n</parameter>
</parameters>
<subConditions />
</condition>
<condition>
<type inverted="false" value="BuiltinCommonInstructions::Once" />
<parameters />
<subConditions />
</condition>
</conditions>
<actions>
<action>
<type inverted="false" value="PlayMusicCanal" />
<parameters>
<parameter></parameter>
<parameter>orchestral.ogg</parameter>
<parameter>60</parameter>
<parameter></parameter>
<parameter></parameter>
<parameter></parameter>
</parameters>
<subActions />
</action>
<action>
<type inverted="false" value="ModPlayingOffsetMusicChannel" />
<parameters>
<parameter></parameter>
<parameter>60</parameter>
<parameter>=</parameter>
<parameter>8.5</parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions>
<condition>
<type inverted="true" value="MusicPlaying" />
<parameters>
<parameter></parameter>
<parameter>4</parameter>
</parameters>
<subConditions />
</condition>
<condition>
<type inverted="false" value="MusicStopped" />
<parameters>
<parameter></parameter>
<parameter>4</parameter>
</parameters>
<subConditions />
</condition>
<condition>
<type inverted="true" value="MusicPaused" />
<parameters>
<parameter></parameter>
<parameter>4</parameter>
</parameters>
<subConditions />
</condition>
</conditions>
<actions>
<action>
<type inverted="false" value="SceneBackground" />
<parameters>
<parameter></parameter>
<parameter>&quot;204;255;102&quot;</parameter>
</parameters>
<subActions />
</action>
</actions>
<events />
</event>
<event disabled="false" folded="false">
<type>BuiltinCommonInstructions::Standard</type>
<conditions />
<actions />
<events />
</event>
</events>
<layers>
<layer name="" visibility="true">
<cameras>
<camera defaultSize="true" defaultViewport="true" height="0.000000" viewportBottom="1.000000" viewportLeft="0.000000" viewportRight="1.000000" viewportTop="0.000000" width="0.000000" />
</cameras>
</layer>
</layers>
<automatismsSharedData />
</layout>
</layouts>
<externalEvents />
<externalLayouts />
<externalSourceFiles />
</project>

BIN
GDJS/tests/games/coin.wav Normal file

Binary file not shown.

Binary file not shown.