pause and continue all audio
parent
2c7d0625cc
commit
61400ed6c2
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
||||||
var __DATE__ = "Tue Nov 21 2017 15:07:22 GMT+0100 (CET)";
|
var __DATE__ = "Tue Nov 21 2017 15:24:50 GMT+0100 (CET)";
|
||||||
// END COMPILE TIME DEFINITIONS
|
// END COMPILE TIME DEFINITIONS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,6 +177,8 @@ GameLib.Event.MOUSE_WHEEL = 0x5f;
|
||||||
GameLib.Event.MOUSE_UP = 0x60;
|
GameLib.Event.MOUSE_UP = 0x60;
|
||||||
GameLib.Event.PARTICLE_INSTANCE_UPDATED = 0x61;
|
GameLib.Event.PARTICLE_INSTANCE_UPDATED = 0x61;
|
||||||
GameLib.Event.GAME_DATA = 0x62;
|
GameLib.Event.GAME_DATA = 0x62;
|
||||||
|
GameLib.Event.PAUSE_ALL_AUDIO = 0x63;
|
||||||
|
GameLib.Event.CONTINUE_ALL_AUDIO = 0x64;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string name of event ID
|
* Returns string name of event ID
|
||||||
|
@ -285,6 +287,8 @@ GameLib.Event.GetEventName = function(number) {
|
||||||
case 0x60 : return 'mouse_up';
|
case 0x60 : return 'mouse_up';
|
||||||
case 0x61 : return 'particle_instance_updated';
|
case 0x61 : return 'particle_instance_updated';
|
||||||
case 0x62 : return 'game_data';
|
case 0x62 : return 'game_data';
|
||||||
|
case 0x63 : return 'pause_all_audio';
|
||||||
|
case 0x64 : return 'continue_all_audio';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25544,12 +25548,18 @@ GameLib.System.Audio = function(
|
||||||
|
|
||||||
this.playAudioSubscription = null;
|
this.playAudioSubscription = null;
|
||||||
|
|
||||||
this.pauseAudioSubscription = null;
|
this.pauseAllAudioSubscription = null;
|
||||||
|
|
||||||
|
this.continueAllAudioSubscription = null;
|
||||||
|
|
||||||
this.stopAudioSubscription = null;
|
this.stopAudioSubscription = null;
|
||||||
|
|
||||||
this.stopAllAudioSubscription = null;
|
this.stopAllAudioSubscription = null;
|
||||||
|
|
||||||
|
this.mute = false;
|
||||||
|
|
||||||
|
this.paused = [];
|
||||||
|
|
||||||
this.audioComponents = [];
|
this.audioComponents = [];
|
||||||
|
|
||||||
this.toPlay = [];
|
this.toPlay = [];
|
||||||
|
@ -25580,9 +25590,15 @@ GameLib.System.Audio.prototype.start = function() {
|
||||||
this.playAudio.bind(this)
|
this.playAudio.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.pauseAudioSubscription = GameLib.Event.Subscribe(
|
this.pauseAllAudioSubscription = GameLib.Event.Subscribe(
|
||||||
GameLib.Event.PAUSE_AUDIO,
|
GameLib.Event.PAUSE_ALL_AUDIO,
|
||||||
this.pauseAudio.bind(this)
|
this.pauseAllAudio.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
this.continueAllAudioSubscription = GameLib.Event.Subscribe(
|
||||||
|
GameLib.Event.CONTINUE_ALL_AUDIO,
|
||||||
|
this.continueAllAudio.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.stopAudioSubscription = GameLib.Event.Subscribe(
|
this.stopAudioSubscription = GameLib.Event.Subscribe(
|
||||||
|
@ -25669,7 +25685,27 @@ GameLib.System.Audio.prototype.playAudio = function(data) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.System.Audio.prototype.pauseAudio = function(data) {
|
GameLib.System.Audio.prototype.pauseAllAudio = function(data) {
|
||||||
|
|
||||||
|
this.paused = [];
|
||||||
|
|
||||||
|
this.audioComponents.map(
|
||||||
|
function(audio) {
|
||||||
|
if (audio.instance.isPlaying) {
|
||||||
|
audio.instance.pause();
|
||||||
|
this.paused.push(audio);
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.System.Audio.prototype.continueAllAudio = function(data) {
|
||||||
|
|
||||||
|
this.paused.map(
|
||||||
|
function(audio) {
|
||||||
|
audio.instance.play();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25712,7 +25748,8 @@ GameLib.System.Audio.prototype.stop = function() {
|
||||||
this.instanceCreatedSubscription.remove();
|
this.instanceCreatedSubscription.remove();
|
||||||
this.removeComponentSubscription.remove();
|
this.removeComponentSubscription.remove();
|
||||||
this.playAudioSubscription.remove();
|
this.playAudioSubscription.remove();
|
||||||
this.pauseAudioSubscription.remove();
|
this.pauseAllAudioSubscription.remove();
|
||||||
|
this.continueAllAudioSubscription.remove();
|
||||||
this.stopAudioSubscription.remove();
|
this.stopAudioSubscription.remove();
|
||||||
this.stopAllAudioSubscription.remove();
|
this.stopAllAudioSubscription.remove();
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,8 @@ GameLib.Event.MOUSE_WHEEL = 0x5f;
|
||||||
GameLib.Event.MOUSE_UP = 0x60;
|
GameLib.Event.MOUSE_UP = 0x60;
|
||||||
GameLib.Event.PARTICLE_INSTANCE_UPDATED = 0x61;
|
GameLib.Event.PARTICLE_INSTANCE_UPDATED = 0x61;
|
||||||
GameLib.Event.GAME_DATA = 0x62;
|
GameLib.Event.GAME_DATA = 0x62;
|
||||||
|
GameLib.Event.PAUSE_ALL_AUDIO = 0x63;
|
||||||
|
GameLib.Event.CONTINUE_ALL_AUDIO = 0x64;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string name of event ID
|
* Returns string name of event ID
|
||||||
|
@ -221,6 +223,8 @@ GameLib.Event.GetEventName = function(number) {
|
||||||
case 0x60 : return 'mouse_up';
|
case 0x60 : return 'mouse_up';
|
||||||
case 0x61 : return 'particle_instance_updated';
|
case 0x61 : return 'particle_instance_updated';
|
||||||
case 0x62 : return 'game_data';
|
case 0x62 : return 'game_data';
|
||||||
|
case 0x63 : return 'pause_all_audio';
|
||||||
|
case 0x64 : return 'continue_all_audio';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,18 @@ GameLib.System.Audio = function(
|
||||||
|
|
||||||
this.playAudioSubscription = null;
|
this.playAudioSubscription = null;
|
||||||
|
|
||||||
this.pauseAudioSubscription = null;
|
this.pauseAllAudioSubscription = null;
|
||||||
|
|
||||||
|
this.continueAllAudioSubscription = null;
|
||||||
|
|
||||||
this.stopAudioSubscription = null;
|
this.stopAudioSubscription = null;
|
||||||
|
|
||||||
this.stopAllAudioSubscription = null;
|
this.stopAllAudioSubscription = null;
|
||||||
|
|
||||||
|
this.mute = false;
|
||||||
|
|
||||||
|
this.paused = [];
|
||||||
|
|
||||||
this.audioComponents = [];
|
this.audioComponents = [];
|
||||||
|
|
||||||
this.toPlay = [];
|
this.toPlay = [];
|
||||||
|
@ -53,9 +59,15 @@ GameLib.System.Audio.prototype.start = function() {
|
||||||
this.playAudio.bind(this)
|
this.playAudio.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.pauseAudioSubscription = GameLib.Event.Subscribe(
|
this.pauseAllAudioSubscription = GameLib.Event.Subscribe(
|
||||||
GameLib.Event.PAUSE_AUDIO,
|
GameLib.Event.PAUSE_ALL_AUDIO,
|
||||||
this.pauseAudio.bind(this)
|
this.pauseAllAudio.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
this.continueAllAudioSubscription = GameLib.Event.Subscribe(
|
||||||
|
GameLib.Event.CONTINUE_ALL_AUDIO,
|
||||||
|
this.continueAllAudio.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.stopAudioSubscription = GameLib.Event.Subscribe(
|
this.stopAudioSubscription = GameLib.Event.Subscribe(
|
||||||
|
@ -142,7 +154,27 @@ GameLib.System.Audio.prototype.playAudio = function(data) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.System.Audio.prototype.pauseAudio = function(data) {
|
GameLib.System.Audio.prototype.pauseAllAudio = function(data) {
|
||||||
|
|
||||||
|
this.paused = [];
|
||||||
|
|
||||||
|
this.audioComponents.map(
|
||||||
|
function(audio) {
|
||||||
|
if (audio.instance.isPlaying) {
|
||||||
|
audio.instance.pause();
|
||||||
|
this.paused.push(audio);
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.System.Audio.prototype.continueAllAudio = function(data) {
|
||||||
|
|
||||||
|
this.paused.map(
|
||||||
|
function(audio) {
|
||||||
|
audio.instance.play();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,7 +217,8 @@ GameLib.System.Audio.prototype.stop = function() {
|
||||||
this.instanceCreatedSubscription.remove();
|
this.instanceCreatedSubscription.remove();
|
||||||
this.removeComponentSubscription.remove();
|
this.removeComponentSubscription.remove();
|
||||||
this.playAudioSubscription.remove();
|
this.playAudioSubscription.remove();
|
||||||
this.pauseAudioSubscription.remove();
|
this.pauseAllAudioSubscription.remove();
|
||||||
|
this.continueAllAudioSubscription.remove();
|
||||||
this.stopAudioSubscription.remove();
|
this.stopAudioSubscription.remove();
|
||||||
this.stopAllAudioSubscription.remove();
|
this.stopAllAudioSubscription.remove();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue