|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groovemanager.sampled.AudioManager
This class can act as a central unit for using AudioRessources of different kinds. It provides some static methods as well as a default implementation, but it can also be subclassed. An AudioManager gets its settings for in and out device (Mixer) as well as the buffer size to use from a ConfigManager to which it is connected
| Field Summary | |
|---|---|
protected ConfigManager |
configManager
The ConfigManager used by this instance. |
static AudioManager |
DEFAULT_AUDIO_MANAGER
The default AudioManager instance. |
(package private) java.util.ArrayList |
fileFormatProviders
List of known AudioFileFormatProviders that will be queried for an AudioFileFormat when requested |
protected javax.sound.sampled.Mixer |
inMixer
The input Mixer selected by the user or by the application |
protected javax.sound.sampled.Mixer |
outMixer
The input Mixer selected by the user or by the application |
(package private) java.util.ArrayList |
outputStreamProviders
List of known AudioFileOutputStreamProviders that will be queried for an AudioFileOutputStream when requested |
| Constructor Summary | |
|---|---|
protected |
AudioManager()
Constructs a new Audiomanager using the default ConfigManager |
|
AudioManager(ConfigManager configManager)
Constructs a new Audiomanager using the given ConfigManager |
| Method Summary | |
|---|---|
boolean |
canWrite(javax.sound.sampled.AudioFileFormat format)
Find out if a provider exists that can write files in the given AudioFileFormat |
private static AudioManager |
createDefault()
Create the default AudioManager instance |
javax.sound.sampled.AudioFileFormat |
getAudioFileFormat(java.io.File f,
java.lang.String[] requiredProperties,
java.lang.String[] desiredProperties)
Get the AudioFileFormat out of a file. |
AudioFileOutputStream |
getAudioFileOutputStream(java.io.File f,
javax.sound.sampled.AudioFormat format,
javax.sound.sampled.AudioFileFormat.Type type,
java.util.Map properties,
java.lang.String[] requiredProperties,
java.lang.String[] desiredProperties)
Get an AudioFileOutputStream for writing the desired Audio data to the given file. |
static AudioManager |
getDefault()
Get the default Audio Manager. |
long |
getFrameLength(java.io.File source)
Get the frame length in sample frames out of an audio file. this method is intended as a help, if the AudioInputStream provided for this file has AudioSystem.NOT_SPECIFIED length. |
javax.sound.sampled.Mixer |
getInMixer()
Get the Input Mixer which is selected in the "audio_in" property of the given ConfigManager |
static javax.sound.sampled.Mixer.Info[] |
getInputMixers()
Get infos about all installed Mixers that are capable of recording Audio data via a TargetDataLine |
static javax.sound.sampled.AudioInputStream |
getMonoInputStream(javax.sound.sampled.AudioInputStream in)
Get a mono AudioInputStream out of the specified one´s left channel. |
javax.sound.sampled.Mixer |
getOutMixer()
Get the Output Mixer which is selected in the "audio_out" property of the given ConfigManager |
static javax.sound.sampled.Mixer.Info[] |
getOutputMixers()
Get infos about all installed Mixers that are capable of playing back Audio data via a SourceDataLine |
static java.util.Map |
getProperties(java.lang.Object o)
Helper method for getting the properties out of an AudioFormat or AudioFileFormat object, if we cannot access it directly because of compatibility to JDK 1.4 |
java.util.List |
getProviders(java.lang.Class c)
Get the installed providers for the given type of service |
AudioFileFormatProvider[] |
getRegisteredFileFormatProviders()
Get all AudioFileFormatProviders currently registered to this AudioManager |
AudioFileOutputStreamProvider[] |
getRegisteredOutputStreamProviders()
Get all AudioFileOutputStreamProviders currently registered to this AudioManager |
static int |
getRelation(javax.sound.sampled.AudioFormat source,
javax.sound.sampled.AudioFormat target)
Get a numeric value for the equalness of two AudioFormat objects. |
static javax.sound.sampled.AudioInputStream |
getStereoInputStream(javax.sound.sampled.AudioInputStream in)
Get a stereo AudioInputStream out of the specified one. |
void |
propertyChange(org.eclipse.jface.util.PropertyChangeEvent event)
|
void |
registerAudioFileFormatProvider(AudioFileFormatProvider provider)
Add an AudioFileFormatProvider to the list of known AudioFileFormatProviders |
void |
registerAudioFileOutputStreamProvider(AudioFileOutputStreamProvider provider)
Add an AudioFileOutputStreamProvider to the list of known AudioOutputStreamProviders |
void |
unregisterAudioFileFormatProvider(AudioFileFormatProvider provider)
Remove an AudioFileFormatProvider from the list of known AudioFileFormatProviders |
void |
unregisterAudioFileOutputStreamProvider(AudioFileOutputStreamProvider provider)
Remove an AudioFileOutputStreamProvider from the list of known AudioOutputStreamProviders |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ConfigManager configManager
public static final AudioManager DEFAULT_AUDIO_MANAGER
java.util.ArrayList fileFormatProviders
protected javax.sound.sampled.Mixer inMixer
protected javax.sound.sampled.Mixer outMixer
java.util.ArrayList outputStreamProviders
| Constructor Detail |
|---|
protected AudioManager()
public AudioManager(ConfigManager configManager)
configManager - The ConfigManager to be used.| Method Detail |
|---|
public boolean canWrite(javax.sound.sampled.AudioFileFormat format)
format - The deired AudioFileFormat in which the provider should be
able to write files
private static AudioManager createDefault()
public javax.sound.sampled.AudioFileFormat getAudioFileFormat(java.io.File f,
java.lang.String[] requiredProperties,
java.lang.String[] desiredProperties)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
AudioSystem.getAudioFileFormat() will be used.
Subclasses may provide a different behaviour for getting the
AudioFileFormat, but it should be documented.
f - The Audio file to get the format fromrequiredProperties - Array of property keys that the provider must
understand. May also be null to indicate that no properties
are required.desiredProperties - Array of property keys that would be nice to
have, but are not absolutely necessary. May also be null to
indicate that no optional properties are desired.
java.io.IOException - If an I/O Error occurs during file reading
javax.sound.sampled.UnsupportedAudioFileException - If either the file format of the
file can not be determined or no provider knowing all required properties
could be found.
public AudioFileOutputStream getAudioFileOutputStream(java.io.File f,
javax.sound.sampled.AudioFormat format,
javax.sound.sampled.AudioFileFormat.Type type,
java.util.Map properties,
java.lang.String[] requiredProperties,
java.lang.String[] desiredProperties)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
f - The file to write the audio data toformat - The format in which the audio data should be writtentype - The type of the audio fileproperties - Map of properties of the source datarequiredProperties - Array of property keys that must be supported
for writingdesiredProperties - Array of property keys that are nice to have but
don´t need to be supported.
java.io.IOException - If an I/O Error occurs during file reading
javax.sound.sampled.UnsupportedAudioFileException - If either the file format of the
file can not be determined or no provider knowing all required properties
could be found.
javax.sound.sampled.UnsupportedAudioFileException - If no provider can be found
supporting the file type, the format and the required properties
java.io.IOException - If an I/O Error occurs during OutputStream creationpublic static AudioManager getDefault()
DEFAULT_AUDIO_MANAGERpublic long getFrameLength(java.io.File source)
source - The audio file in question
public javax.sound.sampled.Mixer getInMixer()
public static javax.sound.sampled.Mixer.Info[] getInputMixers()
public static javax.sound.sampled.AudioInputStream getMonoInputStream(javax.sound.sampled.AudioInputStream in)
in - The AudioInputStream to convert to mono
java.lang.IllegalArgumentException - If the given AudioInputStream has more
than 2 channelspublic javax.sound.sampled.Mixer getOutMixer()
public static javax.sound.sampled.Mixer.Info[] getOutputMixers()
public static java.util.Map getProperties(java.lang.Object o)
o - The AudioFormat or AudioFileFormat object to query for its
properties.
properties() method or nullpublic java.util.List getProviders(java.lang.Class c)
c - The class representing the service
public AudioFileFormatProvider[] getRegisteredFileFormatProviders()
public AudioFileOutputStreamProvider[] getRegisteredOutputStreamProviders()
public static int getRelation(javax.sound.sampled.AudioFormat source,
javax.sound.sampled.AudioFormat target)
source - The source Formattarget - The target Format
public static javax.sound.sampled.AudioInputStream getStereoInputStream(javax.sound.sampled.AudioInputStream in)
in - The AudioInputStream to convert to stereo
java.lang.IllegalArgumentException - If the given AudioInputStream has more
than 2 channelspublic void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event)
propertyChange in interface org.eclipse.jface.util.IPropertyChangeListenerIPropertyChangeListener.propertyChange(org.eclipse.jface.util.PropertyChangeEvent)public void registerAudioFileFormatProvider(AudioFileFormatProvider provider)
provider - The AudioFileFormatProvider to addpublic void registerAudioFileOutputStreamProvider(AudioFileOutputStreamProvider provider)
provider - The AudioFileOutputStreamProvider to addpublic void unregisterAudioFileFormatProvider(AudioFileFormatProvider provider)
provider - The AudioFileFormatProvider to removepublic void unregisterAudioFileOutputStreamProvider(AudioFileOutputStreamProvider provider)
provider - The AudioFileOutputStreamProvider to remove
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||