Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by tarrent

Hi, I'd like to clarify if sound files are still preloaded even if I've specified
ig.Sound.enabled = false;

just before ig.main().

Impact's SoundManager works fine with desktop and android browsers but not yet so in mobile Safari, so I play ios sounds using a single audio sprite sheet from an external script for ios. I'd like to retain Impact's sound handler for desktop and android, but I'd like to know if these sound files are also preloaded (and thus, still downloaded again) on safari. If it does, I might decide to use one set of sound file for android and ios to minimize sound file size and avoid redundant downloads of separate .ogg's, .mp3's and the single audio spritesheet.

Thank you for your suggestions.


EntityPlayer = ig.Entity.extend({
  size: {x:48, y:48},
  animSheet: new ig.AnimationSheet('media/player_sprite.png', 48,48),
  sfx_idle: new ig.Sound('media/sounds/idle.*'),
  sfx_walk: new ig.Sound('media/sounds/walk.*'),
  sfx_shoot: new ig.Sound('media/sounds/shoot.*'),
  isIdle: true,

  init: function(x, y, settings) {
    this.parent(x, y, settings);
    this.addAnim('idle', 0.1, [0]);
    this.currentAnim = this.anims.idle;
  },

  update: function(){
    this.parent();

    if(this.isIdle) {
      this.sfx_idle.play();

      if(ig.ua.iOS) {
        playNonImpactSound('idle');
      }
    }
  }
});

1 decade ago by dominic

If you set ig.Sound.enabled = false; before calling ig.main(), Impact will not load any sound files.

1 decade ago by tarrent

Thanks for clarifying this Dom, I will not have to worry about redundant sound file preloads for safari anymore. All the while I thought ig.Sound.enabled = false; only disables playing sound, but still preloads the the sound files :)
Page 1 of 1
« first « previous next › last »