Package com.amazonaws.ivs.broadcast
Class AudioSource
java.lang.Object
com.amazonaws.ivs.broadcast.Device
com.amazonaws.ivs.broadcast.AudioDevice
com.amazonaws.ivs.broadcast.AudioSource
- Direct Known Subclasses:
CustomAudioSource
Use AudioSource as a generic source to send app-generated audio to the SDK in LPCM format.
See also
Session.createAudioInputSource(int, BroadcastConfiguration.AudioSampleRate, Format)
-
Nested Class Summary
Nested classes/interfaces inherited from class com.amazonaws.ivs.broadcast.AudioDevice
AudioDevice.Format, AudioDevice.StatsCallback
Nested classes/interfaces inherited from class com.amazonaws.ivs.broadcast.Device
Device.Descriptor
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Device.Descriptor
protected long
protected final String
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
appendBuffer
(long handle, ByteBuffer buffer, long count, long presentationTimeUs) int
appendBuffer
(ByteBuffer buffer, long count, long presentationTimeUs) Append an audio buffer.From Devicelong
getTag()
boolean
isValid()
protected void
setConfiguration
(long handle, int channels, int sampleRate, int format) protected void
setGain
(long handle, float gain) void
Set the input gainvoid
setStatsCallback
(AudioDevice.StatsCallback callback) Set a callback to receive audio stats for this device.
-
Field Details
-
descriptor
-
handle
protected long handle -
tag
-
-
Method Details
-
setGain
Description copied from class:AudioDevice
Set the input gain- Specified by:
setGain
in classAudioDevice
- 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
Description copied from class:AudioDevice
Append an audio buffer. This can only be used withDevice.Descriptor.DeviceType.USER_AUDIO
- Specified by:
appendBuffer
in classAudioDevice
- 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
-
getDescriptor
From Device- Specified by:
getDescriptor
in classDevice
-
isValid
public boolean isValid() -
getTag
-
setStatsCallback
Description copied from class:AudioDevice
Set a callback to receive audio stats for this device. This will be called on the main thread.- Specified by:
setStatsCallback
in classAudioDevice
- Parameters:
callback
- A callback lambda that takes two floats: peak and rms.
-
getHandle
public long getHandle() -
setGain
protected void setGain(long handle, float gain) -
setConfiguration
protected void setConfiguration(long handle, int channels, int sampleRate, int format) -
appendBuffer
-