An audio buffer. More...
Public Member Functions | |
void | applyGain (double gain) |
Applies gain to this instance. More... | |
AudioBuffer (fm.liveswitch.DataBuffer dataBuffer, fm.liveswitch.AudioFormat format) | |
Initializes a new instance of the fm.liveswitch.AudioBuffer class. More... | |
AudioBuffer (fm.liveswitch.DataBuffer[] dataBuffers, fm.liveswitch.AudioFormat format) | |
Initializes a new instance of the fm.liveswitch.AudioBuffer class. More... | |
double | calculateLevel () |
Calculates the level of this instance. More... | |
fm.liveswitch.AudioBuffer | clone () |
Clones this instance. More... | |
double | getGain () |
Gets the gain. More... | |
boolean | getGeneratedByPlc () |
Gets a value indicating whether this buffer contains data generated by packet loss concealment (PLC). More... | |
boolean | getIsDtmf () |
Gets a value indicating whether this buffer has DTMF data. More... | |
boolean | getIsL16 () |
Gets a value indicating whether this buffer has L16 audio. More... | |
boolean | getIsMuted () |
Gets a value indicating whether this instance has been muted. More... | |
boolean | getIsOpus () |
Gets a value indicating whether this buffer has Opus audio. More... | |
boolean | getIsPcm () |
Gets a value indicating whether this buffer has raw PCM audio. More... | |
boolean | getIsPcma () |
Gets a value indicating whether this buffer has PCMA audio. More... | |
boolean | getIsPcmu () |
Gets a value indicating whether this buffer has PCMU audio. More... | |
boolean | mute () |
Mutes this instance. More... | |
void | setGeneratedByPlc (boolean value) |
Sets a value indicating whether this buffer contains data generated by packet loss concealment (PLC). More... | |
String | toJson () |
Serializes this instance to JSON. 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... | |
Static Public Member Functions | |
static fm.liveswitch.AudioBuffer | createSilence (int duration, int clockRate, int channelCount) |
Creates a silent audio buffer with the specified duration, clock rate, and channel count. More... | |
static fm.liveswitch.AudioBuffer | createSilence (int duration, fm.liveswitch.AudioConfig config) |
Creates a silent audio buffer with the specified duration and configuration. More... | |
static fm.liveswitch.AudioBuffer | createSound (long timestamp, int duration, int clockRate, int channelCount) |
Creates an audio buffer with the specified duration, clock rate, and channel count, a frequency of 440Hz, and an amplitude of 16,384. More... | |
static fm.liveswitch.AudioBuffer | createSound (long timestamp, int duration, int clockRate, int channelCount, float frequency) |
Creates a silent audio buffer with the specified duration, clock rate, channel count, and frequency, and an amplitude of 16,384. More... | |
static fm.liveswitch.AudioBuffer | createSound (long timestamp, int duration, int clockRate, int channelCount, float frequency, int amplitude) |
Creates a silent audio buffer with the specified duration, clock rate, channel count, frequency, and amplitude. More... | |
static fm.liveswitch.AudioBuffer | createSound (long timestamp, int duration, fm.liveswitch.AudioConfig config) |
Creates an audio buffer with the specified duration and configuration, a frequency of 440Hz, and an amplitude of 16,384. More... | |
static fm.liveswitch.AudioBuffer | createSound (long timestamp, int duration, fm.liveswitch.AudioConfig config, float frequency) |
Creates a silent audio buffer with the specified duration, configuration, and frequency, and an amplitude of 16,384. More... | |
static fm.liveswitch.AudioBuffer | createSound (long timestamp, int duration, fm.liveswitch.AudioConfig config, float frequency, int amplitude) |
Creates a silent audio buffer with the specified duration, configuration, frequency, and amplitude. More... | |
static fm.liveswitch.AudioBuffer | fromJson (String audioBufferJson) |
Deserializes an instance from JSON. More... | |
static fm.liveswitch.AudioBuffer[] | fromJsonArray (String audioBuffersJson) |
Deserializes an array of instances from JSON. More... | |
static int | getMinimumBufferLength (int duration, int clockRate, int channelCount) |
Gets the minimum data buffer length for a given duration, clock rate, and channel count. More... | |
static int | getMinimumBufferLength (int duration, fm.liveswitch.AudioConfig config) |
Gets the minimum data buffer length for a given duration and configuration. More... | |
static String | toJson (final fm.liveswitch.AudioBuffer audioBuffer) |
Serializes an instance to JSON. More... | |
static String | toJsonArray (fm.liveswitch.AudioBuffer[] audioBuffers) |
Serializes an array of instances to JSON. More... | |
Protected Member Functions | |
AudioBuffer () | |
Initializes a new instance of the fm.liveswitch.AudioBuffer class. More... | |
fm.liveswitch.AudioBuffer | createInstance () |
Creates a new instance. More... | |
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... | |
An audio buffer.
|
protected |
Initializes a new instance of the fm.liveswitch.AudioBuffer class.
fm.liveswitch.AudioBuffer.AudioBuffer | ( | fm.liveswitch.DataBuffer | dataBuffer, |
fm.liveswitch.AudioFormat | format | ||
) |
Initializes a new instance of the fm.liveswitch.AudioBuffer class.
dataBuffer | The data buffer. |
format | The format. |
fm.liveswitch.AudioBuffer.AudioBuffer | ( | fm.liveswitch.DataBuffer[] | dataBuffers, |
fm.liveswitch.AudioFormat | format | ||
) |
Initializes a new instance of the fm.liveswitch.AudioBuffer class.
dataBuffers | The data buffers. |
format | The format. |
void fm.liveswitch.AudioBuffer.applyGain | ( | double | gain | ) |
Applies gain to this instance.
gain | The gain. |
double fm.liveswitch.AudioBuffer.calculateLevel | ( | ) |
Calculates the level of this instance.
fm.liveswitch.AudioBuffer fm.liveswitch.AudioBuffer.clone | ( | ) |
Clones this instance.
|
protected |
Creates a new instance.
Reimplemented in fm.liveswitch.PacketizedAudioBuffer.
|
static |
Creates a silent audio buffer with the specified duration and configuration.
duration | The duration in milliseconds. |
config | The configuration. |
|
static |
Creates a silent audio buffer with the specified duration, clock rate, and channel count.
duration | The duration in milliseconds. |
clockRate | The clock rate. |
channelCount | The channel count. |
|
static |
Creates an audio buffer with the specified duration and configuration, a frequency of 440Hz, and an amplitude of 16,384.
timestamp | The starting time of this buffer relative to the clock rate. |
duration | The duration in milliseconds. |
config | The configuration. |
|
static |
Creates a silent audio buffer with the specified duration, configuration, and frequency, and an amplitude of 16,384.
timestamp | The starting time of this buffer relative to the clock rate. |
duration | The duration in milliseconds. |
config | The configuration. |
frequency | The frequency. |
|
static |
Creates a silent audio buffer with the specified duration, configuration, frequency, and amplitude.
timestamp | The starting time of this buffer relative to the clock rate. |
duration | The duration in milliseconds. |
config | The configuration. |
frequency | The frequency. |
amplitude | The amplitude. |
|
static |
Creates an audio buffer with the specified duration, clock rate, and channel count, a frequency of 440Hz, and an amplitude of 16,384.
timestamp | The starting time of this buffer relative to the clock rate. |
duration | The duration in milliseconds. |
clockRate | The clock rate. |
channelCount | The channel count. |
|
static |
Creates a silent audio buffer with the specified duration, clock rate, channel count, and frequency, and an amplitude of 16,384.
timestamp | The starting time of this buffer relative to the clock rate. |
duration | The duration in milliseconds. |
clockRate | The clock rate. |
channelCount | The channel count. |
frequency | The frequency. |
|
static |
Creates a silent audio buffer with the specified duration, clock rate, channel count, frequency, and amplitude.
timestamp | The starting time of this buffer relative to the clock rate. |
duration | The duration in milliseconds. |
clockRate | The clock rate. |
channelCount | The channel count. |
frequency | The frequency. |
amplitude | The amplitude. |
|
static |
Deserializes an instance from JSON.
audioBufferJson | The audio buffer JSON. |
|
static |
Deserializes an array of instances from JSON.
audioBuffersJson | The audio buffers JSON. |
double fm.liveswitch.AudioBuffer.getGain | ( | ) |
Gets the gain.
boolean fm.liveswitch.AudioBuffer.getGeneratedByPlc | ( | ) |
Gets a value indicating whether this buffer contains data generated by packet loss concealment (PLC).
boolean fm.liveswitch.AudioBuffer.getIsDtmf | ( | ) |
Gets a value indicating whether this buffer has DTMF data.
boolean fm.liveswitch.AudioBuffer.getIsL16 | ( | ) |
Gets a value indicating whether this buffer has L16 audio.
boolean fm.liveswitch.AudioBuffer.getIsMuted | ( | ) |
Gets a value indicating whether this instance has been muted.
boolean fm.liveswitch.AudioBuffer.getIsOpus | ( | ) |
Gets a value indicating whether this buffer has Opus audio.
boolean fm.liveswitch.AudioBuffer.getIsPcm | ( | ) |
Gets a value indicating whether this buffer has raw PCM audio.
boolean fm.liveswitch.AudioBuffer.getIsPcma | ( | ) |
Gets a value indicating whether this buffer has PCMA audio.
boolean fm.liveswitch.AudioBuffer.getIsPcmu | ( | ) |
Gets a value indicating whether this buffer has PCMU audio.
|
static |
Gets the minimum data buffer length for a given duration and configuration.
duration | The duration. |
config | The configuration. |
|
static |
Gets the minimum data buffer length for a given duration, clock rate, and channel count.
duration | The duration. |
clockRate | The clock rate. |
channelCount | The channel count. |
boolean fm.liveswitch.AudioBuffer.mute | ( | ) |
Mutes this instance.
This is a one-way operation that clears the underlying data buffer.
void fm.liveswitch.AudioBuffer.setGeneratedByPlc | ( | boolean | value | ) |
Sets a value indicating whether this buffer contains data generated by packet loss concealment (PLC).
String fm.liveswitch.AudioBuffer.toJson | ( | ) |
Serializes this instance to JSON.
|
static |
Serializes an instance to JSON.
audioBuffer | The audio buffer. |
|
static |
Serializes an array of instances to JSON.
audioBuffers | The audio buffers. |