android-audio 下载本文

内容发布更新时间 : 2024/12/22 20:04:41星期一 下面是文章的全部内容请认真阅读。

AudioManager.java AudioService.java setMode(mode) setMode(mode):audioSystem.setPhoneState(mode),getActiveStreamType(),getDeviceForStream(),setStreamVolumeIndex() setParameters(string) setParameters(string):DSDA_GSM,DSDA_QCOM,SHARE_MUSIC setRingerMode(ringerMode:NORMAL/SILENT/VIBRATE) setRingerMode(ringerMode:NORMAL/SILENT/VIBRATE) setRouting(mode, routes, mask) setRouting(mode, routes, mask) setBluetoothA2dpDeviceConnectionState(device, state) setBluetoothA2dpDeviceConnectionState(device, state): BROADCASE_AUDIO_BECOMING_NOISY, system_>setDeviceConnetionState setBluetoothScoOn(on) setBluetoothScoOn(on): ForceUse(Comm-REC-SCO) setWiredDeviceConnectionState(device, state, name) setWiredDeviceConnectionState(device, state, name): BROADCASE_AUDIO_BECOMING_NOISY, onsetxxx->setBluetoothA2dpOn(),system_>setDeviceConnetionState setSpeakerFmOn(on) setSpeakerFmOn(on):ForceUse(Media, Speaker) setSpeakerphoneOn(on) setSpeakerphoneOn(on) :ForceUse(Comm, Speaker) setFmRxMode(mode:ON/OFF) setFmRxMode(mode:ON/OFF):setDeviceConnectionState() setIncallMode(state) setIncallMode(state):internel,mDsdamode,if(newModeOwnerPid) disconnectBluetoothSco() setMasterMute(state) setMasterMute(state) setMasterVolume(index, flags) setMasterVolume(index, flags):system->setMasterVolume(index/MAX,flags) setStreamMute(streamtype, state) setStreamMute(streamtype, state, cb) setStreamVoluem(streamtypye, index, flags) setStreamVolume(streamtypye, index, flags): setVibrateSetting() aps->setStreamVolume(),AudioCommandThread->VolumeCommand,insertCommand,applyDeviceVolume(),system.setStreamVolumeIndex() setBluetoothA2dpOn(on) setVibrateSetting():broadcastVibrateSetting() setWiredHeadsetOn() setBluetoothA2dpOn(on): ForceUse(Media-A2DP) abandonAudioFocus() setWiredHeadsetOn() requestAudioFocus() abandonAudioFocus() getDevicesForStream(streamType)-?audioSystem.getxx requestAudioFocus() startBluetoothSco() private getDeviceForStream(stream)-?audioSystem.getDevicesForStream() stopBluetoothSco() startBluetoothSco():ScoClient.incCount() setMicrophoneMute(on)?audioSystem.muteMicrophonstopBluetoothSco() setDeviceVolume(streamstate, device):sendMSG setForceUse(usage, config) handleMessage(msg):MSG_MEDIA_SERVER_DIED,MSG_SET_A2DP_CONNECTION_STATE….. setRingtonePlayer() sendHookKeyEvent():mSendHookKeyEvent->run

AudioTrack.java play() stop() pause() flush() write() native_xx() AudioRecord.java startRecording() stop() read() native_xx() AudioSystem.java&.cpp setMode(mode):af->setMode(mode) setParameters(string):af->setParameters() setPhoneState(state):aps->setPhoneState() setDeviceConnectionState(device, state,addr):aps->setDeviceConnetionState() setIncallPhoneState(state):aps->setInCallPhoneState(state) setMasterMute(state):af->setMasterMute(state) setMasterVolume(volume, flags):af->setMasterVolume(value) setStreamMute(streamtype, mute):af->setStreamMute(stream,mute) setStreamVolume(streamtype, value, output):af->setStreamVolume(stream,value,output) setStreamVolumeIndex(stream, index, devie):aps->setStreamVolumeIndex(stream,index,device) setVoiceVolume(value) setEffectEnabled(id,enabled):aps->setEffectEnabled(id,enabled) setFmVolume():af->setFmVolume() setForceUse(usage,config):aps->setForceUse(usage,config) getDevicesForStream(streamType):aps->getDevicesForStream(stream) getStrategyForStream(stream):aps->getStrategyForStream(stream) getInput(inputSource,SamplingRate,format,channelMask,seesionId):aps->xx getLatency(output,streamtype,latency):af->latency(output) getOutput(stream,samplingrate,format,channelmask,flags):aps->xxx getParameters():af->getParameters() getAudioFlinger() getAudioPolicyService() startInput(input):aps->xxx stopInput(input) startOutput(output,stream,session):aps->xxx stopOutput(output,stream,session) AudioTrack.cpp set(stream,samplerate,format,channelmask,framecount,flags,cbf…): audioSystem:getoutput() af->createTrack(): flags=NORMAL/DIRECT/LPA/TUNEL/FAST start() stop() flush() pause() mute() setVolume() setSampleRate() setPosition() write() processAudioBuffer() getTimeStamp() getSessionId() AudioTrackThread() Audio_track_cblk_t AudioRecord.cpp Set(inputsource,samplerate,format,…) start() stop() read() setSampleRate() openRecord():af->openRecord(pid,input,samplerate,format,…) processAudioBuffer() restoreRecord() AudioRecordThread() getPosition() getSessionId()

AudioPlicyService.cpp Aps_load_hw_module(service,name): af->loadHwModule(name) Aps_open_output(service,pDevices,pSamplerate,pFormat,pChannelMask): af->openOutput(…) Aps_close_output(sevice,output): af->closeOutput() Aps_suspend_output(service,output): af->suspendOutput() Aps_restore_output(): af->restoreOutput() Aps_open_input(service,pDevices,pSampleRate,pFormat,pChannelMask): af->openInput() Aps_close_input(service,input): af->closeInput() Aps_setStream_output(): af->setStreamOutput() mAudioCommandThread->setStreamVolume(stream, volume, output) Aps_move_effects(): af->moveEffects() Aps_set_parameters(): aps->setParameters() Aps_set_streamVolume(): aps->setStreamVolume() Aps_start_tone(service,tone,stream): aps->startTone() Aps_stop_tone(): aps->stopTone() mAudioPlaybackThread->startToneCommand() Aps_set_voice_volume(): aps->setVoiceVolume() Aps_set_fm_volume(): aps->setFmVolume() AudioPolicyService(): new TonePlaybackThread, new AudioCommandThread, hw_get_module(, *module) audio_policy_dev_open(module,&mpAudioPolicyDev) mpAudioPolicyDev->create_audio_policy(, &mpAudioPolicy) setDeviceConnetionState(device,state,addr): mpAudioPolicy->set_device_connection_state() setPhoneState(state): AudioSystem::setMode(state), mpAudioPolicy->set_phone_state() setIncallPhoneState(state) setForceUse(usage,config): mpAudioPolicy->set_force_use() getOutput(stream,samplerate,format,channelmask,fags): mpAudioPlicy->get_output() startoutput(output,stream,session): mpAudioPlicy->start_output() getInput(inputSource,samplerate,format,channelmask,session): mpAudioPlicy->get_input() startInput(input): mpAudioPlicy->start_input() initStreamVolume() setStreamVolumeIndex() setEffetEnable(id, enable): mpAudioPlicy ->set_effect_enabled(id,enabled) setFmVolume():mAudioCommandThread->fmVolumeCommand(volume,delay) getDevicesForStream(streamType): mpAudioPlicy ->get_Devices_For_Stream(stream) getStrategyForStream(stream): mpAudioPlicy ->get_Strategy_For_Stream(stream)

AudioFlinger.cpp loadHwModule(name): audio_hw_device_open(), dev->setMasterVolume(), new AudioHwDevice(name,dev) openOutput(module,pDevices,pSamplingrate,pFormat,pChannelMask,…): findSuitableHwdev_l() hwDevHal->open_output_stream() createPlayback or Mixer Thread hwDevHal->setMmde() closeOutput(), suspendOutput(),restoreOutput(), openInput(module,pDevices,pSamplingrate,pFormat,pChannelMask): findSuitableHwdev_l() inHwHal->open_input_stream() createRecoredThread() createEffect(): thread->createEffect() createTrack(pid,stream,samplerate,format,…): thread=checkPlaybackThread() getEffectThread() createNewSessionId() thread->createTrack(…) PlaybackThread::track::start(): AudioSystem::startOutput(threadId,stream,sessionId) PlaybackThread::track::stop(): AudioSystem::stopOutput(threadId,stream,sessionId) RecordThread::start(recoreThread,event,tsession): AudioSystem::startInput() applyEffectsOn() setMasterVolume(): dev->hwDevice()->set_master_volume(), for():mPlaybackThread.valueAt(i)->setMasterVolume() setMode(mode):dev->setMode(dev,mode), , for():mPlaybackThreadEfect.valueAt(i)->setMode() setMicMute():dev->setMicMute() setMasterMute():dev->setMasterMute() masterVolume():dev->set_master_volume() setStreamVolume(stream,value,output):desc->stream->set_volume() for():mPlaybackThreadEfect.valueAt(i)->setStreamVolume() setStreamMute():for():mPlaybackThreadEfect.valueAt(i)->setStreamMute() setParameters(): for(audioHardwareDevice):dev->set_parameters() setVoiceVolume(): primaryhardware dev->setVoiceVolume() setFmVolume(): primaryhardware dev->setFmVolume() PlaybackThread::createTrack_l(afclient,stream,samplerate,format,channel,…): PlaybackThread::threadLoop(): moutput->stream->write(moutput->stream,mmixbuffer,buffersize), if() stream->standby() MixerThread::MixerThread()::new AudioMixer(), new AudioStreamOutSink(output-stream) MixerThread::threadloopMix(): mAudioMixer->process() TranckHandle:start(): mTrack->start() TranckHandle:stop(): mTrack->stop()