コード例 #1
0
  /**
   * Creates an AudioSource which can be to manipulate a Sound buffer. An AudioSource can be created
   * multiple times and use the same Sound buffer.
   */
  public AudioSource createAudioSource(final String _file, final StreamType _type) {
    final AudioBuffer<AndroidSound> buffer =
        (AudioBuffer<AndroidSound>) staticSoundManager.get(_file);
    if (buffer == null) {
      System.out.println("Sound Doesn't exist.");
      return null;
    }

    final AndroidSound sound = buffer.getBuffer();
    return new AndroidSource(sound.getBuffer());
  }
コード例 #2
0
  public boolean startGenerator() {
    final ManagerInterface.ResourceLoader<AudioBuffer> loader =
        staticSoundManager.getResourceLoader();
    loader.add(
        new ManagerInterface.ResourceDelegate<AudioBuffer>() {
          public boolean isLoadable(final String _file) {
            return GlobalFileSystem.isExtension(_file, ".wav", ".WAV");
          }

          public AudioBuffer load(final String _file, final Settings _settings) {
            final byte[] buffer = ByteReader.readBytes(_file);
            if (buffer == null) {
              return null;
            }

            return new AudioBuffer<AndroidSound>(new AndroidSound(buffer));
          }
        });

    return true;
  }
コード例 #3
0
 public void clear() {
   staticSoundManager.clear();
 }