* AssetManager now returns AudioData instead of AudioNode (similar to new Material() type behavior)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9321 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent 60e0e46344
commit 7ec115a768
  1. 6
      engine/src/core/com/jme3/asset/AssetManager.java
  2. 8
      engine/src/core/com/jme3/asset/DesktopAssetManager.java
  3. 4
      engine/src/core/com/jme3/audio/AudioKey.java
  4. 4
      engine/src/core/com/jme3/audio/AudioNode.java
  5. 19
      engine/src/core/com/jme3/audio/AudioProcessor.java
  6. 4
      engine/src/test/jme3test/asset/TestAbsoluteLocators.java

@ -34,8 +34,8 @@ package com.jme3.asset;
import com.jme3.asset.plugins.ClasspathLocator;
import com.jme3.asset.plugins.FileLocator;
import com.jme3.audio.AudioData;
import com.jme3.audio.AudioKey;
import com.jme3.audio.AudioNode;
import com.jme3.font.BitmapFont;
import com.jme3.material.Material;
import com.jme3.scene.Spatial;
@ -288,7 +288,7 @@ public interface AssetManager {
*
* @see AssetManager#loadAsset(com.jme3.asset.AssetKey)
*/
public AudioNode loadAudio(AudioKey key);
public AudioData loadAudio(AudioKey key);
/**
* Load audio file, supported types are WAV or OGG.
@ -298,7 +298,7 @@ public interface AssetManager {
*
* @see AssetManager#loadAsset(com.jme3.asset.AssetKey)
*/
public AudioNode loadAudio(String name);
public AudioData loadAudio(String name);
/**
* Loads a 3D model with a ModelKey.

@ -34,8 +34,8 @@ package com.jme3.asset;
import com.jme3.asset.cache.AssetCache;
import com.jme3.asset.cache.SimpleAssetCache;
import com.jme3.audio.AudioData;
import com.jme3.audio.AudioKey;
import com.jme3.audio.AudioNode;
import com.jme3.font.BitmapFont;
import com.jme3.material.Material;
import com.jme3.scene.Spatial;
@ -353,11 +353,11 @@ public class DesktopAssetManager implements AssetManager {
return loadTexture(new TextureKey(name, false));
}
public AudioNode loadAudio(AudioKey key){
return (AudioNode) loadAsset(key);
public AudioData loadAudio(AudioKey key){
return (AudioData) loadAsset(key);
}
public AudioNode loadAudio(String name){
public AudioData loadAudio(String name){
return loadAudio(new AudioKey(name, false));
}

@ -47,7 +47,7 @@ import java.io.IOException;
*
* @author Kirill Vainer
*/
public class AudioKey extends AssetKey<AudioNode> {
public class AudioKey extends AssetKey<AudioData> {
private boolean stream;
private boolean streamCache;
@ -159,7 +159,7 @@ public class AudioKey extends AssetKey<AudioNode> {
@Override
public Class<? extends AssetProcessor> getProcessorType() {
return AudioProcessor.class;
return null;
}
@Override

@ -136,7 +136,7 @@ public class AudioNode extends Node {
*/
public AudioNode(AssetManager assetManager, String name, boolean stream, boolean streamCache) {
this.audioKey = new AudioKey(name, stream, streamCache);
this.data = (AudioData) assetManager.loadAsset(audioKey).data;
this.data = (AudioData) assetManager.loadAsset(audioKey);
}
/**
@ -729,7 +729,7 @@ public class AudioNode extends Node {
if (audioKey != null) {
try {
data = im.getAssetManager().loadAsset(audioKey).data;
data = im.getAssetManager().loadAsset(audioKey);
} catch (AssetNotFoundException ex){
Logger.getLogger(AudioNode.class.getName()).log(Level.FINE, "Cannot locate {0} for audio node {1}", new Object[]{audioKey, key});
data = PlaceholderAssets.getPlaceholderAudio();

@ -1,19 +0,0 @@
package com.jme3.audio;
import com.jme3.asset.AssetKey;
import com.jme3.asset.AssetProcessor;
public class AudioProcessor implements AssetProcessor{
public Object postProcess(AssetKey key, Object obj) {
AudioKey audioKey = (AudioKey) key;
AudioData audioData = (AudioData) obj;
return new AudioNode(audioData, audioKey);
}
public Object createClone(Object obj) {
AudioNode node = (AudioNode) obj;
return node.clone();
}
}

@ -35,7 +35,7 @@ package jme3test.asset;
import com.jme3.asset.AssetManager;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.asset.plugins.ClasspathLocator;
import com.jme3.audio.AudioNode;
import com.jme3.audio.AudioData;
import com.jme3.audio.plugins.WAVLoader;
import com.jme3.texture.Texture;
import com.jme3.texture.plugins.AWTLoader;
@ -51,7 +51,7 @@ public class TestAbsoluteLocators {
am.registerLocator("/", ClasspathLocator.class);
// find a sound
AudioNode audio = am.loadAudio("Sound/Effects/Gun.wav");
AudioData audio = am.loadAudio("Sound/Effects/Gun.wav");
// find a texture
Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.jpg");

Loading…
Cancel
Save