Lines Matching defs:mix

150          * @param mix a non-null {@link AudioMix} to be part of the audio policy.
155 public Builder addMix(@NonNull AudioMix mix) throws IllegalArgumentException {
156 if (mix == null) {
159 mMixes.add(mix);
222 // the AudioPolicy status listener includes updates on each mix activity state
223 for (AudioMix mix : mMixes) {
224 mix.mCallbackFlags |= AudioMix.CALLBACK_FLAG_NOTIFY_ACTIVITY;
273 private void checkMixReadyToUse(AudioMix mix, boolean forTrack)
275 if (mix == null) {
280 if (!mConfig.mMixes.contains(mix)) {
281 throw new IllegalArgumentException("Invalid mix: not part of this policy");
283 if ((mix.getRouteFlags() & AudioMix.ROUTE_FLAG_LOOP_BACK) != AudioMix.ROUTE_FLAG_LOOP_BACK)
287 if (forTrack && (mix.getMixType() != AudioMix.MIX_TYPE_RECORDERS)) {
291 if (!forTrack && (mix.getMixType() != AudioMix.MIX_TYPE_PLAYERS)) {
353 * Audio buffers recorded through the created instance will contain the mix of the audio
355 * @param mix a non-null {@link AudioMix} instance whose routing flags was defined with
363 public AudioRecord createAudioRecordSink(AudioMix mix) throws IllegalArgumentException {
368 checkMixReadyToUse(mix, false/*not for an AudioTrack*/);
369 // create an AudioFormat from the mix format compatible with recording, as the mix
371 AudioFormat mixFormat = new AudioFormat.Builder(mix.getFormat())
373 mix.getFormat().getChannelMask()))
375 // create the AudioRecord, configured for loop back, using the same format as the mix
379 .addTag(addressForTag(mix))
382 AudioRecord.getMinBufferSize(mix.getFormat().getSampleRate(),
384 AudioFormat.CHANNEL_IN_STEREO, mix.getFormat().getEncoding()),
392 * Audio buffers played through the created instance will be sent to the given mix
394 * @param mix a non-null {@link AudioMix} instance whose routing flags was defined with
402 public AudioTrack createAudioTrackSource(AudioMix mix) throws IllegalArgumentException {
407 checkMixReadyToUse(mix, true/*for an AudioTrack*/);
408 // create the AudioTrack, configured for loop back, using the same format as the mix
412 .addTag(addressForTag(mix))
414 mix.getFormat(),
415 AudioTrack.getMinBufferSize(mix.getFormat().getSampleRate(),
416 mix.getFormat().getChannelMask(), mix.getFormat().getEncoding()),
431 public void onMixStateUpdate(AudioMix mix) {}
510 for (AudioMix mix : mConfig.getMixes()) {
511 if (mix.getRegistration().equals(regId)) {
512 mix.mMixState = state;
513 sendMsg(MSG_MIX_STATE_UPDATE, mix, 0/*ignored*/);
582 private static String addressForTag(AudioMix mix) {
583 return "addr=" + mix.getRegistration();