ALSA_PROP(AudioSystem::DEVICE_OUT_WIRED_HEADSET, "headset", "Headphone", "Capture"),
ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_SCO, "bluetooth.sco", "Bluetooth", "Bluetooth Capture"),
ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP, "bluetooth.a2dp", "Bluetooth A2DP", "Bluetooth A2DP Capture"),
- ALSA_PROP(AudioSystem::DEVICE_OUT_FM_HEADPHONE, "fm", "FM", ""),
ALSA_PROP(static_cast<AudioSystem::audio_devices>(0), "", NULL, NULL)
};
mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)) {
newDevice = device;
}
+#ifdef SUPPORT_DEVICE_OUT_TTY
} else if (device == AudioSystem::DEVICE_OUT_TTY) {
LOGV("setDeviceConnectionState() tty device");
// if connecting a wired headset, we check the following by order of priority
mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE))) {
newDevice = device;
}
- } else if (device == AudioSystem::DEVICE_OUT_FM_SPEAKER ||
- device == AudioSystem::DEVICE_OUT_FM_HEADPHONE) {
- LOGV("setDeviceConnectionState() no mic headphone device");
- // if connecting a wired headset, we check the following by order of priority
- // to request a routing change if necessary:
- // 1: the strategy sonification is active on the hardware output:
- // use device for strategy sonification
- // 2: the strategy media is active on the hardware output:
- // use device for strategy media
- if ((getDeviceForStrategy(STRATEGY_SONIFICATION) & device) &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)){
- newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
- } else if ((getDeviceForStrategy(STRATEGY_MEDIA) == device) &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)){
- newDevice = device;
- }
+#endif // SUPPORT_DEVICE_OUT_TTY
}
// request routing change if necessary
mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)){
newDevice = getDeviceForStrategy(STRATEGY_DTMF);
}
+#ifdef SUPPORT_DEVICE_OUT_TTY
} else if (device == AudioSystem::DEVICE_OUT_TTY) {
LOGV("setDeviceConnectionState() tty device");
if (wasUsedforPhone &&
mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE))) {
newDevice = getDeviceForStrategy(STRATEGY_PHONE);
}
- } else if (device == AudioSystem::DEVICE_OUT_FM_SPEAKER ||
- device == AudioSystem::DEVICE_OUT_FM_HEADPHONE) {
- LOGV("setDeviceConnectionState() no mic headphone device");
- if (wasUsedForSonification &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)){
- newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
- } else if (wasUsedForMedia &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)){
- newDevice = getDeviceForStrategy(STRATEGY_MEDIA);
- }
+#endif // SUPPORT_DEVICE_OUT_TTY
}
}
+
// request routing change if necessary
setOutputDevice(mHardwareOutput, newDevice);
// FALL THROUGH
default: // FORCE_NONE
+#ifdef SUPPORT_DEVICE_OUT_TTY
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_TTY;
if (device) break;
+#endif // SUPPORT_DEVICE_OUT_TTY
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
if (device) break;
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
if (device) break;
}
- device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_SPEAKER;
+ device = mAvailableOutputDevices;
if (device) break;
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
if (device == 0) {
if (device2 == 0) {
device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
if (device2 == 0) {
- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_HEADPHONE;
- if (device2 == 0) {
- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_SPEAKER;
- if (device2 == 0) {
- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
- if (device2 == 0) {
- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
- if (device2 == 0) {
- device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
- if (device == 0) {
- LOGE("getDeviceForStrategy() speaker device not found");
- }
- }
- }
- }
- }
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
+ if (device2 == 0) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() speaker device not found");
+ }
+ }
+ }
}
}
}
{AudioSystem::DEVICE_OUT_BLUETOOTH_SCO, "_Bluetooth"},
{AudioSystem::DEVICE_OUT_WIRED_HEADSET, "_Headset"},
{AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP, "_Bluetooth-A2DP"},
- {AudioSystem::DEVICE_OUT_FM_HEADPHONE, "_FM"},
};
static const int deviceSuffixLen = (sizeof(deviceSuffix)
#endif
// Make sure we have at least the size we originally wanted
- err = snd_pcm_hw_params_set_buffer_size(handle->handle, hardwareParams,
- bufferSize);
+ err = snd_pcm_hw_params_set_buffer_size_near(handle->handle, hardwareParams,
+ &bufferSize);
+
if (err < 0) {
LOGE("Unable to set buffer size to %d: %s",
(int)bufferSize, snd_strerror(err));