本文整理汇总了Java中android.media.AudioManager.STREAM_VOICE_CALL属性的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.STREAM_VOICE_CALL属性的具体用法?Java AudioManager.STREAM_VOICE_CALL怎么用?Java AudioManager.STREAM_VOICE_CALL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.STREAM_VOICE_CALL属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVolType
private int getVolType(String type) {
switch (type) {
case VOL_VOICE_CALL:
return AudioManager.STREAM_VOICE_CALL;
case VOL_SYSTEM:
return AudioManager.STREAM_SYSTEM;
case VOL_RING:
return AudioManager.STREAM_RING;
case VOL_ALARM:
return AudioManager.STREAM_ALARM;
case VOL_NOTIFICATION:
return AudioManager.STREAM_NOTIFICATION;
default:
return AudioManager.STREAM_MUSIC;
}
}
示例2: getInCallStream
/**
* Get the stream id for in call track. Can differ on some devices. Current
* device for which it's different :
*
* @return
*/
public static int getInCallStream(boolean requestBluetooth) {
/* Archos 5IT */
if (Build.BRAND.equalsIgnoreCase("archos")
&& Build.DEVICE.equalsIgnoreCase("g7a")) {
// Since archos has no voice call capabilities, voice call stream is
// not implemented
// So we have to choose the good stream tag, which is by default
// falled back to music
return AudioManager.STREAM_MUSIC;
}
if (requestBluetooth) {
return 6; /* STREAM_BLUETOOTH_SCO -- Thx @Stefan for the contrib */
}
// return AudioManager.STREAM_MUSIC;
return AudioManager.STREAM_VOICE_CALL;
}
示例3: SignalAudioManager
public SignalAudioManager(@NonNull Context context) {
this.context = context.getApplicationContext();
this.incomingRinger = new IncomingRinger(context);
this.outgoingRinger = new OutgoingRinger(context);
this.soundPool = new SoundPool(1, AudioManager.STREAM_VOICE_CALL, 0);
this.connectedSoundId = this.soundPool.load(context, R.raw.webrtc_completed, 1);
this.disconnectedSoundId = this.soundPool.load(context, R.raw.webrtc_disconnected, 1);
}
示例4: DialingFeedback
public DialingFeedback(Activity context, boolean inCall) {
this.context = context;
this.inCall = inCall;
toneStream = inCall ? AudioManager.STREAM_VOICE_CALL : AudioManager.STREAM_MUSIC;
prefsWrapper = new PreferencesWrapper(context);
}
示例5: onSensorChanged
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() != Sensor.TYPE_PROXIMITY) return;
if (mediaPlayer == null || !mediaPlayer.isPlaying()) return;
int streamType;
if (event.values[0] < 5f && event.values[0] != proximitySensor.getMaximumRange()) {
streamType = AudioManager.STREAM_VOICE_CALL;
} else {
streamType = AudioManager.STREAM_MUSIC;
}
if (streamType == AudioManager.STREAM_VOICE_CALL &&
mediaPlayer.getAudioStreamType() != streamType &&
!audioManager.isWiredHeadsetOn())
{
double position = mediaPlayer.getCurrentPosition();
double duration = mediaPlayer.getDuration();
double progress = position / duration;
if (wakeLock != null) wakeLock.acquire();
stop();
try {
play(progress, true);
} catch (IOException e) {
Log.w(TAG, e);
}
} else if (streamType == AudioManager.STREAM_MUSIC &&
mediaPlayer.getAudioStreamType() != streamType &&
System.currentTimeMillis() - startTime > 500)
{
if (wakeLock != null) wakeLock.release();
stop();
notifyOnStop();
}
}
示例6: SignalAudioManager
public SignalAudioManager(@NonNull Context context) {
this.context = context.getApplicationContext();
this.incomingRinger = new IncomingRinger(context);
this.outgoingRinger = new OutgoingRinger(context);
this.soundPool = new SoundPool(1, AudioManager.STREAM_VOICE_CALL, 0);
this.connectedSoundId = this.soundPool.load(context, R.raw.webrtc_completed, 1);
this.disconnectedSoundId = this.soundPool.load(context, R.raw.webrtc_disconnected, 1);
}
示例7: getUserSettingAudioStreamType
protected int getUserSettingAudioStreamType() {
// 听筒模式/扬声器模式
if (isEarPhoneModeEnable) {
return AudioManager.STREAM_VOICE_CALL;
} else {
return AudioManager.STREAM_MUSIC;
}
}
示例8: createAudioTrackOnLowerThanLollipop
@SuppressWarnings("deprecation") // Deprecated in API level 25.
private static AudioTrack createAudioTrackOnLowerThanLollipop(
int sampleRateInHz, int channelConfig, int bufferSizeInBytes) {
return new AudioTrack(AudioManager.STREAM_VOICE_CALL, sampleRateInHz, channelConfig,
AudioFormat.ENCODING_PCM_16BIT, bufferSizeInBytes, AudioTrack.MODE_STREAM);
}