use of android.media.PlaybackParams in project platform_frameworks_base by android.
the class MediaPlayer method easyPlaybackParams.
/**
* Sets playback rate and audio mode.
*
* @param rate the ratio between desired playback rate and normal one.
* @param audioMode audio playback mode. Must be one of the supported
* audio modes.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
* @throws IllegalArgumentException if audioMode is not supported.
*
* @hide
*/
@NonNull
public PlaybackParams easyPlaybackParams(float rate, @PlaybackRateAudioMode int audioMode) {
PlaybackParams params = new PlaybackParams();
params.allowDefaults();
switch(audioMode) {
case PLAYBACK_RATE_AUDIO_MODE_DEFAULT:
params.setSpeed(rate).setPitch(1.0f);
break;
case PLAYBACK_RATE_AUDIO_MODE_STRETCH:
params.setSpeed(rate).setPitch(1.0f).setAudioFallbackMode(params.AUDIO_FALLBACK_MODE_FAIL);
break;
case PLAYBACK_RATE_AUDIO_MODE_RESAMPLE:
params.setSpeed(rate).setPitch(rate);
break;
default:
final String msg = "Audio playback mode " + audioMode + " is not supported";
throw new IllegalArgumentException(msg);
}
return params;
}
use of android.media.PlaybackParams in project android_frameworks_base by DirtyUnicorns.
the class MediaPlayer method easyPlaybackParams.
/**
* Sets playback rate and audio mode.
*
* @param rate the ratio between desired playback rate and normal one.
* @param audioMode audio playback mode. Must be one of the supported
* audio modes.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
* @throws IllegalArgumentException if audioMode is not supported.
*
* @hide
*/
@NonNull
public PlaybackParams easyPlaybackParams(float rate, @PlaybackRateAudioMode int audioMode) {
PlaybackParams params = new PlaybackParams();
params.allowDefaults();
switch(audioMode) {
case PLAYBACK_RATE_AUDIO_MODE_DEFAULT:
params.setSpeed(rate).setPitch(1.0f);
break;
case PLAYBACK_RATE_AUDIO_MODE_STRETCH:
params.setSpeed(rate).setPitch(1.0f).setAudioFallbackMode(params.AUDIO_FALLBACK_MODE_FAIL);
break;
case PLAYBACK_RATE_AUDIO_MODE_RESAMPLE:
params.setSpeed(rate).setPitch(rate);
break;
default:
final String msg = "Audio playback mode " + audioMode + " is not supported";
throw new IllegalArgumentException(msg);
}
return params;
}
use of android.media.PlaybackParams in project android_frameworks_base by AOSPA.
the class MediaPlayer method easyPlaybackParams.
/**
* Sets playback rate and audio mode.
*
* @param rate the ratio between desired playback rate and normal one.
* @param audioMode audio playback mode. Must be one of the supported
* audio modes.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
* @throws IllegalArgumentException if audioMode is not supported.
*
* @hide
*/
@NonNull
public PlaybackParams easyPlaybackParams(float rate, @PlaybackRateAudioMode int audioMode) {
PlaybackParams params = new PlaybackParams();
params.allowDefaults();
switch(audioMode) {
case PLAYBACK_RATE_AUDIO_MODE_DEFAULT:
params.setSpeed(rate).setPitch(1.0f);
break;
case PLAYBACK_RATE_AUDIO_MODE_STRETCH:
params.setSpeed(rate).setPitch(1.0f).setAudioFallbackMode(params.AUDIO_FALLBACK_MODE_FAIL);
break;
case PLAYBACK_RATE_AUDIO_MODE_RESAMPLE:
params.setSpeed(rate).setPitch(rate);
break;
default:
final String msg = "Audio playback mode " + audioMode + " is not supported";
throw new IllegalArgumentException(msg);
}
return params;
}
use of android.media.PlaybackParams in project android_frameworks_base by ResurrectionRemix.
the class MediaPlayer method easyPlaybackParams.
/**
* Sets playback rate and audio mode.
*
* @param rate the ratio between desired playback rate and normal one.
* @param audioMode audio playback mode. Must be one of the supported
* audio modes.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
* @throws IllegalArgumentException if audioMode is not supported.
*
* @hide
*/
@NonNull
public PlaybackParams easyPlaybackParams(float rate, @PlaybackRateAudioMode int audioMode) {
PlaybackParams params = new PlaybackParams();
params.allowDefaults();
switch(audioMode) {
case PLAYBACK_RATE_AUDIO_MODE_DEFAULT:
params.setSpeed(rate).setPitch(1.0f);
break;
case PLAYBACK_RATE_AUDIO_MODE_STRETCH:
params.setSpeed(rate).setPitch(1.0f).setAudioFallbackMode(params.AUDIO_FALLBACK_MODE_FAIL);
break;
case PLAYBACK_RATE_AUDIO_MODE_RESAMPLE:
params.setSpeed(rate).setPitch(rate);
break;
default:
final String msg = "Audio playback mode " + audioMode + " is not supported";
throw new IllegalArgumentException(msg);
}
return params;
}
use of android.media.PlaybackParams in project android_frameworks_base by crdroidandroid.
the class MediaPlayer method easyPlaybackParams.
/**
* Sets playback rate and audio mode.
*
* @param rate the ratio between desired playback rate and normal one.
* @param audioMode audio playback mode. Must be one of the supported
* audio modes.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
* @throws IllegalArgumentException if audioMode is not supported.
*
* @hide
*/
@NonNull
public PlaybackParams easyPlaybackParams(float rate, @PlaybackRateAudioMode int audioMode) {
PlaybackParams params = new PlaybackParams();
params.allowDefaults();
switch(audioMode) {
case PLAYBACK_RATE_AUDIO_MODE_DEFAULT:
params.setSpeed(rate).setPitch(1.0f);
break;
case PLAYBACK_RATE_AUDIO_MODE_STRETCH:
params.setSpeed(rate).setPitch(1.0f).setAudioFallbackMode(params.AUDIO_FALLBACK_MODE_FAIL);
break;
case PLAYBACK_RATE_AUDIO_MODE_RESAMPLE:
params.setSpeed(rate).setPitch(rate);
break;
default:
final String msg = "Audio playback mode " + audioMode + " is not supported";
throw new IllegalArgumentException(msg);
}
return params;
}
Aggregations