ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2014年9月5日 星期五

hardware/libhardware_legacy/audio/AudioPolicyManagerBase.cpp
    ALOGV("setOutputDevice() changing device");
    // do the routing
    param.addInt(String8(AudioParameter::keyRouting), (int)device);
    mpClientInterface->setParameters(output, param.toString(), delayMs);


mixer route 的設置變成 hard-code:
AudioHardware.cpp:
   mMixer = mHardware->openMixer_l();
    if (mMixer) {
        ALOGV("open playback normal");
        
        headphone_l_ctl = mixer_get_ctl_by_name(mMixer, "Left dac to hp left amp Switch");
        headphone_r_ctl = mixer_get_ctl_by_name(mMixer, "Right dac to hp right amp Switch");
        speaker_l_ctl = mixer_get_ctl_by_name(mMixer, "Left dac to speaker lineout Switch");
        speaker_r_ctl = mixer_get_ctl_by_name(mMixer, "Right dac to speaker lineout Switch");
        
    }
    
    if (headphone_l_ctl && headphone_r_ctl && speaker_l_ctl && speaker_r_ctl) {
        unsigned int num_values;
        unsigned int hp_num_values;
        unsigned int i;
        num_values = mixer_ctl_get_num_values(speaker_l_ctl);
        hp_num_values = mixer_ctl_get_num_values(headphone_l_ctl);
        
     for (i = 0; i < num_values; i++) {
     if (mDevices & (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_EARPIECE)) {
                mixer_ctl_set_value(speaker_l_ctl, i, 1);
                mixer_ctl_set_value(speaker_r_ctl, i, 1);
     } else {
                mixer_ctl_set_value(speaker_l_ctl, i, 0);
                mixer_ctl_set_value(speaker_r_ctl, i, 0);
     }
 }
 for (i = 0; i < hp_num_values; i++) {
     if (mDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) {
                mixer_ctl_set_value(headphone_l_ctl, i, 1);
                mixer_ctl_set_value(headphone_r_ctl, i, 1);
            } else {
                mixer_ctl_set_value(headphone_l_ctl, i, 0);
                mixer_ctl_set_value(headphone_r_ctl, i, 0);
            }
 }
以前這一段是寫在 asound.conf。
改為 tinyalsa 後就變成 hard-coded

這只是 4.2 的作法, 4.4 以後會是一個專職的 libaudioroute library..

沒有留言:

標籤

網誌存檔