Officially switch to the new Android audio system

Now uses OpenAL Soft 1.16 by default with the Tremor-based OGG/Vorbis decoder.
All jME3 audio features now work on Android.
experimental
shadowislord 10 years ago
parent 915b0b8c61
commit 6cad69e067
  1. 19
      jme3-android/src/main/java/com/jme3/asset/AndroidAssetManager.java
  2. 2
      jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java

@ -34,10 +34,12 @@ package com.jme3.asset;
import com.jme3.asset.plugins.AndroidLocator; import com.jme3.asset.plugins.AndroidLocator;
import com.jme3.asset.plugins.ClasspathLocator; import com.jme3.asset.plugins.ClasspathLocator;
import com.jme3.audio.plugins.AndroidAudioLoader; import com.jme3.audio.plugins.AndroidAudioLoader;
import com.jme3.audio.plugins.NativeVorbisLoader;
import com.jme3.audio.plugins.WAVLoader; import com.jme3.audio.plugins.WAVLoader;
import com.jme3.system.AppSettings; import com.jme3.system.AppSettings;
import com.jme3.system.android.JmeAndroidSystem; import com.jme3.system.android.JmeAndroidSystem;
import com.jme3.texture.plugins.AndroidBufferImageLoader; import com.jme3.texture.plugins.AndroidBufferImageLoader;
import com.jme3.texture.plugins.AndroidNativeImageLoader;
import java.net.URL; import java.net.URL;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -51,16 +53,6 @@ public class AndroidAssetManager extends DesktopAssetManager {
private static final Logger logger = Logger.getLogger(AndroidAssetManager.class.getName()); private static final Logger logger = Logger.getLogger(AndroidAssetManager.class.getName());
public AndroidAssetManager() {
this(null);
}
@Deprecated
public AndroidAssetManager(boolean loadDefaults) {
//this(Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Android.cfg"));
this(null);
}
private void registerLoaderSafe(String loaderClass, String ... extensions) { private void registerLoaderSafe(String loaderClass, String ... extensions) {
try { try {
Class<? extends AssetLoader> loader = (Class<? extends AssetLoader>) Class.forName(loaderClass); Class<? extends AssetLoader> loader = (Class<? extends AssetLoader>) Class.forName(loaderClass);
@ -82,16 +74,13 @@ public class AndroidAssetManager extends DesktopAssetManager {
registerLocator("", AndroidLocator.class); registerLocator("", AndroidLocator.class);
registerLocator("", ClasspathLocator.class); registerLocator("", ClasspathLocator.class);
registerLoader(AndroidBufferImageLoader.class, "jpg", "bmp", "jpeg"); registerLoader(AndroidNativeImageLoader.class, "jpg", "jpeg", "bmp", "gif", "png");
registerLoader(AndroidBufferImageLoader.class, "gif", "png");
if (JmeAndroidSystem.getAudioRendererType().equals(AppSettings.ANDROID_MEDIAPLAYER)) { if (JmeAndroidSystem.getAudioRendererType().equals(AppSettings.ANDROID_MEDIAPLAYER)) {
registerLoader(AndroidAudioLoader.class, "ogg", "mp3", "wav"); registerLoader(AndroidAudioLoader.class, "ogg", "mp3", "wav");
} else if (JmeAndroidSystem.getAudioRendererType().equals(AppSettings.ANDROID_OPENAL_SOFT)) { } else if (JmeAndroidSystem.getAudioRendererType().equals(AppSettings.ANDROID_OPENAL_SOFT)) {
registerLoader(WAVLoader.class, "wav"); registerLoader(WAVLoader.class, "wav");
// TODO jogg is not in core, need to add some other way to get around compile errors, or not. registerLoader(NativeVorbisLoader.class, "ogg");
// registerLoader(com.jme3.audio.plugins.OGGLoader.class, "ogg");
registerLoaderSafe("com.jme3.audio.plugins.OGGLoader", "ogg");
} else { } else {
throw new IllegalStateException("No Audio Renderer Type defined!"); throw new IllegalStateException("No Audio Renderer Type defined!");
} }

@ -32,7 +32,7 @@ import java.util.logging.Level;
public class JmeAndroidSystem extends JmeSystemDelegate { public class JmeAndroidSystem extends JmeSystemDelegate {
private static Activity activity; private static Activity activity;
private static String audioRendererType = AppSettings.ANDROID_MEDIAPLAYER; private static String audioRendererType = AppSettings.ANDROID_OPENAL_SOFT;
static { static {
try { try {

Loading…
Cancel
Save