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 MusicVolumeChangeListener implements ChangeListener {
    private JSlider slider;

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

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