Class MacCoreaudioRenderer

  • All Implemented Interfaces:
    javax.media.Controls, javax.media.PlugIn, javax.media.Renderer

    public class MacCoreaudioRenderer
    extends AbstractAudioRenderer<MacCoreaudioSystem>
    Implements an audio Renderer which uses MacOSX Coreaudio.
    Author:
    Vincent Lucas
    • Constructor Detail

      • MacCoreaudioRenderer

        public MacCoreaudioRenderer()
        Initializes a new MacCoreaudioRenderer instance.
      • MacCoreaudioRenderer

        public MacCoreaudioRenderer​(boolean playback)
        Initializes a new MacCoreaudioRenderer instance which is to either perform playback or sound a notification.
        Parameters:
        playback - true if the new instance is to perform playback or false if the new instance is to sound a notification
    • Method Detail

      • getName

        public String getName()
        Gets the descriptive/human-readable name of this JMF plug-in.
        Returns:
        the descriptive/human-readable name of this JMF plug-in
      • getSupportedInputFormats

        public javax.media.Format[] getSupportedInputFormats()
        Gets the list of JMF Formats of audio data which this Renderer is capable of rendering.
        Specified by:
        getSupportedInputFormats in interface javax.media.Renderer
        Overrides:
        getSupportedInputFormats in class AbstractAudioRenderer<MacCoreaudioSystem>
        Returns:
        an array of JMF Formats of audio data which this Renderer is capable of rendering
      • open

        public void open()
                  throws javax.media.ResourceUnavailableException
        Opens the MacCoreaudio device and output stream represented by this instance which are to be used to render audio.
        Specified by:
        open in interface javax.media.PlugIn
        Overrides:
        open in class AbstractAudioRenderer<MacCoreaudioSystem>
        Throws:
        javax.media.ResourceUnavailableException - if the MacCoreaudio device or output stream cannot be created or opened
      • playbackDevicePropertyChange

        protected void playbackDevicePropertyChange​(PropertyChangeEvent ev)
        Notifies this instance that the value of the PROP_PLAYBACK_DEVICE property of its associated AudioSystem has changed.
        Overrides:
        playbackDevicePropertyChange in class AbstractAudioRenderer<MacCoreaudioSystem>
        Parameters:
        ev - a PropertyChangeEvent which specifies details about the change such as the name of the property and its old and new values
      • process

        public int process​(javax.media.Buffer buffer)
        Renders the audio data contained in a specific Buffer onto the MacCoreaudio device represented by this Renderer.
        Parameters:
        buffer - the Buffer which contains the audio data to be rendered
        Returns:
        BUFFER_PROCESSED_OK if the specified buffer has been successfully processed
      • setLocator

        public void setLocator​(javax.media.MediaLocator locator)
        Sets the MediaLocator which specifies the device index of the MacCoreaudio device to be used by this instance for rendering.
        Overrides:
        setLocator in class AbstractAudioRenderer<MacCoreaudioSystem>
        Parameters:
        locator - a MediaLocator which specifies the device index of the MacCoreaudio device to be used by this instance for rendering
      • start

        public void start()
        Starts the rendering process. Any audio data available in the internal resources associated with this MacCoreaudioRenderer will begin being rendered.
      • stop

        public void stop()
        Stops the rendering process.
      • writeOutput

        public void writeOutput​(byte[] buffer,
                                int bufferLength)
        Writes the data received to the buffer give in arguments, which is provided by the CoreAudio library.
        Parameters:
        buffer - The buffer to fill in provided by the CoreAudio library.
        bufferLength - The length of the buffer provided.