# Class AudioEngine

java.lang.Object
com.sun.j3d.audioengines.AudioEngine

All Implemented Interfaces:
  `AudioDevice`

Direct Known Subclasses:
  `AudioEngine3D`

public abstract class AudioEngine extends Object implements AudioDevice
The AudioEngine Class defines an audio output device that generates sound 'image' from scene graph. An AudioEngine object encapsulates the AudioDevice's basic information.

NOTE: AudioEngine developers should not subclass this class directly. Subclass AudioEngine3DL2 instead.

## Field Summary

### Fields inherited from interface AudioDevice

`HEADPHONES, MONO_SPEAKER, STEREO_SPEAKERS`

## Constructor Summary

Constructors
Constructor
Description
`AudioEngine(PhysicalEnvironment physicalEnvironment)`
Construct a new AudioEngine with the specified P.E.

## Method Summary

Modifier and Type
Method
Description
`abstract boolean`
`close()`
Code to close the device
`float`
`getAngleOffsetToSpeaker()`
Get Angle Offset To Speaker returns value set as angle between vector to speaker and Z head axis
`int`
`getAudioPlaybackType()`
Get Type of Audio Playback Output Device returns audio playback type to which sound is currently output
`float`
`getCenterEarToSpeaker()`
Get Distance from Ear to Speaker returns value set as distance from listener's ear to speaker
`int`
`getChannelsAvailable()`
Query number of channels currently available for use by the returns number of sound channels currently available (number not being used by active sounds.
`int`
`getChannelsUsedForSound(Sound sound)`
Deprecated.
This method is now part of the Sound class
`int`
`getTotalChannels()`
Query total number of channels available for sound rendering for this audio device.
`abstract boolean`
`initialize()`
Code to initialize the device
`void`
`setAngleOffsetToSpeaker(float angle)`
Set Angle Offset To Speaker
`void`
`setAudioPlaybackType(int type)`
Set Type of Audio Playback physical transducer(s) sound is output to.
`void`
`setCenterEarToSpeaker(float distance)`
Set Distance from the Center Ear to a Speaker

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AudioEngine

public AudioEngine(PhysicalEnvironment physicalEnvironment)
Construct a new AudioEngine with the specified P.E.

Parameters:
  `physicalEnvironment` - the physical environment object where we want access to this device.

## Method Details

### initialize

public abstract boolean initialize()
Code to initialize the device

Specified by:
  `initialize` in interface `AudioDevice`
Returns:
  flag: true is initialized sucessfully, false if error

### close

public abstract boolean close()
Code to close the device

Specified by:
  `close` in interface `AudioDevice`
Returns:
  flag: true is closed sucessfully, false if error

### setAudioPlaybackType

public void setAudioPlaybackType(int type)
Set Type of Audio Playback physical transducer(s) sound is output to. Valid types are HEADPHONE, MONO_SPEAKER, STEREO_SPEAKERS

Specified by:
  `setAudioPlaybackType` in interface `AudioDevice`
Parameters:
  `type` - of audio output device

### getAudioPlaybackType

public int getAudioPlaybackType()
Get Type of Audio Playback Output Device returns audio playback type to which sound is currently output

Specified by:
  `getAudioPlaybackType` in interface `AudioDevice`
Returns:
  audio playback type

### setCenterEarToSpeaker

public void setCenterEarToSpeaker(float distance)
Set Distance from the Center Ear to a Speaker

Specified by:
  `setCenterEarToSpeaker` in interface `AudioDevice`
Parameters:
  `distance` - from the center ear and to the speaker

### getCenterEarToSpeaker

public float getCenterEarToSpeaker()
Get Distance from Ear to Speaker returns value set as distance from listener's ear to speaker

Specified by:
  `getCenterEarToSpeaker` in interface `AudioDevice`
Returns:
  distance from interaural midpoint between the ears to closest speaker

### setAngleOffsetToSpeaker

public void setAngleOffsetToSpeaker(float angle)
Set Angle Offset To Speaker

Specified by:
  `setAngleOffsetToSpeaker` in interface `AudioDevice`
Parameters:
  `angle` - in radian between head coordinate Z axis and vector to speaker

### getAngleOffsetToSpeaker

public float getAngleOffsetToSpeaker()
Get Angle Offset To Speaker returns value set as angle between vector to speaker and Z head axis

Specified by:
  `getAngleOffsetToSpeaker` in interface `AudioDevice`
Returns:
  angle in radians from head Z axis and vector from center ear to speaker

### getTotalChannels

public int getTotalChannels()
Query total number of channels available for sound rendering for this audio device. returns number of maximum sound channels you can run with this library/device-driver.

Specified by:
  `getTotalChannels` in interface `AudioDevice`
Returns:
  total number of channels that can be used for this audio device

### getChannelsAvailable

public int getChannelsAvailable()
Query number of channels currently available for use by the returns number of sound channels currently available (number not being used by active sounds.

Specified by:
  `getChannelsAvailable` in interface `AudioDevice`
Returns:
  total number of channels current available

### getChannelsUsedForSound

public int getChannelsUsedForSound(Sound sound)
Deprecated.
This method is now part of the Sound class
Query number of channels that would be used to render a particular sound node.

Specified by:
  `getChannelsUsedForSound` in interface `AudioDevice`
Parameters:
  `sound` - refenence to sound node that query to be performed on returns number of sound channels used by a specific Sound node
Returns:
  number of channels a particular Sound node is using or would used if enabled and activated (rendered).