Java Code Examples for android.media.AudioManager#STREAM_DTMF

The following examples show how to use android.media.AudioManager#STREAM_DTMF . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CalibrationService.java    From NoiseCapture with GNU General Public License v3.0 6 votes vote down vote up
private int getAudioOutput() {
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    String value = sharedPref.getString("settings_calibration_audio_output", "STREAM_MUSIC");

    if("STREAM_VOICE_CALL".equals(value)) {
        return AudioManager.STREAM_VOICE_CALL;
    } else if("STREAM_SYSTEM".equals(value)) {
        return AudioManager.STREAM_SYSTEM;
    } else if("STREAM_RING".equals(value)) {
        return AudioManager.STREAM_RING;
    } else if("STREAM_MUSIC".equals(value)) {
        return AudioManager.STREAM_MUSIC;
    } else if("STREAM_ALARM".equals(value)) {
        return AudioManager.STREAM_ALARM;
    } else if("STREAM_NOTIFICATION".equals(value)) {
        return AudioManager.STREAM_NOTIFICATION;
    } else if("STREAM_DTMF".equals(value)) {
        return AudioManager.STREAM_DTMF;
    } else {
        return AudioManager.STREAM_RING;
    }
}
 
Example 2
Source File: CalibrationLinearityActivity.java    From NoiseCapture with GNU General Public License v3.0 6 votes vote down vote up
private int getAudioOutput() {
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    String value = sharedPref.getString("settings_calibration_audio_output", "STREAM_MUSIC");

    if("STREAM_VOICE_CALL".equals(value)) {
        return AudioManager.STREAM_VOICE_CALL;
    } else if("STREAM_SYSTEM".equals(value)) {
        return AudioManager.STREAM_SYSTEM;
    } else if("STREAM_RING".equals(value)) {
        return AudioManager.STREAM_RING;
    } else if("STREAM_MUSIC".equals(value)) {
        return AudioManager.STREAM_MUSIC;
    } else if("STREAM_ALARM".equals(value)) {
        return AudioManager.STREAM_ALARM;
    } else if("STREAM_NOTIFICATION".equals(value)) {
        return AudioManager.STREAM_NOTIFICATION;
    } else if("STREAM_DTMF".equals(value)) {
        return AudioManager.STREAM_DTMF;
    } else {
        return AudioManager.STREAM_RING;
    }
}
 
Example 3
Source File: BasicMediaPlayerTestCase_SetAudioStreamTypeMethod.java    From android-openslmediaplayer with Apache License 2.0 6 votes vote down vote up
private static String streamTypeToString(int streamtype) {
    switch (streamtype) {
        case AudioManager.STREAM_ALARM:
            return "ALARM";
        case AudioManager.STREAM_DTMF:
            return "DTMF";
        case AudioManager.STREAM_MUSIC:
            return "MUSIC";
        case AudioManager.STREAM_NOTIFICATION:
            return "NOTIFICATION";
        case AudioManager.STREAM_RING:
            return "RING";
        case AudioManager.STREAM_SYSTEM:
            return "SYSTEM";
        case AudioManager.STREAM_VOICE_CALL:
            return "VOICE_CALL";
        default:
            return "Unknown stream type; " + streamtype;
    }
}
 
Example 4
Source File: MediaControllerCompatApi21.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private static int toLegacyStreamType(AudioAttributes aa) {
    // flags to stream type mapping
    if ((aa.getFlags() & AudioAttributes.FLAG_AUDIBILITY_ENFORCED)
            == AudioAttributes.FLAG_AUDIBILITY_ENFORCED) {
        return STREAM_SYSTEM_ENFORCED;
    }
    if ((aa.getFlags() & FLAG_SCO) == FLAG_SCO) {
        return STREAM_BLUETOOTH_SCO;
    }

    // usage to stream type mapping
    switch (aa.getUsage()) {
        case AudioAttributes.USAGE_MEDIA:
        case AudioAttributes.USAGE_GAME:
        case AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY:
        case AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE:
            return AudioManager.STREAM_MUSIC;
        case AudioAttributes.USAGE_ASSISTANCE_SONIFICATION:
            return AudioManager.STREAM_SYSTEM;
        case AudioAttributes.USAGE_VOICE_COMMUNICATION:
            return AudioManager.STREAM_VOICE_CALL;
        case AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING:
            return AudioManager.STREAM_DTMF;
        case AudioAttributes.USAGE_ALARM:
            return AudioManager.STREAM_ALARM;
        case AudioAttributes.USAGE_NOTIFICATION_RINGTONE:
            return AudioManager.STREAM_RING;
        case AudioAttributes.USAGE_NOTIFICATION:
        case AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_REQUEST:
        case AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT:
        case AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_DELAYED:
        case AudioAttributes.USAGE_NOTIFICATION_EVENT:
            return AudioManager.STREAM_NOTIFICATION;
        case AudioAttributes.USAGE_UNKNOWN:
        default:
            return AudioManager.STREAM_MUSIC;
    }
}