コード例 #1
0
status_t AudioResourceManager::SelectOutputDevice(uint32_t new_device)
{
    // TODO: print device name but not just a enum to increase log readibiltiy
    uint32_t pre_device ;
    ALOGD("%s(), pre_device(mDlOutputDevice) = 0x%x, new_device = 0x%x\n", __FUNCTION__, mDlOutputDevice, new_device);

    if (new_device == mDlOutputDevice) { return NO_ERROR; }
    pre_device = mDlOutputDevice;

    // close
    StopOutputDevice();

    // open
    mDlOutputDevice = new_device;
    StartOutputDevice();

    return NO_ERROR;
}
status_t AudioResourceManager::SelectOutputDevice(uint32_t new_device)
{
    // TODO: print device name but not just a enum to increase log readibiltiy
    uint32_t pre_device ;
    ALOGD("%s(), pre_device(mDlOutputDevice) = 0x%x, new_device = 0x%x\n", __FUNCTION__, mDlOutputDevice, new_device);

    if (new_device == mDlOutputDevice) return NO_ERROR;
    pre_device = mDlOutputDevice;

    // close
    StopOutputDevice();
    // open
    mDlOutputDevice = new_device;
    if(mAudioHardware != NULL){
#ifdef FM_DIGITAL_IN_SUPPORT
        mAudioHardware->SetFmDigitalFmHw(pre_device, new_device);
#endif
        mAudioHardware->DoDeviceChangeCallback(new_device);
    }
    StartOutputDevice();

    return NO_ERROR;
}