- add audio renderer based on android native renderer (WIP, needs naming cleanup)


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@11039 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
nor..67 11 years ago
parent eac0f14cab
commit 9df246324d
  1. 1054
      engine/src/ios/com/jme3/audio/android/AL.java
  2. 67
      engine/src/ios/com/jme3/audio/android/AndroidAudioData.java
  3. 24
      engine/src/ios/com/jme3/audio/android/AndroidAudioRenderer.java
  4. 1423
      engine/src/ios/com/jme3/audio/android/AndroidOpenALSoftAudioRenderer.java
  5. 20
      engine/src/ios/com/jme3/audio/plugins/AndroidAudioLoader.java
  6. 5
      engine/src/ios/com/jme3/system/ios/IosAssetManager.java
  7. 3
      engine/src/ios/com/jme3/system/ios/JmeIosSystem.java

File diff suppressed because it is too large Load Diff

@ -0,0 +1,67 @@
package com.jme3.audio.android;
import com.jme3.asset.AssetKey;
import com.jme3.audio.AudioData;
import com.jme3.audio.AudioRenderer;
import com.jme3.util.NativeObject;
public class AndroidAudioData extends AudioData {
protected AssetKey<?> assetKey;
protected float currentVolume = 0f;
public AndroidAudioData(){
super();
}
protected AndroidAudioData(int id){
super(id);
}
public AssetKey<?> getAssetKey() {
return assetKey;
}
public void setAssetKey(AssetKey<?> assetKey) {
this.assetKey = assetKey;
}
@Override
public DataType getDataType() {
return DataType.Buffer;
}
@Override
public float getDuration() {
return 0; // TODO: ???
}
@Override
public void resetObject() {
this.id = -1;
setUpdateNeeded();
}
@Override
public void deleteObject(Object rendererObject) {
((AudioRenderer)rendererObject).deleteAudioData(this);
}
public float getCurrentVolume() {
return currentVolume;
}
public void setCurrentVolume(float currentVolume) {
this.currentVolume = currentVolume;
}
@Override
public NativeObject createDestructableClone() {
return new AndroidAudioData(id);
}
@Override
public long getUniqueId() {
return ((long)OBJTYPE_AUDIOBUFFER << 32) | ((long)id);
}
}

@ -0,0 +1,24 @@
package com.jme3.audio.android;
import com.jme3.audio.AudioRenderer;
/**
* Android specific AudioRenderer interface that supports pausing and resuming
* audio files when the app is minimized or placed in the background
*
* @author iwgeric
*/
public interface AndroidAudioRenderer extends AudioRenderer {
/**
* Pauses all Playing audio. To be used when the app is placed in the
* background.
*/
public void pauseAll();
/**
* Resumes all Paused audio. To be used when the app is brought back to
* the foreground.
*/
public void resumeAll();
}

@ -0,0 +1,20 @@
package com.jme3.audio.plugins;
import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetLoader;
import com.jme3.audio.android.AndroidAudioData;
import java.io.IOException;
/**
* <code>AndroidAudioLoader</code> will create an
* {@link AndroidAudioData} object with the specified asset key.
*/
public class AndroidAudioLoader implements AssetLoader {
@Override
public Object load(AssetInfo assetInfo) throws IOException {
AndroidAudioData result = new AndroidAudioData();
result.setAssetKey(assetInfo.getKey());
return result;
}
}

@ -35,6 +35,7 @@ import com.jme3.asset.AssetLoader;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.asset.TextureKey;
import com.jme3.asset.plugins.ClasspathLocator;
import com.jme3.audio.plugins.WAVLoader;
import com.jme3.texture.Texture;
import java.io.InputStream;
import java.net.URL;
@ -87,8 +88,10 @@ public class IosAssetManager extends DesktopAssetManager {
registerLoader(com.jme3.shader.plugins.GLSLLoader.class, "vert", "frag", "glsl", "glsllib");
registerLoader(com.jme3.export.binary.BinaryImporter.class, "j3o");
registerLoader(com.jme3.font.plugins.BitmapFontLoader.class, "fnt");
registerLoader(WAVLoader.class, "wav");
// Less common loaders (especially on Android)
// Less common loaders (especially on iOS)
registerLoaderSafe("com.jme3.audio.plugins.OGGLoader", "ogg");
registerLoaderSafe("com.jme3.texture.plugins.DDSLoader", "dds");
registerLoaderSafe("com.jme3.texture.plugins.PFMLoader", "pfm");
registerLoaderSafe("com.jme3.texture.plugins.HDRLoader", "hdr");

@ -33,6 +33,7 @@ package com.jme3.system.ios;
import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioRenderer;
import com.jme3.audio.android.AndroidOpenALSoftAudioRenderer;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeContext;
import com.jme3.system.JmeSystemDelegate;
@ -97,7 +98,7 @@ public class JmeIosSystem extends JmeSystemDelegate {
@Override
public AudioRenderer newAudioRenderer(AppSettings settings) {
throw new UnsupportedOperationException("Not supported yet.");
return new AndroidOpenALSoftAudioRenderer();
}
@Override

Loading…
Cancel
Save