Package soundPlayback

Class PlaybackControl

java.lang.Object
PamController.PamControlledUnit
soundPlayback.PlaybackControl
All Implemented Interfaces:
PamSettings, SettingsNameProvider

public class PlaybackControl extends PamControlledUnit implements PamSettings
Main Pam Controller for sound playback modules.
Author:
Doug Gillespie
  • Field Details

  • Constructor Details

    • PlaybackControl

      public PlaybackControl(String unitName)
  • Method Details

    • getFilePlayback

      public FilePlayback getFilePlayback()
      Returns:
      the filePlayback
    • getViewerPlayback

      public static PlaybackControl getViewerPlayback()
      Static easy access to the playback module in PAMGUARD viewer mode. Other modules will be sending commands to this module instructing it to play sections of data out through the speakers.

      This may involve allowing the playback module to use it's own data source, but it may also be instructed to take data from elsewhere - e.g. reconstructed clicks from the click detector.

      Returns:
    • registerPlayButton

      public static void registerPlayButton(AbstractButton button)
    • registerStopButton

      public static void registerStopButton(AbstractButton button)
    • getSettingsReference

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion

      public long getSettingsVersion()
      Specified by:
      getSettingsVersion in interface PamSettings
      Returns:
      An integer version number for the settings
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
      Specified by:
      restoreSettings in interface PamSettings
      Returns:
      true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
    • newSettings

      public void newSettings()
    • createDetectionMenu

      public JMenuItem createDetectionMenu(Frame parentFrame)
      Description copied from class: PamControlledUnit
      Create a JMenu object containing MenuItems associated with PamProcesses
      Overrides:
      createDetectionMenu in class PamControlledUnit
      Parameters:
      parentFrame - The owner frame of the menu
      Returns:
      reference to a JMenu which can be added to an existing menu or menu bar

      Note that if multiple views are to use the same menu, then they should each create a new menu (by setting Create to true) the first time they call this method.

    • findPlaybackSystem

      public PlaybackSystem findPlaybackSystem(PamDataBlock sourceDataBlock)
    • getMaxPlaybackChannels

      public int getMaxPlaybackChannels(PlaybackSystem playbackSystem)
    • getSourceSampleRate

      public double getSourceSampleRate()
    • choseSampleRate

      public float choseSampleRate()
    • notifyModelChanged

      public void notifyModelChanged(int changeType)
      Description copied from class: PamControlledUnit
      General notification when the PAMGAURD model changes.
      Overrides:
      notifyModelChanged in class PamControlledUnit
      Parameters:
      changeType - type of change
    • getPlaybackParameters

      public PlaybackParameters getPlaybackParameters()
      Returns:
      playback parameters.
    • setPlayBackParamters

      public void setPlayBackParamters(PlaybackParameters playbackParameters)
      Set the playback parameters.
      Parameters:
      playbackParameters - - the playback parameters.
    • playViewerData

      public boolean playViewerData(int channelMap, long startMillis, long endMillis, PlaybackProgressMonitor playbackProgressMonitor)
      Play back raw audio data for a specific channel.
      Parameters:
      channelMap -
      startMillis -
      endMillis -
      playbackProgressMonitor -
      Returns:
      true if playback seems to have started OK
    • playViewerData

      public boolean playViewerData(long startMillis, long endMillis, PlaybackProgressMonitor playbackProgressMonitor)
      The simplest of the viewer instructions simply instructs the playback module to play data from it's own data source between the given times.
      Parameters:
      startMillis - start time
      endMillis - end time
      playbackProgressMonitor - progress monitor
      Returns:
      true if playback seems to have started OK
    • playViewerData

      public boolean playViewerData(int channelMap, long startMillis, long endMillis, PlaybackProgressMonitor playbackProgressMonitor, PlaybackDataServer playDataServer)
      This one is for playing back non-raw data through the sound card. e.g. the click detector will play back clicks spaced with zeros between them.

      A new thread will be launched which will call back into playDataServer. playDataServer will have to prepare rawDataUnits which get passed on to the PlaybackProcess. These rawDataUnits will have to follow the basic form of any normal rawDataUnit, but can probably vary a bit in length if necessary.

      Parameters:
      channelMap -
      startMillis -
      endMillis -
      playbackProgressMonitor -
      playDataServer -
      Returns:
      true if playback started successfully.
    • stopViewerPlayback

      public void stopViewerPlayback()
      Stop viewer playback.
    • hasPlayDataSource

      public boolean hasPlayDataSource()
      Returns:
      true if there is a valid data source and the options to play data are checked.
    • isRealTimePlayback

      public boolean isRealTimePlayback()
      Returns true if the playback is real time. If source input device is real time, then the master PAM clock will be the input device (e.g. sound card, NI card, etc). If this is false, then we're talking file playback or viewer mode and the master clock will be the output device itself.
      Returns:
      the realTimePlayback
    • getPlaybackProcess

      public PlaybackProcess getPlaybackProcess()
      Returns:
      the playbackProcess
    • getDeviceState

      public PlayDeviceState getDeviceState()
    • getUnitName

      public String getUnitName()
      Description copied from class: PamControlledUnit
      Returns the name of the unit
      Specified by:
      getUnitName in interface SettingsNameProvider
      Overrides:
      getUnitName in class PamControlledUnit
      Returns:
      the name of the unit
    • getUnitType

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Overrides:
      getUnitType in class PamControlledUnit
      Returns:
      A Name specific to the type, e.g. Click detector
    • getPlaybackSystem

      public PlaybackSystem getPlaybackSystem()
      Returns:
      the playbackSystem
    • getGUI

      public PamControlledUnitGUI getGUI(int flag)
      Description copied from class: PamControlledUnit
      Get the GUI for the PAMControlled unit. This has multiple GUI options which are instantiated depending on the view type.
      Overrides:
      getGUI in class PamControlledUnit
      Parameters:
      flag - . The GUI type flag defined in PAMGuiManager.
      Returns:
      the GUI for the PamControlledUnit unit.