Lines Matching refs:patch

70 status_t AudioFlinger::createAudioPatch(const struct audio_patch *patch,  in createAudioPatch()  argument
75 return mPatchPanel->createAudioPatch(patch, handle); in createAudioPatch()
139 status_t AudioFlinger::PatchPanel::createAudioPatch(const struct audio_patch *patch, in createAudioPatch() argument
143 patch->num_sources, patch->num_sinks, *handle); in createAudioPatch()
151 if (handle == NULL || patch == NULL) { in createAudioPatch()
154 if (patch->num_sources == 0 || patch->num_sources > AUDIO_PATCH_PORTS_MAX || in createAudioPatch()
155 patch->num_sinks == 0 || patch->num_sinks > AUDIO_PATCH_PORTS_MAX) { in createAudioPatch()
160 if (patch->num_sources > 2) { in createAudioPatch()
177 Patch *newPatch = new Patch(patch); in createAudioPatch()
179 switch (patch->sources[0].type) { in createAudioPatch()
181 audio_module_handle_t srcModule = patch->sources[0].ext.device.hw_module; in createAudioPatch()
189 for (unsigned int i = 0; i < patch->num_sinks; i++) { in createAudioPatch()
191 if ((patch->sinks[i].type == AUDIO_PORT_TYPE_MIX || in createAudioPatch()
192 patch->sinks[i].ext.mix.hw_module != srcModule) && in createAudioPatch()
193 patch->num_sinks > 1) { in createAudioPatch()
198 if (patch->sinks[i].type != patch->sinks[0].type) { in createAudioPatch()
210 if ((patch->sinks[0].type == AUDIO_PORT_TYPE_DEVICE) && in createAudioPatch()
211 ((patch->sinks[0].ext.device.hw_module != srcModule) || in createAudioPatch()
213 (patch->num_sources == 2))) { in createAudioPatch()
214 if (patch->num_sources == 2) { in createAudioPatch()
215 if (patch->sources[1].type != AUDIO_PORT_TYPE_MIX || in createAudioPatch()
216 patch->sinks[0].ext.device.hw_module != in createAudioPatch()
217 patch->sources[1].ext.mix.hw_module) { in createAudioPatch()
224 audioflinger->checkPlaybackThread_l(patch->sources[1].ext.mix.handle); in createAudioPatch()
233 audio_devices_t device = patch->sinks[0].ext.device.type; in createAudioPatch()
234 String8 address = String8(patch->sinks[0].ext.device.address); in createAudioPatch()
237 patch->sinks[0].ext.device.hw_module, in createAudioPatch()
251 audio_devices_t device = patch->sources[0].ext.device.type; in createAudioPatch()
252 String8 address = String8(patch->sources[0].ext.device.address); in createAudioPatch()
272 status = createPatchConnections(newPatch, patch); in createAudioPatch()
277 if (patch->sinks[0].type == AUDIO_PORT_TYPE_MIX) { in createAudioPatch()
279 patch->sinks[0].ext.mix.handle); in createAudioPatch()
282 patch->sinks[0].ext.mix.handle); in createAudioPatch()
286 status = thread->sendCreateAudioPatchConfigEvent(patch, &halHandle); in createAudioPatch()
295 patch->num_sources, in createAudioPatch()
296 patch->sources, in createAudioPatch()
297 patch->num_sinks, in createAudioPatch()
298 patch->sinks, in createAudioPatch()
304 audio_module_handle_t srcModule = patch->sources[0].ext.mix.hw_module; in createAudioPatch()
313 for (unsigned int i = 0; i < patch->num_sinks; i++) { in createAudioPatch()
314 if (patch->sinks[i].type != AUDIO_PORT_TYPE_DEVICE) { in createAudioPatch()
316 patch->sinks[i].type); in createAudioPatch()
321 if (patch->sinks[i].ext.device.hw_module != srcModule) { in createAudioPatch()
325 type |= patch->sinks[i].ext.device.type; in createAudioPatch()
328 audioflinger->checkPlaybackThread_l(patch->sources[0].ext.mix.handle); in createAudioPatch()
331 patch->sources[0].ext.mix.handle); in createAudioPatch()
342 status = thread->sendCreateAudioPatchConfigEvent(patch, &halHandle); in createAudioPatch()
363 status_t AudioFlinger::PatchPanel::createPatchConnections(Patch *patch, in createPatchConnections() argument
372 patch->mRecordThread->getAudioPortConfig(&subPatch.sinks[0]); in createPatchConnections()
375 status_t status = createAudioPatch(&subPatch, &patch->mRecordPatchHandle); in createPatchConnections()
377 patch->mRecordPatchHandle = AUDIO_PATCH_HANDLE_NONE; in createPatchConnections()
382 patch->mPlaybackThread->getAudioPortConfig(&subPatch.sources[0]); in createPatchConnections()
384 status = createAudioPatch(&subPatch, &patch->mPlaybackPatchHandle); in createPatchConnections()
386 patch->mPlaybackPatchHandle = AUDIO_PATCH_HANDLE_NONE; in createPatchConnections()
391 size_t playbackFrameCount = patch->mPlaybackThread->frameCount(); in createPatchConnections()
393 size_t recordFramecount = patch->mRecordThread->frameCount(); in createPatchConnections()
403 uint32_t channelCount = patch->mPlaybackThread->channelCount(); in createPatchConnections()
405 audio_channel_mask_t outChannelMask = patch->mPlaybackThread->channelMask(); in createPatchConnections()
406 uint32_t sampleRate = patch->mPlaybackThread->sampleRate(); in createPatchConnections()
407 audio_format_t format = patch->mPlaybackThread->format(); in createPatchConnections()
409 patch->mPatchRecord = new RecordThread::PatchRecord( in createPatchConnections()
410 patch->mRecordThread.get(), in createPatchConnections()
417 if (patch->mPatchRecord == 0) { in createPatchConnections()
420 status = patch->mPatchRecord->initCheck(); in createPatchConnections()
424 patch->mRecordThread->addPatchRecord(patch->mPatchRecord); in createPatchConnections()
428 patch->mPatchTrack = new PlaybackThread::PatchTrack( in createPatchConnections()
429 patch->mPlaybackThread.get(), in createPatchConnections()
435 patch->mPatchRecord->buffer(), in createPatchConnections()
437 if (patch->mPatchTrack == 0) { in createPatchConnections()
440 status = patch->mPatchTrack->initCheck(); in createPatchConnections()
444 patch->mPlaybackThread->addPatchTrack(patch->mPatchTrack); in createPatchConnections()
447 patch->mPatchRecord->setPeerProxy(patch->mPatchTrack.get()); in createPatchConnections()
448 patch->mPatchTrack->setPeerProxy(patch->mPatchRecord.get()); in createPatchConnections()
451 patch->mPatchRecord->start(AudioSystem::SYNC_EVENT_NONE, 0); in createPatchConnections()
452 patch->mPatchTrack->start(); in createPatchConnections()
457 void AudioFlinger::PatchPanel::clearPatchConnections(Patch *patch) in clearPatchConnections() argument
465 patch->mRecordPatchHandle, patch->mPlaybackPatchHandle); in clearPatchConnections()
467 if (patch->mPatchRecord != 0) { in clearPatchConnections()
468 patch->mPatchRecord->stop(); in clearPatchConnections()
470 if (patch->mPatchTrack != 0) { in clearPatchConnections()
471 patch->mPatchTrack->stop(); in clearPatchConnections()
473 if (patch->mRecordPatchHandle != AUDIO_PATCH_HANDLE_NONE) { in clearPatchConnections()
474 releaseAudioPatch(patch->mRecordPatchHandle); in clearPatchConnections()
475 patch->mRecordPatchHandle = AUDIO_PATCH_HANDLE_NONE; in clearPatchConnections()
477 if (patch->mPlaybackPatchHandle != AUDIO_PATCH_HANDLE_NONE) { in clearPatchConnections()
478 releaseAudioPatch(patch->mPlaybackPatchHandle); in clearPatchConnections()
479 patch->mPlaybackPatchHandle = AUDIO_PATCH_HANDLE_NONE; in clearPatchConnections()
481 if (patch->mRecordThread != 0) { in clearPatchConnections()
482 if (patch->mPatchRecord != 0) { in clearPatchConnections()
483 patch->mRecordThread->deletePatchRecord(patch->mPatchRecord); in clearPatchConnections()
485 audioflinger->closeInputInternal_l(patch->mRecordThread); in clearPatchConnections()
487 if (patch->mPlaybackThread != 0) { in clearPatchConnections()
488 if (patch->mPatchTrack != 0) { in clearPatchConnections()
489 patch->mPlaybackThread->deletePatchTrack(patch->mPatchTrack); in clearPatchConnections()
492 if (patch->mAudioPatch.num_sources != 2) { in clearPatchConnections()
493 audioflinger->closeOutputInternal_l(patch->mPlaybackThread); in clearPatchConnections()
496 if (patch->mRecordThread != 0) { in clearPatchConnections()
497 if (patch->mPatchRecord != 0) { in clearPatchConnections()
498 patch->mPatchRecord.clear(); in clearPatchConnections()
500 patch->mRecordThread.clear(); in clearPatchConnections()
502 if (patch->mPlaybackThread != 0) { in clearPatchConnections()
503 if (patch->mPatchTrack != 0) { in clearPatchConnections()
504 patch->mPatchTrack.clear(); in clearPatchConnections()
506 patch->mPlaybackThread.clear(); in clearPatchConnections()
534 struct audio_patch *patch = &removedPatch->mAudioPatch; in releaseAudioPatch() local
536 switch (patch->sources[0].type) { in releaseAudioPatch()
538 audio_module_handle_t srcModule = patch->sources[0].ext.device.hw_module; in releaseAudioPatch()
552 if (patch->sinks[0].type == AUDIO_PORT_TYPE_MIX) { in releaseAudioPatch()
554 patch->sinks[0].ext.mix.handle); in releaseAudioPatch()
557 patch->sinks[0].ext.mix.handle); in releaseAudioPatch()
573 audio_module_handle_t srcModule = patch->sources[0].ext.mix.hw_module; in releaseAudioPatch()
581 audioflinger->checkPlaybackThread_l(patch->sources[0].ext.mix.handle); in releaseAudioPatch()
584 patch->sources[0].ext.mix.handle); in releaseAudioPatch()