Search in sources :

Example 1 with SpeedChangedEvent

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);
        }
    });
}
Also used : SpeedChangedEvent(de.danoeh.antennapod.event.playback.SpeedChangedEvent) CheckBox(android.widget.CheckBox)

Example 2 with SpeedChangedEvent

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);
}
Also used : SpeedChangedEvent(de.danoeh.antennapod.event.playback.SpeedChangedEvent) PlaybackController(de.danoeh.antennapod.core.util.playback.PlaybackController)

Example 3 with SpeedChangedEvent

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);
}
Also used : SpeedChangedEvent(de.danoeh.antennapod.event.playback.SpeedChangedEvent) PlaybackPositionEvent(de.danoeh.antennapod.event.playback.PlaybackPositionEvent)

Example 4 with SpeedChangedEvent

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);
}
Also used : SpeedChangedEvent(de.danoeh.antennapod.event.playback.SpeedChangedEvent) PlaybackController(de.danoeh.antennapod.core.util.playback.PlaybackController)

Example 5 with SpeedChangedEvent

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();
}
Also used : SpeedChangedEvent(de.danoeh.antennapod.event.playback.SpeedChangedEvent)

Aggregations

SpeedChangedEvent (de.danoeh.antennapod.event.playback.SpeedChangedEvent)5 PlaybackController (de.danoeh.antennapod.core.util.playback.PlaybackController)2 CheckBox (android.widget.CheckBox)1 PlaybackPositionEvent (de.danoeh.antennapod.event.playback.PlaybackPositionEvent)1