Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class AudioComponent

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.AudioComponent
All Implemented Interfaces:
AudioSource
Direct Known Subclasses:
ByteAudioComponent

public abstract class AudioComponent
extends NodeComponent
implements AudioSource

Common representation of a component that contains source data to be used in audio.

Version:
$Revision: 1.7 $
Author:
Alan Hudson

Field Summary
protected  java.nio.ByteBuffer data
          Buffer to hold the data
protected  int format
          The format of the data.
protected  int frequency
          The frequency
protected  boolean loop
          Does the sample loop
protected  float pitch
          The pitch
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
lastParent, liveCount, parentList
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Fields inherited from interface org.j3d.aviatrix3d.AudioSource
FORMAT_MONO16, FORMAT_MONO8, FORMAT_SETERO8, FORMAT_STEREO16
 
Constructor Summary
AudioComponent()
          Constructs an Audio component with default values.
 
Method Summary
 void addUpdateListener(AudioUpdateListener l)
          Add a listener for audio change updates.
abstract  void clearLocalData()
          Clear local data stored in this node.
 int getBufferId(net.java.games.joal.AL al, int seq)
          Get a bufferId for a given seq and context.
 int getFormat()
          Get the format of this audio source.
 int getFrequency()
          Get the frequency of this sound source.
 boolean getLoop()
          Does the sample loop.
 float getPitch()
          The pitch to play the sound at.
 void removeUpdateListener(AudioUpdateListener l)
          Remove a listener for audio change updates.
protected  void sendAudioUpdate(int seq)
          Send off a audio update event.
protected  void sendParamUpdate()
          Send off a audio update event.
 void setLoop(boolean val)
          Change whether the audio component should loop or not
 void setPitch(float val)
          Set the pitch to play the sound at.
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected java.nio.ByteBuffer data
Buffer to hold the data


format

protected int format
The format of the data. Defined in AudioSource


frequency

protected int frequency
The frequency


pitch

protected float pitch
The pitch


loop

protected boolean loop
Does the sample loop

Constructor Detail

AudioComponent

public AudioComponent()
Constructs an Audio component with default values.

Method Detail

getFormat

public int getFormat()
Get the format of this audio source. Defintions are provided in AudioSource.

Specified by:
getFormat in interface AudioSource
Returns:
the format.

getFrequency

public int getFrequency()
Get the frequency of this sound source.

Specified by:
getFrequency in interface AudioSource
Returns:
the format

getLoop

public boolean getLoop()
Does the sample loop.

Specified by:
getLoop in interface AudioSource
Returns:
TRUE if it loops.

getPitch

public float getPitch()
The pitch to play the sound at.

Specified by:
getPitch in interface AudioSource
Returns:
the pitch, (0 to 2)

setLoop

public void setLoop(boolean val)
Change whether the audio component should loop or not

Parameters:
val - true if the source should loop
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data callback method

setPitch

public void setPitch(float val)
Set the pitch to play the sound at. This is a multiplier of the base time that the sound would normally play in. A value of 0.5 says the sound takes twice as long to play (and thus drops everything by an octave).

Parameters:
val - The pitch multiplier to now use (0 to 2)
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data callback method

getBufferId

public int getBufferId(net.java.games.joal.AL al,
                       int seq)
Get a bufferId for a given seq and context.

Specified by:
getBufferId in interface AudioSource
Parameters:
seq - The sequence number
Returns:
The bufferId.

addUpdateListener

public void addUpdateListener(AudioUpdateListener l)
Add a listener for audio change updates.

Parameters:
l - The listener instance to add

removeUpdateListener

public void removeUpdateListener(AudioUpdateListener l)
Remove a listener for audio change updates.

Parameters:
l - The listener instance to add

clearLocalData

public abstract void clearLocalData()
Clear local data stored in this node. Only data needed for OpenGL calls will be retained;


sendAudioUpdate

protected void sendAudioUpdate(int seq)
Send off a audio update event.

Parameters:
seq - The sample seq. Seq 0 means complete file. Streamed sources start at 1

sendParamUpdate

protected void sendParamUpdate()
Send off a audio update event.


Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org