Exemplo n.º 1
0
  /**
   * Returns sound source from "sfx" pool configured for specified sound, position and gain
   *
   * @param uri Sound uri
   * @param pos Sound source position
   * @param gain Sound source gain
   * @return Sound source object, or null if there is no free sound sources in effects pool
   */
  public static SoundSource source(AssetUri uri, Vector3d pos, float gain, int priority) {
    SoundSource source = source(uri, priority);
    if (source == null) {
      return null;
    }

    return (pos != null ? source.setPosition(pos).setAbsolute(true) : source).setGain(gain);
  }
Exemplo n.º 2
0
  /**
   * Returns sound source from "sfx" pool configured for specified sound, position and gain
   *
   * @param sound Sound object
   * @param pos Sound source position
   * @param gain Sound source gain
   * @return Sound source object, or null if there is no free sound sources in effects pool
   */
  public static SoundSource source(Sound sound, Vector3d pos, float gain, int priority) {
    SoundSource source = source(sound, priority);

    if (source == null) {
      return null;
    }

    if (pos != null) {
      if (!getInstance().checkDistance(pos)) {
        return null;
      }

      source.setPosition(pos).setAbsolute(true);
    }

    return source.setGain(gain);
  }