Package com.amazonaws.ivs.broadcast
Class AudioDevice
java.lang.Object
com.amazonaws.ivs.broadcast.Device
com.amazonaws.ivs.broadcast.AudioDevice
- Direct Known Subclasses:
AudioSource
Audio input sources must conform to this interface
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAudio data representationsstatic interfaceCallback interface for receiving the raw PCM audio moving through this device.static interfaceNested classes/interfaces inherited from class com.amazonaws.ivs.broadcast.Device
Device.Descriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intappendBuffer(ByteBuffer buffer, long count, long presentationTimeUs) Append an audio buffer.abstract voidSet the input gainabstract voidSet a callback to receive the raw PCM audio buffers as they move through this device.abstract voidsetStatsCallback(AudioDevice.StatsCallback callback) Set a callback to receive audio stats for this device.Methods inherited from class com.amazonaws.ivs.broadcast.Device
getDescriptor, getTag, isValid
-
Constructor Details
-
AudioDevice
public AudioDevice()
-
-
Method Details
-
setGain
Set the input gain- Parameters:
gain- Generally between 0 and 1, but values up to 2 are accepted. Any value over 1 amplifies the signal and may cause clipping.
-
appendBuffer
Append an audio buffer. This can only be used withDevice.Descriptor.DeviceType.USER_AUDIO- Parameters:
buffer- The buffer of audio data to append. This must be allocated as a Direct ByteBuffercount- The number of bytes to usepresentationTimeUs- The presentation time, in microseconds- Returns:
- The number of samples processed
-
setStatsCallback
Set a callback to receive audio stats for this device. This will be called on the main thread.- Parameters:
callback- A callback lambda that takes two floats: peak and rms.
-
setOnPCMBufferCallback
Set a callback to receive the raw PCM audio buffers as they move through this device. The callback fires on the audio thread for lowest latency; it must not block. Pass null to clear.The callback must not call
setOnPCMBufferCallback(com.amazonaws.ivs.broadcast.AudioDevice.PCMBufferCallback)re-entrantly, or a deadlock will occur.- Parameters:
callback- AAudioDevice.PCMBufferCallback, or null to clear.
-