Package adams.flow.source.audiorecorder
Class FixedDuration
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.source.audiorecorder.AbstractAudioRecorder<String>
-
- adams.flow.source.audiorecorder.AbstractFileBasedAudioRecorder
-
- adams.flow.source.audiorecorder.FixedDuration
-
- All Implemented Interfaces:
adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.io.FileWriter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.option.OptionHandler,adams.core.QuickInfoSupporter,adams.core.SizeOfHandler,adams.core.Stoppable,adams.core.StoppableWithFeedback,adams.flow.core.FlowContextHandler,Serializable
public class FixedDuration extends AbstractFileBasedAudioRecorder
Records a WAV file of fixed duration.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_Durationthe duration to record.protected adams.flow.core.RunnableWithLoggingm_Monitorthe monitor thread.protected adams.flow.core.RunnableWithLoggingm_Recordingthe recording worker thread.-
Fields inherited from class adams.flow.source.audiorecorder.AbstractFileBasedAudioRecorder
m_OutputFile
-
Fields inherited from class adams.flow.source.audiorecorder.AbstractAudioRecorder
m_BigEndian, m_Bits, m_Channels, m_FlowContext, m_SampleRate, m_Signed, m_Stopped
-
-
Constructor Summary
Constructors Constructor Description FixedDuration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.protected StringdoRecordTo(adams.core.io.PlaceholderFile output)Records the audio.StringdurationTipText()Returns the tip text for this property.protected adams.core.io.PlaceholderFilegetDefaultOutputFile()Returns the default output file.intgetDuration()Returns the duration of the recording.protected adams.flow.core.RunnableWithLogginggetRecordingWorker(DataLine.Info info, AudioFormat format)Returns worker runnable for recording audio.StringglobalInfo()Returns a string describing the object.StringoutputFileTipText()Returns the tip text for this property.booleanrequiresFlowContext()Returns whether flow context is actually required.voidsetDuration(int value)Sets the duration of the recording.voidstopExecution()Stops the execution.-
Methods inherited from class adams.flow.source.audiorecorder.AbstractFileBasedAudioRecorder
doRecord, generates, getOutputFile, getQuickInfo, getRecordingWorker, setOutputFile
-
Methods inherited from class adams.flow.source.audiorecorder.AbstractAudioRecorder
bigEndianTipText, bitsTipText, channelsTipText, check, getAudioFormat, getBigEndian, getBits, getChannels, getDataLineInfo, getFlowContext, getSampleRate, getSigned, isStopped, record, sampleRateTipText, setBigEndian, setBits, setChannels, setFlowContext, setSampleRate, setSigned, signedTipText
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin classadams.core.option.AbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classAbstractFileBasedAudioRecorder
-
getDefaultOutputFile
protected adams.core.io.PlaceholderFile getDefaultOutputFile()
Returns the default output file.- Specified by:
getDefaultOutputFilein classAbstractFileBasedAudioRecorder- Returns:
- the default
-
outputFileTipText
public String outputFileTipText()
Returns the tip text for this property.- Specified by:
outputFileTipTextin interfaceadams.core.io.FileWriter- Specified by:
outputFileTipTextin classAbstractFileBasedAudioRecorder- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setDuration
public void setDuration(int value)
Sets the duration of the recording.- Parameters:
value- the duration in sec
-
getDuration
public int getDuration()
Returns the duration of the recording.- Returns:
- the duration in sec
-
durationTipText
public String durationTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
requiresFlowContext
public boolean requiresFlowContext()
Returns whether flow context is actually required.- Specified by:
requiresFlowContextin classAbstractAudioRecorder<String>- Returns:
- true if required
-
getRecordingWorker
protected adams.flow.core.RunnableWithLogging getRecordingWorker(DataLine.Info info, AudioFormat format)
Returns worker runnable for recording audio.- Parameters:
info- the line infoformat- the format to record in- Returns:
- the runnable
-
doRecordTo
protected String doRecordTo(adams.core.io.PlaceholderFile output)
Records the audio.- Specified by:
doRecordToin classAbstractFileBasedAudioRecorder- Parameters:
output- the file to record to- Returns:
- null if successful, otherwise error message
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceadams.core.Stoppable- Overrides:
stopExecutionin classAbstractAudioRecorder<String>
-
-