#ifndef LIVE_PLATE_HPP
#define LIVE_PLATE_HPP

#include "Plate.hpp"

#include <SDL.h>
#include <SDL_thread.h>

#include <vector>
#include <list>

using std::vector;
using std::list;

//The live plate takes care of solo and in-editing stuff.

namespace LivePlate {

	class PlateHit {
	public:
		vector< int32_t > values;
		unsigned int tap;
		int start;
		unsigned int period; //loop period, or zero if no loop
	};

	extern Plate plate;
	extern unsigned int tap;
	extern int32_t gain; //gain, (1 << 16) is unity.
	extern unsigned int max_out; //max value, with some smoothing.
	extern SDL_mutex *hits_lock;
	extern list< PlateHit > hits; //protect with hits_lock
	extern int64_t played_samples; //also with hits_lock
	void init();
	void deinit();
};

#endif //LIVE_PLATE_HPP
