use of de.danoeh.antennapod.event.playback.SpeedChangedEvent in project AntennaPod by AntennaPod.
the class PlaybackControlsDialog method setupUi.
private void setupUi() {
txtvPlaybackSpeed = dialog.findViewById(R.id.txtvPlaybackSpeed);
speedSeekBar = dialog.findViewById(R.id.speed_seek_bar);
speedSeekBar.setProgressChangedListener(speed -> {
if (controller != null) {
controller.setPlaybackSpeed(speed);
}
});
updateSpeed(new SpeedChangedEvent(controller.getCurrentPlaybackSpeedMultiplier()));
final CheckBox stereoToMono = dialog.findViewById(R.id.stereo_to_mono);
stereoToMono.setChecked(UserPreferences.stereoToMono());
if (controller != null && !controller.canDownmix()) {
stereoToMono.setEnabled(false);
String sonicOnly = getString(R.string.sonic_only);
stereoToMono.setText(getString(R.string.stereo_to_mono) + " [" + sonicOnly + "]");
}
final CheckBox skipSilence = dialog.findViewById(R.id.skipSilence);
skipSilence.setChecked(UserPreferences.isSkipSilence());
if (!UserPreferences.useExoplayer()) {
skipSilence.setEnabled(false);
String exoplayerOnly = getString(R.string.exoplayer_only);
skipSilence.setText(getString(R.string.pref_skip_silence_title) + " [" + exoplayerOnly + "]");
}
skipSilence.setOnCheckedChangeListener((buttonView, isChecked) -> {
UserPreferences.setSkipSilence(isChecked);
controller.setSkipSilence(isChecked);
});
stereoToMono.setOnCheckedChangeListener((buttonView, isChecked) -> {
UserPreferences.stereoToMono(isChecked);
if (controller != null) {
controller.setDownmix(isChecked);
}
});
}
use of de.danoeh.antennapod.event.playback.SpeedChangedEvent in project AntennaPod by AntennaPod.
the class PlaybackControlsDialog method onStart.
@Override
public void onStart() {
super.onStart();
controller = new PlaybackController(getActivity()) {
@Override
public void loadMediaInfo() {
setupUi();
setupAudioTracks();
updateSpeed(new SpeedChangedEvent(getCurrentPlaybackSpeedMultiplier()));
}
};
controller.init();
setupUi();
EventBus.getDefault().register(this);
}
use of de.danoeh.antennapod.event.playback.SpeedChangedEvent in project AntennaPod by AntennaPod.
the class AudioPlayerFragment method updateUi.
private void updateUi(Playable media) {
if (controller == null || media == null) {
return;
}
duration = controller.getDuration();
updatePosition(new PlaybackPositionEvent(media.getPosition(), media.getDuration()));
updatePlaybackSpeedButton(new SpeedChangedEvent(PlaybackSpeedUtils.getCurrentPlaybackSpeed(media)));
setChapterDividers(media);
setupOptionsMenu(media);
}
use of de.danoeh.antennapod.event.playback.SpeedChangedEvent in project AntennaPod by AntennaPod.
the class VariableSpeedDialog method onStart.
@Override
public void onStart() {
super.onStart();
controller = new PlaybackController(getActivity()) {
@Override
public void loadMediaInfo() {
updateSpeed(new SpeedChangedEvent(controller.getCurrentPlaybackSpeedMultiplier()));
}
};
controller.init();
EventBus.getDefault().register(this);
}
use of de.danoeh.antennapod.event.playback.SpeedChangedEvent in project AntennaPod by AntennaPod.
the class LocalPSMP method setSpeedSyncAndSkipSilence.
/**
* Sets the playback speed.
* This method is executed on the caller's thread.
*/
private void setSpeedSyncAndSkipSilence(float speed, boolean skipSilence) {
playerLock.lock();
Log.d(TAG, "Playback speed was set to " + speed);
EventBus.getDefault().post(new SpeedChangedEvent(speed));
mediaPlayer.setPlaybackParams(speed, skipSilence);
playerLock.unlock();
}
Aggregations