package fr.monkhanny.dorfromantik.listeners;

import fr.monkhanny.dorfromantik.Options;
import fr.monkhanny.dorfromantik.utils.MusicPlayer;

import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.JSlider;

public class SoundsVolumeChangeListener implements ChangeListener {
    private JSlider slider;

    public SoundsVolumeChangeListener(JSlider slider) {
        this.slider = slider;
    }

    @Override
    public void stateChanged(ChangeEvent e) {
        // Récupérer la valeur du slider spécifique
        Options.SOUNDS_VOLUME = slider.getValue();
        MusicPlayer.setVolume(MusicPlayer.getSoundClip(), Options.SOUNDS_VOLUME);
    }
}
