// Path: core/src/com/gdx/musicevents/effects/Effect.java
// public interface Effect {
//     public void update(float dt);
//     public boolean isDone();
// }
// 
// Path: core/src/com/gdx/musicevents/effects/Play.java
// public class Play implements StartEffect {
// 
//     
//     private MusicState nextState;
//     
//     public Play() {
//     }
// 
//     @Override
//     public void beginStart() {
//         nextState.play();
//         nextState.setVolume(1);
//     }
// 
//     @Override
//     public void endStart() {
//     }
// 
//     @Override
//     public void update(float dt) {
//     }
// 
//     @Override
//     public boolean isDone() {
//         return true;
//     }
// 
//     @Override
//     public void initialize(MusicState nextState, MusicState previousState) {
//         this.nextState = nextState;
//     }
// }
// 
// Path: core/src/com/gdx/musicevents/effects/StartEffect.java
// public interface StartEffect extends Effect {
//     public void initialize(MusicState nextState, MusicState previousState);
//     public void beginStart();
//     public void endStart();
// }
// 
// Path: core/src/com/gdx/musicevents/effects/Stop.java
// public class Stop implements StopEffect {
//     private MusicState nextState;
// 
//     public Stop() {
//     }
// 
//     @Override
//     public void initialize(MusicState nextState, MusicState previousState) {
//         this.nextState = nextState;
//     }
//     
//     @Override
//     public void beginStop() {
//         nextState.stop();
//     }
// 
//     @Override
//     public void endStop() {
// 
//     }
// 
//     @Override
//     public void update(float dt) {
//     }
// 
//     @Override
//     public boolean isDone() {
//         return true;
//     }
// }
// 
// Path: core/src/com/gdx/musicevents/effects/StopEffect.java
// public interface StopEffect extends Effect {
// 
//     public void initialize(MusicState nextState, MusicState previousState);
//     public void beginStop();
// 
//     public void endStop();
// }


import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Music.OnCompletionListener;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
import com.gdx.musicevents.effects.Effect;
import com.gdx.musicevents.effects.Play;
import com.gdx.musicevents.effects.StartEffect;
import com.gdx.musicevents.effects.Stop;
import com.gdx.musicevents.effects.StopEffect;
    public void onCompletion(Music music) {
        if (!loopTrack) {
            if (randomTrack) {
                currentTrackIndex = MathUtils.random(0, tracks.size - 1);
            } else {
                currentTrackIndex = (currentTrackIndex + 1) % tracks.size;
            }
        }
        Track currentTrack = getCurrentTrack();
        if(currentTrack != null){
            currentTrack.reset();
            currentTrack.play();
        }
    }
    
    public void init(String basePath) {
        for(int i = 0; i < getTracks().size; i++){
            Track track = getTracks().get(i);
            track.init(basePath, this);
        }
    }
    
    public StartEffect enter(MusicState previousState) {
        
        StartEffect effect = null;
        if(previousState != null){
            effect = enterTransitions.get(previousState.getName());
        }

        if(effect == null){
// Path: core/src/com/gdx/musicevents/effects/Effect.java
// public interface Effect {
//     public void update(float dt);
//     public boolean isDone();
// }
// 
// Path: core/src/com/gdx/musicevents/effects/Play.java
// public class Play implements StartEffect {
// 
//     
//     private MusicState nextState;
//     
//     public Play() {
//     }
// 
//     @Override
//     public void beginStart() {
//         nextState.play();
//         nextState.setVolume(1);
//     }
// 
//     @Override
//     public void endStart() {
//     }
// 
//     @Override
//     public void update(float dt) {
//     }
// 
//     @Override
//     public boolean isDone() {
//         return true;
//     }
// 
//     @Override
//     public void initialize(MusicState nextState, MusicState previousState) {
//         this.nextState = nextState;
//     }
// }
// 
// Path: core/src/com/gdx/musicevents/effects/StartEffect.java
// public interface StartEffect extends Effect {
//     public void initialize(MusicState nextState, MusicState previousState);
//     public void beginStart();
//     public void endStart();
// }
// 
// Path: core/src/com/gdx/musicevents/effects/Stop.java
// public class Stop implements StopEffect {
//     private MusicState nextState;
// 
//     public Stop() {
//     }
// 
//     @Override
//     public void initialize(MusicState nextState, MusicState previousState) {
//         this.nextState = nextState;
//     }
//     
//     @Override
//     public void beginStop() {
//         nextState.stop();
//     }
// 
//     @Override
//     public void endStop() {
// 
//     }
// 
//     @Override
//     public void update(float dt) {
//     }
// 
//     @Override
//     public boolean isDone() {
//         return true;
//     }
// }
// 
// Path: core/src/com/gdx/musicevents/effects/StopEffect.java
// public interface StopEffect extends Effect {
// 
//     public void initialize(MusicState nextState, MusicState previousState);
//     public void beginStop();
// 
//     public void endStop();
// }


// Path: core/src/com/gdx/musicevents/MusicState.java
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Music.OnCompletionListener;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
import com.gdx.musicevents.effects.Effect;
import com.gdx.musicevents.effects.Play;
import com.gdx.musicevents.effects.StartEffect;
import com.gdx.musicevents.effects.Stop;
import com.gdx.musicevents.effects.StopEffect;

    public void onCompletion(Music music) {
        if (!loopTrack) {
            if (randomTrack) {
                currentTrackIndex = MathUtils.random(0, tracks.size - 1);
            } else {
                currentTrackIndex = (currentTrackIndex + 1) % tracks.size;
            }
        }
        Track currentTrack = getCurrentTrack();
        if(currentTrack != null){
            currentTrack.reset();
            currentTrack.play();
        }
    }
    
    public void init(String basePath) {
        for(int i = 0; i < getTracks().size; i++){
            Track track = getTracks().get(i);
            track.init(basePath, this);
        }
    }
    
    public StartEffect enter(MusicState previousState) {
        
        StartEffect effect = null;
        if(previousState != null){
            effect = enterTransitions.get(previousState.getName());
        }

        if(effect == null){
            effect = new Play();