aboutsummaryrefslogtreecommitdiff
path: root/engine/src/android/com/jme3/audio/android/AndroidAudioData.java
blob: 37f41a8883c2f73fa34637ba498310a03dc253a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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);
    }
}