com.jme3.audio.android
Class AndroidAudioRenderer

java.lang.Object
  extended by com.jme3.audio.android.AndroidAudioRenderer
All Implemented Interfaces:
android.media.MediaPlayer.OnCompletionListener, android.media.SoundPool.OnLoadCompleteListener, AudioRenderer

public class AndroidAudioRenderer
extends java.lang.Object
implements AudioRenderer, android.media.SoundPool.OnLoadCompleteListener, android.media.MediaPlayer.OnCompletionListener

This class is the android implementation for AudioRenderer


Constructor Summary
AndroidAudioRenderer(android.app.Activity context)
           
 
Method Summary
 void cleanup()
          Cleanup/destroy the audio system.
 void deleteAudioData(AudioData ad)
           
 void deleteFilter(Filter filter)
           
 void initialize()
          Initializes the renderer.
 void onCompletion(android.media.MediaPlayer mp)
           
 void onLoadComplete(android.media.SoundPool soundPool, int sampleId, int status)
           
 void pauseAll()
          Pause the current playing sounds.
 void pauseSource(AudioNode src)
           
 void playSource(AudioNode src)
           
 void playSourceInstance(AudioNode src)
          Plays using the SoundPool of Android.
 void resumeAll()
          Resume all paused sounds.
 void setEnvironment(Environment env)
          Sets the environment, used for reverb effects.
 void setListener(Listener listener)
           
 void stopSource(AudioNode src)
           
 void update(float tpf)
          Update the audio system.
 void updateListenerParam(Listener listener, ListenerParam param)
           
 void updateSourceParam(AudioNode src, AudioParam param)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndroidAudioRenderer

public AndroidAudioRenderer(android.app.Activity context)
Method Detail

initialize

public void initialize()
Description copied from interface: AudioRenderer
Initializes the renderer. Should be the first method called before using the system.

Specified by:
initialize in interface AudioRenderer

updateSourceParam

public void updateSourceParam(AudioNode src,
                              AudioParam param)
Specified by:
updateSourceParam in interface AudioRenderer

updateListenerParam

public void updateListenerParam(Listener listener,
                                ListenerParam param)
Specified by:
updateListenerParam in interface AudioRenderer

update

public void update(float tpf)
Description copied from interface: AudioRenderer
Update the audio system. Must be called periodically.

Specified by:
update in interface AudioRenderer
Parameters:
tpf - Time per frame.

setListener

public void setListener(Listener listener)
Specified by:
setListener in interface AudioRenderer
Parameters:
listener - The listener camera, all 3D sounds will be oriented around the listener.

cleanup

public void cleanup()
Description copied from interface: AudioRenderer
Cleanup/destroy the audio system. Call this when app closes.

Specified by:
cleanup in interface AudioRenderer

onCompletion

public void onCompletion(android.media.MediaPlayer mp)
Specified by:
onCompletion in interface android.media.MediaPlayer.OnCompletionListener

playSourceInstance

public void playSourceInstance(AudioNode src)
Plays using the SoundPool of Android. Due to hard limitation of the SoundPool: After playing more instances of the sound you only have the channel of the last played instance. It is not possible to get information about the state of the soundpool of a specific streamid, so removing is not possilbe -> noone knows when sound finished.

Specified by:
playSourceInstance in interface AudioRenderer

onLoadComplete

public void onLoadComplete(android.media.SoundPool soundPool,
                           int sampleId,
                           int status)
Specified by:
onLoadComplete in interface android.media.SoundPool.OnLoadCompleteListener

playSource

public void playSource(AudioNode src)
Specified by:
playSource in interface AudioRenderer

pauseAll

public void pauseAll()
Pause the current playing sounds. Both from the SoundPool and the active MediaPlayers


resumeAll

public void resumeAll()
Resume all paused sounds.


pauseSource

public void pauseSource(AudioNode src)
Specified by:
pauseSource in interface AudioRenderer

stopSource

public void stopSource(AudioNode src)
Specified by:
stopSource in interface AudioRenderer

deleteAudioData

public void deleteAudioData(AudioData ad)
Specified by:
deleteAudioData in interface AudioRenderer

setEnvironment

public void setEnvironment(Environment env)
Description copied from interface: AudioRenderer
Sets the environment, used for reverb effects.

Specified by:
setEnvironment in interface AudioRenderer
Parameters:
env - The environment to set.
See Also:
AudioNode.setReverbEnabled(boolean)

deleteFilter

public void deleteFilter(Filter filter)
Specified by:
deleteFilter in interface AudioRenderer