mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Sound duration fixes.
This commit is contained in:
parent
e846f3cbac
commit
8d17e1f963
3 changed files with 14 additions and 9 deletions
|
@ -58,7 +58,7 @@ Version 1.0.7 (in progress in the dev branch)
|
||||||
* Fixed Particle Emitters when using Emitter width/height (thanks XekeDeath)
|
* Fixed Particle Emitters when using Emitter width/height (thanks XekeDeath)
|
||||||
* Made animation looping more robust when skipping frames (thanks XekeDeath)
|
* Made animation looping more robust when skipping frames (thanks XekeDeath)
|
||||||
* Fix for incorrect new particle positioning (issue #73) (thanks cottonflop)
|
* Fix for incorrect new particle positioning (issue #73) (thanks cottonflop)
|
||||||
|
* Added support for Body.maxVelocity (thanks cocoademon)
|
||||||
|
|
||||||
* TODO: addMarker hh:mm:ss:ms
|
* TODO: addMarker hh:mm:ss:ms
|
||||||
* TODO: Direction constants
|
* TODO: Direction constants
|
||||||
|
|
|
@ -51,13 +51,13 @@ Phaser.Physics.Arcade.prototype = {
|
||||||
body.rotation += body.angularVelocity * this.game.time.physicsElapsed;
|
body.rotation += body.angularVelocity * this.game.time.physicsElapsed;
|
||||||
|
|
||||||
// Horizontal
|
// Horizontal
|
||||||
this._velocityDelta = (this.computeVelocity(1, body, body.velocity.x, body.acceleration.x, body.drag.x) - body.velocity.x) / 2;
|
this._velocityDelta = (this.computeVelocity(1, body, body.velocity.x, body.acceleration.x, body.drag.x, body.maxVelocity.x) - body.velocity.x) / 2;
|
||||||
body.velocity.x += this._velocityDelta;
|
body.velocity.x += this._velocityDelta;
|
||||||
this._delta = body.velocity.x * this.game.time.physicsElapsed;
|
this._delta = body.velocity.x * this.game.time.physicsElapsed;
|
||||||
body.x += this._delta;
|
body.x += this._delta;
|
||||||
|
|
||||||
// Vertical
|
// Vertical
|
||||||
this._velocityDelta = (this.computeVelocity(2, body, body.velocity.y, body.acceleration.y, body.drag.y) - body.velocity.y) / 2;
|
this._velocityDelta = (this.computeVelocity(2, body, body.velocity.y, body.acceleration.y, body.drag.y, body.maxVelocity.y) - body.velocity.y) / 2;
|
||||||
body.velocity.y += this._velocityDelta;
|
body.velocity.y += this._velocityDelta;
|
||||||
this._delta = body.velocity.y * this.game.time.physicsElapsed;
|
this._delta = body.velocity.y * this.game.time.physicsElapsed;
|
||||||
body.y += this._delta;
|
body.y += this._delta;
|
||||||
|
|
|
@ -203,6 +203,7 @@ Phaser.Sound.prototype = {
|
||||||
stop: start + duration,
|
stop: start + duration,
|
||||||
volume: volume,
|
volume: volume,
|
||||||
duration: duration,
|
duration: duration,
|
||||||
|
durationMS: duration * 1000,
|
||||||
loop: loop
|
loop: loop
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -293,12 +294,13 @@ Phaser.Sound.prototype = {
|
||||||
if (this.isPlaying == true && forceRestart == false && this.override == false)
|
if (this.isPlaying == true && forceRestart == false && this.override == false)
|
||||||
{
|
{
|
||||||
// Use Restart instead
|
// Use Restart instead
|
||||||
|
console.log('Use Restart instead');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isPlaying && this.override)
|
if (this.isPlaying && this.override)
|
||||||
{
|
{
|
||||||
// console.log('asked to play ' + marker + ' but already playing ' + this.currentMarker);
|
console.log('asked to play ' + marker + ' but already playing ' + this.currentMarker);
|
||||||
|
|
||||||
if (this.usingWebAudio)
|
if (this.usingWebAudio)
|
||||||
{
|
{
|
||||||
|
@ -325,9 +327,10 @@ Phaser.Sound.prototype = {
|
||||||
this.position = this.markers[marker].start;
|
this.position = this.markers[marker].start;
|
||||||
this.volume = this.markers[marker].volume;
|
this.volume = this.markers[marker].volume;
|
||||||
this.loop = this.markers[marker].loop;
|
this.loop = this.markers[marker].loop;
|
||||||
this.duration = this.markers[marker].duration * 1000;
|
this.duration = this.markers[marker].duration;
|
||||||
|
|
||||||
|
console.log('Marker Loaded: ', marker, 'start:', this.position, 'end: ', this.duration, 'loop', this.loop);
|
||||||
|
|
||||||
console.log('marker info loaded', this.loop, this.duration);
|
|
||||||
this._tempMarker = marker;
|
this._tempMarker = marker;
|
||||||
this._tempPosition = this.position;
|
this._tempPosition = this.position;
|
||||||
this._tempVolume = this.volume;
|
this._tempVolume = this.volume;
|
||||||
|
@ -335,7 +338,7 @@ Phaser.Sound.prototype = {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
console.log('no marker info loaded');
|
console.log('no marker info loaded', marker);
|
||||||
|
|
||||||
this.position = position;
|
this.position = position;
|
||||||
this.volume = volume;
|
this.volume = volume;
|
||||||
|
@ -377,12 +380,14 @@ Phaser.Sound.prototype = {
|
||||||
// Useful to cache this somewhere perhaps?
|
// Useful to cache this somewhere perhaps?
|
||||||
if (typeof this._sound.start === 'undefined')
|
if (typeof this._sound.start === 'undefined')
|
||||||
{
|
{
|
||||||
this._sound.noteGrainOn(0, this.position, this.duration / 1000);
|
this._sound.noteGrainOn(0, this.position, this.duration);
|
||||||
|
// this._sound.noteGrainOn(0, this.position, this.duration / 1000);
|
||||||
//this._sound.noteOn(0); // the zero is vitally important, crashes iOS6 without it
|
//this._sound.noteOn(0); // the zero is vitally important, crashes iOS6 without it
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._sound.start(0, this.position, this.duration / 1000);
|
// this._sound.start(0, this.position, this.duration / 1000);
|
||||||
|
this._sound.start(0, this.position, this.duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isPlaying = true;
|
this.isPlaying = true;
|
||||||
|
|
Loading…
Reference in a new issue