Package org.robolectric.shadows
Class ShadowAudioSystem
java.lang.Object
org.robolectric.shadows.ShadowAudioSystem
@Implements(value=android.media.AudioSystem.class,
isInAndroidSdk=false)
public class ShadowAudioSystem
extends Object
Shadow for
AudioSystem
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static int
getDirectPlaybackSupport
(AudioFormat format, AudioAttributes attr) Retrieves the stored direct playback support for theAudioFormat
andAudioAttributes
.protected static int
protected static int
native_get_offload_support
(int encoding, int sampleRate, int channelMask, int channelIndexMask, int streamType) protected static int
protected static int
protected static int
protected static boolean
native_is_offload_supported
(int encoding, int sampleRate, int channelMask, int channelIndexMask, int streamType) static void
reset()
static void
setDirectPlaybackSupport
(AudioFormat format, AudioAttributes attr, int directPlaybackSupport) Sets direct playback support for a key-pair ofAudioFormat
andAudioAttributes
.static void
setOffloadPlaybackSupport
(AudioFormat format, AudioAttributes attr, int offloadSupport) Sets offload playback support for a key-pair ofAudioFormat
andAudioAttributes
.static void
setOffloadSupported
(AudioFormat format, AudioAttributes attr, boolean supported) Sets whether offload playback is supported for a key-pair ofAudioFormat
andAudioAttributes
.
-
Constructor Details
-
ShadowAudioSystem
public ShadowAudioSystem()
-
-
Method Details
-
native_getMaxChannelCount
-
native_getMaxSampleRate
-
native_getMinSampleRate
-
native_get_FCC_8
-
setDirectPlaybackSupport
public static void setDirectPlaybackSupport(AudioFormat format, AudioAttributes attr, int directPlaybackSupport) Sets direct playback support for a key-pair ofAudioFormat
andAudioAttributes
. As a result, callinggetDirectPlaybackSupport(android.media.AudioFormat, android.media.AudioAttributes)
with the same pair ofAudioFormat
andAudioAttributes
values will return the cached support value.- Parameters:
format
- the audio format (codec, sample rate, channels)attr
- theAudioAttributes
to be used for playbackdirectPlaybackSupport
- the level of direct playback support to save for the format and attribute pair. Must be one ofAudioSystem.DIRECT_NOT_SUPPORTED
,AudioSystem.OFFLOAD_NOT_SUPPORTED
,AudioSystem.OFFLOAD_SUPPORTED
,AudioSystem.OFFLOAD_GAPLESS_SUPPORTED
, or a combination ofAudioSystem.DIRECT_OFFLOAD_SUPPORTED
,AudioSystem.DIRECT_OFFLOAD_GAPLESS_SUPPORTED
andAudioSystem.DIRECT_BITSTREAM_SUPPORTED
-
getDirectPlaybackSupport
@Implementation(minSdk=33) protected static int getDirectPlaybackSupport(AudioFormat format, AudioAttributes attr) Retrieves the stored direct playback support for theAudioFormat
andAudioAttributes
. If no value was stored for the key-pair thenAudioSystem.DIRECT_NOT_SUPPORTED
is returned.- Parameters:
format
- the audio format (codec, sample rate, channels) to be used for playbackattr
- theAudioAttributes
to be used for playback- Returns:
- the level of direct playback playback support for the format and attributes.
-
setOffloadPlaybackSupport
public static void setOffloadPlaybackSupport(AudioFormat format, AudioAttributes attr, int offloadSupport) Sets offload playback support for a key-pair ofAudioFormat
andAudioAttributes
. As a result, callingAudioSystem.getOffloadSupport(android.media.AudioFormat, android.media.AudioAttributes)
with the same pair ofAudioFormat
andAudioAttributes
values will return the cached support value.- Parameters:
format
- the audio format (codec, sample rate, channels)attr
- theAudioAttributes
to be used for playbackoffloadSupport
- the level of offload playback support to save for the format and attribute pair. Must be one ofAudioSystem.OFFLOAD_NOT_SUPPORTED
,AudioSystem.OFFLOAD_SUPPORTED
orAudioSystem.OFFLOAD_GAPLESS_SUPPORTED
.
-
setOffloadSupported
Sets whether offload playback is supported for a key-pair ofAudioFormat
andAudioAttributes
. As a result, callingAudioSystem#isOffloadSupported
with the same pair ofAudioFormat
andAudioAttributes
values will returnsupported
.- Parameters:
format
- the audio format (codec, sample rate, channels)attr
- theAudioAttributes
to be used for playback
-
native_is_offload_supported
@Implementation(minSdk=29, maxSdk=30) protected static boolean native_is_offload_supported(int encoding, int sampleRate, int channelMask, int channelIndexMask, int streamType) -
native_get_offload_support
@Implementation(minSdk=31) protected static int native_get_offload_support(int encoding, int sampleRate, int channelMask, int channelIndexMask, int streamType) -
reset
-