quentinc.audio
Class Channel

java.lang.Object
  extended by quentinc.audio.Channel
Direct Known Subclasses:
ChannelGroup

public abstract class Channel
extends java.lang.Object

A channel is an handle to a currently playing sound. It allow you to change various parameters along the sound is playing : volume, panning, pitch...


Method Summary
 boolean addChannelListener(ChannelListener l)
          Attach a channel listener to this channel
 Channel addDSP(DSP dsp)
          Attach a DSP to this channel.
 void close()
          Close the channel and associated resources
 Vector get3DPosition()
          Get the position of the sound in 3D world space
 float getDuration()
          Get the total duration of the sound expressed in seconds. -1 signifizes that it is not known.
 int getDurationInFrames()
          Get the total duration of the sound expressed in frames. -1 signifize that it is not known.
 float getPan()
          Get the panning of the sound, from -1 (left) to 1 (right). 0 is center.
 ChannelGroup getParentChannel()
          Get the parent channel, the channel who own this one.
 float getPitch()
          Get the pitch of the sound. 1 is normal pitch, 2 is twice faster and twice higher as normal.
 float getPosition()
          Get the current playback position expressed in seconds. -1 signifizes that it is not known.
 int getPositionInFrames()
          Get the current playback position expressed in frames. -1 signifizes that it is not known.
 float getReferenceDistance()
          Get the reference distance
 float getRemainingDuration()
          Get the remaining duration til the sound finish playing, expressed in seconds.
 int getRemainingDurationInFrames()
          Get the remaining duration til the sound finish playing, expressed in frames.
 float getVolume()
          Get the volume of the sound, between 0 (silence) to 1 (maximum)
 float getVolumeInDB()
          Get the volume in decibels, 0dB is maximum.
 boolean isActive()
          Tell either the channel is active, in other words if there is currently a sound playing on it.
 boolean isLoop()
          Tell either the sound is looping or not.
 boolean isPaused()
          Tell either the channel is paused or not.
 boolean isVirtual()
          Tell either the channel is virtual or not.
 boolean removeChannelListener(ChannelListener l)
          Detach a channel listener from this channel.
 Channel removeDSP(DSP dsp)
          Detach a DSP from this channel.
 Channel set3DPosition(Vector v)
          Set the 3D position of the sound in world space
 Channel setLoop(boolean b)
          Set the looping state of the sound.
 Channel setPan(float f)
          Set the panning of the sound, from -1 (left) to 1 (right). 0 is center.
 Channel setPaused(boolean b)
          Set the paused state of the channel.
 Channel setPitch(float f)
          Set the pitch of the sound. 1 is normal pitch, 2 is twice faster and twice higher as normal.
 Channel setPosition(float f)
          Set the playback position expressed in seconds.
 Channel setPositionInFrames(int n)
          Set the playback position expressed in frames.
 Channel setReferenceDistance(float f)
          Set the reference distance.
 Channel setRelative3DPosition(Vector v)
          Set the 3D position of the sound, relatively to the listener.
 Channel setVolume(float f)
          Set the volume of the sound, from 0 (silence) to 1 (maximum)
 Channel setVolumeInDB(float db)
          Set the volume in decibels. 0dB is maximum.
 void stop()
          Stop the sound being played by the channel.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getVolume

public float getVolume()
Get the volume of the sound, between 0 (silence) to 1 (maximum)


getVolumeInDB

public float getVolumeInDB()
Get the volume in decibels, 0dB is maximum.


getPan

public float getPan()
Get the panning of the sound, from -1 (left) to 1 (right). 0 is center.


getPitch

public float getPitch()
Get the pitch of the sound. 1 is normal pitch, 2 is twice faster and twice higher as normal.


setVolume

public Channel setVolume(float f)
Set the volume of the sound, from 0 (silence) to 1 (maximum)


setVolumeInDB

public Channel setVolumeInDB(float db)
Set the volume in decibels. 0dB is maximum.


setPan

public Channel setPan(float f)
Set the panning of the sound, from -1 (left) to 1 (right). 0 is center.


setPitch

public Channel setPitch(float f)
Set the pitch of the sound. 1 is normal pitch, 2 is twice faster and twice higher as normal.


isLoop

public boolean isLoop()
Tell either the sound is looping or not.


setLoop

public Channel setLoop(boolean b)
Set the looping state of the sound.


isPaused

public boolean isPaused()
Tell either the channel is paused or not.


setPaused

public Channel setPaused(boolean b)
Set the paused state of the channel.


isVirtual

public boolean isVirtual()
Tell either the channel is virtual or not. A virtual channel is a channel whose sound is too low to be perceved by the listener in the 3D space. The sound of a virtual channel is partially calculated, but not mixed and not affected by DSPs, so that some CPU time is saved.


getParentChannel

public ChannelGroup getParentChannel()
Get the parent channel, the channel who own this one.


getPositionInFrames

public int getPositionInFrames()
Get the current playback position expressed in frames. -1 signifizes that it is not known.


getPosition

public float getPosition()
Get the current playback position expressed in seconds. -1 signifizes that it is not known.


setPositionInFrames

public Channel setPositionInFrames(int n)
Set the playback position expressed in frames.


setPosition

public Channel setPosition(float f)
Set the playback position expressed in seconds.


getDuration

public float getDuration()
Get the total duration of the sound expressed in seconds. -1 signifizes that it is not known.


getDurationInFrames

public int getDurationInFrames()
Get the total duration of the sound expressed in frames. -1 signifize that it is not known.


getRemainingDuration

public float getRemainingDuration()
Get the remaining duration til the sound finish playing, expressed in seconds.


getRemainingDurationInFrames

public int getRemainingDurationInFrames()
Get the remaining duration til the sound finish playing, expressed in frames.


isActive

public boolean isActive()
Tell either the channel is active, in other words if there is currently a sound playing on it.


addDSP

public Channel addDSP(DSP dsp)
Attach a DSP to this channel.


removeDSP

public Channel removeDSP(DSP dsp)
Detach a DSP from this channel.


get3DPosition

public Vector get3DPosition()
Get the position of the sound in 3D world space


set3DPosition

public Channel set3DPosition(Vector v)
Set the 3D position of the sound in world space


setRelative3DPosition

public Channel setRelative3DPosition(Vector v)
Set the 3D position of the sound, relatively to the listener.


getReferenceDistance

public float getReferenceDistance()
Get the reference distance


setReferenceDistance

public Channel setReferenceDistance(float f)
Set the reference distance. The reference distance is the distance under which the sound's volume is halfed.


addChannelListener

public boolean addChannelListener(ChannelListener l)
Attach a channel listener to this channel


removeChannelListener

public boolean removeChannelListener(ChannelListener l)
Detach a channel listener from this channel.


stop

public void stop()
Stop the sound being played by the channel. Stopping a channel implie closing it as well.


close

public void close()
Close the channel and associated resources