Class JavaSoundMixer
java.lang.Object
com.sun.j3d.audioengines.AudioEngine
com.sun.j3d.audioengines.AudioEngine3D
com.sun.j3d.audioengines.AudioEngine3DL2
com.sun.j3d.audioengines.javasound.JavaSoundMixer
- All Implemented Interfaces:
AudioDevice,AudioDevice3D,AudioDevice3DL2
The JavaSoundMixer Class defines an audio output device that accesses
JavaSound functionality stream data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatprotected static final intprotected intprotected static final intprotected static final intprotected static final intFields inherited from class com.sun.j3d.audioengines.AudioEngine3D
attribs, currentView, samplesFields inherited from interface javax.media.j3d.AudioDevice
HEADPHONES, MONO_SPEAKER, STEREO_SPEAKERSFields inherited from interface javax.media.j3d.AudioDevice3D
BACKGROUND_SOUND, BUFFERED_AUDIO_DATA, CONE_SOUND, POINT_SOUND, STREAMING_AUDIO_DATA -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearSound(int index) Clears the fields associated with sample data for this sound.booleanclose()Code to close the device.intgetNumberOfChannelsUsed(int index) Get number of channels used by a particular sample on the audio device.intgetNumberOfChannelsUsed(int index, boolean muted) Overriden method from AudioEngine3D.longgetSampleDuration(int index) Get length of time a sample would play if allowed to play to completion.longgetStartTime(int index) Get time this sample begun playing on the audio device.intQuery total number of channels available for sound rendering for this audio device.booleanCode to initialize the device New interface to mixer/engine specific methodsvoidmuteSample(int index) Mute sample.voidpause()Pauses audio device engine without closing the device and associated threads.voidpauseSample(int index) Pause sample.intprepareSound(int soundType, MediaContainer soundData) Code to load sound data into a channel of device mixer.voidresume()Resumes audio device engine (if previously paused) without reinitializing * the device.voidsetDirection(int index, javax.vecmath.Vector3d direction) Set direction vector of sample.voidsetGain(float scaleFactor) Set overall gain control of all sounds playing on the audio device.voidsetLoop(int index, int count) Set number of times sample is looped.voidsetPosition(int index, javax.vecmath.Point3d position) Set location of sample.voidsetRateScaleFactor(int index, float rateScaleFactor) Set scale factor applied to sample playback rate for a particular sound associated with the audio device.voidsetReflectionCoefficient(float coefficient) Set reverberation surface reflection coefficient value for current aural attribute applied to all samples.voidsetReverbDelay(float reverbDelay) Set reverberation delay time for current aural attribute applied to all samples.voidsetReverbOrder(int reverbOrder) Set reverberation order for current aural attribute applied to all samples.voidsetVworldXfrm(int index, Transform3D trans) Save a reference to the local to virtual world coordinate space Overriden method from AudioEngine3D.intstartSample(int index) Start sample playing on audio deviceintstopSample(int index) Stop sample playing on audio devicevoidunmuteSample(int index) Unmute sample.voidunpauseSample(int index) Unpause sample.voidupdateSample(int index) Update sample.Methods inherited from class com.sun.j3d.audioengines.AudioEngine3DL2
setDecayFilter, setDecayTime, setDensity, setDiffusion, setObstructionFilter, setObstructionGain, setOcclusionFilter, setOcclusionGain, setReflectionDelay, setReverbCoefficientMethods inherited from class com.sun.j3d.audioengines.AudioEngine3D
getAuralParameters, getSample, getSampleList, getSampleListSize, getView, setAngularAttenuation, setDistanceFilter, setDistanceGain, setFrequencyScaleFactor, setRolloff, setSampleGain, setVelocityScaleFactor, setViewMethods inherited from class com.sun.j3d.audioengines.AudioEngine
getAngleOffsetToSpeaker, getAudioPlaybackType, getCenterEarToSpeaker, getChannelsAvailable, getChannelsUsedForSound, setAngleOffsetToSpeaker, setAudioPlaybackType, setCenterEarToSpeakerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.media.j3d.AudioDevice
getAngleOffsetToSpeaker, getAudioPlaybackType, getCenterEarToSpeaker, getChannelsAvailable, getChannelsUsedForSound, setAngleOffsetToSpeaker, setAudioPlaybackType, setCenterEarToSpeakerMethods inherited from interface javax.media.j3d.AudioDevice3D
setAngularAttenuation, setDistanceFilter, setDistanceGain, setFrequencyScaleFactor, setRolloff, setSampleGain, setVelocityScaleFactor, setView
-
Field Details
-
deviceGain
protected float deviceGain -
NOT_PAUSED
protected static final int NOT_PAUSED- See Also:
-
PAUSE_PENDING
protected static final int PAUSE_PENDING- See Also:
-
PAUSED
protected static final int PAUSED- See Also:
-
RESUME_PENDING
protected static final int RESUME_PENDING- See Also:
-
pause
protected int pause
-
-
Constructor Details
-
JavaSoundMixer
-
-
Method Details
-
getTotalChannels
public int getTotalChannels()Query total number of channels available for sound rendering for this audio device. Overridden method from AudioEngine.- Specified by:
getTotalChannelsin interfaceAudioDevice- Overrides:
getTotalChannelsin classAudioEngine- Returns:
- number of maximum voices play simultaneously on JavaSound Mixer.
-
initialize
public boolean initialize()Code to initialize the device New interface to mixer/engine specific methods- Specified by:
initializein interfaceAudioDevice- Specified by:
initializein classAudioEngine- Returns:
- flag: true is initialized sucessfully, false if error
-
close
public boolean close()Code to close the device. New interface to mixer/engine specific methods- Specified by:
closein interfaceAudioDevice- Specified by:
closein classAudioEngine- Returns:
- flag: true is closed sucessfully, false if error
-
prepareSound
Code to load sound data into a channel of device mixer. Load sound as one or mores sample into the Java Sound Mixer: a) as either a STREAM or CLIP based on whether cached is enabled b) positional and directional sounds use three samples per sound Overriden method from AudioEngine3D. Sound type determines if this is a Background, Point or Cone sound source and thus the JSXxxxSample object type Call JSXxxxxSample.loadSample() If no error Get the next free index in the samples list. Store a reference to JSXxxxSample object in samples list.- Specified by:
prepareSoundin interfaceAudioDevice3D- Overrides:
prepareSoundin classAudioEngine3D- Parameters:
soundType- denotes type of sound: Background, Point or ConesoundData- descrition of sound source data- Returns:
- index to the sample in samples list.
-
clearSound
public void clearSound(int index) Clears the fields associated with sample data for this sound. Overriden method from AudioEngine3D.- Specified by:
clearSoundin interfaceAudioDevice3D- Specified by:
clearSoundin classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample
-
setVworldXfrm
Save a reference to the local to virtual world coordinate space Overriden method from AudioEngine3D.- Specified by:
setVworldXfrmin interfaceAudioDevice3D- Overrides:
setVworldXfrmin classAudioEngine3D- Parameters:
index- device specific reference number to device driver sampletrans- is a reference to virtual world composite transform
-
setPosition
public void setPosition(int index, javax.vecmath.Point3d position) Description copied from class:AudioEngine3DSet location of sample.- Specified by:
setPositionin interfaceAudioDevice3D- Overrides:
setPositionin classAudioEngine3D- Parameters:
index- device specific reference number to device driver sampleposition- point location in virtual world coordinate of sample- See Also:
-
setDirection
public void setDirection(int index, javax.vecmath.Vector3d direction) Description copied from class:AudioEngine3DSet direction vector of sample.- Specified by:
setDirectionin interfaceAudioDevice3D- Overrides:
setDirectionin classAudioEngine3D- Parameters:
index- device specific reference number to device driver sampledirection- vector in virtual world coordinate.- See Also:
-
setReflectionCoefficient
public void setReflectionCoefficient(float coefficient) Description copied from class:AudioEngine3DSet reverberation surface reflection coefficient value for current aural attribute applied to all samples.- Specified by:
setReflectionCoefficientin interfaceAudioDevice3D- Overrides:
setReflectionCoefficientin classAudioEngine3D- Parameters:
coefficient- applied to amplitude of reverbation added at each iteration of reverb processing.- See Also:
-
setReverbDelay
public void setReverbDelay(float reverbDelay) Description copied from class:AudioEngine3DSet reverberation delay time for current aural attribute applied to all samples.- Specified by:
setReverbDelayin interfaceAudioDevice3D- Overrides:
setReverbDelayin classAudioEngine3D- Parameters:
reverbDelay- amount of time in millisecond between each iteration of reverb processing.- See Also:
-
setReverbOrder
public void setReverbOrder(int reverbOrder) Description copied from class:AudioEngine3DSet reverberation order for current aural attribute applied to all samples.- Specified by:
setReverbOrderin interfaceAudioDevice3D- Overrides:
setReverbOrderin classAudioEngine3D- Parameters:
reverbOrder- number of times reverb process loop is iterated.- See Also:
-
startSample
public int startSample(int index) Description copied from class:AudioEngine3DStart sample playing on audio device- Specified by:
startSamplein interfaceAudioDevice3D- Specified by:
startSamplein classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- status: invalid input: '<' 0 denotes an error
-
stopSample
public int stopSample(int index) Description copied from class:AudioEngine3DStop sample playing on audio device- Specified by:
stopSamplein interfaceAudioDevice3D- Specified by:
stopSamplein classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- status: invalid input: '<' 0 denotes an error
-
pauseSample
public void pauseSample(int index) Description copied from class:AudioEngine3DPause sample.- Specified by:
pauseSamplein interfaceAudioDevice3D- Specified by:
pauseSamplein classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample
-
unpauseSample
public void unpauseSample(int index) Description copied from class:AudioEngine3DUnpause sample.- Specified by:
unpauseSamplein interfaceAudioDevice3D- Specified by:
unpauseSamplein classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample
-
updateSample
public void updateSample(int index) Description copied from class:AudioEngine3DUpdate sample. Implies that some parameters affecting rendering have been modified.- Specified by:
updateSamplein interfaceAudioDevice3D- Specified by:
updateSamplein classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample
-
muteSample
public void muteSample(int index) Description copied from class:AudioEngine3DMute sample.- Specified by:
muteSamplein interfaceAudioDevice3D- Specified by:
muteSamplein classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample
-
unmuteSample
public void unmuteSample(int index) Description copied from class:AudioEngine3DUnmute sample.- Specified by:
unmuteSamplein interfaceAudioDevice3D- Specified by:
unmuteSamplein classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample
-
getSampleDuration
public long getSampleDuration(int index) Description copied from class:AudioEngine3DGet length of time a sample would play if allowed to play to completion.- Specified by:
getSampleDurationin interfaceAudioDevice3D- Overrides:
getSampleDurationin classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- length of sample in milliseconds
-
getNumberOfChannelsUsed
public int getNumberOfChannelsUsed(int index) Description copied from class:AudioEngine3DGet number of channels used by a particular sample on the audio device.- Specified by:
getNumberOfChannelsUsedin interfaceAudioDevice3D- Overrides:
getNumberOfChannelsUsedin classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- number of channels currently being used by this sample.
-
getNumberOfChannelsUsed
public int getNumberOfChannelsUsed(int index, boolean muted) Overriden method from AudioEngine3D.- Specified by:
getNumberOfChannelsUsedin interfaceAudioDevice3D- Overrides:
getNumberOfChannelsUsedin classAudioEngine3D- Parameters:
index- device specific reference number to device driver samplemuted- denotes the mute state to assume while executing this query. This mute value does not have to match the current mute state of the sample.- Returns:
- number of channels that would be used by this sample if it were playing.
-
getStartTime
public long getStartTime(int index) Description copied from class:AudioEngine3DGet time this sample begun playing on the audio device.- Specified by:
getStartTimein interfaceAudioDevice3D- Overrides:
getStartTimein classAudioEngine3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- system clock time sample started
-
setLoop
public void setLoop(int index, int count) Description copied from class:AudioEngine3DSet number of times sample is looped.- Specified by:
setLoopin interfaceAudioDevice3D- Overrides:
setLoopin classAudioEngine3D- Parameters:
index- device specific reference number to device driver samplecount- number of times sample is repeated- See Also:
-
setGain
public void setGain(float scaleFactor) Description copied from class:AudioEngine3DL2Set overall gain control of all sounds playing on the audio device.- Specified by:
setGainin interfaceAudioDevice3DL2- Specified by:
setGainin classAudioEngine3DL2- Parameters:
scaleFactor- scale factor applied to calculated amplitudes for all sounds playing on this device
-
setRateScaleFactor
public void setRateScaleFactor(int index, float rateScaleFactor) Description copied from class:AudioEngine3DL2Set scale factor applied to sample playback rate for a particular sound associated with the audio device. Changing the device sample rate affects both the pitch and speed. This scale factor is applied to ALL sound types. Changes (scales) the playback rate of a sound independent of Doppler rate changes.- Specified by:
setRateScaleFactorin interfaceAudioDevice3DL2- Overrides:
setRateScaleFactorin classAudioEngine3DL2- Parameters:
index- device specific reference to device driver samplerateScaleFactor- non-negative factor applied to calculated amplitudes for all sounds playing on this device- See Also:
-
pause
public void pause()Pauses audio device engine without closing the device and associated threads. Causes all cached sounds to be paused and all streaming sounds to be stopped.- Specified by:
pausein interfaceAudioDevice3DL2- Specified by:
pausein classAudioEngine3DL2
-
resume
public void resume()Resumes audio device engine (if previously paused) without reinitializing * the device. Causes all paused cached sounds to be resumed and all streaming sounds restarted.- Specified by:
resumein interfaceAudioDevice3DL2- Specified by:
resumein classAudioEngine3DL2
-