Class AudioPlaybackPanel

    • Field Detail

      • m_ButtonStart

        protected adams.gui.core.BaseButton m_ButtonStart
        the button starting playback.
      • m_ButtonPauseResume

        protected adams.gui.core.BaseButton m_ButtonPauseResume
        the button pausing/resuming playback.
      • m_ButtonStop

        protected adams.gui.core.BaseButton m_ButtonStop
        the button stopping playback.
      • m_LabelTime

        protected JLabel m_LabelTime
        the text displaying the time.
      • m_Slider

        protected JSlider m_Slider
        the slider for the current position.
      • m_Playing

        protected boolean m_Playing
        whether audio is being played back.
      • m_Paused

        protected boolean m_Paused
        whether the playback is paused.
      • m_CurrentFile

        protected File m_CurrentFile
        the current file.
      • m_Clip

        protected transient Clip m_Clip
        the current clip.
      • m_FileChooser

        protected AudioFileChooser m_FileChooser
        the filechooser for selecing audio files.
      • m_RefreshTimer

        protected Timer m_RefreshTimer
        timer for refreshing the playback time.
    • Constructor Detail

      • AudioPlaybackPanel

        public AudioPlaybackPanel()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class adams.gui.core.BasePanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class adams.gui.core.BasePanel
      • finishInit

        protected void finishInit()
        Finishes up the initialization.
        Overrides:
        finishInit in class adams.gui.core.BasePanel
      • open

        public boolean open()
        Lets the user select an audio file for playback.
        Returns:
        whether a file was selected
      • open

        public void open​(File file)
        Opens the specified file for playback.
        Parameters:
        file - the file
      • getCurrentFile

        public File getCurrentFile()
        Returns the currently loaded file, if any.
        Returns:
        the file, null if none loaded
      • start

        public void start()
        Starts the playback.
      • pauseOrResume

        public void pauseOrResume()
        Pauses or resumes the playback.
      • stop

        public void stop()
        Stops the playback.
      • isPlaying

        public boolean isPlaying()
        Returns whether playback is currently active.
        Returns:
        true if playback active
      • isPaused

        public boolean isPaused()
        Returns whether playback is currently paused.
        Returns:
        true if playback paused
      • getTimestamp

        public long getTimestamp()
        Returns the current timestamp in millisecond.
        Returns:
        the timestamp, -1 if not active
      • resetTime

        protected void resetTime()
        Resets the time/slider.
        See Also:
        NO_TIME
      • updateTime

        protected void updateTime​(boolean updateSlider)
        Updates the displayed time.
        Parameters:
        updateSlider - whether to update the slider
      • updateButtons

        protected void updateButtons()
        Updates the enabled state of the buttons.
      • update

        protected void update()
        Updates buttons and time.
      • update

        public void update​(LineEvent event)
        Informs the listener that a line's state has changed. The listener can then invoke LineEvent methods to obtain information about the event.
        Specified by:
        update in interface LineListener
        Parameters:
        event - a line event that describes the change
      • setSliderVisible

        public void setSliderVisible​(boolean value)
        Sets the visible state of the slider.
        Parameters:
        value - true to make it visible
      • isSliderVisible

        public boolean isSliderVisible()
        Returns whether the slider is visible.
        Returns:
        true if visible
      • setTimeVisible

        public void setTimeVisible​(boolean value)
        Sets the visible state of the time.
        Parameters:
        value - true to make it visible
      • isTimeVisible

        public boolean isTimeVisible()
        Returns whether the time is visible.
        Returns:
        true if visible
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface adams.core.CleanUpHandler