as.clynx.audio.rep
Class AudioFile

java.lang.Object
  extended by as.clynx.audio.rep.AudioFile

public class AudioFile
extends java.lang.Object

The class AudioFile.java represents a loaded audioinstance.

Version:
cLynx v.1.2, JDK 6.0: 12.10.2007
Author:
Andreas Senfter - andreas@senfters.com

Constructor Summary
AudioFile(java.io.File file, Position2D position, IAudioFileCollection parent)
          Constructor
 
Method Summary
 float getDistance()
          returns the distance to the center. if position was not defined. distance is 0.
 javax.sound.sampled.AudioFormat getFormat()
          returns the format of the decoded audiofilestream
 int getMaxSampleValue()
          returns the upper bound of the analyser
 int getMinSampleValue()
          returns the lower bound of the analyser
 java.awt.Point getPosition()
          returns the position of the audiofile. if position was not defined return center.
 javax.sound.sampled.AudioInputStream getStream()
          returns the decoded audiofilestream
 java.io.File getUrl()
          returns the url of the file
 boolean isActive()
          returns true when the playback of this track takes place.
 boolean isFinished()
          returns true when the stream is closed.
 int louder(int sample, float d)
          normalizes and enlouds the sample
 int normalize(int sample)
          normalizes the passed sample
 void resetStream()
          resets the decoded audiofilestream
 void setActive(boolean b)
          sets the active flag.
 void setFinished(boolean b)
          sets the finished flag.
 void setNormalizer(INormalizer normalizer)
          set the normalizer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioFile

public AudioFile(java.io.File file,
                 Position2D position,
                 IAudioFileCollection parent)
          throws javax.sound.sampled.UnsupportedAudioFileException,
                 java.io.IOException
Constructor

Parameters:
file -
position -
parent -
Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
Method Detail

getStream

public javax.sound.sampled.AudioInputStream getStream()
returns the decoded audiofilestream

Returns:
the decoded audiofilestream
Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

resetStream

public void resetStream()
resets the decoded audiofilestream

Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

getFormat

public javax.sound.sampled.AudioFormat getFormat()
returns the format of the decoded audiofilestream

Returns:
the format of the decoded audiofilestream
Throws:
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException

normalize

public int normalize(int sample)
normalizes the passed sample

Parameters:
sample -
Returns:
the normalized sample

louder

public int louder(int sample,
                  float d)
normalizes and enlouds the sample


setNormalizer

public void setNormalizer(INormalizer normalizer)
set the normalizer

Parameters:
normalizer -

getUrl

public java.io.File getUrl()
returns the url of the file

Returns:
the url of the file

getMaxSampleValue

public int getMaxSampleValue()
returns the upper bound of the analyser

Returns:
the upper bound of the analyser

getMinSampleValue

public int getMinSampleValue()
returns the lower bound of the analyser

Returns:
the lower bound of the analyser

getDistance

public float getDistance()
returns the distance to the center. if position was not defined. distance is 0.

Returns:
the distance to the center. if position was not defined. distance is 0.

getPosition

public java.awt.Point getPosition()
returns the position of the audiofile. if position was not defined return center.

Returns:
the position of the audiofile. if position was not defined return center.

isFinished

public boolean isFinished()
returns true when the stream is closed.

Returns:
true when the stream is closed.

setFinished

public void setFinished(boolean b)
sets the finished flag.

Parameters:
b -

isActive

public boolean isActive()
returns true when the playback of this track takes place.

Returns:
true when the playback of this track takes place.

setActive

public void setActive(boolean b)
sets the active flag.

Parameters:
b -