SoundRecorder
Class RecorderControl

java.lang.Object
  extended by PamController.PamControlledUnit
      extended by SoundRecorder.RecorderControl
All Implemented Interfaces:
PamSettings

public class RecorderControl
extends PamControlledUnit
implements PamSettings

Control a sound file recorder. The sound file recorder has two view panels - a main tab panel and also a smaller side panel which replicates some of the functionality of the main panel.

Author:
Doug Gillespie
See Also:
RecorderProcess, RecorderSettings, RecorderTabPanel, RecorderSidePanel, RecorderStorage, RecorderView

Nested Class Summary
(package private)  class RecorderControl.MenuRecordSettings
           
 
Field Summary
(package private)  java.lang.String actionTrigger
           
private  boolean folderStatus
           
static int IDLE
           
(package private)  int lastPressedButton
           
protected  MenuItemEnabler menuEnabler
           
private  boolean modelComplete
           
(package private)  int pressedButton
           
(package private) static java.util.ArrayList<RecorderControl> recorderControllers
           
(package private)  RecorderProcess recorderProcess
           
(package private)  RecorderSettings recorderSettings
           
(package private)  RecorderSidePanel recorderSidePanel
           
(package private)  int recorderStatus
           
(package private)  RecorderStorage recorderStorage
           
(package private)  RecorderTabPanel recorderTabPanel
           
(package private)  javax.swing.Timer recorderTimer
          Nothing to do with the automatic recordings - just a general timer that triggers all sorts of things.
(package private) static java.util.ArrayList<RecorderTrigger> recorderTriggers
           
static java.lang.String recorderUnitType
           
(package private)  java.util.ArrayList<RecorderView> recorderViews
           
static int RECORDING
           
private  long triggeredRecordingEnd
           
 
Fields inherited from class PamController.PamControlledUnit
isViewer
 
Constructor Summary
RecorderControl(java.lang.String name)
           
 
Method Summary
static void actionRecorderTrigger(RecorderTrigger recorderTrigger)
          static version of actionRecordTrigger can be called from anywhere in PamGuard.
private  void actionRecordTrigger(int triggerIndex, RecorderTrigger recorderTrigger)
          Called when an event triggers to start a recording (or continue a recording if already active).
private  void addRecorderTrigger(RecorderTrigger recorderTrigger)
          Adds a recorder trigger to this recorderControl.
protected  void buttonCommand(int command)
           
 javax.swing.JMenuItem createDetectionMenu(java.awt.Frame parentFrame)
          Create a JMenu object containing MenuItems associated with PamProcesses
 void enableRecording()
          Enables and disables the main control buttons for starting / stopping depending on whether or not the ADC is running.
 void enableRecordingControl(boolean enable)
          Enables and disables controls on the views such as the channel selection buttons, the main settings button and also the menus..
 int getRecorderStatus()
           
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
 void newData(PamDataBlock dataBlock, PamDataUnit dataUnit)
           
protected  void newParams()
           
 void notifyModelChanged(int changeType)
          General notification when the PAMGAURD model changes.
protected  void recordSettingsDialog(java.awt.Frame parentFrame)
           
private static void registerRecorders(RecorderControl recorderControl)
          Keep a static list of all recorders (primarily so that trigger information can be added to them later).
static void registerRecorderTrigger(RecorderTrigger recorderTrigger)
          Register recorder triggers with all recorders.
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
 void sayRecorderStatus()
           
protected  void setFolderStatus(boolean folderOk)
           
private  void setRecorderStatus()
          Works out what the record status should be - the buttons only apply to local control, even if the off button is presses, it may be that a recording is being initiated by some other part of the system.
 void setRecorderStatus(int recorderStatus)
           
protected  void setSampleRate(float sampleRate)
          Called mainly so that the samplerate notification from Acquisition can be used to check the number of channels is correctly displayed.
private  int shouldAutoRecord()
           
private  boolean shouldEnableRecording()
           
 
Methods inherited from class PamController.PamControlledUnit
addOtherRelatedMenuItems, addPamProcess, addRelatedMenuItems, canClose, createDisplayMenu, createFileMenu, createHelpMenu, fillXMLElement, fillXMLParameters, getFrameNumber, getNumPamProcesses, getPamController, getPamModuleInfo, getPamProcess, getPamView, getSidePanel, getTabClipCopier, getTabPanel, getTabSpecificMenuBar, getUnitName, getUnitType, gotoTab, notifyArrayChanged, pamHasStopped, pamToStart, removePamProcess, removeUnit, rename, saveViewerData, setFrameNumber, setPamController, setPamModuleInfo, setPamView, setSidePanel, setTabPanel, setupControlledUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface PamController.PamSettings
getUnitName, getUnitType
 

Field Detail

recorderTabPanel

RecorderTabPanel recorderTabPanel

recorderSidePanel

RecorderSidePanel recorderSidePanel

recorderProcess

RecorderProcess recorderProcess

recorderSettings

RecorderSettings recorderSettings

recorderStorage

RecorderStorage recorderStorage

actionTrigger

java.lang.String actionTrigger

menuEnabler

protected MenuItemEnabler menuEnabler

recorderStatus

int recorderStatus

pressedButton

int pressedButton

lastPressedButton

int lastPressedButton

RECORDING

public static final int RECORDING
See Also:
Constant Field Values

IDLE

public static final int IDLE
See Also:
Constant Field Values

recorderViews

java.util.ArrayList<RecorderView> recorderViews

recorderTriggers

static java.util.ArrayList<RecorderTrigger> recorderTriggers

recorderControllers

static java.util.ArrayList<RecorderControl> recorderControllers

triggeredRecordingEnd

private long triggeredRecordingEnd

recorderUnitType

public static final java.lang.String recorderUnitType
See Also:
Constant Field Values

modelComplete

private boolean modelComplete

recorderTimer

javax.swing.Timer recorderTimer
Nothing to do with the automatic recordings - just a general timer that triggers all sorts of things.


folderStatus

private boolean folderStatus
Constructor Detail

RecorderControl

public RecorderControl(java.lang.String name)
Method Detail

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

getRecorderStatus

public int getRecorderStatus()

sayRecorderStatus

public void sayRecorderStatus()

enableRecording

public void enableRecording()
Enables and disables the main control buttons for starting / stopping depending on whether or not the ADC is running.


shouldEnableRecording

private boolean shouldEnableRecording()

enableRecordingControl

public void enableRecordingControl(boolean enable)
Enables and disables controls on the views such as the channel selection buttons, the main settings button and also the menus..

Parameters:
enable -

createDetectionMenu

public javax.swing.JMenuItem createDetectionMenu(java.awt.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.


newData

public void newData(PamDataBlock dataBlock,
                    PamDataUnit dataUnit)

buttonCommand

protected void buttonCommand(int command)

setRecorderStatus

public void setRecorderStatus(int recorderStatus)

setFolderStatus

protected void setFolderStatus(boolean folderOk)

setRecorderStatus

private void setRecorderStatus()
Works out what the record status should be - the buttons only apply to local control, even if the off button is presses, it may be that a recording is being initiated by some other part of the system. Recording is effectively a logical OR of the local control from buttons and timers in this module and instructions from other detectors.


shouldAutoRecord

private int shouldAutoRecord()

recordSettingsDialog

protected void recordSettingsDialog(java.awt.Frame parentFrame)

newParams

protected void newParams()

setSampleRate

protected void setSampleRate(float sampleRate)
Called mainly so that the samplerate notification from Acquisition can be used to check the number of channels is correctly displayed.

Parameters:
sampleRate -

getSettingsReference

public java.io.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

addRecorderTrigger

private void addRecorderTrigger(RecorderTrigger recorderTrigger)
Adds a recorder trigger to this recorderControl. This can either be called from the constructor as the recordercontrol is created or from the static registerRecorderTrigger function.

Parameters:
recorderTrigger -

actionRecorderTrigger

public static void actionRecorderTrigger(RecorderTrigger recorderTrigger)
static version of actionRecordTrigger can be called from anywhere in PamGuard. It checks the index of the recordTrigger in the static list and then passes this out to individual recorders which can each check whether or not that trigger is enabled for that particular recorder

Parameters:
recorderTrigger -

actionRecordTrigger

private void actionRecordTrigger(int triggerIndex,
                                 RecorderTrigger recorderTrigger)
Called when an event triggers to start a recording (or continue a recording if already active).

Parameters:
recorderTrigger -

registerRecorderTrigger

public static void registerRecorderTrigger(RecorderTrigger recorderTrigger)
Register recorder triggers with all recorders. If the triggers were created and registered before any recorders were created, then they will get added to each recorder as it is constructed. If recorders are created before the triggers, then the new triggers are added to the controller immediately on registration.

Parameters:
recorderTrigger -

registerRecorders

private static void registerRecorders(RecorderControl recorderControl)
Keep a static list of all recorders (primarily so that trigger information can be added to them later).

Parameters:
recorderControl -