fm.liveswitch.AudioSource Class Referenceabstract

An audio source. More...

Public Member Functions

 AudioSource (fm.liveswitch.AudioFormat outputFormat)
 Initializes a new instance of the fm.liveswitch.AudioSource class. More...
 
 AudioSource (fm.liveswitch.AudioFormat outputFormat, int frameDuration)
 Initializes a new instance of the fm.liveswitch.AudioSource class. More...
 
int calculateDuration (int dataLength)
 Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format. More...
 
int calculateDurationFloat (int dataLength)
 Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format. More...
 
fm.liveswitch.AudioConfig getConfig ()
 Gets the output configuration. More...
 
boolean getDisableTimestampReset ()
 Gets whether the timestamp should be reset using the wall clock after fm.liveswitch.AudioSource#getTimestampResetInterval milliseconds elapse between frames. More...
 
boolean getForceTimestampReset ()
 Gets whether the timestamp should be reset before the next frame is processed. More...
 
int getFrameDuration ()
 Gets the frame duration in milliseconds. More...
 
int getTimestampResetInterval ()
 Gets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock. More...
 
double getVolume ()
 Gets a value indicating the volume (output resistance) of this source. More...
 
void setDisableTimestampReset (boolean value)
 Sets whether the timestamp should be reset using the wall clock after fm.liveswitch.AudioSource#getTimestampResetInterval milliseconds elapse between frames. More...
 
void setForceTimestampReset (boolean value)
 Sets whether the timestamp should be reset before the next frame is processed. More...
 
void setTimestampResetInterval (int value)
 Sets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock. More...
 
void setVolume (double value)
 Sets a value indicating the volume (output resistance) of this source. More...
 
- Public Member Functions inherited from fm.liveswitch.MediaSourceBase
String getExternalId ()
 Gets the external identifier. More...
 
String getId ()
 Gets the identifier. More...
 
String getTag ()
 Gets optional data to associate with this instance. More...
 
void setExternalId (String value)
 Sets the external identifier. More...
 
void setTag (String value)
 Sets optional data to associate with this instance. More...
 
abstract fm.liveswitch.Future< Object > start ()
 Starts this instance. More...
 
abstract fm.liveswitch.Future< Object > stop ()
 Stops this instance. More...
 
- Public Member Functions inherited from fm.liveswitch.Dynamic
java.util.HashMap< String, Object > getDynamicProperties ()
 Gets all dynamic properties on this instance. More...
 
Object getDynamicValue (String key)
 Gets a property value from the local cache. More...
 
void setDynamicValue (String key, Object value)
 Sets a property value in the local cache. More...
 
boolean unsetDynamicValue (String key)
 Removes a property value from the local cache. More...
 
- Public Member Functions inherited from fm.liveswitch.IElement
abstract String getExternalId ()
 Gets the external identifier. More...
 
abstract String getId ()
 Gets the identifier. More...
 
abstract String getPipelineJson ()
 Gets the pipeline JSON with this as the central point. More...
 
abstract void setExternalId (String value)
 Sets the external identifier. More...
 
- Public Member Functions inherited from fm.liveswitch.IMediaElement
abstract boolean destroy ()
 Destroys this instance. More...
 
abstract boolean getDeactivated ()
 Gets a value indicating whether this instance is deactivated. More...
 
abstract boolean getDisabled ()
 Gets a value indicating whether this instance is disabled. More...
 
abstract String getLabel ()
 Gets a label that identifies this instance. More...
 
abstract boolean getMuted ()
 Gets a value indicating whether this instance is muted. More...
 
abstract boolean getPaused ()
 Gets a value indicating whether this instance is paused. More...
 
abstract boolean getPersistent ()
 Gets a value indicating whether this instance is persistent. More...
 
abstract void setDeactivated (boolean value)
 Sets a value indicating whether this instance is deactivated. More...
 
abstract void setMuted (boolean value)
 Sets a value indicating whether this instance is muted. More...
 

Static Public Member Functions

static int calculateDuration (int dataLength, int clockRate, int channelCount)
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 
static int calculateDuration (int dataLength, fm.liveswitch.AudioConfig config)
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 
static int calculateDurationFloat (int dataLength, int clockRate, int channelCount)
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 

Protected Member Functions

fm.liveswitch.IAudioInputCollection createInputCollection (fm.liveswitch.IAudioOutput output)
 Creates an input collection. More...
 
void doDestroy ()
 
void raiseFrame (fm.liveswitch.AudioFrame frame)
 Raises a frame. More...
 
boolean trySetSystemTimestamp (fm.liveswitch.AudioFrame frame)
 Tries to set the system timestamp on an audio frame. More...
 
boolean trySetTimestamp (fm.liveswitch.AudioFrame frame)
 Tries to set the timestamp on an audio frame. More...
 
- Protected Member Functions inherited from fm.liveswitch.MediaSourceBase
 MediaSourceBase ()
 
- Protected Member Functions inherited from fm.liveswitch.Dynamic
 Dynamic ()
 
- Protected Member Functions inherited from fm.liveswitch.Serializable
boolean getIsDirty ()
 Gets a value indicating whether this instance is dirty. More...
 
 Serializable ()
 Initializes a new instance of the fm.liveswitch.Serializable class. More...
 
void setIsDirty (boolean value)
 Sets a value indicating whether this instance is dirty. More...
 

Detailed Description

An audio source.

Constructor & Destructor Documentation

◆ AudioSource() [1/2]

fm.liveswitch.AudioSource.AudioSource ( fm.liveswitch.AudioFormat  outputFormat)

Initializes a new instance of the fm.liveswitch.AudioSource class.

Parameters
outputFormatThe output format.

◆ AudioSource() [2/2]

fm.liveswitch.AudioSource.AudioSource ( fm.liveswitch.AudioFormat  outputFormat,
int  frameDuration 
)

Initializes a new instance of the fm.liveswitch.AudioSource class.

Parameters
outputFormatThe output format.
frameDurationThe frame duration in milliseconds.

Member Function Documentation

◆ calculateDuration() [1/3]

int fm.liveswitch.AudioSource.calculateDuration ( int  dataLength)

Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format.

Parameters
dataLengthThe length of the audio chunk.

◆ calculateDuration() [2/3]

static int fm.liveswitch.AudioSource.calculateDuration ( int  dataLength,
fm.liveswitch.AudioConfig  config 
)
static

Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.

Parameters
dataLengthThe length of the audio chunk.
configThe configuration.
Deprecated:
Use SoundUtility.CalculateDuration instead.

◆ calculateDuration() [3/3]

static int fm.liveswitch.AudioSource.calculateDuration ( int  dataLength,
int  clockRate,
int  channelCount 
)
static

Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.

Parameters
dataLengthThe length of the audio chunk.
clockRateThe clock rate.
channelCountThe channel count.
Deprecated:
Use SoundUtility.CalculateDuration instead.

◆ calculateDurationFloat() [1/2]

int fm.liveswitch.AudioSource.calculateDurationFloat ( int  dataLength)

Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format.

Parameters
dataLengthThe length of the audio chunk.

◆ calculateDurationFloat() [2/2]

static int fm.liveswitch.AudioSource.calculateDurationFloat ( int  dataLength,
int  clockRate,
int  channelCount 
)
static

Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.

Parameters
dataLengthThe length of the audio chunk.
clockRateThe clock rate.
channelCountThe channel count.
Deprecated:
Use SoundUtility.CalculateDurationFloat instead.

◆ createInputCollection()

fm.liveswitch.IAudioInputCollection fm.liveswitch.AudioSource.createInputCollection ( fm.liveswitch.IAudioOutput  output)
protected

Creates an input collection.

Parameters
outputThe output.

◆ doDestroy()

void fm.liveswitch.AudioSource.doDestroy ( )
protected

◆ getConfig()

fm.liveswitch.AudioConfig fm.liveswitch.AudioSource.getConfig ( )

Gets the output configuration.

Implements fm.liveswitch.IAudioOutput.

◆ getDisableTimestampReset()

boolean fm.liveswitch.AudioSource.getDisableTimestampReset ( )

Gets whether the timestamp should be reset using the wall clock after fm.liveswitch.AudioSource#getTimestampResetInterval milliseconds elapse between frames.

◆ getForceTimestampReset()

boolean fm.liveswitch.AudioSource.getForceTimestampReset ( )

Gets whether the timestamp should be reset before the next frame is processed.

◆ getFrameDuration()

int fm.liveswitch.AudioSource.getFrameDuration ( )

Gets the frame duration in milliseconds.

Defaults to 20.

◆ getTimestampResetInterval()

int fm.liveswitch.AudioSource.getTimestampResetInterval ( )

Gets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock.

◆ getVolume()

double fm.liveswitch.AudioSource.getVolume ( )

Gets a value indicating the volume (output resistance) of this source.

Valid value range is 0.0 to 1.0, inclusive.

Implements fm.liveswitch.IAudioOutput.

◆ raiseFrame()

void fm.liveswitch.AudioSource.raiseFrame ( fm.liveswitch.AudioFrame  frame)
protected

Raises a frame.

Parameters
frameThe frame.

◆ setDisableTimestampReset()

void fm.liveswitch.AudioSource.setDisableTimestampReset ( boolean  value)

Sets whether the timestamp should be reset using the wall clock after fm.liveswitch.AudioSource#getTimestampResetInterval milliseconds elapse between frames.

◆ setForceTimestampReset()

void fm.liveswitch.AudioSource.setForceTimestampReset ( boolean  value)

Sets whether the timestamp should be reset before the next frame is processed.

◆ setTimestampResetInterval()

void fm.liveswitch.AudioSource.setTimestampResetInterval ( int  value)

Sets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock.

◆ setVolume()

void fm.liveswitch.AudioSource.setVolume ( double  value)

Sets a value indicating the volume (output resistance) of this source.

Valid value range is 0.0 to 1.0, inclusive.

Implements fm.liveswitch.IAudioOutput.

◆ trySetSystemTimestamp()

boolean fm.liveswitch.AudioSource.trySetSystemTimestamp ( fm.liveswitch.AudioFrame  frame)
protected

Tries to set the system timestamp on an audio frame.

This will succeed if the system timestamp is already set or if the system timestamp can be calculated off the timestamp.

Parameters
frameThe frame.

◆ trySetTimestamp()

boolean fm.liveswitch.AudioSource.trySetTimestamp ( fm.liveswitch.AudioFrame  frame)
protected

Tries to set the timestamp on an audio frame.

This will succeed if the timestamp is already set or if the timestamp can be calculated off the system timestamp.

Parameters
frameThe frame.