FMLiveSwitchAudioBuffer Class Reference

An audio buffer. More...

Instance Methods

(void) - applyGain:
 Applies gain to this instance. More...
 
(double) - calculateLevel
 Calculates the level of this instance. More...
 
(FMLiveSwitchAudioBuffer *) - clone
 Clones this instance. More...
 
(FMLiveSwitchAudioBuffer *) - createInstance
 Creates a new instance. More...
 
(double) - gain
 Gets the gain. More...
 
(bool) - generatedByPlc
 Gets a value indicating whether this buffer contains data generated by packet loss concealment (PLC). More...
 
(instancetype) - init
 Initializes a new instance of the FMLiveSwitchAudioBuffer class. More...
 
(instancetype) - initWithDataBuffer:format:
 Initializes a new instance of the FMLiveSwitchAudioBuffer class. More...
 
(instancetype) - initWithDataBuffers:format:
 Initializes a new instance of the FMLiveSwitchAudioBuffer class. More...
 
(bool) - isDtmf
 Gets a value indicating whether this buffer has DTMF data. More...
 
(bool) - isL16
 Gets a value indicating whether this buffer has L16 audio. More...
 
(bool) - isMuted
 Gets a value indicating whether this instance has been muted. More...
 
(bool) - isOpus
 Gets a value indicating whether this buffer has Opus audio. More...
 
(bool) - isPcm
 Gets a value indicating whether this buffer has raw PCM audio. More...
 
(bool) - isPcma
 Gets a value indicating whether this buffer has PCMA audio. More...
 
(bool) - isPcmu
 Gets a value indicating whether this buffer has PCMU audio. More...
 
(bool) - mute
 Mutes this instance. More...
 
(void) - setGeneratedByPlc:
 Sets a value indicating whether this buffer contains data generated by packet loss concealment (PLC). More...
 
(NSString *) - toJson
 Serializes this instance to JSON. More...
 
- Instance Methods inherited from FMLiveSwitchMediaBuffer
(FMLiveSwitchDataBuffer *) - dataBuffer
 Gets the data buffer. More...
 
(NSMutableArray *) - dataBuffers
 Gets the data buffers. More...
 
(NSString *) - description
 Returns a string that represents this instance. More...
 
(int) - footprint
 Gets the approximate footprint of this media buffer by returning the sum of its data buffer lengths. More...
 
(TFormat) - format
 Gets the format. More...
 
(TBuffer) - free
 Frees the data buffers referenced by this instance. More...
 
(instancetype) - initWithDataBuffer:format:
 Initializes a new instance of the FMLiveSwitchMediaBuffer`2 class. More...
 
(instancetype) - initWithDataBuffers:format:
 Initializes a new instance of the FMLiveSwitchMediaBuffer`2 class. More...
 
(TBuffer) - keep
 Keeps the data buffers referenced by this instance. More...
 
(long long) - lastSequenceNumber
 Gets the last sequence number. More...
 
(bool) - recoveredByFec
 Gets a value indicating whether this buffer contains data recovered by forward error correction (FEC). More...
 
(FMLiveSwitchRtpPacketHeader *) - rtpHeader
 Gets the Rtp Packet Header for this media buffer. More...
 
(NSMutableArray *) - rtpHeaders
 Gets the RTP Packet Headers for this media buffer. More...
 
(int) - rtpSequenceNumber
 Gets the RTP sequence number. More...
 
(NSMutableArray *) - rtpSequenceNumbers
 Gets the RTP sequence numbers. More...
 
(long long) - sequenceNumber
 Gets the sequence number. More...
 
(NSMutableArray *) - sequenceNumbers
 Gets the sequence numbers. More...
 
(void) - setDataBuffer:
 Sets the data buffer. More...
 
(void) - setDataBuffers:
 Sets the data buffers. More...
 
(void) - setFormat:
 Sets the format. More...
 
(void) - setRecoveredByFec:
 Sets a value indicating whether this buffer contains data recovered by forward error correction (FEC). More...
 
(void) - setRtpHeader:
 Sets the Rtp Packet Header for this media buffer. More...
 
(void) - setRtpHeaders:
 Sets the RTP Packet Headers for this media buffer. More...
 
(void) - setSequenceNumber:
 Sets the sequence number. More...
 
(void) - setSequenceNumbers:
 Sets the sequence numbers. More...
 
(void) - setSourceId:
 Sets the source identifier. More...
 
(NSString *) - sourceId
 Gets the source identifier. More...
 
(bool) - tryKeep
 Attempts to keep the data buffers referenced by this instance. More...
 

Class Methods

(FMLiveSwitchAudioBuffer *) + audioBuffer
 Initializes a new instance of the FMLiveSwitchAudioBuffer class. More...
 
(FMLiveSwitchAudioBuffer *) + audioBufferWithDataBuffer:format:
 Initializes a new instance of the FMLiveSwitchAudioBuffer class. More...
 
(FMLiveSwitchAudioBuffer *) + audioBufferWithDataBuffers:format:
 Initializes a new instance of the FMLiveSwitchAudioBuffer class. More...
 
(FMLiveSwitchAudioBuffer *) + createSilenceWithDuration:clockRate:channelCount:
 Creates a silent audio buffer with the specified duration, clock rate, and channel count. More...
 
(FMLiveSwitchAudioBuffer *) + createSilenceWithDuration:config:
 Creates a silent audio buffer with the specified duration and configuration. More...
 
(FMLiveSwitchAudioBuffer *) + createSoundWithTimestamp:duration:clockRate: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...
 
(FMLiveSwitchAudioBuffer *) + createSoundWithTimestamp:duration:clockRate:channelCount:frequency:
 Creates a silent audio buffer with the specified duration, clock rate, channel count, and frequency, and an amplitude of 16,384. More...
 
(FMLiveSwitchAudioBuffer *) + createSoundWithTimestamp:duration:clockRate:channelCount:frequency:amplitude:
 Creates a silent audio buffer with the specified duration, clock rate, channel count, frequency, and amplitude. More...
 
(FMLiveSwitchAudioBuffer *) + createSoundWithTimestamp:duration:config:
 Creates an audio buffer with the specified duration and configuration, a frequency of 440Hz, and an amplitude of 16,384. More...
 
(FMLiveSwitchAudioBuffer *) + createSoundWithTimestamp:duration:config:frequency:
 Creates a silent audio buffer with the specified duration, configuration, and frequency, and an amplitude of 16,384. More...
 
(FMLiveSwitchAudioBuffer *) + createSoundWithTimestamp:duration:config:frequency:amplitude:
 Creates a silent audio buffer with the specified duration, configuration, frequency, and amplitude. More...
 
(NSMutableArray *) + fromJsonArrayWithAudioBuffersJson:
 Deserializes an array of instances from JSON. More...
 
(FMLiveSwitchAudioBuffer *) + fromJsonWithAudioBufferJson:
 Deserializes an instance from JSON. More...
 
(int) + getMinimumBufferLengthWithDuration:clockRate:channelCount:
 Gets the minimum data buffer length for a given duration, clock rate, and channel count. More...
 
(int) + getMinimumBufferLengthWithDuration:config:
 Gets the minimum data buffer length for a given duration and configuration. More...
 
(NSString *) + toJsonArrayWithAudioBuffers:
 Serializes an array of instances to JSON. More...
 
(NSString *) + toJsonWithAudioBuffer:
 Serializes an instance to JSON. More...
 
- Class Methods inherited from FMLiveSwitchMediaBuffer
(FMLiveSwitchMediaBuffer *) + mediaBuffer
 Initializes a new instance of the FMLiveSwitchMediaBuffer`2 class. More...
 
(FMLiveSwitchMediaBuffer *) + mediaBufferWithDataBuffer:format:
 Initializes a new instance of the FMLiveSwitchMediaBuffer`2 class. More...
 
(FMLiveSwitchMediaBuffer *) + mediaBufferWithDataBuffers:format:
 Initializes a new instance of the FMLiveSwitchMediaBuffer`2 class. More...
 

Additional Inherited Members

- Protected Attributes inherited from FMLiveSwitchMediaBuffer
 __pad0__: FMLiveSwitchDynamic- (TBuffer) clone
 

Detailed Description

An audio buffer.

Method Documentation

◆ applyGain:

- (void) applyGain: (double)  gain

Applies gain to this instance.

Parameters
gainThe gain.

◆ audioBuffer

+ (FMLiveSwitchAudioBuffer*) audioBuffer

Initializes a new instance of the FMLiveSwitchAudioBuffer class.

◆ audioBufferWithDataBuffer:format:

+ (FMLiveSwitchAudioBuffer*) audioBufferWithDataBuffer: (FMLiveSwitchDataBuffer *)  dataBuffer
format: (FMLiveSwitchAudioFormat *)  format 

Initializes a new instance of the FMLiveSwitchAudioBuffer class.

Parameters
dataBufferThe data buffer.
formatThe format.

◆ audioBufferWithDataBuffers:format:

+ (FMLiveSwitchAudioBuffer*) audioBufferWithDataBuffers: (NSMutableArray *)  dataBuffers
format: (FMLiveSwitchAudioFormat *)  format 

Initializes a new instance of the FMLiveSwitchAudioBuffer class.

Parameters
dataBuffersThe data buffers.
formatThe format.

◆ calculateLevel

- (double) calculateLevel

Calculates the level of this instance.

◆ clone

Clones this instance.

◆ createInstance

- (FMLiveSwitchAudioBuffer*) createInstance

Creates a new instance.

Implements FMLiveSwitchMediaBuffer.

Implemented in FMLiveSwitchPacketizedAudioBuffer.

◆ createSilenceWithDuration:clockRate:channelCount:

+ (FMLiveSwitchAudioBuffer*) createSilenceWithDuration: (int)  duration
clockRate: (int)  clockRate
channelCount: (int)  channelCount 

Creates a silent audio buffer with the specified duration, clock rate, and channel count.

Parameters
durationThe duration in milliseconds.
clockRateThe clock rate.
channelCountThe channel count.

◆ createSilenceWithDuration:config:

+ (FMLiveSwitchAudioBuffer*) createSilenceWithDuration: (int)  duration
config: (FMLiveSwitchAudioConfig *)  config 

Creates a silent audio buffer with the specified duration and configuration.

Parameters
durationThe duration in milliseconds.
configThe configuration.

◆ createSoundWithTimestamp:duration:clockRate:channelCount:

+ (FMLiveSwitchAudioBuffer*) createSoundWithTimestamp: (long long)  timestamp
duration: (int)  duration
clockRate: (int)  clockRate
channelCount: (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.

Parameters
timestampThe starting time of this buffer relative to the clock rate.
durationThe duration in milliseconds.
clockRateThe clock rate.
channelCountThe channel count.

◆ createSoundWithTimestamp:duration:clockRate:channelCount:frequency:

+ (FMLiveSwitchAudioBuffer*) createSoundWithTimestamp: (long long)  timestamp
duration: (int)  duration
clockRate: (int)  clockRate
channelCount: (int)  channelCount
frequency: (float)  frequency 

Creates a silent audio buffer with the specified duration, clock rate, channel count, and frequency, and an amplitude of 16,384.

Parameters
timestampThe starting time of this buffer relative to the clock rate.
durationThe duration in milliseconds.
clockRateThe clock rate.
channelCountThe channel count.
frequencyThe frequency.

◆ createSoundWithTimestamp:duration:clockRate:channelCount:frequency:amplitude:

+ (FMLiveSwitchAudioBuffer*) createSoundWithTimestamp: (long long)  timestamp
duration: (int)  duration
clockRate: (int)  clockRate
channelCount: (int)  channelCount
frequency: (float)  frequency
amplitude: (int)  amplitude 

Creates a silent audio buffer with the specified duration, clock rate, channel count, frequency, and amplitude.

Parameters
timestampThe starting time of this buffer relative to the clock rate.
durationThe duration in milliseconds.
clockRateThe clock rate.
channelCountThe channel count.
frequencyThe frequency.
amplitudeThe amplitude.

◆ createSoundWithTimestamp:duration:config:

+ (FMLiveSwitchAudioBuffer*) createSoundWithTimestamp: (long long)  timestamp
duration: (int)  duration
config: (FMLiveSwitchAudioConfig *)  config 

Creates an audio buffer with the specified duration and configuration, a frequency of 440Hz, and an amplitude of 16,384.

Parameters
timestampThe starting time of this buffer relative to the clock rate.
durationThe duration in milliseconds.
configThe configuration.

◆ createSoundWithTimestamp:duration:config:frequency:

+ (FMLiveSwitchAudioBuffer*) createSoundWithTimestamp: (long long)  timestamp
duration: (int)  duration
config: (FMLiveSwitchAudioConfig *)  config
frequency: (float)  frequency 

Creates a silent audio buffer with the specified duration, configuration, and frequency, and an amplitude of 16,384.

Parameters
timestampThe starting time of this buffer relative to the clock rate.
durationThe duration in milliseconds.
configThe configuration.
frequencyThe frequency.

◆ createSoundWithTimestamp:duration:config:frequency:amplitude:

+ (FMLiveSwitchAudioBuffer*) createSoundWithTimestamp: (long long)  timestamp
duration: (int)  duration
config: (FMLiveSwitchAudioConfig *)  config
frequency: (float)  frequency
amplitude: (int)  amplitude 

Creates a silent audio buffer with the specified duration, configuration, frequency, and amplitude.

Parameters
timestampThe starting time of this buffer relative to the clock rate.
durationThe duration in milliseconds.
configThe configuration.
frequencyThe frequency.
amplitudeThe amplitude.

◆ fromJsonArrayWithAudioBuffersJson:

+ (NSMutableArray*) fromJsonArrayWithAudioBuffersJson: (NSString *)  audioBuffersJson

Deserializes an array of instances from JSON.

Parameters
audioBuffersJsonThe audio buffers JSON.

◆ fromJsonWithAudioBufferJson:

+ (FMLiveSwitchAudioBuffer*) fromJsonWithAudioBufferJson: (NSString *)  audioBufferJson

Deserializes an instance from JSON.

Parameters
audioBufferJsonThe audio buffer JSON.

◆ gain

- (double) gain

Gets the gain.

◆ generatedByPlc

- (bool) generatedByPlc

Gets a value indicating whether this buffer contains data generated by packet loss concealment (PLC).

◆ getMinimumBufferLengthWithDuration:clockRate:channelCount:

+ (int) getMinimumBufferLengthWithDuration: (int)  duration
clockRate: (int)  clockRate
channelCount: (int)  channelCount 

Gets the minimum data buffer length for a given duration, clock rate, and channel count.

Parameters
durationThe duration.
clockRateThe clock rate.
channelCountThe channel count.

◆ getMinimumBufferLengthWithDuration:config:

+ (int) getMinimumBufferLengthWithDuration: (int)  duration
config: (FMLiveSwitchAudioConfig *)  config 

Gets the minimum data buffer length for a given duration and configuration.

Parameters
durationThe duration.
configThe configuration.

◆ init

- (instancetype) init

Initializes a new instance of the FMLiveSwitchAudioBuffer class.

Implements FMLiveSwitchMediaBuffer.

◆ initWithDataBuffer:format:

- (instancetype) initWithDataBuffer: (FMLiveSwitchDataBuffer *)  dataBuffer
format: (FMLiveSwitchAudioFormat *)  format 

Initializes a new instance of the FMLiveSwitchAudioBuffer class.

Parameters
dataBufferThe data buffer.
formatThe format.

◆ initWithDataBuffers:format:

- (instancetype) initWithDataBuffers: (NSMutableArray *)  dataBuffers
format: (FMLiveSwitchAudioFormat *)  format 

Initializes a new instance of the FMLiveSwitchAudioBuffer class.

Parameters
dataBuffersThe data buffers.
formatThe format.

◆ isDtmf

- (bool) isDtmf

Gets a value indicating whether this buffer has DTMF data.

◆ isL16

- (bool) isL16

Gets a value indicating whether this buffer has L16 audio.

◆ isMuted

- (bool) isMuted

Gets a value indicating whether this instance has been muted.

Implements FMLiveSwitchMediaBuffer.

◆ isOpus

- (bool) isOpus

Gets a value indicating whether this buffer has Opus audio.

◆ isPcm

- (bool) isPcm

Gets a value indicating whether this buffer has raw PCM audio.

◆ isPcma

- (bool) isPcma

Gets a value indicating whether this buffer has PCMA audio.

◆ isPcmu

- (bool) isPcmu

Gets a value indicating whether this buffer has PCMU audio.

◆ mute

- (bool) mute

Mutes this instance.

This is a one-way operation that clears the underlying data buffer.

Implements FMLiveSwitchMediaBuffer.

◆ setGeneratedByPlc:

- (void) setGeneratedByPlc: (bool)  value

Sets a value indicating whether this buffer contains data generated by packet loss concealment (PLC).

◆ toJson

- (NSString*) toJson

Serializes this instance to JSON.

◆ toJsonArrayWithAudioBuffers:

+ (NSString*) toJsonArrayWithAudioBuffers: (NSMutableArray *)  audioBuffers

Serializes an array of instances to JSON.

Parameters
audioBuffersThe audio buffers.

◆ toJsonWithAudioBuffer:

+ (NSString*) toJsonWithAudioBuffer: (FMLiveSwitchAudioBuffer *)  audioBuffer

Serializes an instance to JSON.

Parameters
audioBufferThe audio buffer.