public static class AudioMixingRule.Builder extends Object
AudioMixingRule
objectsConstructor and Description |
---|
Builder()
Constructs a new Builder with no rules.
|
Modifier and Type | Method and Description |
---|---|
AudioMixingRule.Builder |
addMixRule(int rule,
Object property)
Add a rule for the selection of which streams are mixed together.
|
AudioMixingRule.Builder |
addRule(AudioAttributes attrToMatch,
int rule)
Add a rule for the selection of which streams are mixed together.
|
AudioMixingRule |
build()
Combines all of the matching and exclusion rules that have been set and return a new
AudioMixingRule object. |
AudioMixingRule.Builder |
excludeMixRule(int rule,
Object property)
Add a rule by exclusion for the selection of which streams are mixed together.
|
AudioMixingRule.Builder |
excludeRule(AudioAttributes attrToMatch,
int rule)
Add a rule by exclusion for the selection of which streams are mixed together.
|
public AudioMixingRule.Builder addRule(AudioAttributes attrToMatch, int rule) throws IllegalArgumentException
attrToMatch
- a non-null AudioAttributes instance for which a contradictory
rule hasn't been set yet.rule
- AudioMixingRule.RULE_MATCH_ATTRIBUTE_USAGE
or
AudioMixingRule.RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET
.IllegalArgumentException
#excludeRule(AudioAttributes, int)}
public AudioMixingRule.Builder excludeRule(AudioAttributes attrToMatch, int rule) throws IllegalArgumentException
AudioAttributes mediaAttr = new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_MEDIA) .build(); AudioMixingRule noMediaRule = new AudioMixingRule.Builder() .excludeRule(mediaAttr, AudioMixingRule.RULE_MATCH_ATTRIBUTE_USAGE) .build();
attrToMatch
- a non-null AudioAttributes instance for which a contradictory
rule hasn't been set yet.rule
- AudioMixingRule.RULE_MATCH_ATTRIBUTE_USAGE
or
AudioMixingRule.RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET
.IllegalArgumentException
#addRule(AudioAttributes, int)}
public AudioMixingRule.Builder addMixRule(int rule, Object property) throws IllegalArgumentException
rule
- one of AudioMixingRule.RULE_MATCH_ATTRIBUTE_USAGE
,
AudioMixingRule.RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET
or
AudioMixingRule.RULE_MATCH_UID
.property
- see the definition of each rule for the type to use (either an
AudioAttributes
or an Integer
).IllegalArgumentException
#excludeMixRule(int, Object)}
public AudioMixingRule.Builder excludeMixRule(int rule, Object property) throws IllegalArgumentException
AudioAttributes mediaAttr = new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_MEDIA) .build(); AudioMixingRule noMediaRule = new AudioMixingRule.Builder() .addMixRule(AudioMixingRule.RULE_MATCH_ATTRIBUTE_USAGE, mediaAttr) .excludeMixRule(AudioMixingRule.RULE_MATCH_UID, new Integer(uidToExclude) .build();
rule
- one of AudioMixingRule.RULE_MATCH_ATTRIBUTE_USAGE
,
AudioMixingRule.RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET
or
AudioMixingRule.RULE_MATCH_UID
.property
- see the definition of each rule for the type to use (either an
AudioAttributes
or an Integer
).IllegalArgumentException
public AudioMixingRule build()
AudioMixingRule
object.AudioMixingRule
object