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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static intgetDirectPlaybackSupport(AudioFormat format, AudioAttributes attr) Retrieves the stored direct playback support for theAudioFormatandAudioAttributes.protected static intgetDirectPlaybackSupport(AudioFormat format, AudioAttributes attr, int uid) Retrieves the stored direct playback support for theAudioFormatandAudioAttributes(uidis ignored).protected static intprotected static intnative_get_offload_support(int encoding, int sampleRate, int channelMask, int channelIndexMask, int streamType) protected static intnative_get_offload_support(int encoding, int sampleRate, Object channelMasks, int streamType) protected static intprotected static intprotected static intprotected static booleannative_is_offload_supported(int encoding, int sampleRate, int channelMask, int channelIndexMask, int streamType) static voidreset()static voidsetDirectPlaybackSupport(AudioFormat format, AudioAttributes attr, int directPlaybackSupport) Sets direct playback support for a key-pair ofAudioFormatandAudioAttributes.static voidsetOffloadPlaybackSupport(AudioFormat format, AudioAttributes attr, int offloadSupport) Sets offload playback support for a key-pair ofAudioFormatandAudioAttributes.static voidsetOffloadSupported(AudioFormat format, AudioAttributes attr, boolean supported) Sets whether offload playback is supported for a key-pair ofAudioFormatandAudioAttributes.
-
Constructor Details
-
ShadowAudioSystem
public ShadowAudioSystem()
-
-
Method Details
-
native_getMaxChannelCount
-
native_getMaxSampleRate
-
native_getMinSampleRate
-
native_get_FCC_8
-
setDirectPlaybackSupport
public static void setDirectPlaybackSupport(@Nonnull AudioFormat format, @Nonnull AudioAttributes attr, int directPlaybackSupport) Sets direct playback support for a key-pair ofAudioFormatandAudioAttributes. As a result, callinggetDirectPlaybackSupport(android.media.AudioFormat, android.media.AudioAttributes)with the same pair ofAudioFormatandAudioAttributesvalues will return the cached support value.- Parameters:
format- the audio format (codec, sample rate, channels)attr- theAudioAttributesto 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_SUPPORTEDandAudioSystem.DIRECT_BITSTREAM_SUPPORTED
-
getDirectPlaybackSupport
@Implementation(minSdk=33, maxSdk=36) protected static int getDirectPlaybackSupport(@Nonnull AudioFormat format, @Nonnull AudioAttributes attr) Retrieves the stored direct playback support for theAudioFormatandAudioAttributes. If no value was stored for the key-pair thenAudioSystem.DIRECT_NOT_SUPPORTEDis returned.- Parameters:
format- the audio format (codec, sample rate, channels) to be used for playbackattr- theAudioAttributesto be used for playback- Returns:
- the level of direct playback playback support for the format and attributes.
-
getDirectPlaybackSupport
@Implementation(minSdk=37) protected static int getDirectPlaybackSupport(@Nonnull AudioFormat format, @Nonnull AudioAttributes attr, int uid) Retrieves the stored direct playback support for theAudioFormatandAudioAttributes(uidis ignored). If no value was stored for the key-pair thenAudioSystem.DIRECT_NOT_SUPPORTEDis returned.- Parameters:
format- the audio format (codec, sample rate, channels) to be used for playbackattr- theAudioAttributesto be used for playbackuid- the uid of the client to be used for playback (ignored by this shadow)- Returns:
- the level of direct playback playback support for the format and attributes.
-
setOffloadPlaybackSupport
public static void setOffloadPlaybackSupport(@Nonnull AudioFormat format, @Nonnull AudioAttributes attr, int offloadSupport) Sets offload playback support for a key-pair ofAudioFormatandAudioAttributes. As a result, callingAudioSystem.getOffloadSupport(android.media.AudioFormat, android.media.AudioAttributes)with the same pair ofAudioFormatandAudioAttributesvalues will return the cached support value.- Parameters:
format- the audio format (codec, sample rate, channels)attr- theAudioAttributesto 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_SUPPORTEDorAudioSystem.OFFLOAD_GAPLESS_SUPPORTED.
-
setOffloadSupported
public static void setOffloadSupported(@Nonnull AudioFormat format, @Nonnull AudioAttributes attr, boolean supported) Sets whether offload playback is supported for a key-pair ofAudioFormatandAudioAttributes. As a result, callingwith the same pair ofinvalid reference
AudioSystem#isOffloadSupportedAudioFormatandAudioAttributesvalues will returnsupported.- Parameters:
format- the audio format (codec, sample rate, channels)attr- theAudioAttributesto 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, maxSdk=36) protected static int native_get_offload_support(int encoding, int sampleRate, int channelMask, int channelIndexMask, int streamType) -
native_get_offload_support
@Implementation(minSdk=37) protected static int native_get_offload_support(int encoding, int sampleRate, Object channelMasks, int streamType) -
reset
-