Class PortAudioRenderer

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

    public class PortAudioRenderer
    extends AbstractAudioRenderer<PortAudioSystem>
    Implements an audio Renderer which uses Pa.
    Author:
    Damian Minkov, Lyubomir Marinov
    • Constructor Detail

      • PortAudioRenderer

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

        public PortAudioRenderer​(boolean playback)
        Initializes a new PortAudioRenderer 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<PortAudioSystem>
        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 PortAudio 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<PortAudioSystem>
        Throws:
        javax.media.ResourceUnavailableException - if the PortAudio 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<PortAudioSystem>
        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 PortAudio 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 PortAudio device to be used by this instance for rendering.
        Overrides:
        setLocator in class AbstractAudioRenderer<PortAudioSystem>
        Parameters:
        locator - a MediaLocator which specifies the device index of the PortAudio 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 PortAudioRenderer will begin being rendered.
      • stop

        public void stop()
        Stops the rendering process.