#include <cstdlib>
#include <OpenSource/SuperpoweredAndroidAudioIO.h>
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_AndroidConfiguration.h>
#include <SuperpoweredAdvancedAudioPlayer.h>
#include <SuperpoweredSimple.h>
#include <SuperpoweredCPU.h>
#include <SuperpoweredMixer.h>
#include <SuperpoweredTimeStretching.h>
#include <android/log.h>
#include "Track.h"

class MultiTracksPlayer {
public:
  MultiTracksPlayer(
    const char **filePathsArray,
    int tracksAmount,
    int samplerate,
    int buffersize
  );

  ~MultiTracksPlayer();

  void pause();

  double play();

  bool process(short *output, unsigned int numberOfFrames, unsigned int samplerate);

  void setPosition(double second, bool andStop);

  double getBufferedEndPercent(int index);

  void setVolume(int index, float left, float right);

  void setRate(float rate);

  void setPitchShiftCents(int pitchShiftCents);

    double getDisplayPosition();

private:
  int tracksAmount;
  Track **tracks;
  Superpowered::StereoMixer audioMixer;
  Superpowered::TimeStretching *timeStretching;
};
