Class JavaSoundMixer

All Implemented Interfaces:
AudioDevice, AudioDevice3D, AudioDevice3DL2

public class JavaSoundMixer extends AudioEngine3DL2
The JavaSoundMixer Class defines an audio output device that accesses JavaSound functionality stream data.
  • Field Details

  • Constructor Details

  • 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:
      getTotalChannels in interface AudioDevice
      Overrides:
      getTotalChannels in class AudioEngine
      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:
      initialize in interface AudioDevice
      Specified by:
      initialize in class AudioEngine
      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:
      close in interface AudioDevice
      Specified by:
      close in class AudioEngine
      Returns:
      flag: true is closed sucessfully, false if error
    • prepareSound

      public int prepareSound(int soundType, MediaContainer soundData)
      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:
      prepareSound in interface AudioDevice3D
      Overrides:
      prepareSound in class AudioEngine3D
      Parameters:
      soundType - denotes type of sound: Background, Point or Cone
      soundData - 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:
      clearSound in interface AudioDevice3D
      Specified by:
      clearSound in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
    • setVworldXfrm

      public void setVworldXfrm(int index, Transform3D trans)
      Save a reference to the local to virtual world coordinate space Overriden method from AudioEngine3D.
      Specified by:
      setVworldXfrm in interface AudioDevice3D
      Overrides:
      setVworldXfrm in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
      trans - is a reference to virtual world composite transform
    • setPosition

      public void setPosition(int index, javax.vecmath.Point3d position)
      Description copied from class: AudioEngine3D
      Set location of sample.
      Specified by:
      setPosition in interface AudioDevice3D
      Overrides:
      setPosition in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
      position - point location in virtual world coordinate of sample
      See Also:
    • setDirection

      public void setDirection(int index, javax.vecmath.Vector3d direction)
      Description copied from class: AudioEngine3D
      Set direction vector of sample.
      Specified by:
      setDirection in interface AudioDevice3D
      Overrides:
      setDirection in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
      direction - vector in virtual world coordinate.
      See Also:
    • setReflectionCoefficient

      public void setReflectionCoefficient(float coefficient)
      Description copied from class: AudioEngine3D
      Set reverberation surface reflection coefficient value for current aural attribute applied to all samples.
      Specified by:
      setReflectionCoefficient in interface AudioDevice3D
      Overrides:
      setReflectionCoefficient in class AudioEngine3D
      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: AudioEngine3D
      Set reverberation delay time for current aural attribute applied to all samples.
      Specified by:
      setReverbDelay in interface AudioDevice3D
      Overrides:
      setReverbDelay in class AudioEngine3D
      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: AudioEngine3D
      Set reverberation order for current aural attribute applied to all samples.
      Specified by:
      setReverbOrder in interface AudioDevice3D
      Overrides:
      setReverbOrder in class AudioEngine3D
      Parameters:
      reverbOrder - number of times reverb process loop is iterated.
      See Also:
    • startSample

      public int startSample(int index)
      Description copied from class: AudioEngine3D
      Start sample playing on audio device
      Specified by:
      startSample in interface AudioDevice3D
      Specified by:
      startSample in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
      Returns:
      status: < 0 denotes an error
    • stopSample

      public int stopSample(int index)
      Description copied from class: AudioEngine3D
      Stop sample playing on audio device
      Specified by:
      stopSample in interface AudioDevice3D
      Specified by:
      stopSample in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
      Returns:
      status: < 0 denotes an error
    • pauseSample

      public void pauseSample(int index)
      Description copied from class: AudioEngine3D
      Pause sample.
      Specified by:
      pauseSample in interface AudioDevice3D
      Specified by:
      pauseSample in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
    • unpauseSample

      public void unpauseSample(int index)
      Description copied from class: AudioEngine3D
      Unpause sample.
      Specified by:
      unpauseSample in interface AudioDevice3D
      Specified by:
      unpauseSample in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
    • updateSample

      public void updateSample(int index)
      Description copied from class: AudioEngine3D
      Update sample. Implies that some parameters affecting rendering have been modified.
      Specified by:
      updateSample in interface AudioDevice3D
      Specified by:
      updateSample in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
    • muteSample

      public void muteSample(int index)
      Description copied from class: AudioEngine3D
      Mute sample.
      Specified by:
      muteSample in interface AudioDevice3D
      Specified by:
      muteSample in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
    • unmuteSample

      public void unmuteSample(int index)
      Description copied from class: AudioEngine3D
      Unmute sample.
      Specified by:
      unmuteSample in interface AudioDevice3D
      Specified by:
      unmuteSample in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
    • getSampleDuration

      public long getSampleDuration(int index)
      Description copied from class: AudioEngine3D
      Get length of time a sample would play if allowed to play to completion.
      Specified by:
      getSampleDuration in interface AudioDevice3D
      Overrides:
      getSampleDuration in class AudioEngine3D
      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: AudioEngine3D
      Get number of channels used by a particular sample on the audio device.
      Specified by:
      getNumberOfChannelsUsed in interface AudioDevice3D
      Overrides:
      getNumberOfChannelsUsed in class AudioEngine3D
      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:
      getNumberOfChannelsUsed in interface AudioDevice3D
      Overrides:
      getNumberOfChannelsUsed in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
      muted - 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: AudioEngine3D
      Get time this sample begun playing on the audio device.
      Specified by:
      getStartTime in interface AudioDevice3D
      Overrides:
      getStartTime in class AudioEngine3D
      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: AudioEngine3D
      Set number of times sample is looped.
      Specified by:
      setLoop in interface AudioDevice3D
      Overrides:
      setLoop in class AudioEngine3D
      Parameters:
      index - device specific reference number to device driver sample
      count - number of times sample is repeated
      See Also:
    • setGain

      public void setGain(float scaleFactor)
      Description copied from class: AudioEngine3DL2
      Set overall gain control of all sounds playing on the audio device.
      Specified by:
      setGain in interface AudioDevice3DL2
      Specified by:
      setGain in class AudioEngine3DL2
      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: AudioEngine3DL2
      Set 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:
      setRateScaleFactor in interface AudioDevice3DL2
      Overrides:
      setRateScaleFactor in class AudioEngine3DL2
      Parameters:
      index - device specific reference to device driver sample
      rateScaleFactor - 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:
      pause in interface AudioDevice3DL2
      Specified by:
      pause in class AudioEngine3DL2
    • 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:
      resume in interface AudioDevice3DL2
      Specified by:
      resume in class AudioEngine3DL2