Class JavaSoundMixer

    • Method Detail

      • 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
      • 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
      • 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
      • 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:
        Sound.setLoop(int)
      • 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:
        Sound.setRateScaleFactor(float)
      • 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