Home | History | Annotate | Download | only in android
      1 package com.jme3.audio.android;
      2 
      3 import com.jme3.asset.AssetKey;
      4 import com.jme3.audio.AudioData;
      5 import com.jme3.audio.AudioRenderer;
      6 import com.jme3.util.NativeObject;
      7 
      8 public class AndroidAudioData extends AudioData {
      9 
     10     protected AssetKey<?> assetKey;
     11     protected float currentVolume = 0f;
     12 
     13     public AndroidAudioData(){
     14         super();
     15     }
     16 
     17     protected AndroidAudioData(int id){
     18         super(id);
     19     }
     20 
     21     public AssetKey<?> getAssetKey() {
     22         return assetKey;
     23     }
     24 
     25     public void setAssetKey(AssetKey<?> assetKey) {
     26         this.assetKey = assetKey;
     27     }
     28 
     29     @Override
     30     public DataType getDataType() {
     31         return DataType.Buffer;
     32     }
     33 
     34     @Override
     35     public float getDuration() {
     36         return 0; // TODO: ???
     37     }
     38 
     39     @Override
     40     public void resetObject() {
     41         this.id = -1;
     42         setUpdateNeeded();
     43     }
     44 
     45     @Override
     46     public void deleteObject(Object rendererObject) {
     47         ((AudioRenderer)rendererObject).deleteAudioData(this);
     48     }
     49 
     50     public float getCurrentVolume() {
     51         return currentVolume;
     52     }
     53 
     54     public void setCurrentVolume(float currentVolume) {
     55         this.currentVolume = currentVolume;
     56     }
     57 
     58     @Override
     59     public NativeObject createDestructableClone() {
     60         return new AndroidAudioData(id);
     61     }
     62 }
     63