Package adams.flow.source.audiorecorder
Class OnDemand
- 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.OnDemand
-
- 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 OnDemand extends AbstractFileBasedAudioRecorder
Records a WAV file from when the user starts recording to when the user ends it.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected adams.flow.core.RunnableWithLogging
m_Monitor
the monitor thread.protected adams.flow.core.RunnableWithLogging
m_Recording
the 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 OnDemand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
check()
Hook method for performing checks before attempting to generate the setups.protected String
doRecordTo(adams.core.io.PlaceholderFile output)
Records the audio.protected adams.core.io.PlaceholderFile
getDefaultOutputFile()
Returns the default output file.protected adams.flow.core.RunnableWithLogging
getRecordingWorker(DataLine.Info info, AudioFormat format)
Returns worker runnable for recording audio.String
globalInfo()
Returns a string describing the object.String
outputFileTipText()
Returns the tip text for this property.boolean
requiresFlowContext()
Returns whether flow context is actually required.void
stopExecution()
Stops the execution.-
Methods inherited from class adams.flow.source.audiorecorder.AbstractFileBasedAudioRecorder
defineOptions, doRecord, generates, getOutputFile, getQuickInfo, getRecordingWorker, setOutputFile
-
Methods inherited from class adams.flow.source.audiorecorder.AbstractAudioRecorder
bigEndianTipText, bitsTipText, channelsTipText, 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:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
getDefaultOutputFile
protected adams.core.io.PlaceholderFile getDefaultOutputFile()
Returns the default output file.- Specified by:
getDefaultOutputFile
in classAbstractFileBasedAudioRecorder
- Returns:
- the default
-
outputFileTipText
public String outputFileTipText()
Returns the tip text for this property.- Specified by:
outputFileTipText
in interfaceadams.core.io.FileWriter
- Specified by:
outputFileTipText
in classAbstractFileBasedAudioRecorder
- 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:
requiresFlowContext
in 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
-
check
protected String check()
Hook method for performing checks before attempting to generate the setups.- Overrides:
check
in classAbstractAudioRecorder<String>
- Returns:
- null if successful, otherwise error message
-
doRecordTo
protected String doRecordTo(adams.core.io.PlaceholderFile output)
Records the audio.- Specified by:
doRecordTo
in classAbstractFileBasedAudioRecorder
- Parameters:
output
- the file to record to- Returns:
- null if successful, otherwise error message
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceadams.core.Stoppable
- Overrides:
stopExecution
in classAbstractAudioRecorder<String>
-
-